// File: /workspace/github_cpp_makefile_star2_O3/Merulo[P]CompilerJFTT/src/IRs/FourthIR.cpp
// Function: FourthIR::handleDirectTranslation(RegisterBlock&, Block&, Line&)
void FourthIR::handleDirectTranslation(RegisterBlock& rb, Block& b, Line& l)
{   
    Register& regOne = rb.getRegister(l.one, b, {}, true, true);
    updateRegisterState(b, rb, regOne, l.one);
    regOne.variableName = l.one;
    regOne.needToSafe = true;

    if (l.one == l.two && l.operation == "ADD")
    {
        b.lines.push_back({l.operation, regOne.name, regOne.name});
        return;
    }

    Register& regTwo = rb.getRegister(l.two, b, {regOne}, false, true);
    updateRegisterState(b, rb, regTwo, l.two);
    regTwo.variableName = l.two;

    b.lines.push_back({l.operation, regOne.name, regTwo.name});  

    if (_symbolTable->isConst(l.two) && _removeConsts)
    {
        regTwo.variableName = "";
        regTwo.state = RegisterState::UNKNOWN;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
movq %rcx, %r14
movq %rdx, %r13
movq %rsi, %r12
movq %rdi, 0x8(%rsp)
leaq 0x1a0(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x20(%rcx), %rsi
movq 0x28(%rcx), %rdx
addq %rsi, %rdx
leaq 0x190(%rsp), %rbx
movq %rbx, %rdi
callq 0xc7aa
xorps %xmm0, %xmm0
leaq 0x130(%rsp), %rcx
movaps %xmm0, (%rcx)
movq $0x0, 0x10(%rcx)
movq %r12, %rdi
movq %rbx, %rsi
movq %r13, 0x10(%rsp)
movq %r13, %rdx
movl $0x1, %r8d
movl $0x1, %r9d
callq 0x7b6c
movq %rax, %r13
movq 0x130(%rsp), %rdi
testq %rdi, %rdi
je 0x260c9
movq 0x140(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
movq 0x190(%rsp), %rdi
cmpq %r15, %rdi
je 0x260e6
movq 0x1a0(%rsp), %rsi
incq %rsi
callq 0x42a0
leaq 0x180(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x20(%r14), %rsi
movq 0x28(%r14), %rdx
addq %rsi, %rdx
leaq 0x170(%rsp), %rbx
movq %rbx, %rdi
callq 0xc7aa
movq 0x8(%rsp), %rdi
movq %r13, %rcx
movq %rbx, %r8
callq 0x28c64
leaq 0x20(%r14), %rbp
movq 0x170(%rsp), %rdi
cmpq %r15, %rdi
je 0x2613e
movq 0x180(%rsp), %rsi
incq %rsi
callq 0x42a0
movq %r13, %rdi
addq $0x30, %rdi
movq %rbp, %rsi
callq 0x4170
movb $0x1, 0x50(%r13)
leaq 0x40(%r14), %rbx
movq 0x28(%r14), %r15
movq 0x48(%r14), %rdx
cmpq %rdx, %r15
jne 0x26199
testq %r15, %r15
je 0x2617e
movq (%rbx), %rsi
movq (%rbp), %rdi
movq %r15, %rdx
callq 0x42b0
movq %r15, %rdx
testl %eax, %eax
jne 0x26199
leaq 0x10f1d(%rip), %rsi     # 0x370a2
movq %r14, %rdi
callq 0x40d0
testl %eax, %eax
je 0x26481
movq 0x48(%r14), %rdx
leaq 0xc0(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rbx), %rsi
addq %rsi, %rdx
leaq 0xb0(%rsp), %rdi
callq 0xc7aa
leaq 0x1b0(%rsp), %rsi
movq %r13, (%rsi)
leaq 0x38(%rsp), %rdi
leaq 0x7(%rsp), %rcx
movl $0x1, %edx
callq 0xc082
leaq 0xb0(%rsp), %rsi
leaq 0x38(%rsp), %rcx
movq %r12, %rdi
movq 0x10(%rsp), %rdx
xorl %r8d, %r8d
movl $0x1, %r9d
callq 0x7b6c
movq %rax, %r12
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x26214
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
movq 0xb0(%rsp), %rdi
cmpq %r15, %rdi
je 0x26231
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x42a0
leaq 0x160(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq 0x40(%r14), %rsi
movq 0x48(%r14), %rdx
addq %rsi, %rdx
leaq 0x150(%rsp), %r15
movq %r15, %rdi
callq 0xc7aa
movq 0x8(%rsp), %rdi
movq %r12, %rcx
movq %r15, %r8
callq 0x28c64
movq 0x150(%rsp), %rdi
cmpq %rbp, %rdi
je 0x26285
movq 0x160(%rsp), %rsi
incq %rsi
callq 0x42a0
movq %r12, %rbp
addq $0x30, %rbp
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x4170
leaq 0xa0(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0x90(%rsp), %rdi
callq 0xc7aa
leaq 0x80(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq 0x10(%r13), %rsi
movq 0x18(%r13), %rdx
addq %rsi, %rdx
leaq 0x70(%rsp), %rdi
callq 0xc7aa
leaq 0x60(%rsp), %r13
movq %r13, -0x10(%r13)
movq 0x10(%r12), %rsi
movq 0x18(%r12), %rdx
addq %rsi, %rdx
leaq 0x50(%rsp), %rdi
callq 0xc7aa
leaq 0x1b0(%rsp), %rdi
leaq 0x90(%rsp), %rsi
leaq 0x70(%rsp), %rdx
leaq 0x50(%rsp), %rcx
callq 0xbbea
movq 0x10(%rsp), %rdi
addq $0x20, %rdi
leaq 0x1b0(%rsp), %rsi
callq 0xccac
leaq 0x200(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x26351
movq 0x200(%rsp), %rsi
incq %rsi
callq 0x42a0
leaq 0x1e0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x26372
movq 0x1e0(%rsp), %rsi
incq %rsi
callq 0x42a0
leaq 0x1c0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x26393
movq 0x1c0(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x50(%rsp), %rdi
cmpq %r13, %rdi
je 0x263aa
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x70(%rsp), %rdi
cmpq %rbx, %rdi
je 0x263c4
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x90(%rsp), %rdi
cmpq %r15, %rdi
je 0x263e1
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x8(%rsp), %rax
movq (%rax), %rbx
leaq 0x28(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x40(%r14), %rsi
movq 0x48(%r14), %rdx
addq %rsi, %rdx
leaq 0x18(%rsp), %r14
movq %r14, %rdi
callq 0xc7aa
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1a6f8
testb %al, %al
je 0x26469
movq 0x8(%rsp), %rax
movb 0xd0(%rax), %bl
movq 0x18(%rsp), %rdi
cmpq %r15, %rdi
je 0x2643b
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x42a0
testb %bl, %bl
je 0x265e1
movq 0x38(%r12), %rdx
leaq 0x10c94(%rip), %rcx     # 0x370e3
movq %rbp, %rdi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0x4440
movl $0x0, (%r12)
jmp 0x265e1
movq 0x18(%rsp), %rdi
cmpq %r15, %rdi
je 0x265e1
movq 0x28(%rsp), %rsi
jmp 0x265d9
leaq 0x120(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0x110(%rsp), %rdi
callq 0xc7aa
leaq 0x100(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x10(%r13), %rsi
movq 0x18(%r13), %rdx
addq %rsi, %rdx
leaq 0xf0(%rsp), %rdi
callq 0xc7aa
leaq 0xe0(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq 0x10(%r13), %rsi
movq 0x18(%r13), %rdx
addq %rsi, %rdx
leaq 0xd0(%rsp), %rdi
callq 0xc7aa
leaq 0x1b0(%rsp), %rdi
leaq 0x110(%rsp), %rsi
leaq 0xf0(%rsp), %rdx
leaq 0xd0(%rsp), %rcx
callq 0xbbea
movq 0x10(%rsp), %rdi
addq $0x20, %rdi
leaq 0x1b0(%rsp), %rsi
callq 0xccac
leaq 0x200(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x26548
movq 0x200(%rsp), %rsi
incq %rsi
callq 0x42a0
leaq 0x1e0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x26569
movq 0x1e0(%rsp), %rsi
incq %rsi
callq 0x42a0
leaq 0x1c0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2658a
movq 0x1c0(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0xd0(%rsp), %rdi
cmpq %rbx, %rdi
je 0x265a7
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0xf0(%rsp), %rdi
cmpq %r14, %rdi
je 0x265c4
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x110(%rsp), %rdi
cmpq %r15, %rdi
je 0x265e1
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x42a0
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r12
leaq 0x1b0(%rsp), %rdi
callq 0xbca2
jmp 0x26608
movq %rax, %r12
movq 0xd0(%rsp), %rdi
cmpq %rbx, %rdi
je 0x2662a
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x2662a
movq %rax, %r12
movq 0xf0(%rsp), %rdi
cmpq %r14, %rdi
je 0x2664c
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x2664c
movq %rax, %r12
movq 0x110(%rsp), %rdi
cmpq %r15, %rdi
je 0x267a1
movq 0x120(%rsp), %rsi
jmp 0x26799
movq %rax, %r12
movq 0x18(%rsp), %rdi
cmpq %r15, %rdi
je 0x267a1
movq 0x28(%rsp), %rsi
jmp 0x26799
movq %rax, %r12
leaq 0x1b0(%rsp), %rdi
callq 0xbca2
jmp 0x2669a
movq %rax, %r12
movq 0x50(%rsp), %rdi
cmpq %r13, %rdi
je 0x266b6
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x266b6
movq %rax, %r12
movq 0x70(%rsp), %rdi
cmpq %rbx, %rdi
je 0x266d5
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x266d5
movq %rax, %r12
movq 0x90(%rsp), %rdi
cmpq %r15, %rdi
je 0x267a1
movq 0xa0(%rsp), %rsi
jmp 0x26799
movq %rax, %r12
movq 0x150(%rsp), %rdi
cmpq %rbp, %rdi
je 0x267a1
movq 0x160(%rsp), %rsi
jmp 0x26799
movq %rax, %r12
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x26733
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
jmp 0x26733
movq %rax, %r12
movq 0xb0(%rsp), %rdi
cmpq %r15, %rdi
je 0x267a1
movq 0xc0(%rsp), %rsi
jmp 0x26799
movq %rax, %r12
movq 0x170(%rsp), %rdi
cmpq %r15, %rdi
je 0x267a1
movq 0x180(%rsp), %rsi
jmp 0x26799
movq %rax, %r12
movq 0x130(%rsp), %rdi
testq %rdi, %rdi
je 0x26784
movq 0x140(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
movq 0x190(%rsp), %rdi
cmpq %r15, %rdi
je 0x267a1
movq 0x1a0(%rsp), %rsi
incq %rsi
callq 0x42a0
movq %r12, %rdi
callq 0x44c0
nop