         Edinburgh IMP77 Compiler - Version 8.4-2024.12.18

     1  %begin
 0000 C8 00 00 01                           ENTER 0000,1
     2  %integer i, a,b,c, q
     3  
     4    q = 0;
 0004 C7 45 E8 00 00 00 00                  MOV DWORD PTR [%EBP-24],#0
     5    
     6    %for i = 3,1,5 %cycle
 000B C7 45 F8 02 00 00 00                  MOV DWORD PTR [%EBP-8],#2
 0012                      L1001  EQU $
 0012 8B 45 F8                              MOV %EAX,[%EBP-8]
 0015 3D 05 00 00 00                        CMP %EAX,#5
 001A 74 00                                 JE L1002
 001C 40                                    INC %EAX
 001D 89 45 F8                              MOV [%EBP-8],%EAX
     7      q = q+i
 0020 8B 45 F8                              MOV %EAX,[%EBP-8]
 0023 01 45 E8                              ADD [%EBP-24],%EAX
     8    %repeat
 0026 EB 00                                 JMP L1001
 0028                      L1002  EQU $
     9  
    10    %for i = 3,2,5 %cycle
 0028 C7 45 F8 01 00 00 00                  MOV DWORD PTR [%EBP-8],#1
 002F                      L1003  EQU $
 002F 8B 45 F8                              MOV %EAX,[%EBP-8]
 0032 3D 05 00 00 00                        CMP %EAX,#5
 0037 74 00                                 JE L1004
 0039 05 02 00 00 00                        ADD %EAX,#2
 003E 89 45 F8                              MOV [%EBP-8],%EAX
    11      q = q+i
 0041 8B 45 F8                              MOV %EAX,[%EBP-8]
 0044 01 45 E8                              ADD [%EBP-24],%EAX
    12    %repeat
 0047 EB 00                                 JMP L1003
 0049                      L1004  EQU $
    13  
    14    %for i = 5,-1,3 %cycle
 0049 C7 45 F8 06 00 00 00                  MOV DWORD PTR [%EBP-8],#6
 0050                      L1005  EQU $
 0050 8B 45 F8                              MOV %EAX,[%EBP-8]
 0053 3D 03 00 00 00                        CMP %EAX,#3
 0058 74 00                                 JE L1006
 005A 48                                    DEC %EAX
 005B 89 45 F8                              MOV [%EBP-8],%EAX
    15      q = q+i
 005E 8B 45 F8                              MOV %EAX,[%EBP-8]
 0061 01 45 E8                              ADD [%EBP-24],%EAX
    16    %repeat
 0064 EB 00                                 JMP L1005
 0066                      L1006  EQU $
    17  
    18    %for i = 5,-2,3 %cycle
 0066 C7 45 F8 07 00 00 00                  MOV DWORD PTR [%EBP-8],#7
 006D                      L1007  EQU $
 006D 8B 45 F8                              MOV %EAX,[%EBP-8]
 0070 3D 03 00 00 00                        CMP %EAX,#3
 0075 74 00                                 JE L1008
 0077 05 FE FF FF FF                        ADD %EAX,#-2
 007C 89 45 F8                              MOV [%EBP-8],%EAX
    19      q = q+i
 007F 8B 45 F8                              MOV %EAX,[%EBP-8]
 0082 01 45 E8                              ADD [%EBP-24],%EAX
    20    %repeat
 0085 EB 00                                 JMP L1007
 0087                      L1008  EQU $
    21  
    22    a = 3; b = 1; c = 5
 0087 C7 45 F4 03 00 00 00                  MOV DWORD PTR [%EBP-12],#3
 008E C7 45 F0 01 00 00 00                  MOV DWORD PTR [%EBP-16],#1
 0095 C7 45 EC 05 00 00 00                  MOV DWORD PTR [%EBP-20],#5
    23  
    24    %for i = a, b, c %cycle
 009C 8B 45 EC                              MOV %EAX,[%EBP-20]
 009F 89 45 E4                              MOV [%EBP-28],%EAX
 00A2 8B 45 F0                              MOV %EAX,[%EBP-16]
 00A5 89 45 E0                              MOV [%EBP-32],%EAX
 00A8 8B 45 F4                              MOV %EAX,[%EBP-12]
 00AB 2B 45 E0                              SUB %EAX,[%EBP-32]
 00AE 89 45 F8                              MOV [%EBP-8],%EAX
 00B1                      L1009  EQU $
 00B1 8B 45 F8                              MOV %EAX,[%EBP-8]
 00B4 3B 45 E4                              CMP %EAX,[%EBP-28]
 00B7 74 00                                 JE L1010
 00B9 03 45 E0                              ADD %EAX,[%EBP-32]
 00BC 89 45 F8                              MOV [%EBP-8],%EAX
    25      q = q+i+a
 00BF 8B 45 E8                              MOV %EAX,[%EBP-24]
 00C2 03 45 F8                              ADD %EAX,[%EBP-8]
 00C5 03 45 F4                              ADD %EAX,[%EBP-12]
 00C8 89 45 E8                              MOV [%EBP-24],%EAX
    26    %repeat
 00CB EB 00                                 JMP L1009
 00CD                      L1010  EQU $
    27  
    28    a = 3; b = 2; c = 5
 00CD C7 45 F4 03 00 00 00                  MOV DWORD PTR [%EBP-12],#3
 00D4 C7 45 F0 02 00 00 00                  MOV DWORD PTR [%EBP-16],#2
 00DB C7 45 EC 05 00 00 00                  MOV DWORD PTR [%EBP-20],#5
    29  
    30    %for i = a, b, c %cycle
 00E2 8B 45 EC                              MOV %EAX,[%EBP-20]
 00E5 89 45 DC                              MOV [%EBP-36],%EAX
 00E8 8B 45 F0                              MOV %EAX,[%EBP-16]
 00EB 89 45 D8                              MOV [%EBP-40],%EAX
 00EE 8B 45 F4                              MOV %EAX,[%EBP-12]
 00F1 2B 45 D8                              SUB %EAX,[%EBP-40]
 00F4 89 45 F8                              MOV [%EBP-8],%EAX
 00F7                      L1011  EQU $
 00F7 8B 45 F8                              MOV %EAX,[%EBP-8]
 00FA 3B 45 DC                              CMP %EAX,[%EBP-36]
 00FD 74 00                                 JE L1012
 00FF 03 45 D8                              ADD %EAX,[%EBP-40]
 0102 89 45 F8                              MOV [%EBP-8],%EAX
    31      q = q+i+a
 0105 8B 45 E8                              MOV %EAX,[%EBP-24]
 0108 03 45 F8                              ADD %EAX,[%EBP-8]
 010B 03 45 F4                              ADD %EAX,[%EBP-12]
 010E 89 45 E8                              MOV [%EBP-24],%EAX
    32    %repeat
 0111 EB 00                                 JMP L1011
 0113                      L1012  EQU $
    33  
    34    a = 5; b = -1; c = 3
 0113 C7 45 F4 05 00 00 00                  MOV DWORD PTR [%EBP-12],#5
 011A C7 45 F0 FF FF FF FF                  MOV DWORD PTR [%EBP-16],#-1
 0121 C7 45 EC 03 00 00 00                  MOV DWORD PTR [%EBP-20],#3
    35  
    36    %for i = a, b, c %cycle
 0128 8B 45 EC                              MOV %EAX,[%EBP-20]
 012B 89 45 D4                              MOV [%EBP-44],%EAX
 012E 8B 45 F0                              MOV %EAX,[%EBP-16]
 0131 89 45 D0                              MOV [%EBP-48],%EAX
 0134 8B 45 F4                              MOV %EAX,[%EBP-12]
 0137 2B 45 D0                              SUB %EAX,[%EBP-48]
 013A 89 45 F8                              MOV [%EBP-8],%EAX
 013D                      L1013  EQU $
 013D 8B 45 F8                              MOV %EAX,[%EBP-8]
 0140 3B 45 D4                              CMP %EAX,[%EBP-44]
 0143 74 00                                 JE L1014
 0145 03 45 D0                              ADD %EAX,[%EBP-48]
 0148 89 45 F8                              MOV [%EBP-8],%EAX
    37      q = q+i+a
 014B 8B 45 E8                              MOV %EAX,[%EBP-24]
 014E 03 45 F8                              ADD %EAX,[%EBP-8]
 0151 03 45 F4                              ADD %EAX,[%EBP-12]
 0154 89 45 E8                              MOV [%EBP-24],%EAX
    38    %repeat
 0157 EB 00                                 JMP L1013
 0159                      L1014  EQU $
    39  
    40    a = 5; b = -2; c = 3
 0159 C7 45 F4 05 00 00 00                  MOV DWORD PTR [%EBP-12],#5
 0160 C7 45 F0 FE FF FF FF                  MOV DWORD PTR [%EBP-16],#-2
 0167 C7 45 EC 03 00 00 00                  MOV DWORD PTR [%EBP-20],#3
    41  
    42    %for i = a, b, c %cycle
 016E 8B 45 EC                              MOV %EAX,[%EBP-20]
 0171 89 45 CC                              MOV [%EBP-52],%EAX
 0174 8B 45 F0                              MOV %EAX,[%EBP-16]
 0177 89 45 C8                              MOV [%EBP-56],%EAX
 017A 8B 45 F4                              MOV %EAX,[%EBP-12]
 017D 2B 45 C8                              SUB %EAX,[%EBP-56]
 0180 89 45 F8                              MOV [%EBP-8],%EAX
 0183                      L1015  EQU $
 0183 8B 45 F8                              MOV %EAX,[%EBP-8]
 0186 3B 45 CC                              CMP %EAX,[%EBP-52]
 0189 74 00                                 JE L1016
 018B 03 45 C8                              ADD %EAX,[%EBP-56]
 018E 89 45 F8                              MOV [%EBP-8],%EAX
    43      q = q+i+a
 0191 8B 45 E8                              MOV %EAX,[%EBP-24]
 0194 03 45 F8                              ADD %EAX,[%EBP-8]
 0197 03 45 F4                              ADD %EAX,[%EBP-12]
 019A 89 45 E8                              MOV [%EBP-24],%EAX
    44    %repeat
 019D EB 00                                 JMP L1015
 019F                      L1016  EQU $
    45  
    46    %if q = 120 %then printstring("Pass!") %else printstring("Fail!")
 019F 8B 45 E8                              MOV %EAX,[%EBP-24]
 01A2 3D 78 00 00 00                        CMP %EAX,#120
 01A7 75 00                                 JNE L1017
 01A9 81 EC 00 01 00 00                     SUB %ESP,#256
 01AF 89 E0                                 MOV %EAX,%ESP
 01B1 50                                    PUSH %EAX
 01B2 B8 00 00 00 00                        MOV %EAX,COT+#0
 01B7 50                                    PUSH %EAX
 01B8 68 FF 00 00 00                        PUSH #255
 01BD E8 03 00                              CALL '_IMPSTRCPY' (EXTERN 3)
 01C0 83 C4 0C                              ADD %ESP,#12
 01C3 E8 3B 00                              CALL 'PRINTSTRING' (EXTERN 59)
 01C6 81 C4 00 01 00 00                     ADD %ESP,#256
 01CC EB 00                                 JMP L1018
 01CE                      L1017  EQU $
 01CE 81 EC 00 01 00 00                     SUB %ESP,#256
 01D4 89 E0                                 MOV %EAX,%ESP
 01D6 50                                    PUSH %EAX
 01D7 B8 06 00 00 00                        MOV %EAX,COT+#6
 01DC 50                                    PUSH %EAX
 01DD 68 FF 00 00 00                        PUSH #255
 01E2 E8 03 00                              CALL '_IMPSTRCPY' (EXTERN 3)
 01E5 83 C4 0C                              ADD %ESP,#12
 01E8 E8 3B 00                              CALL 'PRINTSTRING' (EXTERN 59)
 01EB 81 C4 00 01 00 00                     ADD %ESP,#256
 01F1                      L1018  EQU $
    47    newline
 01F1 E8 43 00                              CALL 'NEWLINE' (EXTERN 67)
    48    
    49  %endofprogram
 01F4 C9                                    LEAVE
 01F5 C3                                    RET

    42 Statements compiled



 ELF object file generated from IMP source file: '/home/gtoal/src/compilers101/new-parser/imps/tests/test126.imp'
 +----------+---------------------+---------+---------+---------+------------+
 | Sections |       Symbols       | Code    | Data    | Diag    | Total size |
 +----------+----------+----------+---------+---------+---------+------------+
 |  (count) | Internal | External | (bytes) | (bytes) | (bytes) | (bytes)    |
 +----------+----------+----------+---------+---------+---------+------------+
 |       12 |        5 |        9 |     512 |      12 |      32 |        556 |
 +----------+----------+----------+---------+---------+---------+------------+


