#include <perms.h>

//          Edinburgh IMP77 Compiler - Version 8.4
//
//     1  ! Some *very* crude substitutes for missing library procedures
//     2
//     3  %const %string (1) snl = "

const _imp_string1 SNL = _imp_str_init("\n");

//     4+ "
//     5
//     6  %external %string (30) %fn imp11version

_imp_string30 IMP11VERSION(void) {
  //     7     %result = "VGT"

  return *(_imp_string30 *)/*?*/ _imp_str_literal_ptr("VGT");

  //     8  %end

} /* end of IMP11VERSION */

//     9

_imp_string255 CLIPARAM(void) {
  //    10  !%externalintegerfn shortinteger(%integer addr) ;! for testing with old compiler that doesn't support shortintegers

  int I;

  //    11  !  %integer si

  _imp_string255 S;

  _imp_strncpy(/*?*/ &S, ({
                 __typeof__(_imp_string255) tmp; /*B*/
                 tmp = _imp_str_literal("");
                 (void *)&tmp;
               }),
               /*max:*/ 255);

  //    12  !  si = integer(addr) & 16_ffff

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

    //    13  !  %if (si & 16_8000 # 0) %then si = si ! 16_ffff0000

    if (I != 1) goto L_0004;

    _imp_strncpy(/*?*/ &S, ({
                   __typeof__(_imp_string255) tmp; /*B*/
                   tmp = _imp_GETARG(1);
                   (void *)&tmp;
                 }),
                 /*max:*/ 255);

    goto L_0005;
  L_0004:;

    _imp_strncpy(/*?*/ &S, ({
                   __typeof__(_imp_string255) tmp; /*C*/
                   tmp = *({
                     _imp_string255 tmp = _imp_join((_imp_string *)/*?*/ &*({
                                                      _imp_string255 tmp =
                                                          _imp_join((_imp_string *)/*?*/ &S,
                                                                    (_imp_string *)/*?*/ _imp_str_literal_ptr(" "));
                                                      (_imp_string255 *)&tmp;
                                                    }),
                                                    ({
                                                      __typeof__(_imp_string255) tmp; /*E*/
                                                      tmp = _imp_GETARG(I);
                                                      (void *)&tmp;
                                                    }));
                     (_imp_string255 *)&tmp;
                   });
                   (void *)&tmp;
                 }),
                 /*max:*/ 255);

  L_0005:;

  //    14  !  %result = si

    goto L_0001;
  }

L_0002:;

//    15  !%end

  return *(_imp_string255 *)/*?*/ &S;

  //    16

} /* end of CLIPARAM */

//    17  %include "cliparam.inc"
//  &1     %externalstring (255) %fn cli param
//  &2       %integer i
//  &3       %string (255) s = ""
//  &4       %for i = 1, 1, get argcount %cycle
//  &5         %if i = 1 %then s = get arg(1) %else s <- s." ".get arg(i)
//  &6       %repeat
//  &7       %result = s
//  &8     %end
//  &9     %endoffile
//    18
//    19  %external %routine print ch(%integer n)

void PRINTCH(int N) {
  //    20    print symbol(n)

  _imp_PRINTSYMBOL(N);

  //    21  %end

  return;
} /* end of PRINTCH */

//    22
//    23  %external %routine read ch(%integer %name ch)

void READCH(int *CH) {
  //    24    read symbol(ch)

  _imp_READSYMBOL(CH);

  //    25  %end

  return;
} /* end of READCH */

//    26
//    27  %external %routine p octal(%integer n)

void POCTAL(int N) {
  //    28    print symbol(((n>>15) & 1) + '0')

  _imp_PRINTSYMBOL(((unsigned int)N >> 15 & 1) + 48);

  //    29    print symbol(((n>>12) & 7) + '0')

  _imp_PRINTSYMBOL(((unsigned int)N >> 12 & 7) + 48);

  //    30    print symbol(((n>>9)  & 7) + '0')

  _imp_PRINTSYMBOL(((unsigned int)N >> 9 & 7) + 48);

  //    31    print symbol(((n>>6)  & 7) + '0')

  _imp_PRINTSYMBOL(((unsigned int)N >> 6 & 7) + 48);

  //    32    print symbol(((n>>3)  & 7) + '0')

  _imp_PRINTSYMBOL(((unsigned int)N >> 3 & 7) + 48);

  //    33    print symbol(( n      & 7) + '0')

  _imp_PRINTSYMBOL((N & 7) + 48);

  //    34  %end

  return;
} /* end of POCTAL */

//    35
//    36
//    37  %external %routine move %alias "S#MOVE"(%integer length,from,to)

void MOVE(int LENGTH, int FROM, int TO) {
  //    38    %integer i

  int I;

  //    39    ! presumably a safe move is wanted
  //    40    %if to+length > from+length %start

  if (TO + LENGTH <= FROM + LENGTH) goto L_0006;

    //    41      %for i = length-1, -1, 0 %cycle

    // %for I = LENGTH - 1,  -1, 0 %cycle
  {
    int _initial = LENGTH - 1;
    if (invalid_for_loop(_initial, -1, 0)) _imp_signal(5, 1, 0, "Illegal cycle I = LENGTH - 1,  -1, 0");
    I = _initial - (-1);
  L_0007:
    if (I == 0) goto L_0008;
    I -= 1;

    //    42        byte integer(to + i) = byte integer(from + i)

    *_imp_BYTEINTEGER(TO + I) = *_imp_BYTEINTEGER(FROM + I);

    //    43      %repeat

    goto L_0007;
  }

L_0008:;

//    44    %else %if to < from

  goto L_000A;
L_0006:;
  if (TO >= FROM) goto L_000B;

    //    45      %for i = 0, 1, length-1 %cycle

    // %for I = 0, 1, LENGTH - 1 %cycle
  {
    int _final = LENGTH - 1;
    if (invalid_for_loop(0, 1, _final)) _imp_signal(5, 1, 0, "Illegal cycle I = 0, 1, LENGTH - 1");
    I = -1;
  L_000C:
    if (I == _final) goto L_000D;
    I += 1;

    //    46        byte integer(to + i) = byte integer(from + i)

    *_imp_BYTEINTEGER(TO + I) = *_imp_BYTEINTEGER(FROM + I);

    //    47      %repeat

    goto L_000C;
  }

L_000D:;

//    48    %finish

L_000B:;
L_000A:;

//    49  %end

  return;
} /* end of MOVE */

//    50
//    51  %external %integerfn i mod(%integer n)

int IMOD(int N) {
  //    52    %result = -n %if n < 0

  if (N >= 0) goto L_000E;
  return -N;
L_000E:;

//    53    %result = n

  return N;

  //    54  %end

} /* end of IMOD */

//    55
//    56  %externalroutine close stream(%integer stream)

void CLOSESTREAM(int STREAM) {
  //    57    %integer cur stream = input stream

  int CURSTREAM;
  CURSTREAM = _imp_INPUTSTREAM();

  //    58    select input(stream)

  _imp_SELECTINPUT(STREAM);

  //    59    close input

  _imp_CLOSEINPUT();

  //    60    %if stream = cur stream %then select input(0) %else select input(cur stream)

  if (STREAM != CURSTREAM) goto L_000F;
  _imp_SELECTINPUT(0);
  goto L_0010;
L_000F:;
  _imp_SELECTINPUT(CURSTREAM);
L_0010:;

//    61  %end

  return;
} /* end of CLOSESTREAM */

//    62

static int ENDOFINPUT(void) {
  //    63  %include "endofinput.inc"

  if (!_imp_on_event(9)) goto L_0011;

    //  &1     %predicate end of input
    //  &2       %on %event 9 %start
    //  &3         %true
    //  &4       %finish
    //  &5       %true %if next symbol = -1 %or next symbol = 0
    //  &6       %false
    //  &7     %end
    //  &8     %endoffile
    //    64

  return 1 /*TRUE*/;

  //    65  %external %predicate exists %alias "S#EXIST" (%string(255) filename)

L_0011:;

//    66    %integer prev

  if (_imp_NEXTSYMBOL() == -1) goto L_0003;
  if (_imp_NEXTSYMBOL() != 0) goto L_0012;
L_0003:;
  return 1 /*TRUE*/;
L_0012:;

//    67    %on %event 9 %start

  return 0 /*FALSE*/;

  //    68  print string(" - no".snl)

} /* end of ENDOFINPUT */

//    69      %false

int EXISTS(_imp_string255 FILENAME) {
  //    70    %finish

  int PREV;

  //    71  print string("Does ".filename." exist?")

  if (!_imp_on_event(9)) goto L_0013;

    //    72    prev = input stream

  _imp_PRINTSTRING(
      *({
        __typeof__(_imp_string255) tmp = *({
          _imp_string255 tmp = _imp_join((_imp_string *)/*?*/ _imp_str_literal_ptr(" - no"), (_imp_string *)/*?*/ &SNL);
          (_imp_string255 *)&tmp;
        }) /*q*/;
        (_imp_string255 *)&tmp;
      })
  );

  //    73    open input(3, filename)

  return 0 /*FALSE*/;

  //    74    select input(3)

L_0013:;

//    75  print string(" - no".snl) %and %c

  _imp_PRINTSTRING(
      *({
        __typeof__(_imp_string255) tmp = *({
          _imp_string255 tmp = _imp_join((_imp_string *)/*?*/ &*({
                                           _imp_string255 tmp =
                                               _imp_join((_imp_string *)/*?*/ _imp_str_literal_ptr("Does "),
                                                         (_imp_string *)/*?*/ &FILENAME);
                                           (_imp_string255 *)&tmp;
                                         }),
                                         (_imp_string *)/*?*/ _imp_str_literal_ptr(" exist?"));
          (_imp_string255 *)&tmp;
        }) /*q*/;
        (_imp_string255 *)&tmp;
      })
  );

  //    76+   %false %if end of input

  PREV = _imp_INPUTSTREAM();

  //    77    close input

  _imp_OPENINPUT(3,
                 *({
                   __typeof__(_imp_string255) tmp = FILENAME /*q*/;
                   (_imp_string255 *)&tmp;
                 })
  );

  //    78    select input(prev)

  _imp_SELECTINPUT(3);

  //    79  print string(" - yes".snl)

  if (!(ENDOFINPUT())) goto L_0014;
  _imp_PRINTSTRING(
      *({
        __typeof__(_imp_string255) tmp = *({
          _imp_string255 tmp = _imp_join((_imp_string *)/*?*/ _imp_str_literal_ptr(" - no"), (_imp_string *)/*?*/ &SNL);
          (_imp_string255 *)&tmp;
        }) /*q*/;
        (_imp_string255 *)&tmp;
      })
  );
  return 0 /*FALSE*/;
L_0014:;

//    80    %true

  _imp_CLOSEINPUT();

  //    81  %end

  _imp_SELECTINPUT(PREV);

  //    82

  _imp_PRINTSTRING(
      *({
        __typeof__(_imp_string255) tmp = *({
          _imp_string255 tmp =
              _imp_join((_imp_string *)/*?*/ _imp_str_literal_ptr(" - yes"), (_imp_string *)/*?*/ &SNL);
          (_imp_string255 *)&tmp;
        }) /*q*/;
        (_imp_string255 *)&tmp;
      })
  );

  //    83  %external %string (255) %fn Date

  return 1 /*TRUE*/;

  //    84    %result = "00/00/00"

} /* end of EXISTS */

//    85  %end

_imp_string255 DATE(void) {
  //    86

  return *(_imp_string255 *)/*?*/ _imp_str_literal_ptr("00/00/00");

  //    87  %external %string (255) %fn Time

} /* end of DATE */

//    88    %result = "00:00:00"

_imp_string255 TIME(void) {
  //    89  %end

  return *(_imp_string255 *)/*?*/ _imp_str_literal_ptr("00:00:00");

  //    90

} /* end of TIME */

//    91  %external %integerfn cpu time %alias "S#CPUTIME"

int CPUTIME(void) {
  //    92    %own %integer now = 1234

  static int NOW = 1234;

  //    93    now = now + 123

  NOW = NOW + 123;

  //    94    %result = now

  return NOW;

  //    95  %end

} /* end of CPUTIME */

//    96
//    97  %external %integer %map comreg %alias "S#COMREGMAP"(%integer n)

int *COMREG(int N)
{

  //    98    %own %integer saved46 = 0

  static int SAVED46 = 0;

  //    99    print string("Accessing COMREG(" . i to s(n,0) . ")" . tostring(nl)) %if n # 46

  if (N == 46) goto L_0015;
  _imp_PRINTSTRING(
      *({
        __typeof__(_imp_string255) tmp = *({
          _imp_string255 tmp = _imp_join((_imp_string *)/*?*/ &*({
                                           _imp_string255 tmp = _imp_join(
                                               (_imp_string *)/*?*/ &*({
                                                 _imp_string255 tmp = _imp_join(
                                                     (_imp_string *)/*?*/ _imp_str_literal_ptr("Accessing COMREG("), ({
                                                       __typeof__(_imp_string255) tmp; /*E*/
                                                       tmp = _imp_ITOS(N, 0);
                                                       (void *)&tmp;
                                                     }));
                                                 (_imp_string255 *)&tmp;
                                               }),
                                               (_imp_string *)/*?*/ _imp_str_literal_ptr(")"));
                                           (_imp_string255 *)&tmp;
                                         }),
                                         ({
                                           __typeof__(_imp_string1) tmp; /*E*/
                                           tmp = _imp_TOSTRING(10);
                                           (void *)&tmp;
                                         }));
          (_imp_string255 *)&tmp;
        }) /*q*/;
        (_imp_string255 *)&tmp;
      })
  );
L_0015:;

//   100    %result == saved46

  return /*?*/ &SAVED46;

  //   101  %end

} /* end of COMREG */

//   102
//   103  %external %integer %spec LIST

extern int LIST;

//   104
//   105  %systemintegerfnspec mmap %alias "mmap"(%integer addrptr, %integer length, %integer prot, %integer flags, %integer fd, %integer offset)

extern int MMAP(int ADDRPTR, int LENGTH, int PROT, int FLAGS, int FD, int OFFSET) __asm__("mmap");

//   106
//   107  %systemintegerfnspec open %alias "open" (%integer stringaddr, %integer option, %integer mode)

extern int OPEN(int STRINGADDR, int OPTION, int MODE) __asm__("open");

//   108  %externalintegerfnspec errno %alias "get_c_errno"

extern int ERRNO(void) __asm__("get_c_errno");

//   109  %externalstring(255)%fn ssfmessage

_imp_string255 SSFMESSAGE(void) {
  //   110    %string(255) mess

  _imp_string255 MESS;

  //   111    %systemintegerfnspec strerror %alias "strerror" (%integer errnum);   !char *strerror(int errnum)

  extern int STRERROR(int ERRNUM) __asm__("strerror");

  //   112    %systemintegerfnspec strlen %alias "strlen" (%integer strad)

  extern int STRLEN(int STRAD) __asm__("strlen");

  //   113    %integer i, address, len

  int I;
  int ADDRESS;
  int LEN;

  //   114    address = strerror(errno)

  ADDRESS = STRERROR(ERRNO());

  //   115    len = strlen(address)

  LEN = STRLEN(ADDRESS);

  //   116    charno(mess, i) = byteinteger(address+i-1) %for i = 1,1,len

  // %for I = 1, 1, LEN %cycle
  {
    int _final = LEN;
    if (invalid_for_loop(1, 1, _final)) _imp_signal(5, 1, 0, "Illegal cycle I = 1, 1, LEN");
    I = 0;
  L_0016:
    if (I == _final) goto L_0017;
    I += 1;
    *_imp_CHARNO((_imp_string255 *)/*p*/ /*?*/ &MESS, I) = *_imp_BYTEINTEGER(ADDRESS + I - 1);
    goto L_0016;
  }

L_0017:;

//   117    length(mess) = len

  *_imp_LENGTH((_imp_string255 *)/*p*/ /*?*/ &MESS) = LEN;

  //   118    %result = mess

  return *(_imp_string255 *)/*?*/ &MESS;

  //   119  %end

} /* end of SSFMESSAGE */

//   120
//   121  %externalroutine ssmess(%integer errno)

void SSMESS(int ERRNO) {
  //   122    %string(255) mess

  _imp_string255 MESS;

  //   123    %systemintegerfnspec strerror %alias "strerror" (%integer errnum);   !char *strerror(int errnum)

  extern int STRERROR(int ERRNUM) __asm__("strerror");

  //   124    %systemintegerfnspec strlen %alias "strlen" (%integer strad)

  extern int STRLEN(int STRAD) __asm__("strlen");

  //   125    %integer i, address, len

  int I;
  int ADDRESS;
  int LEN;

  //   126    address = strerror(errno)

  ADDRESS = STRERROR(ERRNO);

  //   127    len = strlen(address)

  LEN = STRLEN(ADDRESS);

  //   128    charno(mess, i) = byteinteger(address+i-1) %for i = 1,1,len

  // %for I = 1, 1, LEN %cycle
  {
    int _final = LEN;
    if (invalid_for_loop(1, 1, _final)) _imp_signal(5, 1, 0, "Illegal cycle I = 1, 1, LEN");
    I = 0;
  L_0019:
    if (I == _final) goto L_001A;
    I += 1;
    *_imp_CHARNO((_imp_string255 *)/*p*/ /*?*/ &MESS, I) = *_imp_BYTEINTEGER(ADDRESS + I - 1);
    goto L_0019;
  }

L_001A:;

//   129    length(mess) = len

  *_imp_LENGTH((_imp_string255 *)/*p*/ /*?*/ &MESS) = LEN;

  //   130    printstring(mess)

  _imp_PRINTSTRING(
      *({
        __typeof__(_imp_string255) tmp = MESS /*q*/;
        (_imp_string255 *)&tmp;
      })
  );

  //   131  %end

  return;
} /* end of SSMESS */

//   132
//   133
//   134  %systemintegerfnspec lseek %alias "lseek" (%integer fd, %integer offset, %integer whence)

extern int LSEEK(int FD, int OFFSET, int WHENCE) __asm__("lseek");

//   135
//   136  %record %format rfm(%integer conad,filetype,datastart,dataend,a,b,c,d)

struct RFM {
  union {
    struct {
      int CONAD;
      int FILETYPE;
      int DATASTART;
      int DATAEND;
      int A;
      int B;
      int C;
      int D;
    };
  };
};

//   137
//   138  %constinteger O RDONLY = 0
//   139  %constinteger SEEK END = 2
//   140  %constinteger SEEK SET = 0
//   141  %constinteger PROT READ = 1
//   142  %constinteger MAP PRIVATE = 2
//   143
//   144  %external %routine connect %alias "S#OLDCONNECT"(%string (255) file,

void CONNECT(_imp_string255 FILE, int MODE, int HOLE, int PROT, struct RFM *R, int *FLAG) {
  //   145+       %integer mode,hole,prot, %record (rfm) %name r, %integer %name flag)
  //   146
  //   147    %integer fd, flen, ignore

  int FD;
  int FLEN;
  int IGNORE;

  //   148    %string (255) filename = file ; ! guarantee a writable copy

  _imp_string255 FILENAME;

  _imp_strncpy(/*?*/ &FILENAME, ({
                 __typeof__(_imp_string255) tmp; /*B*/
                 tmp = FILE;
                 (void *)&tmp;
               }),
               /*max:*/ 255);

  //   149
  //   150    CHARNO(filename, LENGTH(filename)+1) = 0 ; ! nul-terminated C string

  *_imp_CHARNO((_imp_string255 *)/*p*/ /*?*/ &FILENAME, *_imp_LENGTH((_imp_string255 *)/*p*/ /*?*/ &FILENAME) + 1) = 0;

  //   151    %if 0=1 %start

  if (0 != 1) goto L_001B;

    //   152      ! confirmed that we're passing the right file name.
    //   153      %integer i

  int I;

  //   154      i = ADDR(filename)+1

  I = _imp_ADDR(/*?*/ &FILENAME) + 1;

  //   155      %cycle

L_001C:;

//   156        %integer c = byteinteger(i)

  int C;
  C = *_imp_BYTEINTEGER(I);

  //   157        i = i+1

  I = I + 1;

  //   158        %if 33 <= i <= 126 %then printsymbol(c) %elsestart

  {
// Double-sided test on I (Part I)
    int tmp;
    if (33 > (tmp = I)) goto L_001D;
// Double-sided test on I (Part II)
    if (tmp > 126) goto L_001D;
  }
  _imp_PRINTSYMBOL(C);
  goto L_001E;
L_001D:;

//   159          printsymbol('[');write(c,0);printsymbol(']')

  _imp_PRINTSYMBOL(91);
  _imp_WRITE(C, 0);
  _imp_PRINTSYMBOL(93);

  //   160        %finish

L_001E:;

//   161        %exit %if c = 0

  if (C != 0) goto L_001F;
  goto L_0020;
L_001F:;

//   162      %repeat

  goto L_001C;
L_0020:;

//   163      newline

  _imp_NEWLINE();

  //   164    %finish

L_001B:;

//   165    fd = open(0, O RDONLY, ADDR(filename)+1)

  FD = OPEN(0, 0, _imp_ADDR(/*?*/ &FILENAME) + 1);

  //   166    %if fd = -1 %start

  if (FD != -1) goto L_0021;

    //   167      flag = errno

  *FLAG = ERRNO();

  //   168      print string("Open ".file." failed: ".ssfmessage." - ")  ; write(errno,0) ; newline

  _imp_PRINTSTRING(
      *({
        __typeof__(_imp_string255) tmp = *({
          _imp_string255 tmp = _imp_join((_imp_string *)/*?*/ &*({
                                           _imp_string255 tmp =
                                               _imp_join((_imp_string *)/*?*/ &*({
                                                           _imp_string255 tmp = _imp_join(
                                                               (_imp_string *)/*?*/ &*({
                                                                 _imp_string255 tmp = _imp_join(
                                                                     (_imp_string *)/*?*/ _imp_str_literal_ptr("Open "),
                                                                     (_imp_string *)/*?*/ &FILE);
                                                                 (_imp_string255 *)&tmp;
                                                               }),
                                                               (_imp_string *)/*?*/ _imp_str_literal_ptr(" failed: "));
                                                           (_imp_string255 *)&tmp;
                                                         }),
                                                         ({
                                                           __typeof__(_imp_string255) tmp; /*E*/
                                                           tmp = SSFMESSAGE();
                                                           (void *)&tmp;
                                                         }));
                                           (_imp_string255 *)&tmp;
                                         }),
                                         (_imp_string *)/*?*/ _imp_str_literal_ptr(" - "));
          (_imp_string255 *)&tmp;
        }) /*q*/;
        (_imp_string255 *)&tmp;
      })
  );
  _imp_WRITE(ERRNO(), 0);
  _imp_NEWLINE();

  //   169      %return

  return;

  //   170    %finish

L_0021:;

//   171    flen = lseek(fd, 0, SEEK END)

  FLEN = LSEEK(FD, 0, 2);

  //   172    ignore = lseek(fd, 0, SEEK SET)

  IGNORE = LSEEK(FD, 0, 0);

  //   173    r_conad = mmap(0, flen, PROT READ, MAP PRIVATE, fd, 0)

  R->CONAD = MMAP(0, FLEN, 1, 2, FD, 0);

  //   174    r_filetype = 3 ; ! text file

  R->FILETYPE = 3;

  //   175
  //   176  !  r_datastart = r_conad ;
  //   177  !  r_dataend = r_conad+flen ;
  //   178  !  r_a = ... ;
  //   179  !  r_b = ... ;
  //   180  !  r_c = ... ;
  //   181  !  r_d = ... ;
  //   182
  //   183    flag = 0 ; ! non-zero is an error

  *FLAG = 0;

  //   184  %end

  return;
} /* end of CONNECT */

// ?PROT unused
// ?HOLE unused
// ?MODE unused
//   185
//   186  {%external %routine imp11(%string (255) s)
//   187  %begin

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

  //   188     %string (255) s = get arg(1)

  _imp_string255 S;

  _imp_strncpy(/*?*/ &S, ({
                 __typeof__(_imp_string255) tmp; /*B*/
                 tmp = _imp_GETARG(1);
                 (void *)&tmp;
               }),
               /*max:*/ 255);

  //   189     %external %string (6) %fn %spec imp11host

  extern _imp_string6 IMP11HOST(void);

  //   190  !   %extrinsic %integer shortjumps
  //   191  !   %extrinsic %integer mediumjumps
  //   192  !   %extrinsic %integer longjumps
  //   193  !   %extrinsic %real stretchtime
  //   194      %owninteger shortjumps,mediumjumps,longjumps,stretchtime

  static int SHORTJUMPS;
  static int MEDIUMJUMPS;
  static int LONGJUMPS;
  static int STRETCHTIME;

  //   195     %external %integer permad

  int PERMAD;

  //   196  !   {%extrinsic}%external %integer LIST
  //   197  !   %external %routine %spec timeio(%string (63) file)
  //   198  {X  %external %string (255) %function %spec date %alias "S#DATE"
  //   199  {X  %external %string (255) %function %spec time %alias "S#TIME"
  //   200  {X  %external %long %real %function %spec cpu time %alias "S#CPUTIME"
  //   201     %own %integer exclam= 0, info2, info3

  static int EXCLAM = 0;
  static int INFO2;
  static int INFO3;

  //   202     %string (63) source,object,listing,grot,x1,x2

  _imp_string63 SOURCE;
  _imp_string63 OBJECT;
  _imp_string63 LISTING;
  _imp_string63 GROT;
  _imp_string63 X1;
  _imp_string63 X2;

  //   203     %integer flag,stats

  int FLAG;
  int STATS;

  //   204     %real t0,t1,t2,t3

  float T0;
  float T1;
  float T2;
  float T3;

  //   205  {X  %external %integer %map %spec comreg %alias "S#COMREGMAP"(%integer n)
  //   206  {X  %record %format rfm(%integer conad,filetype,datastart,dataend,a,b,c,d)
  //   207     %external %routine %spec connect %alias "S#OLDCONNECT"(%string (255) file,

  extern void CONNECT(_imp_string255 FILE, int MODE, int HOLE, int PROT, struct RFM *R,
                      int *FLAG) __asm__("S#OLDCONNECT");

  //   208+       %integer mode,hole,prot, %record (rfm) %name r, %integer %name flag)
  //   209     %string (31) ss

  _imp_string31 SS;

  //   210     %record (rfm) r

  struct RFM R;

  //   211
  //   212  {X  %routine define(%string (255) s)
  //   213  {X     %external %routine %spec emas3(%string (255) %name command,params,
  //   214  {X        %integer %name flag)
  //   215  {X     %integer flag
  //   216  {X     emas3("DEFINE",s,flag)
  //   217  {X  %end;                                 ! Of %routine define.
  //   218
  //   219  {X  %external %integer %function %spec exist %alias "S#EXIST"(%string %c
  //   220  {X     (255) file)
  //   221     %external %routine %spec destroy %alias "S#DESTROY"(%string (255) file,

  extern void DESTROY(_imp_string255 FILE, int *FLAG) __asm__("S#DESTROY");

  //   222+       %integer %name flag)
  //   223     %external %integer %fn %spec pass1

  extern int PASS1(void);

  //   224     %external %routine %spec pass2

  extern void PASS2(void);

  //   225     %external %routine %spec pass3

  extern void PASS3(void);

  //   226     %own %integer uselimit=1000, envirs=7, arrayopt=1

  static int USELIMIT = 1000;
  static int ENVIRS = 7;
  static int ARRAYOPT = 1;

  //   227     %own %integer noremember=0,nocc=0,noparams=0,nosame=0, nostatic=0

  static int NOREMEMBER = 0;
  static int NOCC = 0;
  static int NOPARAMS = 0;
  static int NOSAME = 0;
  static int NOSTATIC = 0;

  //   228     %routine show date

  void SHOWDATE(void) {
    //   229  {X     %const %string (3) %array month(1:12)= "JAN", "FEB", "MAR", "APR",
    //   230        %const %string (3) %array month(0:12)= "00", "JAN", "FEB", "MAR", "APR",

    const _imp_string3 MONTH[13] = {
        _imp_str_init("00"),  _imp_str_init("JAN"), _imp_str_init("FEB"), _imp_str_init("MAR"), _imp_str_init("APR"),
        _imp_str_init("MAY"), _imp_str_init("JUN"), _imp_str_init("JUL"), _imp_str_init("AUG"), _imp_str_init("SEP"),
        _imp_str_init("OCT"), _imp_str_init("NOV"), _imp_str_init("DEC")};

    //   231+                                             "MAY", "JUN", "JUL", "AUG",
    //   232+                                             "SEP", "OCT", "NOV", "DEC"
    //   233        %integer n

    int N;

    //   234        %string (15) dat,day,mon,year   , TEMP

    _imp_string15 DAT;
    _imp_string15 DAY;
    _imp_string15 MON;
    _imp_string15 YEAR;
    _imp_string15 TEMP;

    //   235        dat = date

    _imp_strncpy(/*?*/ &DAT, ({
                   __typeof__(_imp_string255) tmp; /*B*/
                   tmp = DATE();
                   (void *)&tmp;
                 }),
                 /*max:*/ 15);

    //   236  {X     dat -> day.("/").mon.("/").year
    //   237  day="00" %and mon="00" %and year="00" %unless dat -> day.("/").TEMP %and TEMP -> mon.("/").year

    if (!(_imp_resolve(*({
          _imp_string15 tmp = DAT;
          (_imp_string255 *)&tmp;
        }),
                       (_imp_string255 *)/*?*/ &DAY, *({
                         _imp_string tmp = _imp_str_literal("/");
                         (_imp_string255 *)&tmp;
                       }),
                       (_imp_string255 *)/*?*/ &TEMP)))
      goto L_0018;
    if (_imp_resolve(*({
          _imp_string15 tmp = TEMP;
          (_imp_string255 *)&tmp;
        }),
                     (_imp_string255 *)/*?*/ &MON, *({
                       _imp_string tmp = _imp_str_literal("/");
                       (_imp_string255 *)&tmp;
                     }),
                     (_imp_string255 *)/*?*/ &YEAR))
      goto L_0022;
  L_0018:;

    _imp_strncpy(/*?*/ &DAY, ({
                   __typeof__(_imp_string255) tmp; /*B*/
                   tmp = _imp_str_literal("00");
                   (void *)&tmp;
                 }),
                 /*max:*/ 15);

    _imp_strncpy(/*?*/ &MON, ({
                   __typeof__(_imp_string255) tmp; /*B*/
                   tmp = _imp_str_literal("00");
                   (void *)&tmp;
                 }),
                 /*max:*/ 15);

    _imp_strncpy(/*?*/ &YEAR, ({
                   __typeof__(_imp_string255) tmp; /*B*/
                   tmp = _imp_str_literal("00");
                   (void *)&tmp;
                 }),
                 /*max:*/ 15);

  L_0022:;

  //   238        n = (charno(mon,1)-'0')*10+charno(mon,2)-'0'

    N = (*_imp_CHARNO((_imp_string255 *)/*p*/ /*?*/ &MON, 1) - 48) * 10 +
        *_imp_CHARNO((_imp_string255 *)/*p*/ /*?*/ &MON, 2) - 48;

    //   239        printstring(day."-".month(n)."-19".year)

    _imp_PRINTSTRING(
        *({
          __typeof__(_imp_string255) tmp = *({
            _imp_string255 tmp = _imp_join((_imp_string *)/*?*/ &*({
                                             _imp_string255 tmp =
                                                 _imp_join((_imp_string *)/*?*/ &*({
                                                             _imp_string255 tmp = _imp_join(
                                                                 (_imp_string *)/*?*/ &*({
                                                                   _imp_string255 tmp = _imp_join(
                                                                       (_imp_string *)/*?*/ &DAY,
                                                                       (_imp_string *)/*?*/ _imp_str_literal_ptr("-"));
                                                                   (_imp_string255 *)&tmp;
                                                                 }),
                                                                 (_imp_string *)/*?*/ &MONTH[N]);
                                                             (_imp_string255 *)&tmp;
                                                           }),
                                                           (_imp_string *)/*?*/ _imp_str_literal_ptr("-19"));
                                             (_imp_string255 *)&tmp;
                                           }),
                                           (_imp_string *)/*?*/ &YEAR);
            (_imp_string255 *)&tmp;
          }) /*q*/;
          (_imp_string255 *)&tmp;
        })
    );

    //   240     %end

    return;
  } /* end of SHOWDATE */

  //   241     %routine try(%integer %name flag, %string (15) key, %integer value)

  void TRY(int *FLAG, _imp_string15 KEY, int VALUE) {
    //   242        %if grot->x1.(key).x2 %start

    if (!(_imp_resolve(*({
          _imp_string63 tmp = GROT;
          (_imp_string255 *)&tmp;
        }),
                       (_imp_string255 *)/*?*/ &X1, *({
                         _imp_string15 tmp = KEY;
                         (_imp_string255 *)&tmp;
                       }),
                       (_imp_string255 *)/*?*/ &X2)))
      goto L_0023;

      //   243           flag = flag!value

    *FLAG = *FLAG | VALUE;

    //   244           printstring(key." set"); newline

    _imp_PRINTSTRING(
        *({
          __typeof__(_imp_string255) tmp = *({
            _imp_string255 tmp =
                _imp_join((_imp_string *)/*?*/ &KEY, (_imp_string *)/*?*/ _imp_str_literal_ptr(" set"));
            (_imp_string255 *)&tmp;
          }) /*q*/;
          (_imp_string255 *)&tmp;
        })
    );
    _imp_NEWLINE();

    //   245        %finish

  L_0023:;

  //   246     %end

    return;
  } /* end of TRY */

  //   247
  //   248     info2 = 0; info3 = 0

  INFO2 = 0;
  INFO3 = 0;

  //   249     %if s->source.("!").grot %start

  if (!(_imp_resolve(*({
        _imp_string255 tmp = S;
        (_imp_string255 *)&tmp;
      }),
                     (_imp_string255 *)/*?*/ &SOURCE, *({
                       _imp_string tmp = _imp_str_literal("!");
                       (_imp_string255 *)&tmp;
                     }),
                     (_imp_string255 *)/*?*/ &GROT)))
    goto L_0024;

    //   250        exclam = 1

  EXCLAM = 1;

  //   251        try(info3,"NOSHORT",1)

  TRY(/*?*/ &INFO3, _imp_str_literal_size(15, "NOSHORT"), 1);

  //   252        try(info3,"NOROUND",2)

  TRY(/*?*/ &INFO3, _imp_str_literal_size(15, "NOROUND"), 2);

  //   253        try(info3,"NODEFER",4)

  TRY(/*?*/ &INFO3, _imp_str_literal_size(15, "NODEFER"), 4);

  //   254        try(info3,"NOENTRY",8)

  TRY(/*?*/ &INFO3, _imp_str_literal_size(15, "NOENTRY"), 8);

  //   255        uselimit = charno(x2,1)-'0' %if grot->x1.("USE=").x2

  if (!(_imp_resolve(*({
        _imp_string63 tmp = GROT;
        (_imp_string255 *)&tmp;
      }),
                     (_imp_string255 *)/*?*/ &X1, *({
                       _imp_string tmp = _imp_str_literal("USE=");
                       (_imp_string255 *)&tmp;
                     }),
                     (_imp_string255 *)/*?*/ &X2)))
    goto L_0025;
  USELIMIT = *_imp_CHARNO((_imp_string255 *)/*p*/ /*?*/ &X2, 1) - 48;
L_0025:;

//   256        envirs = charno(x2,1)-'0' %if grot->x1.("ENVIR=").x2

  if (!(_imp_resolve(*({
        _imp_string63 tmp = GROT;
        (_imp_string255 *)&tmp;
      }),
                     (_imp_string255 *)/*?*/ &X1, *({
                       _imp_string tmp = _imp_str_literal("ENVIR=");
                       (_imp_string255 *)&tmp;
                     }),
                     (_imp_string255 *)/*?*/ &X2)))
    goto L_0026;
  ENVIRS = *_imp_CHARNO((_imp_string255 *)/*p*/ /*?*/ &X2, 1) - 48;
L_0026:;

//   257        try(noremember,"NOREMEMBER",1)

  TRY(/*?*/ &NOREMEMBER, _imp_str_literal_size(15, "NOREMEMBER"), 1);

  //   258        array opt = 0

  ARRAYOPT = 0;

  //   259        try(array opt,"NOARRAY",1)

  TRY(/*?*/ &ARRAYOPT, _imp_str_literal_size(15, "NOARRAY"), 1);

  //   260        array opt = array opt!!1

  ARRAYOPT = ARRAYOPT ^ 1;

  //   261        try(nocc,"NOCC",1)

  TRY(/*?*/ &NOCC, _imp_str_literal_size(15, "NOCC"), 1);

  //   262        try(nosame,"NOSAME",1)

  TRY(/*?*/ &NOSAME, _imp_str_literal_size(15, "NOSAME"), 1);

  //   263        try(noparams,"NOPARAMS",1)

  TRY(/*?*/ &NOPARAMS, _imp_str_literal_size(15, "NOPARAMS"), 1);

  //   264        try(nostatic,"NOSTATIC",1)

  TRY(/*?*/ &NOSTATIC, _imp_str_literal_size(15, "NOSTATIC"), 1);

  //   265     %finish

L_0024:;

//   266     object = ""; listing = ""

  _imp_strncpy(/*?*/ &OBJECT, ({
                 __typeof__(_imp_string255) tmp; /*B*/
                 tmp = _imp_str_literal("");
                 (void *)&tmp;
               }),
               /*max:*/ 63);

  _imp_strncpy(/*?*/ &LISTING, ({
                 __typeof__(_imp_string255) tmp; /*B*/
                 tmp = _imp_str_literal("");
                 (void *)&tmp;
               }),
               /*max:*/ 63);

  //   267     source = s

  _imp_strncpy(/*?*/ &SOURCE, ({
                 __typeof__(_imp_string255) tmp; /*B*/
                 tmp = S;
                 (void *)&tmp;
               }),
               /*max:*/ 63);

  //   268  {X   %if s->source.("/").s %or s->source.(",").s %start
  //   269     %if s->source.("/").grot %or s->source.(",").grot %start

  if (_imp_resolve(*({
        _imp_string255 tmp = S;
        (_imp_string255 *)&tmp;
      }),
                   (_imp_string255 *)/*?*/ &SOURCE, *({
                     _imp_string tmp = _imp_str_literal("/");
                     (_imp_string255 *)&tmp;
                   }),
                   (_imp_string255 *)/*?*/ &GROT))
    goto L_0027;
  if (!(_imp_resolve(*({
        _imp_string255 tmp = S;
        (_imp_string255 *)&tmp;
      }),
                     (_imp_string255 *)/*?*/ &SOURCE, *({
                       _imp_string tmp = _imp_str_literal(",");
                       (_imp_string255 *)&tmp;
                     }),
                     (_imp_string255 *)/*?*/ &GROT)))
    goto L_0028;
L_0027:;

//   270       s=grot

  _imp_strncpy(/*?*/ &S, ({
                 __typeof__(_imp_string63) tmp; /*B*/
                 tmp = GROT;
                 (void *)&tmp;
               }),
               /*max:*/ 255);

  //   271       object = s %unless s->object.(",").listing

  if (_imp_resolve(*({
        _imp_string255 tmp = S;
        (_imp_string255 *)&tmp;
      }),
                   (_imp_string255 *)/*?*/ &OBJECT, *({
                     _imp_string tmp = _imp_str_literal(",");
                     (_imp_string255 *)&tmp;
                   }),
                   (_imp_string255 *)/*?*/ &LISTING))
    goto L_0029;

  _imp_strncpy(/*?*/ &OBJECT, ({
                 __typeof__(_imp_string255) tmp; /*B*/
                 tmp = S;
                 (void *)&tmp;
               }),
               /*max:*/ 63);

L_0029:;

//   272     %finish

L_0028:;

//   273  {X  s = source %unless source->s.("#").grot
//   274     s = source %unless source->s.(".").grot

  if (_imp_resolve(*({
        _imp_string63 tmp = SOURCE;
        (_imp_string255 *)&tmp;
      }),
                   (_imp_string255 *)/*?*/ &S, *({
                     _imp_string tmp = _imp_str_literal(".");
                     (_imp_string255 *)&tmp;
                   }),
                   (_imp_string255 *)/*?*/ &GROT))
    goto L_002A;

  _imp_strncpy(/*?*/ &S, ({
                 __typeof__(_imp_string63) tmp; /*B*/
                 tmp = SOURCE;
                 (void *)&tmp;
               }),
               /*max:*/ 255);

L_002A:;

//   275  {X  object = s."#REL" %if object=""
//   276     object = s.".rel" %if object=""

  if (_imp_strcmp((_imp_string *)/*?*/ &OBJECT, (_imp_string *)/*?*/ _imp_str_literal_ptr("")) != 0) goto L_002B;

  _imp_strncpy(/*?*/ &OBJECT, ({
                 __typeof__(_imp_string255) tmp; /*B*/
                 tmp = *({
                   _imp_string255 tmp =
                       _imp_join((_imp_string *)/*?*/ &S, (_imp_string *)/*?*/ _imp_str_literal_ptr(".rel"));
                   (_imp_string255 *)&tmp;
                 });
                 (void *)&tmp;
               }),
               /*max:*/ 63);

L_002B:;

//   277  {X  listing = ".NULL" %if listing="" %or listing=".N"
//   278     listing = "/dev/null" %if listing="" %or listing=".N" %or listing=".n"

  if (_imp_strcmp((_imp_string *)/*?*/ &LISTING, (_imp_string *)/*?*/ _imp_str_literal_ptr("")) == 0) goto L_002C;

  if (_imp_strcmp((_imp_string *)/*?*/ &LISTING, (_imp_string *)/*?*/ _imp_str_literal_ptr(".N")) == 0) goto L_002C;

  if (_imp_strcmp((_imp_string *)/*?*/ &LISTING, (_imp_string *)/*?*/ _imp_str_literal_ptr(".n")) != 0) goto L_002D;

L_002C:;

  _imp_strncpy(/*?*/ &LISTING, ({
                 __typeof__(_imp_string255) tmp; /*B*/
                 tmp = _imp_str_literal("/dev/null");
                 (void *)&tmp;
               }),
               /*max:*/ 63);

L_002D:;

//   279
//   280     s = source

  _imp_strncpy(/*?*/ &S, ({
                 __typeof__(_imp_string63) tmp; /*B*/
                 tmp = SOURCE;
                 (void *)&tmp;
               }),
               /*max:*/ 255);

  //   281  {X  %if exist(s)=0 %start
  //   282     %unless exists(s) %start

  if (EXISTS(
          *({
            __typeof__(_imp_string255) tmp = S /*q*/;
            (_imp_string255 *)&tmp;
          })
              ))
    goto L_002E;

    //   283  {X     s = s."#IMP"
    //   284        s = s.".imp"

  _imp_strncpy(/*?*/ &S, ({
                 __typeof__(_imp_string255) tmp; /*B*/
                 tmp = *({
                   _imp_string255 tmp =
                       _imp_join((_imp_string *)/*?*/ &S, (_imp_string *)/*?*/ _imp_str_literal_ptr(".imp"));
                   (_imp_string255 *)&tmp;
                 });
                 (void *)&tmp;
               }),
               /*max:*/ 255);

  //   285  {X     %if exist(s)=0 %start
  //   286        %unless exists(s) %start

  if (EXISTS(
          *({
            __typeof__(_imp_string255) tmp = S /*q*/;
            (_imp_string255 *)&tmp;
          })
              ))
    goto L_002F;

    //   287           printstring(s." does not exist")

  _imp_PRINTSTRING(
      *({
        __typeof__(_imp_string255) tmp = *({
          _imp_string255 tmp =
              _imp_join((_imp_string *)/*?*/ &S, (_imp_string *)/*?*/ _imp_str_literal_ptr(" does not exist"));
          (_imp_string255 *)&tmp;
        }) /*q*/;
        (_imp_string255 *)&tmp;
      })
  );

  //   288           newline

  _imp_NEWLINE();

  //   289           %return

  goto end_0;

  //   290        %finish

L_002F:;

//   291     %finish

L_002E:;

//   292     source = s

  _imp_strncpy(/*?*/ &SOURCE, ({
                 __typeof__(_imp_string255) tmp; /*B*/
                 tmp = S;
                 (void *)&tmp;
               }),
               /*max:*/ 63);

  //   293     ss = source

  _imp_strncpy(/*?*/ &SS, ({
                 __typeof__(_imp_string63) tmp; /*B*/
                 tmp = SOURCE;
                 (void *)&tmp;
               }),
               /*max:*/ 31);

  //   294  printstring("About to connect file ".ss.snl)

  _imp_PRINTSTRING(
      *({
        __typeof__(_imp_string255) tmp = *({
          _imp_string255 tmp = _imp_join((_imp_string *)/*?*/ &*({
                                           _imp_string255 tmp = _imp_join(
                                               (_imp_string *)/*?*/ _imp_str_literal_ptr("About to connect file "),
                                               (_imp_string *)/*?*/ &SS);
                                           (_imp_string255 *)&tmp;
                                         }),
                                         (_imp_string *)/*?*/ &SNL);
          (_imp_string255 *)&tmp;
        }) /*q*/;
        (_imp_string255 *)&tmp;
      })
  );

  //   295  l1:connect(ss,0,0,0,r,flag)

U_1000:;
  CONNECT(
      *({
        __typeof__(_imp_string31) tmp = SS /*q*/;
        (_imp_string255 *)&tmp;
      })
          ,
      0, 0, 0, /*?*/ &R, /*?*/ &FLAG);

  //   296     %if flag#0 %start

  if (FLAG == 0) goto L_0030;

    //   297        printstring("

  _imp_PRINTSTRING(
      *({
        __typeof__(_imp_string255) tmp = *({
          _imp_string255 tmp = _imp_join((_imp_string *)/*?*/ &*({
                                           _imp_string255 tmp =
                                               _imp_join((_imp_string *)/*?*/ _imp_str_literal_ptr("\ncannot connect "),
                                                         (_imp_string *)/*?*/ &SS);
                                           (_imp_string255 *)&tmp;
                                         }),
                                         (_imp_string *)/*?*/ _imp_str_literal_ptr("\n"));
          (_imp_string255 *)&tmp;
        }) /*q*/;
        (_imp_string255 *)&tmp;
      })
  );

  //   298+ cannot connect ".ss."
  //   299+ ")
  //   300        %return

  goto end_0;

  //   301     %finish

L_0030:;

//   302     %if r_filetype#3 %start

  if (R.FILETYPE == 3) goto L_0031;

    //   303        printstring("

  _imp_PRINTSTRING(
      *({
        __typeof__(_imp_string255) tmp = *({
          _imp_string255 tmp =
              _imp_join((_imp_string *)/*?*/ &*({
                          _imp_string255 tmp =
                              _imp_join((_imp_string *)/*?*/ _imp_str_literal_ptr("\n"), (_imp_string *)/*?*/ &SS);
                          (_imp_string255 *)&tmp;
                        }),
                        (_imp_string *)/*?*/ _imp_str_literal_ptr(" is not a character file\n"));
          (_imp_string255 *)&tmp;
        }) /*q*/;
        (_imp_string255 *)&tmp;
      })
  );

  //   304+ ".ss." is not a character file
  //   305+ ")
  //   306        %return

  goto end_0;

  //   307     %finish

L_0031:;

//   308  printstring("About to examine prims".snl)

  _imp_PRINTSTRING(
      *({
        __typeof__(_imp_string255) tmp = *({
          _imp_string255 tmp =
              _imp_join((_imp_string *)/*?*/ _imp_str_literal_ptr("About to examine prims"), (_imp_string *)/*?*/ &SNL);
          (_imp_string255 *)&tmp;
        }) /*q*/;
        (_imp_string255 *)&tmp;
      })
  );

  //   309  {X  %if ss=source %then comreg(46) = r_conad %and ss = imp11host.":IMP11PRIMS" %and ->l1
  //   310     %if ss=source %then comreg(46) = r_conad %and ss = "prims.inc" %and ->l1

  if (_imp_strcmp((_imp_string *)/*?*/ &SS, (_imp_string *)/*?*/ &SOURCE) != 0) goto L_0032;

  *COMREG(46) = R.CONAD;

  _imp_strncpy(/*?*/ &SS, ({
                 __typeof__(_imp_string255) tmp; /*B*/
                 tmp = _imp_str_literal("prims.inc");
                 (void *)&tmp;
               }),
               /*max:*/ 31);

  goto U_1000;
L_0032:;

//   311     permad = r_conad

  PERMAD = R.CONAD;

  //   312  {X  define("ST4,".listing)
  //   313  {X open output(4, listing)
  //   314     %if listing=".NULL" %or listing="/dev/null" %or listing=".N" %or listing=".n" %then open output(4, "/dev/null") %else open output(4, listing)

  if (_imp_strcmp((_imp_string *)/*?*/ &LISTING, (_imp_string *)/*?*/ _imp_str_literal_ptr(".NULL")) == 0) goto L_0033;

  if (_imp_strcmp((_imp_string *)/*?*/ &LISTING, (_imp_string *)/*?*/ _imp_str_literal_ptr("/dev/null")) == 0)
    goto L_0033;

  if (_imp_strcmp((_imp_string *)/*?*/ &LISTING, (_imp_string *)/*?*/ _imp_str_literal_ptr(".N")) == 0) goto L_0033;

  if (_imp_strcmp((_imp_string *)/*?*/ &LISTING, (_imp_string *)/*?*/ _imp_str_literal_ptr(".n")) != 0) goto L_0034;

L_0033:;
  _imp_OPENOUTPUT(4, _imp_str_literal("/dev/null"));
  goto L_0035;
L_0034:;
  _imp_OPENOUTPUT(4,
                  *({
                    __typeof__(_imp_string63) tmp = LISTING /*q*/;
                    (_imp_string255 *)&tmp;
                  })
  );
L_0035:;

//   315  {X   LIST = 10000 %if listing=".NULL"
//   316     LIST = 10000 %if listing=".NULL" %or listing="/dev/null" %or listing=".N" %or listing=".n"

  if (_imp_strcmp((_imp_string *)/*?*/ &LISTING, (_imp_string *)/*?*/ _imp_str_literal_ptr(".NULL")) == 0) goto L_0036;

  if (_imp_strcmp((_imp_string *)/*?*/ &LISTING, (_imp_string *)/*?*/ _imp_str_literal_ptr("/dev/null")) == 0)
    goto L_0036;

  if (_imp_strcmp((_imp_string *)/*?*/ &LISTING, (_imp_string *)/*?*/ _imp_str_literal_ptr(".N")) == 0) goto L_0036;

  if (_imp_strcmp((_imp_string *)/*?*/ &LISTING, (_imp_string *)/*?*/ _imp_str_literal_ptr(".n")) != 0) goto L_0037;

L_0036:;
  LIST = 10000;
L_0037:;

//   317     %if LIST<=1 %start

  if (LIST > 1) goto L_0038;

    //   318        select output(4)

  _imp_SELECTOUTPUT(4);

  //   319        printstring("Source file: ".source)

  _imp_PRINTSTRING(
      *({
        __typeof__(_imp_string255) tmp = *({
          _imp_string255 tmp =
              _imp_join((_imp_string *)/*?*/ _imp_str_literal_ptr("Source file: "), (_imp_string *)/*?*/ &SOURCE);
          (_imp_string255 *)&tmp;
        }) /*q*/;
        (_imp_string255 *)&tmp;
      })
  );

  //   320        printstring("       Compiled: ")

  _imp_PRINTSTRING(_imp_str_literal("       Compiled: "));

  //   321        show date

  SHOWDATE();

  //   322        spaces(2)

  _imp_SPACES(2);

  //   323        printstring(time)

  _imp_PRINTSTRING(
      *({
        __typeof__(_imp_string255) tmp = TIME() /*q*/;
        (_imp_string255 *)&tmp;
      })
  );

  //   324        newline

  _imp_NEWLINE();

  //   325        printstring("Object file: ".object)

  _imp_PRINTSTRING(
      *({
        __typeof__(_imp_string255) tmp = *({
          _imp_string255 tmp =
              _imp_join((_imp_string *)/*?*/ _imp_str_literal_ptr("Object file: "), (_imp_string *)/*?*/ &OBJECT);
          (_imp_string255 *)&tmp;
        }) /*q*/;
        (_imp_string255 *)&tmp;
      })
  );

  //   326        newlines(2)

  _imp_NEWLINES(2);

  //   327     %finish

L_0038:;

//   328     t1 = cputime

  T1 = CPUTIME();

  //   329     stats = pass1

  STATS = PASS1();

  //   330     t1 = cputime-t1

  T1 = CPUTIME() - T1;

  //   331     selectoutput(0)

  _imp_SELECTOUTPUT(0);

  //   332     %if stats>0 %start

  if (STATS <= 0) goto L_0039;

    //   333        write(stats,4)

  _imp_WRITE(STATS, 4);

  //   334        printstring(" statements compiled"); newline

  _imp_PRINTSTRING(_imp_str_literal(" statements compiled"));
  _imp_NEWLINE();

  //   335        ->avoid %if object=".NULL"

  if (_imp_strcmp((_imp_string *)/*?*/ &OBJECT, (_imp_string *)/*?*/ _imp_str_literal_ptr(".NULL")) != 0) goto L_003A;

  goto U_1001;
L_003A:;

//   336        selectinput(0)

  _imp_SELECTINPUT(0);

  //   337        close stream(1)

  CLOSESTREAM(1);

  //   338        close stream(4)

  CLOSESTREAM(4);

  //   339  p2:

U_1002:;

//   340  {X     define("ST2,SS#IMP77O")
//   341  open output(2, "/tmp/imp77.o")

  _imp_OPENOUTPUT(2, _imp_str_literal("/tmp/imp77.o"));

  //   342  {X     define("ST3,SS#IMP77D")
  //   343  open output(3, "/tmp/imp77.d")

  _imp_OPENOUTPUT(3, _imp_str_literal("/tmp/imp77.d"));

  //   344  {X     define("ST4,.OUT")
  //   345  open output(4, "/dev/stdout")

  _imp_OPENOUTPUT(4, _imp_str_literal("/dev/stdout"));

  //   346        t2 = cputime

  T2 = CPUTIME();

  //   347        pass2

  PASS2();

  //   348        t2 = cputime-t2

  T2 = CPUTIME() - T2;

  //   349        selectoutput(0)

  _imp_SELECTOUTPUT(0);

  //   350        close stream(2); close stream(3)

  CLOSESTREAM(2);
  CLOSESTREAM(3);

  //   351  {X     define("ST1,SS#IMP77O")
  //   352  open input(1, "/tmp/imp77.o")

  _imp_OPENINPUT(1, _imp_str_literal("/tmp/imp77.o"));

  //   353  {X     define("ST2,SS#IMP77D")
  //   354  open input(2, "/tmp/imp77.d")

  _imp_OPENINPUT(2, _imp_str_literal("/tmp/imp77.d"));

  //   355  {X     define("ST3,".object)
  //   356  open output(3, object)

  _imp_OPENOUTPUT(3,
                  *({
                    __typeof__(_imp_string63) tmp = OBJECT /*q*/;
                    (_imp_string255 *)&tmp;
                  })
  );

  //   357        t3 = cputime

  T3 = CPUTIME();

  //   358        pass3

  PASS3();

  //   359        t3 = cputime-t3

  T3 = CPUTIME() - T3;

  //   360  avoid:

U_1001:;

//   361     %finish %else %start

  goto L_003B;
L_0039:;

//   362        printstring("Program contains"); write(-stats,1)

  _imp_PRINTSTRING(_imp_str_literal("Program contains"));
  _imp_WRITE(-STATS, 1);

  //   363        printstring(" fault")

  _imp_PRINTSTRING(_imp_str_literal(" fault"));

  //   364        printsymbol('s') %unless stats=-1

  if (STATS == -1) goto L_003C;
  _imp_PRINTSYMBOL(115);
L_003C:;

//   365     %finish

L_003B:;

//   366     newline

  _imp_NEWLINE();

  //   367     select input(0); selectoutput(0)

  _imp_SELECTINPUT(0);
  _imp_SELECTOUTPUT(0);

  //   368     close stream(1); closestream(2); closestream(3); closestream(4)

  CLOSESTREAM(1);
  CLOSESTREAM(2);
  CLOSESTREAM(3);
  CLOSESTREAM(4);

  //   369     ->closef %if exclam=0 %or stats<0

  if (EXCLAM == 0) goto L_003D;
  if (STATS >= 0) goto L_003E;
L_003D:;
  goto U_1003;
L_003E:;

//   370     write(shortjumps,1); printstring(" short,")

  _imp_WRITE(SHORTJUMPS, 1);
  _imp_PRINTSTRING(_imp_str_literal(" short,"));

  //   371     write(mediumjumps,1); printstring(" medium, and")

  _imp_WRITE(MEDIUMJUMPS, 1);
  _imp_PRINTSTRING(_imp_str_literal(" medium, and"));

  //   372     write(longjumps,1); printstring(" long jumps")

  _imp_WRITE(LONGJUMPS, 1);
  _imp_PRINTSTRING(_imp_str_literal(" long jumps"));

  //   373     newline

  _imp_NEWLINE();

  //   374     print real(stretch time,2,4); printstring(" seconds in STRETCH")

  _imp_PRINTREAL(STRETCHTIME, 2, 4);
  _imp_PRINTSTRING(_imp_str_literal(" seconds in STRETCH"));

  //   375     newline

  _imp_NEWLINE();

  //   376     %return %if t1<=0 %or t2<=0 %or t3<=0

  if (T1 <= 0) goto L_003F;
  if (T2 <= 0) goto L_003F;
  if (T3 > 0) goto L_0040;
L_003F:;
  goto end_0;
L_0040:;

//   377     t0 = t1+t2+t3

  T0 = T1 + T2 + T3;

  //   378     printstring("Pass1 time ="); print real(t1,2,4); printstring(" sec")

  _imp_PRINTSTRING(_imp_str_literal("Pass1 time ="));
  _imp_PRINTREAL(T1, 2, 4);
  _imp_PRINTSTRING(_imp_str_literal(" sec"));

  //   379     newline

  _imp_NEWLINE();

  //   380     printstring("Pass2 time ="); print real(t2,2,4); printstring(" sec")

  _imp_PRINTSTRING(_imp_str_literal("Pass2 time ="));
  _imp_PRINTREAL(T2, 2, 4);
  _imp_PRINTSTRING(_imp_str_literal(" sec"));

  //   381     newline

  _imp_NEWLINE();

  //   382     printstring("Pass3 time ="); print real(t3,2,4); printstring(" sec")

  _imp_PRINTSTRING(_imp_str_literal("Pass3 time ="));
  _imp_PRINTREAL(T3, 2, 4);
  _imp_PRINTSTRING(_imp_str_literal(" sec"));

  //   383     newline

  _imp_NEWLINE();

  //   384     printstring("Total time ="); print real(t1+t2+t3,2,4); printstring(" sec")

  _imp_PRINTSTRING(_imp_str_literal("Total time ="));
  _imp_PRINTREAL(T1 + T2 + T3, 2, 4);
  _imp_PRINTSTRING(_imp_str_literal(" sec"));

  //   385     newline

  _imp_NEWLINE();

  //   386     stats = stats*60

  STATS = STATS * 60;

  //   387     write(int(stats/t1),1)

  _imp_WRITE(_imp_INT((double)(STATS / T1)), 1);

  //   388     printstring(" &")

  _imp_PRINTSTRING(_imp_str_literal(" &"));

  //   389     write(int(stats/t2),1)

  _imp_WRITE(_imp_INT((double)(STATS / T2)), 1);

  //   390     printstring(" &")

  _imp_PRINTSTRING(_imp_str_literal(" &"));

  //   391     write(int(stats/t3),1)

  _imp_WRITE(_imp_INT((double)(STATS / T3)), 1);

  //   392     printstring(": ")

  _imp_PRINTSTRING(_imp_str_literal(": "));

  //   393     write(int(stats/t0),1)

  _imp_WRITE(_imp_INT((double)(STATS / T0)), 1);

  //   394     printstring(" statements per minute")

  _imp_PRINTSTRING(_imp_str_literal(" statements per minute"));

  //   395     newline

  _imp_NEWLINE();

  //   396     ! timeio(source)
  //   397  !    timeio("IMP#INT")
  //   398  !    timeio("SS#IMP77O")
  //   399  !    timeio("SS#IMP77D")
  //   400  !    timeio(object)
  //   401  closef:

U_1003:;

//   402  {X  %unless comreg(27)&(1<<18)#0 %start
//   403  {X     destroy("SS#IMP77O",flag)
//   404  {X     destroy("SS#IMP77D",flag)
//   405  {X     destroy("IMP#INT",flag)
//   406  {X  %finish
//   407  {%end
//   408  {%end %of %file
//   409  %endofprogram

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