#include <perms.h>

//          Edinburgh IMP77 Compiler - Version 8.4
//
//     1  %diagnose 16_800F  { Mon Codes ! Mon ICode | Mon Line | Mon Debug }

// _imp_diagnose(0x800f); /* %diagnose is a compiler directive and does not generate code */

//     2  %own %integer Outer = 57

static int OUTER = 57;

//     3  %begin

int main(int argc, char **argv) { /*%begin*/
  _imp_initialise(argc, argv);
  auto void INNER(int X);

  //     4     %routine %spec Inner ( %integer A )
  //     5     %integer i, j = 42, k

  int I;
  int J;
  J = 42;
  int K;

  //     6     %routine Inner ( %integer x )

  void INNER(int X) {
    //     7        %const %integer Foo = 99
    //     8        %own %integer Own

    static int OWN;

    //     9        %routine Inner

    void INNER(void) {
      //    10           %own %integer Own

      static int OWN;

      //    11           %integer Inner = 0

      int INNER;
      INNER = 0;

      //    12           x = 33

      X = 33;

      //    13           Own = Outer

      OWN = OUTER;

      //    14        %end

      return;
    } /* end of INNER */

    // ?INNER unused
    //    15        Own = Foo

    OWN = 99;

    //    16        j = 17

    J = 17;

    //    17        k = 5

    K = 5;

    //    18        x = 25

    X = 25;

    //    19        Inner

    INNER();

    //    20     %end

    return;
  } /* end of INNER */

  //    21     Inner(0)

  INNER(0);

  //    22     Print String("Outer j=")

  _imp_PRINTSTRING(_imp_str_literal("Outer j="));

  //    23     Write(j, 0)

  _imp_WRITE(J, 0);

  //    24     Newline

  _imp_NEWLINE();

  //    25  %endofprogram

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