#include <perms.h>

                                                                //      1  %begin
#line 1 "regression-compile-tmp/recordmap.imp"
int main(int argc, char **argv) {
  _imp_initialise(argc, argv);
                                                                //      2  
                                                                //      3    %recordformat small rec fm(%integer i, %real r)
#line 3 "regression-compile-tmp/recordmap.imp"
typedef struct SMALLRECFM SMALLRECFM;
struct SMALLRECFM {
  int I;
  float R;
};
                                                                //      4    %recordformat big rec fm(%integer i, %real r, %string(255) s)
#line 4 "regression-compile-tmp/recordmap.imp"
typedef struct BIGRECFM BIGRECFM;
struct BIGRECFM {
  int I;
  float R;
  _imp_string /*%string(255)*/ S;
};
                                                                //      5    
                                                                //      6    %record (small rec fm) small rec, small rec 2
#line 6 "regression-compile-tmp/recordmap.imp"
 SMALLRECFM SMALLREC;
#line 6 "regression-compile-tmp/recordmap.imp"
 SMALLRECFM SMALLREC2;
                                                                //      7    %record (big rec fm) big rec
#line 7 "regression-compile-tmp/recordmap.imp"
 BIGRECFM BIGREC;
                                                                //      8  
                                                                //      9    %record (small rec fm) %name small ptr
#line 9 "regression-compile-tmp/recordmap.imp"
 SMALLRECFM /*name*/*SMALLPTR;
                                                                //     10  
                                                                //     11    small rec_i = 123 ; small rec_r = 234.56
#line 11 "regression-compile-tmp/recordmap.imp"
SMALLREC.I = 123;
#line 11 "regression-compile-tmp/recordmap.imp"
SMALLREC.R = 234.56;
                                                                //     12    big rec_i = 123 ; big rec_r = 234.56 ; big rec_s = "A String"
#line 12 "regression-compile-tmp/recordmap.imp"
BIGREC.I = 123;
#line 12 "regression-compile-tmp/recordmap.imp"
BIGREC.R = 234.56;
#line 12 "regression-compile-tmp/recordmap.imp"
BIGREC.S = _imp_str_literal("A String");
                                                                //     13  
                                                                //     14  ! regular record assignments. These work OK.
                                                                //     15  
                                                                //     16    small ptr == small rec 2
#line 16 "regression-compile-tmp/recordmap.imp"
SMALLPTR = &SMALLREC2;
                                                                //     17  
                                                                //     18    small ptr = small rec
#line 18 "regression-compile-tmp/recordmap.imp"
*SMALLPTR = SMALLREC;
                                                                //     19  
                                                                //     20    small rec = small ptr
#line 20 "regression-compile-tmp/recordmap.imp"
SMALLREC = *SMALLPTR;
                                                                //     21  
                                                                //     22    small rec <- small ptr
#line 22 "regression-compile-tmp/recordmap.imp"
SMALLREC = *SMALLPTR;
                                                                //     23  
                                                                //     24  ! These generate bad code:
                                                                //     25  
                                                                //     26  ! RECORD() on RHS
                                                                //     27  
                                                                //     28    small ptr == RECORD(ADDR(big rec))
#line 28 "regression-compile-tmp/recordmap.imp"
SMALLPTR =  (SMALLRECFM *) _imp_RECORD(_imp_ADDR(&BIGREC));
                                                                //     29  
                                                                //     30    small ptr == RECORD(ADDR(small rec))
#line 30 "regression-compile-tmp/recordmap.imp"
SMALLPTR =  (SMALLRECFM *) _imp_RECORD(_imp_ADDR(&SMALLREC));
                                                                //     31  
                                                                //     32    small rec 2 = RECORD(ADDR(big rec))
#line 32 "regression-compile-tmp/recordmap.imp"
SMALLREC2 =  *(SMALLRECFM *) _imp_RECORD(_imp_ADDR(&BIGREC));
                                                                //     33  
                                                                //     34    small rec 2 <- RECORD(ADDR(big rec))
#line 34 "regression-compile-tmp/recordmap.imp"
SMALLREC2 =  *(SMALLRECFM *) _imp_RECORD(_imp_ADDR(&BIGREC));
                                                                //     35  
                                                                //     36    small ptr = RECORD(ADDR(big rec))
#line 36 "regression-compile-tmp/recordmap.imp"
*SMALLPTR =  *(SMALLRECFM *) _imp_RECORD(_imp_ADDR(&BIGREC));
                                                                //     37  
                                                                //     38    small ptr <- RECORD(ADDR(big rec))
#line 38 "regression-compile-tmp/recordmap.imp"
*SMALLPTR =  *(SMALLRECFM *) _imp_RECORD(_imp_ADDR(&BIGREC));
                                                                //     39  
                                                                //     40  ! RECORD() on LHS
                                                                //     41  
                                                                //     42    RECORD(ADDR(big rec)) = small rec
#line 42 "regression-compile-tmp/recordmap.imp"
 *(SMALLRECFM *) _imp_RECORD(_imp_ADDR(&BIGREC)) = SMALLREC;
                                                                //     43  
                                                                //     44    RECORD(ADDR(big rec)) <- small rec
#line 44 "regression-compile-tmp/recordmap.imp"
 *(SMALLRECFM *) _imp_RECORD(_imp_ADDR(&BIGREC)) = SMALLREC;
                                                                //     45  
                                                                //     46    RECORD(ADDR(small rec)) = big rec
#line 46 "regression-compile-tmp/recordmap.imp"
 *(BIGRECFM *) _imp_RECORD(_imp_ADDR(&SMALLREC)) = BIGREC;
                                                                //     47  
                                                                //     48    RECORD(ADDR(small rec)) <- big rec
#line 48 "regression-compile-tmp/recordmap.imp"
 *(BIGRECFM *) _imp_RECORD(_imp_ADDR(&SMALLREC)) = BIGREC;
                                                                //     49  
                                                                //     50    
                                                                //     51  %endofprogram
#line 51 "regression-compile-tmp/recordmap.imp"
/* Remove %on %event handler here if present for this block */
return 0;
} // End of block _imp_main at level 1
#line 51 "regression-compile-tmp/recordmap.imp"
// End of file
