#include <perms.h>

                                                                //      1  %begin
#line 1 "regression-bugs-tmp/arraynames.imp"
int main(int argc, char **argv) {
  _imp_initialise(argc, argv);
                                                                //      2    %routine level2 test array(%string(255) who, %integerarrayname harry, %integer from low, to high)
#line 2 "regression-bugs-tmp/arraynames.imp"
void LEVEL2TESTARRAY( _imp_string /*%string(255)*/ WHO, int /*arrayname*/*HARRY, int FROMLOW, int TOHIGH )
#line 2 "regression-bugs-tmp/arraynames.imp"
{
                                                                //      3      %integer element
#line 3 "regression-bugs-tmp/arraynames.imp"
int ELEMENT;
                                                                //      4      %for element = from low, 1, to high %cycle
#line 4 "regression-bugs-tmp/arraynames.imp"
{static int _initial, _increment, _final, _control;
_initial = FROMLOW; _increment = 1; _final = TOHIGH; ELEMENT = _control = _initial;
if (((_final-_initial) % _increment) != 0) _imp_signal(5,1,0,"Illegal cycle ELEMENT = FROMLOW, 1, TOHIGH");
ELEMENT -= _increment; _control -= _increment;
L_0002:;
if (ELEMENT == _final) goto L_0003;
ELEMENT += _increment; _control += _increment;
if (ELEMENT != _control) _imp_signal(4,2,0,"Corrupt control variable ELEMENT"); /* FOR loop control variable corrupted */
}
                                                                //      5        print string("Child of "); print string(who); printsymbol('('); write(element, 0); printstring(") = ");
#line 5 "regression-bugs-tmp/arraynames.imp"
_imp_PRINTSTRING(_imp_str_literal("Child of "));
#line 5 "regression-bugs-tmp/arraynames.imp"
_imp_PRINTSTRING(WHO);
#line 5 "regression-bugs-tmp/arraynames.imp"
_imp_PRINTSYMBOL(40);
#line 5 "regression-bugs-tmp/arraynames.imp"
_imp_WRITE(ELEMENT, 0);
#line 5 "regression-bugs-tmp/arraynames.imp"
_imp_PRINTSTRING(_imp_str_literal(") = "));
                                                                //      6        write(harry(element), 0); newline
#line 6 "regression-bugs-tmp/arraynames.imp"
_imp_WRITE(HARRY[ELEMENT], 0);
#line 6 "regression-bugs-tmp/arraynames.imp"
_imp_NEWLINE();
                                                                //      7      %repeat
#line 7 "regression-bugs-tmp/arraynames.imp"
goto L_0002;
#line 7 "regression-bugs-tmp/arraynames.imp"
L_0003:;
                                                                //      8    %end
#line 8 "regression-bugs-tmp/arraynames.imp"
/* Remove %on %event handler here if present for this block */
return;
} // End of block LEVEL2TESTARRAY at level 2
                                                                //      9  
                                                                //     10    %routine test array(%string(255) who, %integerarrayname harry, %integer from low, to high)
#line 10 "regression-bugs-tmp/arraynames.imp"
void TESTARRAY( _imp_string /*%string(255)*/ WHO, int /*arrayname*/*HARRY, int FROMLOW, int TOHIGH )
#line 10 "regression-bugs-tmp/arraynames.imp"
{
                                                                //     11      %integer element
#line 11 "regression-bugs-tmp/arraynames.imp"
int ELEMENT;
                                                                //     12      %for element = from low, 1, to high %cycle
#line 12 "regression-bugs-tmp/arraynames.imp"
{static int _initial, _increment, _final, _control;
_initial = FROMLOW; _increment = 1; _final = TOHIGH; ELEMENT = _control = _initial;
if (((_final-_initial) % _increment) != 0) _imp_signal(5,1,0,"Illegal cycle ELEMENT = FROMLOW, 1, TOHIGH");
ELEMENT -= _increment; _control -= _increment;
L_0005:;
if (ELEMENT == _final) goto L_0006;
ELEMENT += _increment; _control += _increment;
if (ELEMENT != _control) _imp_signal(4,2,0,"Corrupt control variable ELEMENT"); /* FOR loop control variable corrupted */
}
                                                                //     13        print string(who); printsymbol('('); write(element, 0); printstring(") = ");
#line 13 "regression-bugs-tmp/arraynames.imp"
_imp_PRINTSTRING(WHO);
#line 13 "regression-bugs-tmp/arraynames.imp"
_imp_PRINTSYMBOL(40);
#line 13 "regression-bugs-tmp/arraynames.imp"
_imp_WRITE(ELEMENT, 0);
#line 13 "regression-bugs-tmp/arraynames.imp"
_imp_PRINTSTRING(_imp_str_literal(") = "));
                                                                //     14        write(harry(element), 0); newline
#line 14 "regression-bugs-tmp/arraynames.imp"
_imp_WRITE(HARRY[ELEMENT], 0);
#line 14 "regression-bugs-tmp/arraynames.imp"
_imp_NEWLINE();
                                                                //     15      %repeat
#line 15 "regression-bugs-tmp/arraynames.imp"
goto L_0005;
#line 15 "regression-bugs-tmp/arraynames.imp"
L_0006:;
                                                                //     16      level2 test array(who, harry, from low, to high);
#line 16 "regression-bugs-tmp/arraynames.imp"
LEVEL2TESTARRAY(WHO, /*is_array_name_param2 BUG? */ &HARRY[0], FROMLOW, TOHIGH);
                                                                //     17    %end
#line 17 "regression-bugs-tmp/arraynames.imp"
/* Remove %on %event handler here if present for this block */
return;
} // End of block TESTARRAY at level 2
                                                                //     18  
                                                                //     19    %ownintegerarray bert(-3:6);  ! note non-0 lower bound static array
#line 19 "regression-bugs-tmp/arraynames.imp"
static int BERT[10];
                                                                //     20    %integer i
#line 20 "regression-bugs-tmp/arraynames.imp"
int I;
                                                                //     21  
                                                                //     22    %for i = -3, 1, 6 %cycle
#line 22 "regression-bugs-tmp/arraynames.imp"
I = (-4);
if ((((6)-((-3))) % (1)) != 0) _imp_signal(5,1,0,"Illegal cycle I = (-3), 1, 6");
L_0008:;
if (I == 6) goto L_0009;
I += 1;
                                                                //     23      bert(i) = i * 10
#line 23 "regression-bugs-tmp/arraynames.imp"
(BERT+3)[I] = (((int)(I)) * (10));
                                                                //     24    %repeat
#line 24 "regression-bugs-tmp/arraynames.imp"
goto L_0008;
#line 24 "regression-bugs-tmp/arraynames.imp"
L_0009:;
                                                                //     25  
                                                                //     26    ! i2c passes &bert[0] but should have passed &(bert - (-3))[0]
                                                                //     27    !  or equivalent, to account for the non-0 lower bound!
                                                                //     28    test array("bert", bert, -3, 6);       ! static bounds arrays now fixed, but ...
#line 28 "regression-bugs-tmp/arraynames.imp"
TESTARRAY(_imp_str_literal("bert"), /*is_array_name4*/ &((BERT+3)[0]), (-3), 6);
                                                                //     29  
                                                                //     30    %ownintegerarrayname pointer
#line 30 "regression-bugs-tmp/arraynames.imp"
static int /*arrayname*/*POINTER;
                                                                //     31  
                                                                //     32    pointer == bert
#line 32 "regression-bugs-tmp/arraynames.imp"
POINTER = /*is_array_name6*/ &((BERT+3)[0]);                                                                //     33  
                                                                //     34    test array("pointer to bert", pointer, -3, 6);       ! static bounds arrays now fixed, but ...
#line 34 "regression-bugs-tmp/arraynames.imp"
TESTARRAY(_imp_str_literal("pointer to bert"), /*is_array_name_param2 BUG? */ &POINTER[0], (-3), 6);
                                                                //     35  
                                                                //     36    %begin
#line 36 "regression-bugs-tmp/arraynames.imp"
void _BLOCK_1_LEVEL_1_(void) {
                                                                //     37      %integerarray sheila(-3:6);  ! note non-0 lower bound *AUTO* array
#line 37 "regression-bugs-tmp/arraynames.imp"
int SHEILA[10];
                                                                //     38  
                                                                //     39      %for i = -3, 1, 6 %cycle
#line 39 "regression-bugs-tmp/arraynames.imp"
I = (-4);
if ((((6)-((-3))) % (1)) != 0) _imp_signal(5,1,0,"Illegal cycle I = (-3), 1, 6");
L_000b:;
if (I == 6) goto L_000c;
I += 1;
                                                                //     40        sheila(i) = i * 10
#line 40 "regression-bugs-tmp/arraynames.imp"
SHEILA[((I) + ((int)(3)))] = (((int)(I)) * (10));
                                                                //     41      %repeat
#line 41 "regression-bugs-tmp/arraynames.imp"
goto L_000b;
#line 41 "regression-bugs-tmp/arraynames.imp"
L_000c:;
                                                                //     42  
                                                                //     43      ! i2c passes &bert[0] but should have passed &(bert - (-3))[0]
                                                                //     44      !  or equivalent, to account for the non-0 lower bound!
                                                                //     45      test array("sheila", sheila, -3, 6);   ! ... but dynamic bounds (auto) arrays not yet implemented... 
#line 45 "regression-bugs-tmp/arraynames.imp"
TESTARRAY(_imp_str_literal("sheila"), &SHEILA[-((-3))], (-3), 6);
                                                                //     46    %end
#line 46 "regression-bugs-tmp/arraynames.imp"
return;
} // End of block _BLOCK_1_LEVEL_1_ at level 2
_BLOCK_1_LEVEL_1_();
                                                                //     47  
                                                                //     48  %endofprogram
#line 48 "regression-bugs-tmp/arraynames.imp"
/* Remove %on %event handler here if present for this block */
return 0;
} // End of block _imp_main at level 1
#line 48 "regression-bugs-tmp/arraynames.imp"
// End of file
