         Edinburgh IMP77 Compiler - Version 8.4-2024.12.18

     1  %begin
 0000 C8 00 00 01                           ENTER 0000,1
     2    %integer cond
     3    cond = 1
 0004 C7 45 F8 01 00 00 00                  MOV DWORD PTR [%EBP-8],#1
     4    !
     5    %if cond # 0 %start
 000B 8B 45 F8                              MOV %EAX,[%EBP-8]
 000E 3D 00 00 00 00                        CMP %EAX,#0
 0013 74 00                                 JE L1001
     6      %if cond # 1 %start { generated dangling else error until fixed with extra bracketing }
 0015 8B 45 F8                              MOV %EAX,[%EBP-8]
 0018 3D 01 00 00 00                        CMP %EAX,#1
 001D 74 00                                 JE L1002
     7        cond = 4
 001F C7 45 F8 04 00 00 00                  MOV DWORD PTR [%EBP-8],#4
     8      %finish
 0026                      L1002  EQU $
     9    %finishelsestart
 0026 EB 00                                 JMP L1003
 0028                      L1001  EQU $
    10      cond = 3
 0028 C7 45 F8 03 00 00 00                  MOV DWORD PTR [%EBP-8],#3
    11    %finish
 002F                      L1003  EQU $
    12  
    13    ! Same logic but tortured expression of it...
    14    ! this one *would* have still generated dangling else error
    15    ! *IF* the then/else reversal were working as it should! (which it isn't)
    16    
    17    %if cond # 0 %start
 002F 8B 45 F8                              MOV %EAX,[%EBP-8]
 0032 3D 00 00 00 00                        CMP %EAX,#0
 0037 74 00                                 JE L1004
    18      %if cond = 1 %start
 0039 8B 45 F8                              MOV %EAX,[%EBP-8]
 003C 3D 01 00 00 00                        CMP %EAX,#1
 0041 75 00                                 JNE L1005
    19      %finishelse cond = 4
 0043 EB 00                                 JMP L1006
 0045                      L1005  EQU $
 0045 C7 45 F8 04 00 00 00                  MOV DWORD PTR [%EBP-8],#4
 004C                      L1006  EQU $
    20    %finishelsestart
 004C EB 00                                 JMP L1007
 004E                      L1004  EQU $
    21      cond = 3
 004E C7 45 F8 03 00 00 00                  MOV DWORD PTR [%EBP-8],#3
    22    %finish
 0055                      L1007  EQU $
    23  
    24    ! Let's test the simple reversal on its own...
    25    %if cond = 1 %start
 0055 8B 45 F8                              MOV %EAX,[%EBP-8]
 0058 3D 01 00 00 00                        CMP %EAX,#1
 005D 75 00                                 JNE L1008
    26    %finishelse cond = 4
 005F EB 00                                 JMP L1009
 0061                      L1008  EQU $
 0061 C7 45 F8 04 00 00 00                  MOV DWORD PTR [%EBP-8],#4
 0068                      L1009  EQU $
    27  
    28  %endofprogram
 0068 C9                                    LEAVE
 0069 C3                                    RET

    19 Statements compiled



 ELF object file generated from IMP source file: '/home/gtoal/src/compilers101/new-parser/imps/tests/test211.imp'
 +----------+---------------------+---------+---------+---------+------------+
 | Sections |       Symbols       | Code    | Data    | Diag    | Total size |
 +----------+----------+----------+---------+---------+---------+------------+
 |  (count) | Internal | External | (bytes) | (bytes) | (bytes) | (bytes)    |
 +----------+----------+----------+---------+---------+---------+------------+
 |       11 |        4 |        6 |     106 |       0 |      32 |        138 |
 +----------+----------+----------+---------+---------+---------+------------+


