#include <perms.h>

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

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

  //     2
  //     3    %byte b

  unsigned char B;

  //     4    %short sh

  short int SH;

  //     5    %integer i

  int I;

  //     6    %longinteger li

  long int LI;

  //     7
  //     8    b = 255

  B = 255;

  //     9    b = 127

  B = 127;

  //    10    b = -128

  B = -128;

  //    11    b = 16_FF

  B = 255;

  //    12    b = 16_7F

  B = 127;

  //    13    b = 16_80

  B = 128;

  //    14
  //    15    sh = 65535        ;! Too big - warning or error - "Short numerical constant too big"  Should cause runtime integer overflow

  SH = 65535;

  //    16    sh = 32767

  SH = 32767;

  //    17    sh = -32768

  SH = -32768;

  //    18    sh = 16_FFFF      ;! Too big - warning or error - "Short numerical constant too big"  Should cause runtime integer overflow

  SH = 65535;

  //    19    sh = 16_7FFF

  SH = 32767;

  //    20    sh = 16_8000

  SH = 32768;

  //    21
  //    22    sh <- b

  SH = (short int)(B);

  //    23    sh = b

  SH = B;

  //    24    sh <- i

  SH = (short int)(I);

  //    25    sh <- li

  SH = (short int)(LI);

  //    26
  //    27    ! i = 4294967295    ;! Too big - type error
  //    28    i = 2147483647

  I = 2147483647;

  //    29    ! i = -2147483648   ;! Too big - type error!  Because it is compiled as -(2147483648)
  //    30    i = -2147483647     ;! Too big - type error!  Because it is compiled as -(2147483648)

  I = -2147483647;

  //    31    i = 16_FFFFFFFF     ;! Too big - warning or error  Should cause runtime integer overflow

  I = -1;

  //    32    i = 16_7FFFFFFF

  I = 2147483647;

  //    33    i = 16_80000000

  I = -2147483648;

  //    34
  //    35    i <- b

  I = (int)(B);

  //    36    i = b

  I = B;

  //    37    i <- sh

  I = (int)(SH);

  //    38    i = sh

  I = SH;

  //    39    i <- li

  I = (int)(LI);

  //    40
  //    41    ! li = 18446744073709551615  ;! Too big - type error
  //    42    ! li = -9223372036854775808  ;! Too big - type error
  //    43    ! li =  9223372036854775807  ;! Too big - type error
  //    44
  //    45    li = 16_FFFFFFFFFFFFFFFF        ;! These three are accepted, but I believe will be truncated because our pass1 is 32-bit    Should cause runtime integer overflow

  LI = -1;

  //    46    li = 16_7FFFFFFFFFFFFFFF

  LI = -1;

  //    47    li = 16_8000000000000000

  LI = 0;

  //    48
  //    49    li <- b

  LI = (long long int)(B);

  //    50    li = b

  LI = B;

  //    51    li <- sh

  LI = (long long int)(SH);

  //    52    li = sh

  LI = SH;

  //    53    li <- i

  LI = (long long int)(I);

  //    54    li = i

  LI = I;

  //    55
  //    56  %endofprogram

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