// File: /workspace/github_cpp_makefile_star2_O1/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 0x2f0f6
xorb $0x1, %al
orb %bpl, %al
je 0x2e256
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2f0f6
andb %bpl, %al
cmpb $0x1, %al
jne 0x2e283
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 0x2fbd0
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 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 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
addq %rsi, %rdx
leaq 0xa8(%rsp), %rdi
callq 0xca12
leaq 0x98(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x20(%rsp), %rsi
movq 0x28(%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 0x2e38d
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0xa8(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e3aa
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 0x2e3f4
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x42a0
leaq 0xd8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2e415
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x2e431
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x20(%rsp), %rdi
cmpq %r13, %rdi
je 0x2e448
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x42a0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x2e463
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 0x2e494
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x2e494
movq %rax, %rbx
leaq 0xd8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2e4f6
movq 0xd8(%rsp), %rsi
jmp 0x2e4e9
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r12, %rdi
je 0x2e4d4
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x2e4d4
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e4f6
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x2e4f6
movq %rax, %rbx
movq %rsp, %rdi
callq 0xbf10
movq %rbx, %rdi
callq 0x44c0
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r13, %rdi
je 0x2e525
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x2e525
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x2e4fe
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x2e4fe