         Edinburgh IMP77 Compiler - Version 8.4-2024.12.18

     1  ! second test
     2  %begin
 0000 C8 00 00 01                           ENTER 0000,1
     3    %routine test(%name param)         ;! ia1          ia2
 0004 EB 00                                 JMP L1001
 0006                      L1002  EQU $
 0006 C8 00 00 02                           ENTER 0000,2
     4      write(addr(param),0)  ; newline  ;! 2145833816   2145833816     same address again!
 000A FF 75 08                              PUSH DWORD PTR [%EBP+8]
 000D 6A 00                                 PUSH #0
 000F E8 40 00                              CALL 'WRITE' (EXTERN 64)
 0012 83 C4 08                              ADD %ESP,#8
 0015 E8 43 00                              CALL 'NEWLINE' (EXTERN 67)
     5      write(sizeof(param),0); newline  ;! 4            4              sizeof  %integer
 0018 FF 75 0C                              PUSH DWORD PTR [%EBP+12]
 001B FF 75 08                              PUSH DWORD PTR [%EBP+8]
 001E E8 11 00                              CALL 'SIZEOF' (EXTERN 17)
 0021 83 C4 08                              ADD %ESP,#8
 0024 50                                    PUSH %EAX
 0025 6A 00                                 PUSH #0
 0027 E8 40 00                              CALL 'WRITE' (EXTERN 64)
 002A 83 C4 08                              ADD %ESP,#8
 002D E8 43 00                              CALL 'NEWLINE' (EXTERN 67)
     6      write(typeof(param),0); newline  ;! 1            1              typeof  %integer
 0030 FF 75 0C                              PUSH DWORD PTR [%EBP+12]
 0033 FF 75 08                              PUSH DWORD PTR [%EBP+8]
 0036 E8 10 00                              CALL 'TYPEOF' (EXTERN 16)
 0039 83 C4 08                              ADD %ESP,#8
 003C 50                                    PUSH %EAX
 003D 6A 00                                 PUSH #0
 003F E8 40 00                              CALL 'WRITE' (EXTERN 64)
 0042 83 C4 08                              ADD %ESP,#8
 0045 E8 43 00                              CALL 'NEWLINE' (EXTERN 67)
     7    %end
 0048 C9                                    LEAVE
 0049 C3                                    RET
 004A                      L1001  EQU $
     8  
     9    %integerarray ia1(3:5)
 004A C7 45 EC 01 00 00 00                  MOV DWORD PTR [%EBP-20],#1
 0051 C7 45 F0 03 00 00 00                  MOV DWORD PTR [%EBP-16],#3
 0058 C7 45 F4 05 00 00 00                  MOV DWORD PTR [%EBP-12],#5
 005F C7 45 F8 83 00 00 00                  MOV DWORD PTR [%EBP-8],#131
 0066 8D 45 EC                              LEA %EAX,[%EBP-20]
 0069 50                                    PUSH %EAX
 006A E8 0A 00                              CALL '_IMPADEF' (EXTERN 10)
 006D 83 C4 04                              ADD %ESP,#4
 0070 8D 4D EC                              LEA %ECX,[%EBP-20]
 0073 89 E3                                 MOV %EBX,%ESP
 0075 29 D3                                 SUB %EBX,%EDX
 0077 89 5D E4                              MOV [%EBP-28],%EBX
 007A 89 4D E8                              MOV [%EBP-24],%ECX
 007D 01 C3                                 ADD %EBX,%EAX
 007F 89 DC                                 MOV %ESP,%EBX
    10    %integerarray ia2(2:4,3:6)
 0081 C7 45 CC 02 00 00 00                  MOV DWORD PTR [%EBP-52],#2
 0088 C7 45 D0 02 00 00 00                  MOV DWORD PTR [%EBP-48],#2
 008F C7 45 D4 04 00 00 00                  MOV DWORD PTR [%EBP-44],#4
 0096 C7 45 D8 03 00 00 00                  MOV DWORD PTR [%EBP-40],#3
 009D C7 45 DC 06 00 00 00                  MOV DWORD PTR [%EBP-36],#6
 00A4 C7 45 E0 83 00 00 00                  MOV DWORD PTR [%EBP-32],#131
 00AB 8D 45 CC                              LEA %EAX,[%EBP-52]
 00AE 50                                    PUSH %EAX
 00AF E8 0A 00                              CALL '_IMPADEF' (EXTERN 10)
 00B2 83 C4 04                              ADD %ESP,#4
 00B5 8D 4D CC                              LEA %ECX,[%EBP-52]
 00B8 89 E3                                 MOV %EBX,%ESP
 00BA 29 D3                                 SUB %EBX,%EDX
 00BC 89 5D C4                              MOV [%EBP-60],%EBX
 00BF 89 4D C8                              MOV [%EBP-56],%ECX
 00C2 01 C3                                 ADD %EBX,%EAX
 00C4 89 DC                                 MOV %ESP,%EBX
    11  
    12    write(addr(ia1),0); newline     ;! 2145833816     Note it is the same address as written in test(ia1) and test (ia2)!
 00C6 8D 44 04 24                           LEA %EAX,[%ESP+4]
 00CA 8D 4D E4                              LEA %ECX,[%EBP-28]
 00CD 89 CA                                 MOV %EDX,%ECX
 00CF 89 50 04                              MOV [%EAX+4],%EDX
 00D2 89 08                                 MOV [%EAX],%ECX
 00D4 6A 00                                 PUSH #0
 00D6 E8 40 00                              CALL 'WRITE' (EXTERN 64)
 00D9 83 C4 08                              ADD %ESP,#8
 00DC E8 43 00                              CALL 'NEWLINE' (EXTERN 67)
    13    write(addr(ia1(3)),0); newline  ;! 2145833744
 00DF 6A 03                                 PUSH #3
 00E1 FF 75 E8                              PUSH DWORD PTR [%EBP-24]
 00E4 E8 09 00                              CALL '_IMPAREF' (EXTERN 9)
 00E7 83 C4 08                              ADD %ESP,#8
 00EA 89 C6                                 MOV %ESI,%EAX
 00EC 03 75 E4                              ADD %ESI,[%EBP-28]
 00EF 56                                    PUSH %ESI
 00F0 6A 00                                 PUSH #0
 00F2 E8 40 00                              CALL 'WRITE' (EXTERN 64)
 00F5 83 C4 08                              ADD %ESP,#8
 00F8 E8 43 00                              CALL 'NEWLINE' (EXTERN 67)
    14    write(sizeof(ia1),0); newline   ;! 4
 00FB FF 75 E8                              PUSH DWORD PTR [%EBP-24]
 00FE FF 75 E4                              PUSH DWORD PTR [%EBP-28]
 0101 E8 11 00                              CALL 'SIZEOF' (EXTERN 17)
 0104 83 C4 08                              ADD %ESP,#8
 0107 50                                    PUSH %EAX
 0108 6A 00                                 PUSH #0
 010A E8 40 00                              CALL 'WRITE' (EXTERN 64)
 010D 83 C4 08                              ADD %ESP,#8
 0110 E8 43 00                              CALL 'NEWLINE' (EXTERN 67)
    15    write(typeof(ia1),0); newline   ;! 1
 0113 FF 75 E8                              PUSH DWORD PTR [%EBP-24]
 0116 FF 75 E4                              PUSH DWORD PTR [%EBP-28]
 0119 E8 10 00                              CALL 'TYPEOF' (EXTERN 16)
 011C 83 C4 08                              ADD %ESP,#8
 011F 50                                    PUSH %EAX
 0120 6A 00                                 PUSH #0
 0122 E8 40 00                              CALL 'WRITE' (EXTERN 64)
 0125 83 C4 08                              ADD %ESP,#8
 0128 E8 43 00                              CALL 'NEWLINE' (EXTERN 67)
    16  
    17    test(ia1)
 012B FF 75 E8                              PUSH DWORD PTR [%EBP-24]
 012E FF 75 E4                              PUSH DWORD PTR [%EBP-28]
 0131 E8 00 00                              CALL 'TEST' (INTERNAL L1002 )
 0134 83 C4 08                              ADD %ESP,#8
    18  
    19  
    20    write(addr(ia2),0); newline       ;! 2145833816   Same address as ia1 above!!!  that was unexpected.
 0137 8D 44 04 24                           LEA %EAX,[%ESP+4]
 013B 8D 4D C4                              LEA %ECX,[%EBP-60]
 013E 89 CA                                 MOV %EDX,%ECX
 0140 89 50 04                              MOV [%EAX+4],%EDX
 0143 89 08                                 MOV [%EAX],%ECX
 0145 6A 00                                 PUSH #0
 0147 E8 40 00                              CALL 'WRITE' (EXTERN 64)
 014A 83 C4 08                              ADD %ESP,#8
 014D E8 43 00                              CALL 'NEWLINE' (EXTERN 67)
    21    write(addr(ia2(2,3)),0); newline  ;! 2145833756   This is 12 bytes after address of first element of ia1, i.e. ia1(3)
 0150 6A 02                                 PUSH #2
 0152 6A 03                                 PUSH #3
 0154 FF 75 C8                              PUSH DWORD PTR [%EBP-56]
 0157 E8 09 00                              CALL '_IMPAREF' (EXTERN 9)
 015A 83 C4 0C                              ADD %ESP,#12
 015D 89 C7                                 MOV %EDI,%EAX
 015F 03 7D C4                              ADD %EDI,[%EBP-60]
 0162 57                                    PUSH %EDI
 0163 6A 00                                 PUSH #0
 0165 E8 40 00                              CALL 'WRITE' (EXTERN 64)
 0168 83 C4 08                              ADD %ESP,#8
 016B E8 43 00                              CALL 'NEWLINE' (EXTERN 67)
    22                                       !              (Note ia1 is 3 elements of 4 bytes per element)
    23    write(sizeof(ia2),0); newline     ;! 4
 016E FF 75 C8                              PUSH DWORD PTR [%EBP-56]
 0171 FF 75 C4                              PUSH DWORD PTR [%EBP-60]
 0174 E8 11 00                              CALL 'SIZEOF' (EXTERN 17)
 0177 83 C4 08                              ADD %ESP,#8
 017A 50                                    PUSH %EAX
 017B 6A 00                                 PUSH #0
 017D E8 40 00                              CALL 'WRITE' (EXTERN 64)
 0180 83 C4 08                              ADD %ESP,#8
 0183 E8 43 00                              CALL 'NEWLINE' (EXTERN 67)
    24    write(typeof(ia2),0); newline     ;! 1
 0186 FF 75 C8                              PUSH DWORD PTR [%EBP-56]
 0189 FF 75 C4                              PUSH DWORD PTR [%EBP-60]
 018C E8 10 00                              CALL 'TYPEOF' (EXTERN 16)
 018F 83 C4 08                              ADD %ESP,#8
 0192 50                                    PUSH %EAX
 0193 6A 00                                 PUSH #0
 0195 E8 40 00                              CALL 'WRITE' (EXTERN 64)
 0198 83 C4 08                              ADD %ESP,#8
 019B E8 43 00                              CALL 'NEWLINE' (EXTERN 67)
    25  
    26    test(ia2)
 019E FF 75 C8                              PUSH DWORD PTR [%EBP-56]
 01A1 FF 75 C4                              PUSH DWORD PTR [%EBP-60]
 01A4 E8 00 00                              CALL 'TEST' (INTERNAL L1002 )
 01A7 83 C4 08                              ADD %ESP,#8
    27  
    28  %endofprogram
 01AA C9                                    LEAVE
 01AB C3                                    RET

    30 Statements compiled



 ELF object file generated from IMP source file: '/home/gtoal/src/compilers101/new-parser/imps/tests/gtoal002.imp'
 +----------+---------------------+---------+---------+---------+------------+
 | Sections |       Symbols       | Code    | Data    | Diag    | Total size |
 +----------+----------+----------+---------+---------+---------+------------+
 |  (count) | Internal | External | (bytes) | (bytes) | (bytes) | (bytes)    |
 +----------+----------+----------+---------+---------+---------+------------+
 |       11 |        5 |       12 |     496 |       0 |      64 |        560 |
 +----------+----------+----------+---------+---------+---------+------------+


