// File: Merulo[P]CompilerJFTT/src/IRs/ThirdIR.cpp
// Function: ThirdIR::legalizeSpecificJumps()
void ThirdIR::legalizeSpecificJumps()
{
    for(auto& b : _blocks)
    {
        for(auto i = b.lines.begin(); i != b.lines.end(); i++)
        {
            if (i->operation == "JZERO")
            {
                i->two = "#" + b.blockIfTrue;
                b.lines.push_back({"JUMP", "", "#" + b.blockIfFalse});
                break;
            }
        }
    }    
}

// Assembly:
subq $0x168, %rsp            # imm = 0x168
movq %rdi, 0x160(%rsp)
movq 0x160(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x158(%rsp)
movq 0x158(%rsp), %rdi
callq 0x29fd0
movq %rax, 0x150(%rsp)
movq 0x158(%rsp), %rdi
callq 0x2a870
movq %rax, 0x148(%rsp)
leaq 0x150(%rsp), %rdi
leaq 0x148(%rsp), %rsi
callq 0x30be0
testb $0x1, %al
jne 0x4037b
jmp 0x40617
leaq 0x150(%rsp), %rdi
callq 0x2bda0
movq %rax, 0x140(%rsp)
movq 0x140(%rsp), %rdi
addq $0x20, %rdi
callq 0xe3f0
movq %rax, 0x138(%rsp)
movq 0x140(%rsp), %rdi
addq $0x20, %rdi
callq 0xe380
movq %rax, 0x130(%rsp)
leaq 0x138(%rsp), %rdi
leaq 0x130(%rsp), %rsi
callq 0xec10
testb $0x1, %al
jne 0x403e0
jmp 0x40603
leaq 0x138(%rsp), %rdi
callq 0x30d40
movq %rax, %rdi
leaq 0x10dbd(%rip), %rsi     # 0x511b4
callq 0xdd10
testb $0x1, %al
jne 0x40405
jmp 0x405e8
movq 0x140(%rsp), %rdx
addq $0x38, %rdx
leaq 0x11184(%rip), %rsi     # 0x5159c
leaq 0x110(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x5070
leaq 0x138(%rsp), %rdi
callq 0x30d40
movq 0x8(%rsp), %rsi
movq %rax, %rdi
addq $0x40, %rdi
callq 0x4440
movq 0x8(%rsp), %rdi
callq 0x46e8
movq 0x140(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x10(%rsp)
leaq 0x87(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x4600
movq 0x18(%rsp), %rdx
leaq 0x10d43(%rip), %rsi     # 0x511c4
leaq 0x88(%rsp), %rdi
callq 0x4f10
jmp 0x40490
leaq 0x4f(%rsp), %rdi
movq %rdi, (%rsp)
callq 0x4600
movq (%rsp), %rdx
leaq 0x10c72(%rip), %rsi     # 0x5111b
leaq 0x50(%rsp), %rdi
callq 0x4f10
jmp 0x404b5
movq 0x140(%rsp), %rdx
addq $0x58, %rdx
leaq 0x110d4(%rip), %rsi     # 0x5159c
leaq 0x28(%rsp), %rdi
callq 0x5070
jmp 0x404d4
leaq 0xa8(%rsp), %rdi
leaq 0x88(%rsp), %rsi
leaq 0x50(%rsp), %rdx
leaq 0x28(%rsp), %rcx
callq 0xd3b0
jmp 0x404f5
movq 0x10(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0xd380
jmp 0x40509
leaq 0xa8(%rsp), %rdi
callq 0xd490
leaq 0x28(%rsp), %rdi
callq 0x46e8
leaq 0x50(%rsp), %rdi
callq 0x46e8
leaq 0x4f(%rsp), %rdi
callq 0x43b0
leaq 0x88(%rsp), %rdi
callq 0x46e8
leaq 0x87(%rsp), %rdi
callq 0x43b0
jmp 0x40603
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
jmp 0x405d9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
jmp 0x405c2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
jmp 0x405b8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
jmp 0x405ae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
leaq 0xa8(%rsp), %rdi
callq 0xd490
leaq 0x28(%rsp), %rdi
callq 0x46e8
leaq 0x50(%rsp), %rdi
callq 0x46e8
leaq 0x4f(%rsp), %rdi
callq 0x43b0
leaq 0x88(%rsp), %rdi
callq 0x46e8
leaq 0x87(%rsp), %rdi
callq 0x43b0
jmp 0x4061f
jmp 0x405ea
leaq 0x138(%rsp), %rdi
xorl %esi, %esi
callq 0x30e00
movq %rax, 0x20(%rsp)
jmp 0x403a9
jmp 0x40605
leaq 0x150(%rsp), %rdi
callq 0x30c20
jmp 0x4035d
addq $0x168, %rsp            # imm = 0x168
retq
movq 0x78(%rsp), %rdi
callq 0x45f0
nopl (%rax)