#include <perms.h>

                                                                //      1  ! NOT REALLY:
                                                                //      2  %constinteger minint = x'80000000'
                                                                //      3  %constinteger maxint = x'7FFFFFFF'
                                                                //      4  %constinteger minintlastdigit = 0
                                                                //      5  %constinteger maxdigits = 12
                                                                //      6  
                                                                //      7  %routine EMAS I77 write(%integer num, pl)
#line 7 "regression-bugs-tmp/write-emas77.imp"
void EMASI77WRITE( int NUM, int PL )
#line 7 "regression-bugs-tmp/write-emas77.imp"
{
  __label__ _imp_endofblock;
                                                                //      8     %string (63) %function itos(%integer n, places)
_imp_current_line = 8; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 8 "regression-bugs-tmp/write-emas77.imp"
_imp_string /*%string(63)*/ ITOS( int N, int PLACES )
#line 8 "regression-bugs-tmp/write-emas77.imp"
{
  __label__ _imp_endofblock;
                                                                //      9        !
                                                                //     10        ! ITOS0
                                                                //     11        !
                                                                //     12        ! Returns a string representing the argument as
                                                                //     13        ! a decimal number, without any space justification
                                                                //     14        ! or padding.
                                                                //     15        !
                                                                //     16        %const %integer maxdigits = 255
_imp_current_line = 16; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
                                                                //     17        %string (maxdigits) %function itos0(%integer n)
_imp_current_line = 17; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 17 "regression-bugs-tmp/write-emas77.imp"
_imp_string /*%string(255)*/ ITOS0( int N )
#line 17 "regression-bugs-tmp/write-emas77.imp"
{
  __label__ _imp_endofblock;
                                                                //     18           %string (maxdigits) res
_imp_current_line = 18; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 18 "regression-bugs-tmp/write-emas77.imp"
_imp_string /*%string(255)*/ RES;
                                                                //     19           %integer s, p, e
_imp_current_line = 19; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 19 "regression-bugs-tmp/write-emas77.imp"
int S;
#line 19 "regression-bugs-tmp/write-emas77.imp"
int P;
#line 19 "regression-bugs-tmp/write-emas77.imp"
int E;
                                                                //     20           s = 0
_imp_current_line = 20; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 20 "regression-bugs-tmp/write-emas77.imp"
S = 0;
                                                                //     21           %if n < 0 %start
_imp_current_line = 21; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 21 "regression-bugs-tmp/write-emas77.imp"
if (((N) >= (0))) goto L_0002;
                                                                //     22              s = -1
_imp_current_line = 22; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 22 "regression-bugs-tmp/write-emas77.imp"
S = (-1);
                                                                //     23              ! mark -ve
                                                                //     24              %if n = minint %start
_imp_current_line = 24; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 24 "regression-bugs-tmp/write-emas77.imp"
if (((N) != ((-2147483648)))) goto L_0003;
                                                                //     25                 ! special case
                                                                //     26                 n = maxint
_imp_current_line = 26; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 26 "regression-bugs-tmp/write-emas77.imp"
N = 2147483647;
                                                                //     27                 ! rely on  "max int = (-min int) - 1"
                                                                //     28                 s = 1
_imp_current_line = 28; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 28 "regression-bugs-tmp/write-emas77.imp"
S = 1;
                                                                //     29                 ! mark special
                                                                //     30              %finish %else %start
_imp_current_line = 30; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 30 "regression-bugs-tmp/write-emas77.imp"
goto L_0004;
#line 30 "regression-bugs-tmp/write-emas77.imp"
L_0003:;
                                                                //     31                 n = -n
_imp_current_line = 31; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 31 "regression-bugs-tmp/write-emas77.imp"
N = (-(N));
                                                                //     32              %finish
_imp_current_line = 32; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 32 "regression-bugs-tmp/write-emas77.imp"
L_0004:;
                                                                //     33           %finish
_imp_current_line = 33; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 33 "regression-bugs-tmp/write-emas77.imp"
L_0002:;
                                                                //     34           p = addr(res) + maxdigits
_imp_current_line = 34; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 34 "regression-bugs-tmp/write-emas77.imp"
P = (((int)(_imp_ADDR(&RES))) + (255));
                                                                //     35           e = p
_imp_current_line = 35; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 35 "regression-bugs-tmp/write-emas77.imp"
E = P;
                                                                //     36           ! end point
                                                                //     37           byteinteger(p) = rem(n, 10) + '0' %and n = n // 10 %and p = p - 1 %until n = 0
_imp_current_line = 37; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 37 "regression-bugs-tmp/write-emas77.imp"
L_0005:;
#line 37 "regression-bugs-tmp/write-emas77.imp"
*_imp_BYTEINTEGER(P) = (((int)(_imp_REM(N, 10))) + (48));
#line 37 "regression-bugs-tmp/write-emas77.imp"
N = (long)((long)((int)(N)) / (long)((int)(10)));
#line 37 "regression-bugs-tmp/write-emas77.imp"
P = (((int)(P)) - (1));
#line 37 "regression-bugs-tmp/write-emas77.imp"
if (((N) == (0))) goto L_0006;
#line 37 "regression-bugs-tmp/write-emas77.imp"
goto L_0005;
#line 37 "regression-bugs-tmp/write-emas77.imp"
L_0006:;
                                                                //     38           %if s # 0 %start
_imp_current_line = 38; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 38 "regression-bugs-tmp/write-emas77.imp"
if (((S) == (0))) goto L_0008;
                                                                //     39              ! negative
                                                                //     40              byteinteger(p) = '-'
_imp_current_line = 40; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 40 "regression-bugs-tmp/write-emas77.imp"
*_imp_BYTEINTEGER(P) = 45;
                                                                //     41              p = p - 1
_imp_current_line = 41; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 41 "regression-bugs-tmp/write-emas77.imp"
P = (((int)(P)) - (1));
                                                                //     42              %if s > 0 %start
_imp_current_line = 42; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 42 "regression-bugs-tmp/write-emas77.imp"
if (((S) <= (0))) goto L_0009;
                                                                //     43                 ! min int
                                                                //     44                 charno(res, maxdigits) = minintlastdigit
_imp_current_line = 44; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 44 "regression-bugs-tmp/write-emas77.imp"
*_imp_CHARNO(&RES, 255) = 0;
                                                                //     45              %finish
_imp_current_line = 45; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 45 "regression-bugs-tmp/write-emas77.imp"
L_0009:;
                                                                //     46           %finish
_imp_current_line = 46; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 46 "regression-bugs-tmp/write-emas77.imp"
L_0008:;
                                                                //     47           byteinteger(p) = e - p
_imp_current_line = 47; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 47 "regression-bugs-tmp/write-emas77.imp"
*_imp_BYTEINTEGER(P) = (((int)(E)) - (P));
                                                                //     48           ! length byte
                                                                //     49           %result = string(p)
_imp_current_line = 49; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 49 "regression-bugs-tmp/write-emas77.imp"
return *_imp_STRING(P);
                                                                //     50        %end
_imp_current_line = 50; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 50 "regression-bugs-tmp/write-emas77.imp"
_imp_endofblock: ;
} // End of block ITOS0 at level 3
                                                                //     51  !!      %string (63 + maxdigits) res
                                                                //     52        %string (255) res
_imp_current_line = 52; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 52 "regression-bugs-tmp/write-emas77.imp"
_imp_string /*%string(255)*/ RES;
                                                                //     53        %integer p, slen
_imp_current_line = 53; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 53 "regression-bugs-tmp/write-emas77.imp"
int P;
#line 53 "regression-bugs-tmp/write-emas77.imp"
int SLEN;
                                                                //     54        p = addr(res) + 62
_imp_current_line = 54; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 54 "regression-bugs-tmp/write-emas77.imp"
P = (((int)(_imp_ADDR(&RES))) + (62));
                                                                //     55        ! digit string right justified
                                                                //     56        string(p) = itos0(n)
_imp_current_line = 56; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 56 "regression-bugs-tmp/write-emas77.imp"
*_imp_STRING(P) = ITOS0(N);
                                                                //     57        slen = byteinteger(p)
_imp_current_line = 57; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 57 "regression-bugs-tmp/write-emas77.imp"
SLEN = *_imp_BYTEINTEGER(P);
                                                                //     58        %if n > 0 %and places > 0 %start
_imp_current_line = 58; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 58 "regression-bugs-tmp/write-emas77.imp"
if (((N) <= (0))) goto L_000a;
#line 58 "regression-bugs-tmp/write-emas77.imp"
if (((PLACES) <= (0))) goto L_000a;
                                                                //     59           byteinteger(p) = ' '
_imp_current_line = 59; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 59 "regression-bugs-tmp/write-emas77.imp"
*_imp_BYTEINTEGER(P) = 32;
                                                                //     60           p = p - 1
_imp_current_line = 60; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 60 "regression-bugs-tmp/write-emas77.imp"
P = (((int)(P)) - (1));
                                                                //     61           slen = slen + 1
_imp_current_line = 61; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 61 "regression-bugs-tmp/write-emas77.imp"
SLEN = (((int)(SLEN)) + (1));
                                                                //     62        %finish
_imp_current_line = 62; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 62 "regression-bugs-tmp/write-emas77.imp"
L_000a:;
                                                                //     63        %if places <= 0 %start
_imp_current_line = 63; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 63 "regression-bugs-tmp/write-emas77.imp"
if (((PLACES) > (0))) goto L_000b;
                                                                //     64           places = -places
_imp_current_line = 64; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 64 "regression-bugs-tmp/write-emas77.imp"
PLACES = (-(PLACES));
                                                                //     65        %finish %else %start
_imp_current_line = 65; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 65 "regression-bugs-tmp/write-emas77.imp"
goto L_000c;
#line 65 "regression-bugs-tmp/write-emas77.imp"
L_000b:;
                                                                //     66           places = places + 1
_imp_current_line = 66; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 66 "regression-bugs-tmp/write-emas77.imp"
PLACES = (((int)(PLACES)) + (1));
                                                                //     67        %finish
_imp_current_line = 67; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 67 "regression-bugs-tmp/write-emas77.imp"
L_000c:;
                                                                //     68        places = 63 %if places > 63
_imp_current_line = 68; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 68 "regression-bugs-tmp/write-emas77.imp"
if (((PLACES) <= (63))) goto L_000d;
#line 68 "regression-bugs-tmp/write-emas77.imp"
PLACES = 63;
#line 68 "regression-bugs-tmp/write-emas77.imp"
L_000d:;
                                                                //     69        %while slen < places %cycle
_imp_current_line = 69; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 69 "regression-bugs-tmp/write-emas77.imp"
L_000e:;
#line 69 "regression-bugs-tmp/write-emas77.imp"
if (((SLEN) >= (PLACES))) goto L_000f;
                                                                //     70           byteinteger(p) = ' '
_imp_current_line = 70; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 70 "regression-bugs-tmp/write-emas77.imp"
*_imp_BYTEINTEGER(P) = 32;
                                                                //     71           p = p - 1
_imp_current_line = 71; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 71 "regression-bugs-tmp/write-emas77.imp"
P = (((int)(P)) - (1));
                                                                //     72           slen = slen + 1
_imp_current_line = 72; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 72 "regression-bugs-tmp/write-emas77.imp"
SLEN = (((int)(SLEN)) + (1));
                                                                //     73        %repeat
_imp_current_line = 73; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 73 "regression-bugs-tmp/write-emas77.imp"
goto L_000e;
#line 73 "regression-bugs-tmp/write-emas77.imp"
L_000f:;
                                                                //     74        byteinteger(p) = slen
_imp_current_line = 74; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 74 "regression-bugs-tmp/write-emas77.imp"
*_imp_BYTEINTEGER(P) = SLEN;
                                                                //     75        %result = string(p)
_imp_current_line = 75; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 75 "regression-bugs-tmp/write-emas77.imp"
return *_imp_STRING(P);
                                                                //     76     %end
_imp_current_line = 76; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 76 "regression-bugs-tmp/write-emas77.imp"
_imp_endofblock: ;
} // End of block ITOS at level 2
                                                                //     77     %string (63) res
_imp_current_line = 77; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 77 "regression-bugs-tmp/write-emas77.imp"
_imp_string /*%string(63)*/ RES;
                                                                //     78     res = itos(num, pl)
_imp_current_line = 78; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 78 "regression-bugs-tmp/write-emas77.imp"
RES = ITOS(NUM, PL);
                                                                //     79     pl = \pl %if pl < 0
_imp_current_line = 79; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 79 "regression-bugs-tmp/write-emas77.imp"
if (((PL) >= (0))) goto L_0011;
#line 79 "regression-bugs-tmp/write-emas77.imp"
PL = (~(PL));
#line 79 "regression-bugs-tmp/write-emas77.imp"
L_0011:;
                                                                //     80     spaces(pl - 62)
_imp_current_line = 80; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 80 "regression-bugs-tmp/write-emas77.imp"
_imp_SPACES((((int)(PL)) - (62)));
                                                                //     81     printstring(res)
_imp_current_line = 81; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 81 "regression-bugs-tmp/write-emas77.imp"
_imp_PRINTSTRING(RES);
                                                                //     82  %end
_imp_current_line = 82; _imp_current_file = "regression-bugs-tmp/write-emas77.imp";
#line 82 "regression-bugs-tmp/write-emas77.imp"
return;
_imp_endofblock: ;
} // End of block EMASI77WRITE at level 1
                                                                //     83  
                                                                //     84  %endoffile
#line 84 "regression-bugs-tmp/write-emas77.imp"
// End of file
