#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,%integername line,length)

  struct F {
    union {
      struct {
        int I;
        int J;
        int K;
        int *LINE;
        int *LENGTH;
      };
    };
  };

  //     3  %record(f) spacea,spaceb

  struct F SPACEA;
  struct F SPACEB;

  //     4  %record(f) %name worka,workb

  struct F *WORKA;
  struct F *WORKB;

  //     5  %integer i,j,x

  int I;
  int J;
  int X;

  //     6         i=3; j=4

  I = 3;
  J = 4;

  //     7  worka==spacea; workb==spaceb

  WORKA = (struct F *)/*?*/ &SPACEA;
  WORKB = (struct F *)/*?*/ &SPACEB;

  //     8  worka_line==i

  WORKA->LINE = (int *)/*?*/ &I;

  //     9  workb_length==j

  WORKB->LENGTH = (int *)/*?*/ &J;

  //    10         x=i+4+worka_line*workb_length

  X = I + 4 + *WORKA->LINE * *WORKB->LENGTH;

  //    11  %if x=19 %then printstring("TEST OK") %else printstring("Failed")

  if (X != 19) goto L_0001;
  _imp_PRINTSTRING(_imp_str_literal("TEST OK"));
  goto L_0002;
L_0001:;
  _imp_PRINTSTRING(_imp_str_literal("Failed"));
L_0002:;

//    12  %endofprogram

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