#include <perms.h>

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

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

  //     2    %owninteger      io

  static int IO;

  //     3    %integer         i

  int I;

  //     4    %integername     in

  int *IN;

  //     5    %externalinteger ie

  int IE;

  //     6    %integerarray    ia(0:9)

  int IA[10];

  //     7    %integerfn       ifn(%integer i)

  int IFN(int I) {
    //     8      %result = 1

    return 1;

    //     9    %end

  } /* end of IFN */

  // ?I unused
  //    10    %integerfn       ifn2

  int IFN2(void) {
    //    11      %result = 1

    return 1;

    //    12    %end

  } /* end of IFN2 */

  //    13    %integermap      im(%integer i)

  int *IM(int I)
  {

    //    14      %result ==  io

    return /*?*/ &IO;

    //    15    %end

  } /* end of IM */

  // ?I unused
  //    16    %integermap      im2

  int *IM2(void)
  {

    //    17      %result ==  io

    return /*?*/ &IO;

    //    18    %end

  } /* end of IM2 */

  //    19    %routine         ir(%integer n)

  void IR(int N) {
    //    20    %end

    return;
  } /* end of IR */

  // ?N unused
  //    21    %recordformat    rf(%integer i)

  struct RF {
    union {
      struct {
        int I;
      };
    };
  };

  //    22    %recordformat    rfa(%integerarray ia(0:9))

  struct RFA {
    union {
      struct {
        int IA[10];
      };
    };
  };

  //    23    %record(rfa)%map   rm

  struct RFA *RM(void)
  {

    //    24      %ownrecord(rfa) orec

    static struct RFA OREC;

    //    25      %result == orec

    return /*?*/ &OREC;

    //    26    %end

  } /* end of RM */

  //    27    %record(rf)%array  rec(0:9)

  struct RF REC[10];

  //    28    %switch          sw(0:9)

  int SW_index;
  int SW_line;
  char *SW_file;
  static const void *SW[10] = {&&case_SW_missing, &&case_SW_1,       &&case_SW_missing, &&case_SW_missing,
                               &&case_SW_missing, &&case_SW_missing, &&case_SW_missing, &&case_SW_missing,
                               &&case_SW_missing, &&case_SW_missing};

  //    29
  //    30    sw(1):

case_SW_1:;

//    31    %comment sw(1):
//    32
//    33    io = 1

  IO = 1;

  //    34    %comment io = 1
  //    35
  //    36    ie = 1

  IE = 1;

  //    37    %comment ie = 1
  //    38
  //    39    ia(1) = 1

  IA[1] = 1;

  //    40    %comment ia(1) = 1
  //    41
  //    42    i = ifn(1)

  I = IFN(1);

  //    43    %comment i = ifn(1)
  //    44
  //    45    i = ifn2

  I = IFN2();

  //    46    %comment i = ifn2
  //    47
  //    48    i = im(1)

  I = *IM(1);

  //    49    %comment i = im(1)
  //    50
  //    51    in == im(1)

  IN = (int *)IM(1);

  //    52    %comment in == im(1)
  //    53
  //    54    im(1) = 1

  *IM(1) = 1;

  //    55    %comment im(1) = 1
  //    56
  //    57    im2 = 1

  *IM2() = 1;

  //    58    %comment im2 = 1
  //    59
  //    60    rec(1)_i = 1

  REC[1].I = 1;

  //    61    %comment rec(1)_i = 1
  //    62
  //    63    ir(1)

  IR(1);

  //    64    %comment ir(1)
  //    65
  //    66    in == ia(1)

  IN = (int *)/*?*/ &IA[1];

  //    67    %comment in == ia(1)
  //    68
  //    69    i = ia(1)

  I = IA[1];

  //    70    %comment i = ia(1)
  //    71
  //    72    i = rm_ia(1)

  I = RM()->IA[1];

  //    73    %comment i = rm_ia(1)
  //    74
  //    75    in == rm_ia(1)

  IN = (int *)/*?*/ &RM()->IA[1];

  //    76    %comment in = rm_ia(1)
  //    77
  //    78  %endofprogram

  _imp_stop(0);
  return 0;

case_SW_dispatch:
  if (SW_index < 0 || SW_index > 9)
    _imp_signalf(6, 3, SW_index, "->SW(%d) out of bounds at %s line %d", SW_index, SW_file, SW_line);
  goto *SW[SW_index - 0];

case_SW_missing:
  _imp_signalf(8, 2, SW_index, "switch jump to undefined label SW(%d): at %s line %d", SW_index, SW_file, SW_line);
end_0:;
}