#include <perms.h>

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

void TOPLEV(void) {
  //     2
  //     3  ! compiled with ./imps this gives a segfault but with ./bin/imps it compiles OK???!
  //     4  ! what in the prims.inc could cause that?
  //     5
  //     6    %longreal lr1

  double LR1;

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

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

  //     8
  //     9    %if i2 = i3 %start

  if (I2 != I3) goto L_0001;

    //    10        i = i1

  I = I1;

  //    11    %finish

L_0001:;

//    12
//    13    test3else:

U_1000:;

//    14
//    15    %if i2 = i3 %then i = i1 %else i = i2

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

//    16
//    17    test4else:

U_1001:;

//    18
//    19    %if i2 = i3 %then %start

  if (I2 != I3) goto L_0004;

    //    20        i = i1

  I = I1;

  //    21    %finish %else i = i2

  goto L_0005;
L_0004:;
  I = I2;
L_0005:;

//    22
//    23  %end

  return;
} /* end of TOPLEV */

// ?TEST4ELSE unused
// ?TEST3ELSE unused
// ?LR1 unused
//    24  %endoffile