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

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

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

    b.lines.push_back({"COPY", regOne.name, regTwo.name});  

    regOne.constValue = regTwo.constValue;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movq %rcx, %r13
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, 0x8(%rsp)
leaq 0x140(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x40(%rcx), %rsi
movq 0x48(%rcx), %rdx
addq %rsi, %rdx
leaq 0x130(%rsp), %rbx
movq %rbx, %rdi
callq 0xc7aa
xorps %xmm0, %xmm0
leaq 0xd0(%rsp), %rcx
movaps %xmm0, (%rcx)
movq $0x0, 0x10(%rcx)
movq %r15, %rdi
movq %rbx, %rsi
movq %r12, 0x10(%rsp)
movq %r12, %rdx
movl $0x1, %r8d
movl $0x1, %r9d
callq 0x7b6c
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x25b55
movq 0xe0(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
movq 0x130(%rsp), %rdi
cmpq %r14, %rdi
je 0x25b72
movq 0x140(%rsp), %rsi
incq %rsi
callq 0x42a0
leaq 0x120(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x40(%r13), %rsi
movq 0x48(%r13), %rdx
addq %rsi, %rdx
leaq 0x110(%rsp), %r14
movq %r14, %rdi
callq 0xc7aa
movq 0x8(%rsp), %rdi
movq %rbx, %rcx
movq %r14, %r8
callq 0x28c64
leaq 0x40(%r13), %r14
movq 0x110(%rsp), %rdi
cmpq %r12, %rdi
je 0x25bcb
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x42a0
movq %rbx, %rbp
addq $0x30, %rbp
movq %rbp, %rdi
movq %r14, %rsi
callq 0x4170
leaq 0xc0(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x20(%r13), %rsi
movq 0x28(%r13), %rdx
addq %rsi, %rdx
leaq 0xb0(%rsp), %rdi
callq 0xc7aa
leaq 0x150(%rsp), %rsi
movq %rbx, (%rsi)
leaq 0x38(%rsp), %rdi
leaq 0x7(%rsp), %rcx
movl $0x1, %edx
callq 0xc082
leaq 0xb0(%rsp), %rsi
leaq 0x38(%rsp), %rcx
movq %r15, %rdi
movq 0x10(%rsp), %rdx
movl $0x1, %r8d
xorl %r9d, %r9d
callq 0x7b6c
movq %rax, %r15
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x25c5d
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
movq 0xb0(%rsp), %rdi
cmpq %r14, %rdi
je 0x25c7a
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x42a0
leaq 0x100(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x20(%r13), %rsi
movq 0x28(%r13), %rdx
addq %rsi, %rdx
leaq 0xf0(%rsp), %r14
movq %r14, %rdi
callq 0xc7aa
movq 0x8(%rsp), %rdi
movq %r15, %rcx
movq %r14, %r8
callq 0x28c64
leaq 0x20(%r13), %r14
movq 0xf0(%rsp), %rdi
cmpq %r12, %rdi
je 0x25cd3
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x42a0
movq %r15, %rdi
addq $0x30, %rdi
movq %r14, %rsi
callq 0x4170
movb $0x1, 0x50(%r15)
movq 0x8(%rsp), %rax
movq (%rax), %r14
leaq 0x28(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x40(%r13), %rsi
movq 0x48(%r13), %rdx
addq %rsi, %rdx
leaq 0x18(%rsp), %r13
movq %r13, %rdi
callq 0xc7aa
movq %r14, %rdi
movq %r13, %rsi
callq 0x1a6f8
testb %al, %al
je 0x25d68
movq 0x8(%rsp), %rax
movb 0xd0(%rax), %r14b
movq 0x18(%rsp), %rdi
cmpq %r12, %rdi
je 0x25d43
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x42a0
testb %r14b, %r14b
je 0x25d7f
movq 0x38(%rbx), %rdx
leaq 0x11390(%rip), %rcx     # 0x370e3
movq %rbp, %rdi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0x4440
movl $0x0, (%rbx)
jmp 0x25d7f
movq 0x18(%rsp), %rdi
cmpq %r12, %rdi
je 0x25d7f
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x42a0
leaq 0xa0(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x11333(%rip), %rsi     # 0x370c5
leaq 0x11330(%rip), %rdx     # 0x370c9
leaq 0x90(%rsp), %rdi
callq 0x53cc
leaq 0x80(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x10(%r15), %rsi
movq 0x18(%r15), %rdx
addq %rsi, %rdx
leaq 0x70(%rsp), %rdi
callq 0xc7aa
leaq 0x60(%rsp), %r13
movq %r13, -0x10(%r13)
movq 0x10(%rbx), %rsi
movq 0x18(%rbx), %rdx
addq %rsi, %rdx
leaq 0x50(%rsp), %rdi
callq 0xc7aa
leaq 0x150(%rsp), %rdi
leaq 0x90(%rsp), %rsi
leaq 0x70(%rsp), %rdx
leaq 0x50(%rsp), %rcx
callq 0xbbea
movq 0x10(%rsp), %rdi
addq $0x20, %rdi
leaq 0x150(%rsp), %rsi
callq 0xccac
leaq 0x1a0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x25e3c
movq 0x1a0(%rsp), %rsi
incq %rsi
callq 0x42a0
leaq 0x180(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x25e5d
movq 0x180(%rsp), %rsi
incq %rsi
callq 0x42a0
leaq 0x160(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x25e7e
movq 0x160(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x50(%rsp), %rdi
cmpq %r13, %rdi
je 0x25e95
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x70(%rsp), %rdi
cmpq %r12, %rdi
je 0x25eaf
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x90(%rsp), %rdi
cmpq %r14, %rdi
je 0x25ecc
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x8(%rbx), %rax
movq %rax, 0x8(%r15)
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x150(%rsp), %rdi
callq 0xbca2
jmp 0x25efb
movq %rax, %rbx
movq 0x50(%rsp), %rdi
cmpq %r13, %rdi
je 0x25f17
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x25f17
movq %rax, %rbx
movq 0x70(%rsp), %rdi
cmpq %r12, %rdi
je 0x25f36
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x25f36
movq %rax, %rbx
movq 0x90(%rsp), %rdi
cmpq %r14, %rdi
je 0x26025
movq 0xa0(%rsp), %rsi
jmp 0x2601d
movq %rax, %rbx
jmp 0x26025
movq %rax, %rbx
movq 0x18(%rsp), %rdi
cmpq %r12, %rdi
je 0x26025
movq 0x28(%rsp), %rsi
jmp 0x2601d
movq %rax, %rbx
movq 0xf0(%rsp), %rdi
cmpq %r12, %rdi
je 0x26025
movq 0x100(%rsp), %rsi
jmp 0x2601d
movq %rax, %rbx
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x25fb7
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
jmp 0x25fb7
movq %rax, %rbx
movq 0xb0(%rsp), %rdi
cmpq %r14, %rdi
je 0x26025
movq 0xc0(%rsp), %rsi
jmp 0x2601d
movq %rax, %rbx
movq 0x110(%rsp), %rdi
cmpq %r12, %rdi
je 0x26025
movq 0x120(%rsp), %rsi
jmp 0x2601d
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x26008
movq 0xe0(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
movq 0x130(%rsp), %rdi
cmpq %r14, %rdi
je 0x26025
movq 0x140(%rsp), %rsi
incq %rsi
callq 0x42a0
movq %rbx, %rdi
callq 0x44c0
nop