#include <perms.h>

//          Edinburgh IMP77 Compiler - Version 8.4
//
//     1
//     2  ! This recordformat spec does not get passed into the icode file.
//     3
//     4  %recordformatspec stackfm
//     5
//     6  ! I cannot see anywhere in the icode that tells us that LINK is a STACKFM???!
//     7  ! Yet the output of my icode2ast program correctly declares link as a %record (STACKFM) %name ???!
//     8
//     9  %recordformat blech(%integer x, %record (stackfm) %name link)

struct BLECH {
  union {
    struct {
      int X;
      struct STACKFM *LINK;
    };
  };
};

//    10
//    11  %recordformat stackfm(%integer s)

struct STACKFM {
  union {
    struct {
      int S;
    };
  };
};

//    12
//    13  %external %routine PASS2(%integer p, %record (blech) puke)

void PASS2(int P, struct BLECH PUKE) {
  //    14    %routine {PASS2} ASSEMBLE(%integer AMODE, %integer VARS, %integer LOCAL, %integer PARAMETERLIST, %integer %name GLOBALATTRIBUTES)

  void ASSEMBLE(int AMODE, int VARS, int LOCAL, int PARAMETERLIST, int *GLOBALATTRIBUTES) {
    //    15      %routine {PASS2 ASSEMBLE} SHOWDATA(%record (STACKFM) %name V, %integer LEFT)

    void SHOWDATA(struct STACKFM * V, int LEFT) {
      //    16        %integer q = V_S

      int Q;
      Q = V->S;

      //    17      %end

      return;
    } /* end of SHOWDATA */

    // ?Q unused
    // ?LEFT unused
    //    18    %end

    return;
  } /* end of ASSEMBLE */

  // ?SHOWDATA unused
  // ?GLOBALATTRIBUTES unused
  // ?PARAMETERLIST unused
  // ?LOCAL unused
  // ?VARS unused
  // ?AMODE unused
  //    19  %end

  return;
} /* end of PASS2 */

// ?ASSEMBLE unused
// ?PUKE unused
// ?P unused
//    20
//    21  %endoffile