#include <perms.h>

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

int main(int argc, char **argv) { /*%begin*/
  _imp_initialise(argc, argv);
  auto void HANDLEKNOWN(struct SPECFM * NOWWEGOTDETAILS);

  //     2
  //     3  %recordformatspec specfm  ;! remember this line is not passed to the ICode file...
  //     4
  //     5  %routinespec handle known(%record (specfm) %name no details yet)  ;! icode2ast should trigger on this recordformat and cause the %spec to be output before this line!
  //     6
  //     7  %routine handle unknown(%record (specfm) %name no details yet)

  void HANDLEUNKNOWN(struct SPECFM * NODETAILSYET) {
    //     8    handle known(no details yet)

    HANDLEKNOWN(NODETAILSYET);

    //     9  %end

    return;
  } /* end of HANDLEUNKNOWN */

  //    10
  //    11  %recordformat specfm(%real r, %integer detail, %string(15) another)

  struct SPECFM {
    union {
      struct {
        float R;
        int DETAIL;
        _imp_string15 ANOTHER;
      };
    };
  };

  //    12
  //    13  %routine handle known(%record (specfm) %name now we got details)

  void HANDLEKNOWN(struct SPECFM * NOWWEGOTDETAILS) {
    //    14    write(now we got details_detail, 0)

    _imp_WRITE(NOWWEGOTDETAILS->DETAIL, 0);

    //    15    newline

    _imp_NEWLINE();

    //    16  %end

    return;
  } /* end of HANDLEKNOWN */

  //    17
  //    18  %record (specfm) known

  struct SPECFM KNOWN;

  //    19
  //    20  handle unknown(known)

  HANDLEUNKNOWN(/*?*/ &KNOWN);

  //    21
  //    22  %endofprogram

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