#include <perms.h>

                                                                //      1  %externalroutine write2(%integer n, p)
#line 1 "regression-bugs-tmp/write2.imp"
void WRITE2( int N, int P )
#line 1 "regression-bugs-tmp/write2.imp"
{
  __label__ _imp_endofblock;
                                                                //      2    %string(63)%fn itos(%integer n, p)
_imp_current_line = 2; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 2 "regression-bugs-tmp/write2.imp"
_imp_string /*%string(63)*/ ITOS( int N, int P )
#line 2 "regression-bugs-tmp/write2.imp"
{
  __label__ _imp_endofblock;
                                                                //      3       %string(255) answer
_imp_current_line = 3; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 3 "regression-bugs-tmp/write2.imp"
_imp_string /*%string(255)*/ ANSWER;
                                                                //      4       %byteintegerarray a(0:64)
_imp_current_line = 4; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 4 "regression-bugs-tmp/write2.imp"
unsigned char A[65];
                                                                //      5       %integer sign, sym, pt, val
_imp_current_line = 5; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 5 "regression-bugs-tmp/write2.imp"
int SIGN;
#line 5 "regression-bugs-tmp/write2.imp"
int SYM;
#line 5 "regression-bugs-tmp/write2.imp"
int PT;
#line 5 "regression-bugs-tmp/write2.imp"
int VAL;
                                                                //      6       val = p
_imp_current_line = 6; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 6 "regression-bugs-tmp/write2.imp"
VAL = P;
                                                                //      7       %if p > 0 %then p = p+1 %else p = -p
_imp_current_line = 7; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 7 "regression-bugs-tmp/write2.imp"
if (((P) <= (0))) goto L_0002;
#line 7 "regression-bugs-tmp/write2.imp"
P = (((int)(P)) + (1));
#line 7 "regression-bugs-tmp/write2.imp"
goto L_0003;
#line 7 "regression-bugs-tmp/write2.imp"
L_0002:;
#line 7 "regression-bugs-tmp/write2.imp"
P = (-(P));
#line 7 "regression-bugs-tmp/write2.imp"
L_0003:;
                                                                //      8       p = 63 %if p > 63
_imp_current_line = 8; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 8 "regression-bugs-tmp/write2.imp"
if (((P) <= (63))) goto L_0004;
#line 8 "regression-bugs-tmp/write2.imp"
P = 63;
#line 8 "regression-bugs-tmp/write2.imp"
L_0004:;
                                                                //      9       sign = ' '
_imp_current_line = 9; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 9 "regression-bugs-tmp/write2.imp"
SIGN = 32;
                                                                //     10       sign = 0 %if val <= 0
_imp_current_line = 10; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 10 "regression-bugs-tmp/write2.imp"
if (((VAL) > (0))) goto L_0005;
#line 10 "regression-bugs-tmp/write2.imp"
SIGN = 0;
#line 10 "regression-bugs-tmp/write2.imp"
L_0005:;
                                                                //     11       pt = 0
_imp_current_line = 11; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 11 "regression-bugs-tmp/write2.imp"
PT = 0;
                                                                //     12       %if n < 0 %start
_imp_current_line = 12; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 12 "regression-bugs-tmp/write2.imp"
if (((N) >= (0))) goto L_0006;
                                                                //     13          sign = '-'
_imp_current_line = 13; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 13 "regression-bugs-tmp/write2.imp"
SIGN = 45;
                                                                //     14          %if n = 16_80000000 %start
_imp_current_line = 14; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 14 "regression-bugs-tmp/write2.imp"
if (((N) != ((-2147483648)))) goto L_0007;
                                                                //     15             string(addr(a(pt))) = "8463847412"
_imp_current_line = 15; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 15 "regression-bugs-tmp/write2.imp"
*_imp_STRING(_imp_ADDR(&A[PT])) = _imp_str_literal("8463847412");
                                                                //     16             pt = pt + 10
_imp_current_line = 16; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 16 "regression-bugs-tmp/write2.imp"
PT = (((int)(PT)) + (10));
                                                                //     17             -> set
_imp_current_line = 17; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 17 "regression-bugs-tmp/write2.imp"
goto U_1000;
                                                                //     18             %finish
_imp_current_line = 18; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 18 "regression-bugs-tmp/write2.imp"
L_0007:;
                                                                //     19          n = -n
_imp_current_line = 19; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 19 "regression-bugs-tmp/write2.imp"
N = (-(N));
                                                                //     20          %finish
_imp_current_line = 20; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 20 "regression-bugs-tmp/write2.imp"
L_0006:;
                                                                //     21       %cycle
_imp_current_line = 21; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 21 "regression-bugs-tmp/write2.imp"
L_0008:;
                                                                //     22          sym = n-n//10*10
_imp_current_line = 22; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 22 "regression-bugs-tmp/write2.imp"
SYM = ((N) - (((((long)((long)((int)(N)) / (long)((int)(10))))) * (10))));
                                                                //     23          pt = pt+1
_imp_current_line = 23; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 23 "regression-bugs-tmp/write2.imp"
PT = (((int)(PT)) + (1));
                                                                //     24          a(pt) = sym+'0'
_imp_current_line = 24; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 24 "regression-bugs-tmp/write2.imp"
A[PT] = (((int)(SYM)) + (48));
                                                                //     25          n = n//10
_imp_current_line = 25; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 25 "regression-bugs-tmp/write2.imp"
N = (long)((long)((int)(N)) / (long)((int)(10)));
                                                                //     26       %repeat %until n = 0
_imp_current_line = 26; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 26 "regression-bugs-tmp/write2.imp"
if (((N) == (0))) goto L_0009;
#line 26 "regression-bugs-tmp/write2.imp"
goto L_0008;
#line 26 "regression-bugs-tmp/write2.imp"
L_0009:;
                                                                //     27      set:
_imp_current_line = 27; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 27 "regression-bugs-tmp/write2.imp"
U_1000:;
                                                                //     28       %if sign # 0 %start
_imp_current_line = 28; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 28 "regression-bugs-tmp/write2.imp"
if (((SIGN) == (0))) goto L_000b;
                                                                //     29          pt = pt+1;  a(pt) = sign
_imp_current_line = 29; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 29 "regression-bugs-tmp/write2.imp"
PT = (((int)(PT)) + (1));
_imp_current_line = 29; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 29 "regression-bugs-tmp/write2.imp"
A[PT] = SIGN;
                                                                //     30       %finish
_imp_current_line = 30; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 30 "regression-bugs-tmp/write2.imp"
L_000b:;
                                                                //     31       %while pt < p %cycle
_imp_current_line = 31; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 31 "regression-bugs-tmp/write2.imp"
L_000c:;
#line 31 "regression-bugs-tmp/write2.imp"
if (((PT) >= (P))) goto L_000d;
                                                                //     32          pt = pt+1;  a(pt) = ' '
_imp_current_line = 32; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 32 "regression-bugs-tmp/write2.imp"
PT = (((int)(PT)) + (1));
_imp_current_line = 32; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 32 "regression-bugs-tmp/write2.imp"
A[PT] = 32;
                                                                //     33       %repeat
_imp_current_line = 33; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 33 "regression-bugs-tmp/write2.imp"
goto L_000c;
#line 33 "regression-bugs-tmp/write2.imp"
L_000d:;
                                                                //     34       answer = ""
_imp_current_line = 34; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 34 "regression-bugs-tmp/write2.imp"
ANSWER = _imp_str_literal("");
                                                                //     35       %cycle
_imp_current_line = 35; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 35 "regression-bugs-tmp/write2.imp"
L_000f:;
                                                                //     36          answer = answer.tostring(a(pt))
_imp_current_line = 36; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 36 "regression-bugs-tmp/write2.imp"
ANSWER = _imp_join((_imp_string)ANSWER,(_imp_string)_imp_TOSTRING(A[PT]));
                                                                //     37          pt = pt-1
_imp_current_line = 37; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 37 "regression-bugs-tmp/write2.imp"
PT = (((int)(PT)) - (1));
                                                                //     38       %repeat %until pt = 0
_imp_current_line = 38; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 38 "regression-bugs-tmp/write2.imp"
if (((PT) == (0))) goto L_0010;
#line 38 "regression-bugs-tmp/write2.imp"
goto L_000f;
#line 38 "regression-bugs-tmp/write2.imp"
L_0010:;
                                                                //     39       %result = answer
_imp_current_line = 39; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 39 "regression-bugs-tmp/write2.imp"
return ANSWER;
                                                                //     40    %end
_imp_current_line = 40; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 40 "regression-bugs-tmp/write2.imp"
_imp_endofblock: ;
} // End of block ITOS at level 2
                                                                //     41    space %and p = p-1 %while p > 62
_imp_current_line = 41; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 41 "regression-bugs-tmp/write2.imp"
L_0012:;
#line 41 "regression-bugs-tmp/write2.imp"
if (((P) <= (62))) goto L_0013;
#line 41 "regression-bugs-tmp/write2.imp"
_imp_SPACE();
#line 41 "regression-bugs-tmp/write2.imp"
P = (((int)(P)) - (1));
#line 41 "regression-bugs-tmp/write2.imp"
goto L_0012;
#line 41 "regression-bugs-tmp/write2.imp"
L_0013:;
                                                                //     42    printstring(itos(n, p))
_imp_current_line = 42; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 42 "regression-bugs-tmp/write2.imp"
_imp_PRINTSTRING(ITOS(N, P));
                                                                //     43  %end
_imp_current_line = 43; _imp_current_file = "regression-bugs-tmp/write2.imp";
#line 43 "regression-bugs-tmp/write2.imp"
return;
_imp_endofblock: ;
} // End of block WRITE2 at level 1
                                                                //     44  
                                                                //     45  %endoffile
#line 45 "regression-bugs-tmp/write2.imp"
// End of file
