// File: /workspace/github_cpp_makefile_star2_O3/Merulo[P]CompilerJFTT/src/IRs/ThirdIR.cpp
// Function: ThirdIR::calculateDiff(Block&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool)
std::string ThirdIR::calculateDiff(Block& b, std::string one, std::string two, bool inc)
{
    std::string var = _symbolTable->getExtraVariable();
    
    Line copyLine;
    copyLine.operation = "COPY";
    copyLine.one = var;
    copyLine.two = one;
    b.lines.push_back(copyLine);
    
    if (inc)
    {
        Line incLine;
        incLine.operation = "INC";
        incLine.one = var;
        b.lines.push_back(incLine);
    }

    Line subLine;
    subLine.operation = "SUB";
    subLine.one = var;
    subLine.two = two;
    b.lines.push_back(subLine);    

    return var;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movl %r9d, %ebp
movq %r8, %r15
movq %rcx, %r12
movq %rdx, %r14
movq %rdi, %rbx
movq (%rsi), %rsi
callq 0x1b20a
leaq 0x80(%rsp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0xa0(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0xc0(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x87cc(%rip), %rcx      # 0x370c5
leaq 0x70(%rsp), %rdi
movl $0x4, %r8d
xorl %esi, %esi
xorl %edx, %edx
callq 0x4440
leaq 0x90(%rsp), %rdi
movq %rbx, %rsi
callq 0x4170
leaq 0xb0(%rsp), %rdi
movq %r12, %rsi
callq 0x4170
addq $0x20, %r14
leaq 0x70(%rsp), %rsi
movq %r14, %rdi
callq 0x1f6f6
leaq 0x18(%rsp), %r12
testb %bpl, %bpl
je 0x2e9f4
leaq 0x38(%rsp), %rbp
movq %r12, -0x30(%rbp)
xorl %eax, %eax
movq %rax, -0x28(%rbp)
movb %al, -0x20(%rbp)
movq %rbp, -0x10(%rbp)
movq %rax, -0x8(%rbp)
movb %al, (%rbp)
leaq 0x58(%rsp), %r13
movq %r13, -0x10(%r13)
movq %rax, -0x8(%r13)
movb %al, (%r13)
leaq 0x871d(%rip), %rcx      # 0x3709e
leaq 0x8(%rsp), %rdi
movl $0x3, %r8d
xorl %esi, %esi
xorl %edx, %edx
callq 0x4440
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq 0x4170
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x1f6f6
movq 0x48(%rsp), %rdi
cmpq %r13, %rdi
je 0x2e9c6
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x2e9dd
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x2e9f4
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x42a0
leaq 0x38(%rsp), %rbp
movq %r12, -0x30(%rbp)
xorl %eax, %eax
movq %rax, -0x28(%rbp)
movb %al, -0x20(%rbp)
movq %rbp, -0x10(%rbp)
movq %rax, -0x8(%rbp)
movb %al, (%rbp)
leaq 0x58(%rsp), %r13
movq %r13, -0x10(%r13)
movq %rax, -0x8(%r13)
movb %al, (%r13)
leaq 0x866d(%rip), %rcx      # 0x37096
leaq 0x8(%rsp), %rdi
movl $0x3, %r8d
xorl %esi, %esi
xorl %edx, %edx
callq 0x4440
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq 0x4170
leaq 0x48(%rsp), %rdi
movq %r15, %rsi
callq 0x4170
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x1f6f6
movq 0x48(%rsp), %rdi
cmpq %r13, %rdi
je 0x2ea7b
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
leaq 0x80(%rsp), %r14
leaq 0xa0(%rsp), %r13
je 0x2eaa2
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x2eab9
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0xb0(%rsp), %rdi
leaq 0xc0(%rsp), %rax
cmpq %rax, %rdi
je 0x2eade
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x90(%rsp), %rdi
cmpq %r13, %rdi
je 0x2eafb
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x70(%rsp), %rdi
cmpq %r14, %rdi
je 0x2eb15
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x42a0
movq %rbx, %rax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2eb2c
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0xbca2
jmp 0x2eb3e
movq %rax, %r14
leaq 0x70(%rsp), %rdi
callq 0xbca2
movq (%rbx), %rdi
addq $0x10, %rbx
cmpq %rbx, %rdi
je 0x2eb5f
movq (%rbx), %rsi
incq %rsi
callq 0x42a0
movq %r14, %rdi
callq 0x44c0
nop