#include <perms.h>

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

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

  //     2    %INTEGER NP

  int NP;

  //     3    NP = 5

  NP = 5;

  //     4    ! Generates wrong C code!  Limit should be evaluated once at start of loop.y
  //     5    %CYCLE NP=1,1,NP

  // %for NP = 1, 1, NP %cycle
  {
    int _final = NP;
    if (invalid_for_loop(1, 1, _final)) _imp_signal(5, 1, 0, "Illegal cycle NP = 1, 1, NP");
    NP = 0;
  L_0001:
    if (NP == _final) goto L_0002;
    NP += 1;

    //     6      WRITE(NP, 0); NEWLINE

    _imp_WRITE(NP, 0);
    _imp_NEWLINE();

    //     7    %REPEAT

    goto L_0001;
  }

L_0002:;

//     8  %ENDOFPROGRAM

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