// File: /workspace/github_cpp_makefile_star2_O3/Merulo[P]CompilerJFTT/src/IRs/ThirdIR.cpp
// Function: ThirdIR::legalizeJLS(Block&, bool)
void ThirdIR::legalizeJLS(Block& b, bool inc)
{
    if (checkZeroJump(b) && !inc)
    {
        std::swap(b.lines.back().one, b.lines.back().two);
        legalizeJumpWithZero(b);
        return;
    }
    if (checkZeroJump(b) && inc)
    {
        std::swap(b.lines.back().one, b.lines.back().two);
        legalizeJumpWithEqualZero(b);
        return;
    }
    Line lastLine = b.lines.back();
    b.lines.pop_back();

    std::string var = calculateDiff(b, lastLine.two, lastLine.one, 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 0x2edc6
xorb $0x1, %al
orb %bpl, %al
je 0x2df26
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2edc6
andb %bpl, %al
cmpb $0x1, %al
jne 0x2df53
movq 0x28(%rbx), %rsi
leaq -0x48(%rsi), %rdi
addq $-0x28, %rsi
callq 0x41f0
movq %r14, %rdi
movq %rbx, %rsi
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2f86a
movq 0x28(%rbx), %rsi
leaq -0x48(%rsi), %rdi
addq $-0x28, %rsi
callq 0x41f0
movq %r14, %rdi
movq %rbx, %rsi
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2f2c0
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 0xc7aa
leaq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %r13
movq %r13, -0x10(%r13)
movq -0x48(%r15), %rsi
movq -0x40(%r15), %rdx
addq %rsi, %rdx
callq 0xc7aa
leaq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
movq -0x28(%r15), %rsi
movq -0x20(%r15), %rdx
addq %rsi, %rdx
callq 0xc7aa
leaq 0x20(%rbx), %rdi
movl -0x8(%r15), %eax
movl %eax, 0x60(%rsp)
movq 0x28(%rbx), %rsi
addq $-0x68, %rsi
movq %rsi, 0x28(%rbx)
callq 0xced4
leaq 0xb8(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
addq %rsi, %rdx
leaq 0xa8(%rsp), %rdi
callq 0xc7aa
leaq 0x98(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
addq %rsi, %rdx
leaq 0x88(%rsp), %rdi
callq 0xc7aa
movzbl %bpl, %r9d
leaq 0xc8(%rsp), %rdi
leaq 0xa8(%rsp), %rcx
leaq 0x88(%rsp), %r8
movq %r14, %rsi
movq %rbx, %rdx
callq 0x2e892
movq 0x88(%rsp), %rdi
cmpq %r12, %rdi
je 0x2e05d
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0xa8(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e07a
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 0xc7aa
leaq 0x68(%rsp), %rdx
movq %rbx, %rsi
callq 0x2eb68
movq 0x68(%rsp), %rdi
cmpq %r14, %rdi
je 0x2e0c4
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x42a0
leaq 0xd8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2e0e5
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x2e101
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x20(%rsp), %rdi
cmpq %r13, %rdi
je 0x2e118
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x42a0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x2e133
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 0x2e164
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x2e164
movq %rax, %rbx
leaq 0xd8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2e1c6
movq 0xd8(%rsp), %rsi
jmp 0x2e1b9
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r12, %rdi
je 0x2e1a4
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x2e1a4
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e1c6
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x2e1c6
movq %rax, %rbx
movq %rsp, %rdi
callq 0xbca2
movq %rbx, %rdi
callq 0x44c0
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r13, %rdi
je 0x2e1f5
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x2e1f5
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x2e1ce
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x2e1ce