#include <perms.h>

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

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

  //     2  %RECORDFORMAT F(%INTEGER I,J,K,%INTEGERARRAY A(1:5))

  struct F {
    union {
      struct {
        int I;
        int J;
        int K;
        int A[5];
      };
    };
  };

  //     3  %RECORD(F) R

  struct F R;

  //     4  %INTEGERARRAYNAME B

  int *B;

  //     5  %INTEGER I,Fail

  int I;
  int FAIL;

  //     6        Fail=0

  FAIL = 0;

  //     7        R_I='I'

  R.I = 73;

  //     8        R_J='J'

  R.J = 74;

  //     9        %CYCLE I=1,1,5

  // %for I = 1, 1, 5 %cycle
  {
    I = 0;
  L_0001:
    if (I == 5) goto L_0002;
    I += 1;

    //    10        R_A(I)=I

    R.A[I - 1] = I;

    //    11        %REPEAT

    goto L_0001;
  }

L_0002:;

//    12        R_K=255

  R.K = 255;

  //    13        B==R_A

  B = (int *)R.A;

  //    14        %CYCLE I=1,1,5

  // %for I = 1, 1, 5 %cycle
  {
    I = 0;
  L_0004:
    if (I == 5) goto L_0005;
    I += 1;

    //    15           %if b(i)#i %then fail=1 %and WRITE(B(I),5)

    if ([/*BUG*/ 0] == I) goto L_0006;
    FAIL = 1;
    _imp_WRITE([/*BUG*/ 0], 5);
  L_0006:;

  //    16        %REPEAT

    goto L_0004;
  }

L_0005:;

//    17  %if fail=0 %then printstring("Test OK")

  if (FAIL != 0) goto L_0007;
  _imp_PRINTSTRING(_imp_str_literal("Test OK"));
L_0007:;

//    18  %ENDOFPROGRAM

  _imp_stop(0);
  return 0;
end_0:;
}