#include <perms.h>

                                                                //      1  %begin
#line 1 "regression-bugs-tmp/ercc-write.imp"
int main(int argc, char **argv) {
  __label__ _imp_endofblock;
  _imp_initialise(argc, argv);
                                                                //      2  
                                                                //      3  %routine emaswrite(%integer value, places)
_imp_current_line = 3; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 3 "regression-bugs-tmp/ercc-write.imp"
void EMASWRITE( int VALUE, int PLACES )
#line 3 "regression-bugs-tmp/ercc-write.imp"
{
  __label__ _imp_endofblock;
                                                                //      4     !***********************************************************************
                                                                //      5     !*    SIMPLE MINDED ALL IMP VERSION NOT USING STRINGS                  *
                                                                //      6     !***********************************************************************
                                                                //      7     %string (15) %fn swrite %alias "S#SWRITE"(%integer value, places)
_imp_current_line = 7; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 7 "regression-bugs-tmp/ercc-write.imp"
_imp_string /*%string(15)*/ SWRITE( int VALUE, int PLACES )
#line 7 "regression-bugs-tmp/ercc-write.imp"
{
  __label__ _imp_endofblock;
                                                                //      8        !***********************************************************************
                                                                //      9        !*    SIMPLE MINDED ALL IMP VERSION                                    *
                                                                //     10        !***********************************************************************
                                                                //     11        %string (1) sign
_imp_current_line = 11; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 11 "regression-bugs-tmp/ercc-write.imp"
_imp_string /*%string(1)*/ SIGN;
                                                                //     12        %string (15) res
_imp_current_line = 12; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 12 "regression-bugs-tmp/ercc-write.imp"
_imp_string /*%string(15)*/ RES;
                                                                //     13        %integer work, ptr
_imp_current_line = 13; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 13 "regression-bugs-tmp/ercc-write.imp"
int WORK;
#line 13 "regression-bugs-tmp/ercc-write.imp"
int PTR;
                                                                //     14        %string (1) %array ch(0 : 15)
_imp_current_line = 14; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 14 "regression-bugs-tmp/ercc-write.imp"
_imp_string /*%string(1)*/ CH[16];
                                                                //     15        res = ""
_imp_current_line = 15; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 15 "regression-bugs-tmp/ercc-write.imp"
RES = _imp_str_literal("");
                                                                //     16        sign = " "
_imp_current_line = 16; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 16 "regression-bugs-tmp/ercc-write.imp"
SIGN = _imp_str_literal(" ");
                                                                //     17        %if value = X'80000000' %then %start
_imp_current_line = 17; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 17 "regression-bugs-tmp/ercc-write.imp"
if (((VALUE) != ((-2147483648)))) goto L_0002;
                                                                //     18           res = "-2147483548"
_imp_current_line = 18; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 18 "regression-bugs-tmp/ercc-write.imp"
RES = _imp_str_literal("-2147483548");
                                                                //     19           res = " " . res %for ptr = 1, 1, places - 10
_imp_current_line = 19; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 19 "regression-bugs-tmp/ercc-write.imp"
{static int _initial, _increment, _final, _control;
_initial = 1; _increment = 1; _final = (((int)(PLACES)) - (10)); PTR = _control = _initial;
if (((_final-_initial) % _increment) != 0) _imp_signal(5,1,0,"Illegal cycle PTR = 1, 1, (((int)(PLACES)) - (10))");
PTR -= _increment; _control -= _increment;
L_0003:;
if (PTR == _final) goto L_0004;
PTR += _increment; _control += _increment;
if (PTR != _control) _imp_signal(4,2,0,"Corrupt control variable PTR"); /* FOR loop control variable corrupted */
}
#line 19 "regression-bugs-tmp/ercc-write.imp"
RES = _imp_join((_imp_string)_imp_str_literal(" "),(_imp_string)RES);
#line 19 "regression-bugs-tmp/ercc-write.imp"
goto L_0003;
#line 19 "regression-bugs-tmp/ercc-write.imp"
L_0004:;
                                                                //     20           %result = res
_imp_current_line = 20; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 20 "regression-bugs-tmp/ercc-write.imp"
return RES;
                                                                //     21        %finish
_imp_current_line = 21; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 21 "regression-bugs-tmp/ercc-write.imp"
L_0002:;
                                                                //     22        %if value = X'80000000' %then %result = "-2147483648"
_imp_current_line = 22; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 22 "regression-bugs-tmp/ercc-write.imp"
if (((VALUE) != ((-2147483648)))) goto L_0006;
#line 22 "regression-bugs-tmp/ercc-write.imp"
return _imp_str_literal("-2147483648");
#line 22 "regression-bugs-tmp/ercc-write.imp"
L_0006:;
                                                                //     23        %if value < 0 %then sign = "-" %and value = -value
_imp_current_line = 23; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 23 "regression-bugs-tmp/ercc-write.imp"
if (((VALUE) >= (0))) goto L_0007;
#line 23 "regression-bugs-tmp/ercc-write.imp"
SIGN = _imp_str_literal("-");
#line 23 "regression-bugs-tmp/ercc-write.imp"
VALUE = (-(VALUE));
#line 23 "regression-bugs-tmp/ercc-write.imp"
L_0007:;
                                                                //     24        ptr = 0
_imp_current_line = 24; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 24 "regression-bugs-tmp/ercc-write.imp"
PTR = 0;
                                                                //     25        %cycle 
_imp_current_line = 25; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 25 "regression-bugs-tmp/ercc-write.imp"
L_0008:;
                                                                //     26           work = value // 10
_imp_current_line = 26; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 26 "regression-bugs-tmp/ercc-write.imp"
WORK = (long)((long)((int)(VALUE)) / (long)((int)(10)));
                                                                //     27           ch(ptr) = tostring(value - 10 * work + '0')
_imp_current_line = 27; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 27 "regression-bugs-tmp/ercc-write.imp"
CH[PTR] = _imp_TOSTRING((((int)(((VALUE) - ((int)((((int)(10)) * (WORK))))))) + (48)));
                                                                //     28           value = work
_imp_current_line = 28; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 28 "regression-bugs-tmp/ercc-write.imp"
VALUE = WORK;
                                                                //     29           ptr = ptr + 1
_imp_current_line = 29; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 29 "regression-bugs-tmp/ercc-write.imp"
PTR = (((int)(PTR)) + (1));
                                                                //     30        %repeat %until value = 0
_imp_current_line = 30; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 30 "regression-bugs-tmp/ercc-write.imp"
if (((VALUE) == (0))) goto L_0009;
#line 30 "regression-bugs-tmp/ercc-write.imp"
goto L_0008;
#line 30 "regression-bugs-tmp/ercc-write.imp"
L_0009:;
                                                                //     31        res = res . " " %for work = ptr, 1, places - 1
_imp_current_line = 31; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 31 "regression-bugs-tmp/ercc-write.imp"
{static int _initial, _increment, _final, _control;
_initial = PTR; _increment = 1; _final = (((int)(PLACES)) - (1)); WORK = _control = _initial;
if (((_final-_initial) % _increment) != 0) _imp_signal(5,1,0,"Illegal cycle WORK = PTR, 1, (((int)(PLACES)) - (1))");
WORK -= _increment; _control -= _increment;
L_000b:;
if (WORK == _final) goto L_000c;
WORK += _increment; _control += _increment;
if (WORK != _control) _imp_signal(4,2,0,"Corrupt control variable WORK"); /* FOR loop control variable corrupted */
}
#line 31 "regression-bugs-tmp/ercc-write.imp"
RES = _imp_join((_imp_string)RES,(_imp_string)_imp_str_literal(" "));
#line 31 "regression-bugs-tmp/ercc-write.imp"
goto L_000b;
#line 31 "regression-bugs-tmp/ercc-write.imp"
L_000c:;
                                                                //     32        work = ptr - 1
_imp_current_line = 32; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 32 "regression-bugs-tmp/ercc-write.imp"
WORK = (((int)(PTR)) - (1));
                                                                //     33        res = res . sign
_imp_current_line = 33; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 33 "regression-bugs-tmp/ercc-write.imp"
RES = _imp_join((_imp_string)RES,(_imp_string)SIGN);
                                                                //     34        res = res . ch(ptr) %for ptr = work, -1, 0
_imp_current_line = 34; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 34 "regression-bugs-tmp/ercc-write.imp"
PTR = ((WORK) + ((int)(1)));
if ((((0)-(WORK)) % ((-1))) != 0) _imp_signal(5,1,0,"Illegal cycle PTR = WORK, (-1), 0");
L_000e:;
if (PTR == 0) goto L_000f;
PTR += (-1);
#line 34 "regression-bugs-tmp/ercc-write.imp"
RES = _imp_join((_imp_string)RES,(_imp_string)CH[PTR]);
#line 34 "regression-bugs-tmp/ercc-write.imp"
goto L_000e;
#line 34 "regression-bugs-tmp/ercc-write.imp"
L_000f:;
                                                                //     35        %result = res
_imp_current_line = 35; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 35 "regression-bugs-tmp/ercc-write.imp"
return RES;
                                                                //     36     %end
_imp_current_line = 36; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 36 "regression-bugs-tmp/ercc-write.imp"
_imp_endofblock: ;
} // End of block SWRITE at level 3
                                                                //     37     %integer sign, work, ptr
_imp_current_line = 37; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 37 "regression-bugs-tmp/ercc-write.imp"
int SIGN;
#line 37 "regression-bugs-tmp/ercc-write.imp"
int WORK;
#line 37 "regression-bugs-tmp/ercc-write.imp"
int PTR;
                                                                //     38     %byte %integer %array ch(0 : 15)
_imp_current_line = 38; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 38 "regression-bugs-tmp/ercc-write.imp"
unsigned char CH[16];
                                                                //     39     sign = ' '
_imp_current_line = 39; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 39 "regression-bugs-tmp/ercc-write.imp"
SIGN = 32;
                                                                //     40     %if value = X'80000000' %then printstring(swrite(value, places)) %and %return
_imp_current_line = 40; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 40 "regression-bugs-tmp/ercc-write.imp"
if (((VALUE) != ((-2147483648)))) goto L_0011;
#line 40 "regression-bugs-tmp/ercc-write.imp"
_imp_PRINTSTRING(SWRITE(VALUE, PLACES));
#line 40 "regression-bugs-tmp/ercc-write.imp"
return;
#line 40 "regression-bugs-tmp/ercc-write.imp"
L_0011:;
                                                                //     41     %if value < 0 %then sign = '-' %and value = -value
_imp_current_line = 41; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 41 "regression-bugs-tmp/ercc-write.imp"
if (((VALUE) >= (0))) goto L_0012;
#line 41 "regression-bugs-tmp/ercc-write.imp"
SIGN = 45;
#line 41 "regression-bugs-tmp/ercc-write.imp"
VALUE = (-(VALUE));
#line 41 "regression-bugs-tmp/ercc-write.imp"
L_0012:;
                                                                //     42     ptr = 0
_imp_current_line = 42; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 42 "regression-bugs-tmp/ercc-write.imp"
PTR = 0;
                                                                //     43     %cycle 
_imp_current_line = 43; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 43 "regression-bugs-tmp/ercc-write.imp"
L_0013:;
                                                                //     44        work = value // 10
_imp_current_line = 44; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 44 "regression-bugs-tmp/ercc-write.imp"
WORK = (long)((long)((int)(VALUE)) / (long)((int)(10)));
                                                                //     45        ch(ptr) = value - 10 * work
_imp_current_line = 45; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 45 "regression-bugs-tmp/ercc-write.imp"
CH[PTR] = ((VALUE) - ((int)((((int)(10)) * (WORK)))));
                                                                //     46        value = work
_imp_current_line = 46; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 46 "regression-bugs-tmp/ercc-write.imp"
VALUE = WORK;
                                                                //     47        ptr = ptr + 1
_imp_current_line = 47; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 47 "regression-bugs-tmp/ercc-write.imp"
PTR = (((int)(PTR)) + (1));
                                                                //     48     %repeat %until value = 0
_imp_current_line = 48; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 48 "regression-bugs-tmp/ercc-write.imp"
if (((VALUE) == (0))) goto L_0014;
#line 48 "regression-bugs-tmp/ercc-write.imp"
goto L_0013;
#line 48 "regression-bugs-tmp/ercc-write.imp"
L_0014:;
                                                                //     49     %if places > ptr %then spaces(places - ptr)
_imp_current_line = 49; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 49 "regression-bugs-tmp/ercc-write.imp"
if (((PLACES) <= (PTR))) goto L_0016;
#line 49 "regression-bugs-tmp/ercc-write.imp"
_imp_SPACES((((int)(PLACES)) - (PTR)));
#line 49 "regression-bugs-tmp/ercc-write.imp"
L_0016:;
                                                                //     50     work = ptr - 1
_imp_current_line = 50; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 50 "regression-bugs-tmp/ercc-write.imp"
WORK = (((int)(PTR)) - (1));
                                                                //     51     printsymbol(sign)
_imp_current_line = 51; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 51 "regression-bugs-tmp/ercc-write.imp"
_imp_PRINTSYMBOL(SIGN);
                                                                //     52     printsymbol(ch(ptr) + '0') %for ptr = work, -1, 0
_imp_current_line = 52; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 52 "regression-bugs-tmp/ercc-write.imp"
PTR = ((WORK) + ((int)(1)));
if ((((0)-(WORK)) % ((-1))) != 0) _imp_signal(5,1,0,"Illegal cycle PTR = WORK, (-1), 0");
L_0017:;
if (PTR == 0) goto L_0018;
PTR += (-1);
#line 52 "regression-bugs-tmp/ercc-write.imp"
_imp_PRINTSYMBOL((((int)(CH[PTR])) + (48)));
#line 52 "regression-bugs-tmp/ercc-write.imp"
goto L_0017;
#line 52 "regression-bugs-tmp/ercc-write.imp"
L_0018:;
                                                                //     53  %end
_imp_current_line = 53; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 53 "regression-bugs-tmp/ercc-write.imp"
return;
_imp_endofblock: ;
} // End of block EMASWRITE at level 2
                                                                //     54  
                                                                //     55  %endofprogram
_imp_current_line = 55; _imp_current_file = "regression-bugs-tmp/ercc-write.imp";
#line 55 "regression-bugs-tmp/ercc-write.imp"
return 0;
_imp_endofblock: ;
} // End of block _imp_main at level 1
#line 55 "regression-bugs-tmp/ercc-write.imp"
// End of file
