#include <perms.h>

//          Edinburgh IMP77 Compiler - Version 8.4
//
//     1  %begin

int main(int argc, char **argv) { /*%begin*/
  _imp_initialise(argc, argv);
  auto void LOAD(void);

  auto void NEXTCH(void);

  auto void FIND(int X);

  auto void MONITOR(int N);

  //     2  !%externalstring(255)%fnspec itos(%integer i,n)
  //     3  !%externalroutinespec openinput(%integer stream, %string(255) filename)
  //     4  !%externalroutinespec openoutput(%integer stream, %string(255) filename)
  //     5
  //     6  %routinespec load
  //     7  %routinespec nextch
  //     8  %routinespec find(%integer x)
  //     9  %routinespec monitor(%integer n)
  //    10  %constinteger marker=16_ffffc000
  //    11  %conststring(1) snl = "

  const _imp_string1 SNL = _imp_str_init("\n");

  //    12+ "
  //    13  %ownshortintegerarray st(0:10000)=%c

  static short int ST[10001] = {
      -1, 4,  100, 101, 102, -1,  0,  4,  118, 97,  108, -2, 6,  7,  117, 112, 100, 97,  116, 101,
      -3, 12, 4,   98,  105, 110, -4, 21, 4,   100, 101, 99, -5, 27, 4,   98,  97,  114, -6,  [39 ... 10000] = 0};

  //    14+    -1,4,'d','e','f',-1,
  //    15+    0,4,'v','a','l',-2,
  //    16+    6,7,'u','p','d','a','t','e',-3,
  //    17+    12,4,'b','i','n',-4,
  //    18+    21,4,'d','e','c',-5,
  //    19+    27,4,'b','a','r',-6,
  //    20+    0(9962)
  //    21  %owninteger e=33, s=39

  static int E = 33;
  static int S = 39;

  //    22  %integer a, w, w1, h, p, f, c, q, e0, f0, h0, r

  int A;
  int W;
  int W1;
  int H;
  int P;
  int F;
  int C;
  int Q;
  int E0;
  int F0;
  int H0;
  int R;

  //    23  %string(63) filename

  _imp_string63 FILENAME;

  //    24  %switch mcm(1:6)

  int MCM_index;
  int MCM_line;
  char *MCM_file;
  static const void *MCM[6] = {&&case_MCM_1, &&case_MCM_2, &&case_MCM_3, &&case_MCM_4, &&case_MCM_5, &&case_MCM_6};

  //    25
  //    26    %on %event {0,} 9 %start

  if (!_imp_on_event(9)) goto L_0001;

    //    27      %if eventno{event_event} = 9 %then %start

  if (_imp_EVENTNO() != 9) goto L_0002;

    //    28        select input(0)

  _imp_SELECTINPUT(0);

  //    29        ->start

  goto U_1000;

  //    30      %finish %else print string(snl."GPM terminated".snl)

L_0002:;
  _imp_PRINTSTRING(
      *({
        __typeof__(_imp_string255) tmp = *({
          _imp_string255 tmp = _imp_join((_imp_string *)/*?*/ &*({
                                           _imp_string255 tmp =
                                               _imp_join((_imp_string *)/*?*/ &SNL,
                                                         (_imp_string *)/*?*/ _imp_str_literal_ptr("GPM terminated"));
                                           (_imp_string255 *)&tmp;
                                         }),
                                         (_imp_string *)/*?*/ &SNL);
          (_imp_string255 *)&tmp;
        }) /*q*/;
        (_imp_string255 *)&tmp;
      })
  );

  //    31      %stop

  _imp_stop(0);

  //    32    %finish

L_0001:;

//    33
//    34     a=0

  A = 0;

  //    35     w=0

  W = 0;

  //    36     w1=0

  W1 = 0;

  //    37     h=0

  H = 0;

  //    38     p=0

  P = 0;

  //    39     f=0

  F = 0;

  //    40     c=0

  C = 0;

  //    41     q=1

  Q = 1;

  //    42
  //    43  start:nextch

U_1000:;
  NEXTCH();

  //    44     %if a='@' %then %start

  if (A != 64) goto L_0003;

    //    45       read(filename)

  _imp_READ(/*?*/ &FILENAME);

  //    46       openinput(1,filename)

  _imp_OPENINPUT(1,
                 *({
                   __typeof__(_imp_string63) tmp = FILENAME /*q*/;
                   (_imp_string255 *)&tmp;
                 })
  );

  //    47       select input(1)

  _imp_SELECTINPUT(1);

  //    48       ->start ; %finish

  goto U_1000;
L_0003:;

//    49     %if a='/' %then %start

  if (A != 47) goto L_0004;

    //    50       read(filename)

  _imp_READ(/*?*/ &FILENAME);

  //    51       openoutput(1,filename)

  _imp_OPENOUTPUT(1,
                  *({
                    __typeof__(_imp_string63) tmp = FILENAME /*q*/;
                    (_imp_string255 *)&tmp;
                  })
  );

  //    52       select output(1)

  _imp_SELECTOUTPUT(1);

  //    53       ->start ; %finish

  goto U_1000;
L_0004:;

//    54     %if a='<' %then q=q+1 %and ->q2

  if (A != 60) goto L_0005;
  Q = Q + 1;
  goto U_1001;
L_0005:;

//    55     %if a='$' %then ->fn

  if (A != 36) goto L_0006;
  goto U_1002;
L_0006:;

//    56     %if a=',' %then ->next item

  if (A != 44) goto L_0007;
  goto U_1003;
L_0007:;

//    57     %if a=';' %then ->apply

  if (A != 59) goto L_0008;
  goto U_1004;
L_0008:;

//    58     %if a='#' %then ->load arg

  if (A != 35) goto L_0009;
  goto U_1005;
L_0009:;

//    59     %if a=marker %then ->endfn

  if (A != -16384) goto L_000A;
  goto U_1006;
L_000A:;

//    60     %if a='>' %then ->exit

  if (A != 62) goto L_000B;
  goto U_1007;
L_000B:;

//    61  copy:load

U_1008:;
  LOAD();

  //    62     %if q=1 %then ->start

  if (Q != 1) goto L_000C;
  goto U_1000;
L_000C:;

//    63  q2:nextch

U_1001:;
  NEXTCH();

  //    64     %if a='<' %then q=q+1 %and ->copy

  if (A != 60) goto L_000D;
  Q = Q + 1;
  goto U_1008;
L_000D:;

//    65     %if a#'>' %then ->copy

  if (A == 62) goto L_000E;
  goto U_1008;
L_000E:;

//    66     q=q-1

  Q = Q - 1;

  //    67     %if q=1 %then ->start %else ->copy

  if (Q != 1) goto L_000F;
  goto U_1000;
L_000F:;
  goto U_1008;

  //    68  fn:st(s)=h

U_1002:;
  ST[S] = H;

  //    69     st(s+1)=f

  ST[S + 1] = F;

  //    70     st(s+2)=0

  ST[S + 2] = 0;

  //    71     st(s+3)=0

  ST[S + 3] = 0;

  //    72     h=s+3

  H = S + 3;

  //    73     f=s+1

  F = S + 1;

  //    74     s=s+4

  S = S + 4;

  //    75     ->start

  goto U_1000;

  //    76
  //    77  next item:%if h=0 %then ->copy

U_1003:;
  if (H != 0) goto L_0010;
  goto U_1008;
L_0010:;

//    78     st(h)=s-h-st(h)

  ST[H] = S - H - ST[H];

  //    79     st(s)=0

  ST[S] = 0;

  //    80     h=s

  H = S;

  //    81     s=s+1

  S = S + 1;

  //    82     ->start

  goto U_1000;

  //    83
  //    84  apply:%if p>f %then monitor(1)

U_1004:;
  if (P <= F) goto L_0011;
  MONITOR(1);
L_0011:;

//    85     %if h=0 %then ->copy

  if (H != 0) goto L_0012;
  goto U_1008;
L_0012:;

//    86     st(h)=s-h

  ST[H] = S - H;

  //    87     st(s)=marker

  ST[S] = -16384;

  //    88     h0=st(f-1)

  H0 = ST[F - 1];

  //    89     f0=st(f)

  F0 = ST[F];

  //    90     st(f-1)=s-f+2

  ST[F - 1] = S - F + 2;

  //    91     st(f)=p

  ST[F] = P;

  //    92     st(f+1)=c

  ST[F + 1] = C;

  //    93     p=f

  P = F;

  //    94     f=f0

  F = F0;

  //    95     h=h0

  H = H0;

  //    96     s=s+1

  S = S + 1;

  //    97     %unless h=0 %then st(h)=st(h)+st(p-1)

  if (H == 0) goto L_0013;
  ST[H] = ST[H] + ST[P - 1];
L_0013:;

//    98     find(p+2)

  FIND(P + 2);

  //    99     %if st(w)<0 %then ->mcm(-st(w))

  if (ST[W] >= 0) goto L_0014;
  MCM_line = __LINE__;
  MCM_file = __FILE__;
  MCM_index = -ST[W];
  goto case_MCM_dispatch;
L_0014:;

//   100     c=w+1

  C = W + 1;

  //   101     ->start

  goto U_1000;

  //   102
  //   103  loadarg:%if p=0 %then %start

U_1005:;
  if (P != 0) goto L_0016;

    //   104       %if h=0 %then ->copy %else monitor(2)

  if (H != 0) goto L_0017;
  goto U_1008;
L_0017:;
  MONITOR(2);

  //   105       %finish

L_0016:;

//   106     nextch

  NEXTCH();

  //   107     w=p+2

  W = P + 2;

  //   108     %if a<'0' %then monitor(3)

  if (A >= 48) goto L_0018;
  MONITOR(3);
L_0018:;

//   109     %if a>'0' %then %start

  if (A <= 48) goto L_0019;

    //   110       %for r=0,1,a-'0'-1 %cycle

    // %for R = 0, 1, A - 48 - 1 %cycle
  {
    int _final = A - 48 - 1;
    if (invalid_for_loop(0, 1, _final)) _imp_signal(5, 1, 0, "Illegal cycle R = 0, 1, A - 48 - 1");
    R = -1;
  L_001A:
    if (R == _final) goto L_001B;
    R += 1;

    //   111       w=w+st(w)

    W = W + ST[W];

    //   112       %if st(w)=marker %then monitor(4)

    if (ST[W] != -16384) goto L_001D;
    MONITOR(4);
  L_001D:;

  //   113       %repeat

    goto L_001A;
  }

L_001B:;

//   114       %finish

L_0019:;

//   115     %for r=1,1,st(w)-1 %cycle

// %for R = 1, 1, ST[W] - 1 %cycle
  {
    int _final = ST[W] - 1;
    if (invalid_for_loop(1, 1, _final)) _imp_signal(5, 1, 0, "Illegal cycle R = 1, 1, ST[W] - 1");
    R = 0;
  L_001E:
    if (R == _final) goto L_001F;
    R += 1;

    //   116     a=st(w+r)

    A = ST[W + R];

    //   117     load

    LOAD();

    //   118     %repeat

    goto L_001E;
  }

L_001F:;

//   119     ->start

  goto U_1000;

  //   120
  //   121  endfn:%if f>p %then monitor(5)

U_1006:;
  if (F <= P) goto L_0021;
  MONITOR(5);
L_0021:;

//   122     st(s)=e

  ST[S] = E;

  //   123     a=s

  A = S;

  //   124     %while st(a)>=p-1+st(p-1) %cycle

L_0022:;
  if (ST[A] < P - 1 + ST[P - 1]) goto L_0023;

    //   125       e0=st(a)

  E0 = ST[A];

  //   126       st(a)=e0-st(p-1)

  ST[A] = E0 - ST[P - 1];

  //   127       a=e0

  A = E0;

  //   128    %repeat

  goto L_0022;
L_0023:;

//   129     w=st(a)

  W = ST[A];

  //   130     w=st(w) %while w>p-1

L_0024:;
  if (W <= P - 1) goto L_0025;
  W = ST[W];
  goto L_0024;
L_0025:;

//   131     st(a)=w

  ST[A] = W;

  //   132     e=st(s)

  E = ST[S];

  //   133     %unless h=0 %then %start

  if (H == 0) goto L_0026;

    //   134       %if h>p %then h=h-st(p-1) %else st(h)=st(h)-st(p-1)

  if (H <= P) goto L_0027;
  H = H - ST[P - 1];
  goto L_0028;
L_0027:;
  ST[H] = ST[H] - ST[P - 1];
L_0028:;

//   135       %finish

L_0026:;

//   136     a=p-1

  A = P - 1;

  //   137     w=a+st(p-1)

  W = A + ST[P - 1];

  //   138     c=st(p+1)

  C = ST[P + 1];

  //   139     s=s-st(p-1)

  S = S - ST[P - 1];

  //   140     p=st(p)

  P = ST[P];

  //   141     st(a)=st(w) %and a=a+1 %and w=w+1 %while a#s

L_0029:;
  if (A == S) goto L_002A;
  ST[A] = ST[W];
  A = A + 1;
  W = W + 1;
  goto L_0029;
L_002A:;

//   142     ->start

  goto U_1000;

  //   143
  //   144  exit:%unless c=h=0 %then monitor(8)

U_1007:;
  {
// Double-sided test on H (Part I)
    int tmp;
    if (C != (tmp = H)) goto L_0020;
// Double-sided test on H (Part II)
    if (tmp == 0) goto L_002B;
  }
L_0020:;
  MONITOR(8);
L_002B:;

//   145     %stop

  _imp_stop(0);

  //   146
  //   147  mcm(1):! def

case_MCM_1:;

//   148     %unless h=0 %then st(h)=st(h)-st(p-1)+6

  if (H == 0) goto L_002C;
  ST[H] = ST[H] - ST[P - 1] + 6;
L_002C:;

//   149     st(p-1)=6

  ST[P - 1] = 6;

  //   150     st(p+5)=e

  ST[P + 5] = E;

  //   151     e=p+5

  E = P + 5;

  //   152     ->endfn

  goto U_1006;

  //   153
  //   154  mcm(2):! val

case_MCM_2:;

//   155     find(p+6)

  FIND(P + 6);

  //   156     a=st(w+1) %and w=w+1 %and load %while st(w+1)#marker

L_002D:;
  if (ST[W + 1] == -16384) goto L_002E;
  A = ST[W + 1];
  W = W + 1;
  LOAD();
  goto L_002D;
L_002E:;

//   157     ->endfn

  goto U_1006;

  //   158
  //   159  mcm(3):! update

case_MCM_3:;

//   160     find(p+9)

  FIND(P + 9);

  //   161     a=p+9+st(p+9)

  A = P + 9 + ST[P + 9];

  //   162     %if st(a)>st(w) %then monitor(9)

  if (ST[A] <= ST[W]) goto L_002F;
  MONITOR(9);
L_002F:;

//   163     %for r=1,1,st(a) %cycle

// %for R = 1, 1, ST[A] %cycle
  {
    int _final = ST[A];
    if (invalid_for_loop(1, 1, _final)) _imp_signal(5, 1, 0, "Illegal cycle R = 1, 1, ST[A]");
    R = 0;
  L_0030:
    if (R == _final) goto L_0031;
    R += 1;

    //   164     st(w+r)=st(a+r)

    ST[W + R] = ST[A + R];

    //   165     %repeat

    goto L_0030;
  }

L_0031:;

//   166     ->endfn

  goto U_1006;

  //   167
  //   168  mcm(4):! bin

case_MCM_4:;

//   169     w=0

  W = 0;

  //   170     %if st(p+7)='+' %or st(p+7)='-' %then a=p+8 %else a=p+7

  if (ST[P + 7] == 43) goto L_0032;
  if (ST[P + 7] != 45) goto L_0033;
L_0032:;
  A = P + 8;
  goto L_0034;
L_0033:;
  A = P + 7;
L_0034:;

//   171     %while st(a)#marker %cycle

L_0035:;
  if (ST[A] == -16384) goto L_0036;

    //   172       %unless '0'<=st(a)<='9' %then monitor(10)

  {
// Double-sided test on ST[A] (Part I)
    short int tmp;
    if (48 > (tmp = ST[A])) goto L_001C;
// Double-sided test on ST[A] (Part II)
    if (tmp <= 57) goto L_0037;
  }
L_001C:;
  MONITOR(10);
L_0037:;

//   173       w=10*w+st(a)-'0'

  W = 10 * W + ST[A] - 48;

  //   174       a=a+1

  A = A + 1;

  //   175       %repeat

  goto L_0035;
L_0036:;

//   176     %if st(p+7)='-' %then st(s)=-w %else st(s)=w

  if (ST[P + 7] != 45) goto L_0038;
  ST[S] = -W;
  goto L_0039;
L_0038:;
  ST[S] = W;
L_0039:;

//   177     s=s+1

  S = S + 1;

  //   178     ->endfn

  goto U_1006;

  //   179
  //   180  mcm(5):! dec

case_MCM_5:;

//   181     w=st(p+7)

  W = ST[P + 7];

  //   182     %if w<0 %then w=-w %and a='-' %and load

  if (W >= 0) goto L_003A;
  W = -W;
  A = 45;
  LOAD();
L_003A:;

//   183     r=1

  R = 1;

  //   184     r=10*r %while 10*r<=w

L_003B:;
  if (10 * R > W) goto L_003C;
  R = 10 * R;
  goto L_003B;
L_003C:;

//   185     a=w//r+'0' %and load %and w=w-r*(a-'0')%and r=r//10 %while r>=1

L_003D:;
  if (R < 1) goto L_003E;
  A = ((long)W / (long)R) + 48;
  LOAD();
  W = W - R * (A - 48);
  R = ((long)R / (long)10);
  goto L_003D;
L_003E:;

//   186     ->endfn

  goto U_1006;

  //   187
  //   188  mcm(6):! bar

case_MCM_6:;

//   189     w=st(p+9)

  W = ST[P + 9];

  //   190     a=st(p+11)

  A = ST[P + 11];

  //   191     %if st(p+7)='+' %then a=w+a

  if (ST[P + 7] != 43) goto L_003F;
  A = W + A;
L_003F:;

//   192     %if st(p+7)='-' %then a=w-a

  if (ST[P + 7] != 45) goto L_0040;
  A = W - A;
L_0040:;

//   193     %if st(p+7)='*' %then a=w*a

  if (ST[P + 7] != 42) goto L_0041;
  A = W * A;
L_0041:;

//   194     %if st(p+7)='/' %then a=w//a

  if (ST[P + 7] != 47) goto L_0042;
  A = ((long)W / (long)A);
L_0042:;

//   195     %if st(p+7)='r' %then a=w-w//a*a

  if (ST[P + 7] != 114) goto L_0043;
  A = W - ((long)W / (long)A) * A;
L_0043:;

//   196     load

  LOAD();

  //   197     ->endfn

  goto U_1006;

  //   198
  //   199  {------------------------------------------------------------------------------}
  //   200
  //   201  %routine load

  void LOAD(void) {
    //   202     %if h=0 %then print symbol(a) %else st(s)=a %and s=s+1

    if (H != 0) goto L_0044;
    _imp_PRINTSYMBOL(A);
    goto L_0045;
  L_0044:;
    ST[S] = A;
    S = S + 1;
  L_0045:;

  //   203  %end

    return;
  } /* end of LOAD */

  //   204
  //   205  {------------------------------------------------------------------------------}
  //   206
  //   207  %routine nextch

  void NEXTCH(void) {
    //   208     %if c=0 %then read symbol(a) %else a=st(c) %and c=c+1

    if (C != 0) goto L_0046;
    _imp_READSYMBOL(/*?*/ &A);
    goto L_0047;
  L_0046:;
    A = ST[C];
    C = C + 1;
  L_0047:;

  //   209  %end

    return;
  } /* end of NEXTCH */

  //   210
  //   211  {------------------------------------------------------------------------------}
  //   212
  //   213  %routine find(%integer x)

  void FIND(int X) {
    //   214     a=e

    A = E;

    //   215     w=x

    W = X;

    //   216  again: %for r=0,1,st(w)-1 %cycle

  U_1009:;
  // %for R = 0, 1, ST[W] - 1 %cycle
    {
      int _final = ST[W] - 1;
      if (invalid_for_loop(0, 1, _final)) _imp_signal(5, 1, 0, "Illegal cycle R = 0, 1, ST[W] - 1");
      R = -1;
    L_0048:
      if (R == _final) goto L_0049;
      R += 1;

      // ?Non-local
      //   217        %if st(w+r)#st(a+r+1) %then ->next

      if (ST[W + R] == ST[A + R + 1]) goto L_004B;
      goto U_100A;
    L_004B:;

    //   218     %repeat

      goto L_0048;
    }

  L_0049:;

  //   219     w=a+1+st(w)

    W = A + 1 + ST[W];

    //   220     %return

    return;

    //   221  next:a=st(a)

  U_100A:;
    A = ST[A];

    //   222     ->again %unless a<0

    if (A < 0) goto L_004C;
    goto U_1009;
  L_004C:;

  //   223     monitor(7)

    MONITOR(7);

    //   224  %end

    return;
  } /* end of FIND */

  //   225
  //   226  {------------------------------------------------------------------------------}
  //   227
  //   228  %routine monitor(%integer n)

  void MONITOR(int N) {
    auto void ITEM(int X);

    //   229  %routinespec item(%integer x)
    //   230  %switch fault(1:10)

    int FAULT_index;
    int FAULT_line;
    char *FAULT_file;
    static const void *FAULT[10] = {&&case_FAULT_1, &&case_FAULT_2, &&case_FAULT_3, &&case_FAULT_4, &&case_FAULT_5,
                                    &&case_FAULT_6, &&case_FAULT_7, &&case_FAULT_8, &&case_FAULT_9, &&case_FAULT_10};

    //   231
    //   232     print string(snl."Monitor : ")

    _imp_PRINTSTRING(
        *({
          __typeof__(_imp_string255) tmp = *({
            _imp_string255 tmp =
                _imp_join((_imp_string *)/*?*/ &SNL, (_imp_string *)/*?*/ _imp_str_literal_ptr("Monitor : "));
            (_imp_string255 *)&tmp;
          }) /*q*/;
          (_imp_string255 *)&tmp;
        })
    );

    //   233     ->fault(n)

    FAULT_line = __LINE__;
    FAULT_file = __FILE__;
    FAULT_index = N;
    goto case_FAULT_dispatch;

    //   234
    //   235  fault(1):print string("Unmatched semicolon in definition of ")

  case_FAULT_1:;
    _imp_PRINTSTRING(_imp_str_literal("Unmatched semicolon in definition of "));

    //   236     item(p+2)

    ITEM(P + 2);

    //   237     ->end

    goto U_100B;

    //   238
    //   239  fault(2):print string("Unquoted # in argument list of ")

  case_FAULT_2:;
    _imp_PRINTSTRING(_imp_str_literal("Unquoted # in argument list of "));

    //   240     item(f+2)

    ITEM(F + 2);

    //   241     ->end

    goto U_100B;

    //   242
    //   243  fault(3):print string("Impossible argument number in definition of ")

  case_FAULT_3:;
    _imp_PRINTSTRING(_imp_str_literal("Impossible argument number in definition of "));

    //   244     item(p+2)

    ITEM(P + 2);

    //   245     ->end

    goto U_100B;

    //   246
    //   247  fault(4):print string("No argument ")

  case_FAULT_4:;
    _imp_PRINTSTRING(_imp_str_literal("No argument "));

    //   248     print symbol(a)

    _imp_PRINTSYMBOL(A);

    //   249     print string(" in call for ")

    _imp_PRINTSTRING(_imp_str_literal(" in call for "));

    //   250     item(p+2)

    ITEM(P + 2);

    //   251     ->end

    goto U_100B;

    //   252
    //   253  fault(5):print string("Terminator in ")

  case_FAULT_5:;
    _imp_PRINTSTRING(_imp_str_literal("Terminator in "));

    //   254     %if c=0 %then print string("input stream; GPM error ?") %and ->end

    if (C != 0) goto L_004E;
    _imp_PRINTSTRING(_imp_str_literal("input stream; GPM error ?"));
    goto U_100B;
  L_004E:;

  //   255     print string("argument list for ")

    _imp_PRINTSTRING(_imp_str_literal("argument list for "));

    //   256     item(f+2)

    ITEM(F + 2);

    //   257     print string(snl."probably due to semicolon missing from definition of ")

    _imp_PRINTSTRING(
        *({
          __typeof__(_imp_string255) tmp = *({
            _imp_string255 tmp = _imp_join(
                (_imp_string *)/*?*/ &SNL,
                (_imp_string *)/*?*/ _imp_str_literal_ptr("probably due to semicolon missing from definition of "));
            (_imp_string255 *)&tmp;
          }) /*q*/;
          (_imp_string255 *)&tmp;
        })
    );

    //   258     item(p+2)

    ITEM(P + 2);

    //   259     ->end

    goto U_100B;

    //   260
    //   261  fault(6):print string("GPM error?")

  case_FAULT_6:;
    _imp_PRINTSTRING(_imp_str_literal("GPM error?"));

    //   262     ->end

    goto U_100B;

    //   263
    //   264  fault(7):print string("Undefined name ")

  case_FAULT_7:;
    _imp_PRINTSTRING(_imp_str_literal("Undefined name "));

    //   265     item(w)

    ITEM(W);

    //   266     ->end

    goto U_100B;

    //   267
    //   268  fault(8):print string("Unmatched >; GPM error ?")

  case_FAULT_8:;
    _imp_PRINTSTRING(_imp_str_literal("Unmatched >; GPM error ?"));

    //   269     ->end

    goto U_100B;

    //   270
    //   271  fault(9):print string("Update argument too long for ")

  case_FAULT_9:;
    _imp_PRINTSTRING(_imp_str_literal("Update argument too long for "));

    //   272     item(p+9)

    ITEM(P + 9);

    //   273     ->end

    goto U_100B;

    //   274
    //   275  fault(10):print string("Non-digit in number ")

  case_FAULT_10:;
    _imp_PRINTSTRING(_imp_str_literal("Non-digit in number "));

    //   276
    //   277  end:

  U_100B:;

  //   278
  //   279     ! general monitor
  //   280     w=20

    W = 20;

    //   281     print string(snl."Current macros are :")

    _imp_PRINTSTRING(
        *({
          __typeof__(_imp_string255) tmp = *({
            _imp_string255 tmp =
                _imp_join((_imp_string *)/*?*/ &SNL, (_imp_string *)/*?*/ _imp_str_literal_ptr("Current macros are :"));
            (_imp_string255 *)&tmp;
          }) /*q*/;
          (_imp_string255 *)&tmp;
        })
    );

    //   282     %while p#0 %or f#0 %cycle

  L_004F:;
    if (P != 0) goto L_004A;
    if (F == 0) goto L_0050;
  L_004A:;

  //   283       %if p>f %then %start

    if (P <= F) goto L_0051;

      //   284         w1=p+2

    W1 = P + 2;

    //   285         p=st(p)

    P = ST[P];

    //   286         print string(snl."already entered :  ")

    _imp_PRINTSTRING(
        *({
          __typeof__(_imp_string255) tmp = *({
            _imp_string255 tmp =
                _imp_join((_imp_string *)/*?*/ &SNL, (_imp_string *)/*?*/ _imp_str_literal_ptr("already entered :  "));
            (_imp_string255 *)&tmp;
          }) /*q*/;
          (_imp_string255 *)&tmp;
        })
    );

    //   287       %finish %else %start

    goto L_0052;
  L_0051:;

  //   288         w1=f+2

    W1 = F + 2;

    //   289         f=st(f)

    F = ST[F];

    //   290         print string(snl."not yet entered :  ")

    _imp_PRINTSTRING(
        *({
          __typeof__(_imp_string255) tmp = *({
            _imp_string255 tmp =
                _imp_join((_imp_string *)/*?*/ &SNL, (_imp_string *)/*?*/ _imp_str_literal_ptr("not yet entered :  "));
            (_imp_string255 *)&tmp;
          }) /*q*/;
          (_imp_string255 *)&tmp;
        })
    );

    //   291       %finish

  L_0052:;

  //   292       %for r=1,1,w %cycle

  // %for R = 1, 1, W %cycle
    {
      int _final = W;
      if (invalid_for_loop(1, 1, _final)) _imp_signal(5, 1, 0, "Illegal cycle R = 1, 1, W");
      R = 0;
    L_0053:
      if (R == _final) goto L_0054;
      R += 1;

      // ?Non-local
      //   293         item(w1)

      ITEM(W1);

      //   294         %if st(w1)=0 %then %exit

      if (ST[W1] != 0) goto L_0056;
      goto L_0054;
    L_0056:;

    //   295         w1=w1+st(w1)

      W1 = W1 + ST[W1];

      //   296         %if st(w1)=marker %then %exit

      if (ST[W1] != -16384) goto L_0057;
      goto L_0054;
    L_0057:;

    //   297         %unless w=1 %then %start

      if (W == 1) goto L_0058;

        //   298           print string(snl."arg".itos(r,1)." :    ")

      _imp_PRINTSTRING(
          *({
            __typeof__(_imp_string255) tmp = *({
              _imp_string255 tmp = _imp_join((_imp_string *)/*?*/ &*({
                                               _imp_string255 tmp =
                                                   _imp_join((_imp_string *)/*?*/ &*({
                                                               _imp_string255 tmp = _imp_join(
                                                                   (_imp_string *)/*?*/ &SNL,
                                                                   (_imp_string *)/*?*/ _imp_str_literal_ptr("arg"));
                                                               (_imp_string255 *)&tmp;
                                                             }),
                                                             ({
                                                               __typeof__(_imp_string255) tmp; /*E*/
                                                               tmp = _imp_ITOS(R, 1);
                                                               (void *)&tmp;
                                                             }));
                                               (_imp_string255 *)&tmp;
                                             }),
                                             (_imp_string *)/*?*/ _imp_str_literal_ptr(" :    "));
              (_imp_string255 *)&tmp;
            }) /*q*/;
            (_imp_string255 *)&tmp;
          })
      );

      //   299         %finish

    L_0058:;

    //   300       %repeat

      goto L_0053;
    }

  L_0054:;

  //   301       w=1

    W = 1;

    //   302       %repeat

    goto L_004F;
  L_0050:;

  //   303     print string(snl."End of monitor printing".snl)

    _imp_PRINTSTRING(
        *({
          __typeof__(_imp_string255) tmp = *({
            _imp_string255 tmp = _imp_join((_imp_string *)/*?*/ &*({
                                             _imp_string255 tmp = _imp_join(
                                                 (_imp_string *)/*?*/ &SNL,
                                                 (_imp_string *)/*?*/ _imp_str_literal_ptr("End of monitor printing"));
                                             (_imp_string255 *)&tmp;
                                           }),
                                           (_imp_string *)/*?*/ &SNL);
            (_imp_string255 *)&tmp;
          }) /*q*/;
          (_imp_string255 *)&tmp;
        })
    );

    //   304     %stop

    _imp_stop(0);

    //   305
    //   306  %routine item(%integer x)

    void ITEM(int X) {
      //   307  %integer k,l

      int K;
      int L;

      //   308     %if st(x)=0 %then l=s-x-1 %else l=st(x)-1

      if (ST[X] != 0) goto L_0059;
      L = S - X - 1;
      goto L_005A;
    L_0059:;
      L = ST[X] - 1;
    L_005A:;

    //   309     %if l>0 %then %start

      if (L <= 0) goto L_005B;

        //   310       print symbol(st(x+k)) %for k=1, 1, l

        // %for K = 1, 1, L %cycle
      {
        int _final = L;
        if (invalid_for_loop(1, 1, _final)) _imp_signal(5, 1, 0, "Illegal cycle K = 1, 1, L");
        K = 0;
      L_005C:
        if (K == _final) goto L_005D;
        K += 1;
        _imp_PRINTSYMBOL(ST[X + K]);
        goto L_005C;
      }

    L_005D:;

    //   311     %finish

    L_005B:;

    //   312     %if st(x)=0 %then print string("...    (incomplete)")

      if (ST[X] != 0) goto L_005E;
      _imp_PRINTSTRING(_imp_str_literal("...    (incomplete)"));
    L_005E:;

    //   313  %end

      return;
    } /* end of ITEM */

    //   314
    //   315  %end

    return;

  case_FAULT_dispatch:
    if (FAULT_index < 1 || FAULT_index > 10)
      _imp_signalf(6, 3, FAULT_index, "->FAULT(%d) out of bounds at %s line %d", FAULT_index, FAULT_file, FAULT_line);
    goto *FAULT[FAULT_index - 1];
  } /* end of MONITOR */

  //   316
  //   317  %endofprogram

  _imp_stop(0);
  return 0;

case_MCM_dispatch:
  if (MCM_index < 1 || MCM_index > 6)
    _imp_signalf(6, 3, MCM_index, "->MCM(%d) out of bounds at %s line %d", MCM_index, MCM_file, MCM_line);
  goto *MCM[MCM_index - 1];
end_0:;
}