// File: /workspace/github_cpp_makefile_star2_O2/Merulo[P]CompilerJFTT/src/IRs/ThirdIR.cpp
// Function: ThirdIR::legalizeJumps()
void ThirdIR::legalizeJumps()
{
    for (size_t i = 0; i < _blocks.size(); i++)
    {
        if (!_blocks[i].blockJump.empty())
        {
            Line l;
            l.operation = "JUMP";
            l.two = "#" + _blocks[i].blockJump;
            _blocks[i].lines.push_back(l);
            continue;
        }
        if (_blocks[i].lines.back().operation == "JLS")
        {
            legalizeJLS(_blocks[i], false);
        }
        if(_blocks[i].lines.back().operation == "JMR")
        {
            legalizeJMR(_blocks[i], false);
        }
        if (_blocks[i].lines.back().operation == "JLE")
        {
            legalizeJLS(_blocks[i], true);
        }
        if(_blocks[i].lines.back().operation == "JME")
        {
            legalizeJMR(_blocks[i], true);
        }
        if(_blocks[i].lines.back().operation == "JEQ")
        {
            legalizeEquality(_blocks[i]);
        }
        if(_blocks[i].lines.back().operation == "JNE")
        {
            std::swap(_blocks[i].blockIfFalse, _blocks[i].blockIfTrue);
            legalizeEquality(_blocks[i]);
        }           
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdi, %rbx
xorl %r14d, %r14d
movq %rsp, %r15
leaq 0x68(%rsp), %r13
xorl %r12d, %r12d
xorl %ebp, %ebp
movq 0x10(%rbx), %rcx
movq 0x18(%rbx), %rax
subq %rcx, %rax
cqto
movl $0xa0, %esi
idivq %rsi
cmpq %rax, %rbp
jae 0x1c805
cmpq $0x0, 0x80(%rcx,%r12)
je 0x1c6cf
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
andq $0x0, 0x8(%rsp)
movb %r14b, 0x10(%rsp)
leaq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
andq $0x0, 0x28(%rsp)
movb %r14b, 0x30(%rsp)
leaq 0x50(%rsp), %rax
movq %rax, 0x40(%rsp)
andq $0x0, 0x48(%rsp)
movb %r14b, 0x50(%rsp)
movq %r15, %rdi
leaq 0x6b13(%rip), %rsi      # 0x2318c
callq 0x44e0
movq 0x10(%rbx), %rax
leaq (%rax,%r12), %rdx
addq $0x78, %rdx
movq %r13, %rdi
leaq 0x6ec7(%rip), %rsi      # 0x2355b
callq 0x4acd
leaq 0x40(%rsp), %rdi
movq %r13, %rsi
callq 0x4340
movq %r13, %rdi
callq 0x4548
movq 0x10(%rbx), %rax
leaq (%rax,%r12), %rdi
addq $0x20, %rdi
movq %r15, %rsi
callq 0x13a3e
movq %r15, %rdi
callq 0x81fe
jmp 0x1c7f6
movq 0x28(%rcx,%r12), %rdi
addq $-0x68, %rdi
leaq 0x6f38(%rip), %rsi      # 0x23617
callq 0x8453
testb %al, %al
je 0x1c6f9
movq 0x10(%rbx), %rsi
addq %r12, %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x1c8fc
movq 0x10(%rbx), %rax
movq 0x28(%rax,%r12), %rdi
addq $-0x68, %rdi
leaq 0x6f0e(%rip), %rsi      # 0x2361b
callq 0x8453
testb %al, %al
je 0x1c727
movq 0x10(%rbx), %rsi
addq %r12, %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x1ca8a
movq 0x10(%rbx), %rax
movq 0x28(%rax,%r12), %rdi
addq $-0x68, %rdi
leaq 0x6ee4(%rip), %rsi      # 0x2361f
callq 0x8453
testb %al, %al
je 0x1c756
movq 0x10(%rbx), %rsi
addq %r12, %rsi
movq %rbx, %rdi
pushq $0x1
popq %rdx
callq 0x1c8fc
movq 0x10(%rbx), %rax
movq 0x28(%rax,%r12), %rdi
addq $-0x68, %rdi
leaq 0x6eb9(%rip), %rsi      # 0x23623
callq 0x8453
testb %al, %al
je 0x1c785
movq 0x10(%rbx), %rsi
addq %r12, %rsi
movq %rbx, %rdi
pushq $0x1
popq %rdx
callq 0x1ca8a
movq 0x10(%rbx), %rax
movq 0x28(%rax,%r12), %rdi
addq $-0x68, %rdi
leaq 0x6e8e(%rip), %rsi      # 0x23627
callq 0x8453
testb %al, %al
je 0x1c7b1
movq 0x10(%rbx), %rsi
addq %r12, %rsi
movq %rbx, %rdi
callq 0x1cbf6
movq 0x10(%rbx), %rax
movq 0x28(%rax,%r12), %rdi
addq $-0x68, %rdi
leaq 0x6e66(%rip), %rsi      # 0x2362b
callq 0x8453
testb %al, %al
je 0x1c7f6
movq 0x10(%rbx), %rax
leaq (%rax,%r12), %rdi
addq $0x58, %rdi
leaq (%rax,%r12), %rsi
addq $0x38, %rsi
callq 0x41f0
movq 0x10(%rbx), %rsi
addq %r12, %rsi
movq %rbx, %rdi
callq 0x1cbf6
incq %rbp
addq $0xa0, %r12
jmp 0x1c604
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1c819
movq %rax, %rbx
movq %rsp, %rdi
callq 0x81fe
movq %rbx, %rdi
callq 0x4490