#include <perms.h>

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

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

  //     2  %recordformat resf((%shortinteger h0,%byteinteger b2,b3) %or %integer w)

  struct RESF {
    union {
      struct {
        union {
          struct {
            short int H0;
            unsigned char B2;
            unsigned char B3;
          };
        };

      };
      struct {
        int W;
      };
    };
  };

  //     3  %record(resf) p,q

  struct RESF P;
  struct RESF Q;

  //     4  %integer i

  int I;

  //     5  p=0

  P = (struct RESF){0};

  //     6  p_h0=11

  P.H0 = 11;

  //     7  p_b3=1

  P.B3 = 1;

  //     8  i=p_h0

  I = P.H0;

  //     9  q=p

  Q = P;

  //    10  %if q_w= 11<<16!1 %or q_w=1<<24!11 %then printstring("Test OK

  if (Q.W == 11 << 16 | 1) goto L_0001;
  if (Q.W != 1 << 24 | 11) goto L_0002;
L_0001:;
  _imp_PRINTSTRING(_imp_str_literal("Test OK\n"));
  _imp_stop(0);
L_0002:;

//    11+ ") %and %stop
//    12  write(q_w,4);newline

  _imp_WRITE(Q.W, 4);
  _imp_NEWLINE();

  //    13  write(i,4);newline

  _imp_WRITE(I, 4);
  _imp_NEWLINE();

  //    14  write(p_w,4);newline

  _imp_WRITE(P.W, 4);
  _imp_NEWLINE();

  //    15  %endofprogram

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