// File: /workspace/github_cpp_makefile_star2_O1/Merulo[P]CompilerJFTT/src/IRs/ThirdIR.cpp
// Function: ThirdIR::legalizeJMR(Block&, bool)
void ThirdIR::legalizeJMR(Block& b, bool inc)
{
    if (checkZeroJump(b) && !inc)
    {
        legalizeJumpWithZero(b);
        return;
    }
    if (checkZeroJump(b) && inc)
    {
        legalizeJumpWithEqualZero(b);
        return;
    }

    Line lastLine = b.lines.back();
    b.lines.pop_back();

    std::string var = calculateDiff(b, lastLine.one, lastLine.two, inc);
    insertJumps(b, var);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
callq 0x2f0f6
xorb $0x1, %al
orb %bpl, %al
je 0x2e595
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2f0f6
andb %bpl, %al
cmpb $0x1, %al
jne 0x2e5b1
movq %r14, %rdi
movq %rbx, %rsi
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2fbd0
movq %r14, %rdi
movq %rbx, %rsi
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2f626
movq 0x28(%rbx), %r15
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
movq -0x68(%r15), %rsi
movq -0x60(%r15), %rdx
addq %rsi, %rdx
movq %rsp, %rdi
callq 0xca12
leaq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %r13
movq %r13, -0x10(%r13)
movq -0x48(%r15), %rsi
movq -0x40(%r15), %rdx
addq %rsi, %rdx
callq 0xca12
leaq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
movq -0x28(%r15), %rsi
movq -0x20(%r15), %rdx
addq %rsi, %rdx
callq 0xca12
leaq 0x20(%rbx), %rdi
movl -0x8(%r15), %eax
movl %eax, 0x60(%rsp)
movq 0x28(%rbx), %rsi
addq $-0x68, %rsi
movq %rsi, 0x28(%rbx)
callq 0xd12e
leaq 0xb8(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
addq %rsi, %rdx
leaq 0xa8(%rsp), %rdi
callq 0xca12
leaq 0x98(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
addq %rsi, %rdx
leaq 0x88(%rsp), %rdi
callq 0xca12
movzbl %bpl, %r9d
leaq 0xc8(%rsp), %rdi
leaq 0xa8(%rsp), %rcx
leaq 0x88(%rsp), %r8
movq %r14, %rsi
movq %rbx, %rdx
callq 0x2ebc2
movq 0x88(%rsp), %rdi
cmpq %r12, %rdi
je 0x2e6bb
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0xa8(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e6d8
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x42a0
leaq 0x78(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0xc8(%rsp), %rsi
movq 0xd0(%rsp), %rdx
addq %rsi, %rdx
leaq 0x68(%rsp), %rdi
callq 0xca12
leaq 0x68(%rsp), %rdx
movq %rbx, %rsi
callq 0x2ee98
movq 0x68(%rsp), %rdi
cmpq %r14, %rdi
je 0x2e722
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x42a0
leaq 0xd8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2e743
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x2e75f
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x20(%rsp), %rdi
cmpq %r13, %rdi
je 0x2e776
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x42a0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x2e791
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x42a0
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r14, %rdi
je 0x2e7c2
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x2e7c2
movq %rax, %rbx
leaq 0xd8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2e824
movq 0xd8(%rsp), %rsi
jmp 0x2e817
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r12, %rdi
je 0x2e802
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x2e802
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e824
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x2e824
movq %rax, %rbx
movq %rsp, %rdi
callq 0xbf10
movq %rbx, %rdi
callq 0x44c0
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r13, %rdi
je 0x2e853
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x2e853
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x2e82c
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x2e82c