#include <perms.h>

//          Edinburgh IMP77 Compiler - Version 8.4
//
//     1  %externalroutine toplev

void TOPLEV(void) {
  //     2    %longreal lr1

  double LR1;

  //     3    %integer i, i1 = 1, i2 = 2, i3 = 3

  int I;
  int I1;
  I1 = 1;
  int I2;
  I2 = 2;
  int I3;
  I3 = 3;

  //     4
  //     5    i = i1 %if i2 = i3

  if (I2 != I3) goto L_0001;
  I = I1;
L_0001:;

//     6  %comment  i = i1 %if i2 = i3
//     7    i = i1 %while i2 = i3

L_0002:;
  if (I2 != I3) goto L_0003;
  I = I1;
  goto L_0002;
L_0003:;

//     8  %comment  i = i1 %while i2 = i3
//     9    i = i1 %until i2 = i3

L_0004:;
  I = I1;
  if (I2 == I3) goto L_0005;
  goto L_0004;
L_0005:;

//    10  %comment  i = i1 %until i2 = i3
//    11    i = i1 %unless i2 = i3

  if (I2 == I3) goto L_0006;
  I = I1;
L_0006:;

//    12  %comment  i = i1 %unless i2 = i3
//    13    i = i1 %for i2 = i3, 1, i1

// %for I2 = I3, 1, I1 %cycle
  {
    int _initial = I3, _final = I1;
    if (invalid_for_loop(_initial, 1, _final)) _imp_signal(5, 1, 0, "Illegal cycle I2 = I3, 1, I1");
    I2 = _initial - (1);
  L_0007:
    if (I2 == _final) goto L_0008;
    I2 += 1;
    I = I1;
    goto L_0007;
  }

L_0008:;

//    14  %comment  i = i1 %for i2 = i3, 1, i1
//    15
//    16  %comment
//    17    i = i1 %and i1 = i2 %if i2 = i3

  if (I2 != I3) goto L_000A;
  I = I1;
  I1 = I2;
L_000A:;

//    18  %comment  i = i1 %and i1 = i2 %if i2 = i3
//    19    i = i1 %and i1 = i2 %while i2 = i3

L_000B:;
  if (I2 != I3) goto L_000C;
  I = I1;
  I1 = I2;
  goto L_000B;
L_000C:;

//    20  %comment  i = i1 %and i1 = i2 %while i2 = i3
//    21    i = i1 %and i1 = i2 %until i2 = i3

L_000D:;
  I = I1;
  I1 = I2;
  if (I2 == I3) goto L_000E;
  goto L_000D;
L_000E:;

//    22  %comment  i = i1 %and i1 = i2 %until i2 = i3
//    23    i = i1 %and i1 = i2 %unless i2 = i3

  if (I2 == I3) goto L_000F;
  I = I1;
  I1 = I2;
L_000F:;

//    24  %comment  i = i1 %and i1 = i2 %unless i2 = i3
//    25    i = i1 %and i1 = i2 %for i2 = i3, 1, i1

// %for I2 = I3, 1, I1 %cycle
  {
    int _initial = I3, _final = I1;
    if (invalid_for_loop(_initial, 1, _final)) _imp_signal(5, 1, 0, "Illegal cycle I2 = I3, 1, I1");
    I2 = _initial - (1);
  L_0010:
    if (I2 == _final) goto L_0011;
    I2 += 1;
    I = I1;
    I1 = I2;
    goto L_0010;
  }

L_0011:;

//    26  %comment  i = i1 %and i1 = i2 %for i2 = i3, 1, i1
//    27
//    28  %end

  return;
} /* end of TOPLEV */

// ?LR1 unused
//    29  %endoffile