// File: /workspace/github_cpp_makefile_star2_O1/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 0x1b4c8
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 0x949c(%rip), %rcx      # 0x380c5
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 0x1f9be
leaq 0x18(%rsp), %r12
testb %bpl, %bpl
je 0x2ed24
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 0x93ed(%rip), %rcx      # 0x3809e
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 0x1f9be
movq 0x48(%rsp), %rdi
cmpq %r13, %rdi
je 0x2ecf6
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x2ed0d
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x2ed24
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 0x933d(%rip), %rcx      # 0x38096
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 0x1f9be
movq 0x48(%rsp), %rdi
cmpq %r13, %rdi
je 0x2edab
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
leaq 0x80(%rsp), %r14
leaq 0xa0(%rsp), %r13
je 0x2edd2
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x2ede9
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0xb0(%rsp), %rdi
leaq 0xc0(%rsp), %rax
cmpq %rax, %rdi
je 0x2ee0e
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x90(%rsp), %rdi
cmpq %r13, %rdi
je 0x2ee2b
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x70(%rsp), %rdi
cmpq %r14, %rdi
je 0x2ee45
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 0x2ee5c
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0xbf10
jmp 0x2ee6e
movq %rax, %r14
leaq 0x70(%rsp), %rdi
callq 0xbf10
movq (%rbx), %rdi
addq $0x10, %rbx
cmpq %rbx, %rdi
je 0x2ee8f
movq (%rbx), %rsi
incq %rsi
callq 0x42a0
movq %r14, %rdi
callq 0x44c0
nop