// File: /workspace/github_cpp_makefile_star2_O1/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 0xca12
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 0x7d06
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x25dc3
movq 0xe0(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
movq 0x130(%rsp), %rdi
cmpq %r14, %rdi
je 0x25de0
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 0xca12
movq 0x8(%rsp), %rdi
movq %rbx, %rcx
movq %r14, %r8
callq 0x28ed2
leaq 0x40(%r13), %r14
movq 0x110(%rsp), %rdi
cmpq %r12, %rdi
je 0x25e39
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 0xca12
leaq 0x150(%rsp), %rsi
movq %rbx, (%rsi)
leaq 0x38(%rsp), %rdi
leaq 0x7(%rsp), %rcx
movl $0x1, %edx
callq 0xc2ee
leaq 0xb0(%rsp), %rsi
leaq 0x38(%rsp), %rcx
movq %r15, %rdi
movq 0x10(%rsp), %rdx
movl $0x1, %r8d
xorl %r9d, %r9d
callq 0x7d06
movq %rax, %r15
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x25ecb
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
movq 0xb0(%rsp), %rdi
cmpq %r14, %rdi
je 0x25ee8
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 0xca12
movq 0x8(%rsp), %rdi
movq %r15, %rcx
movq %r14, %r8
callq 0x28ed2
leaq 0x20(%r13), %r14
movq 0xf0(%rsp), %rdi
cmpq %r12, %rdi
je 0x25f41
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 0xca12
movq %r14, %rdi
movq %r13, %rsi
callq 0x1a9b6
testb %al, %al
je 0x25fd6
movq 0x8(%rsp), %rax
movb 0xd0(%rax), %r14b
movq 0x18(%rsp), %rdi
cmpq %r12, %rdi
je 0x25fb1
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x42a0
testb %r14b, %r14b
je 0x25fed
movq 0x38(%rbx), %rdx
leaq 0x12122(%rip), %rcx     # 0x380e3
movq %rbp, %rdi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0x4440
movl $0x0, (%rbx)
jmp 0x25fed
movq 0x18(%rsp), %rdi
cmpq %r12, %rdi
je 0x25fed
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x42a0
leaq 0xa0(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x120c5(%rip), %rsi     # 0x380c5
leaq 0x120c2(%rip), %rdx     # 0x380c9
leaq 0x90(%rsp), %rdi
callq 0x54fc
leaq 0x80(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x10(%r15), %rsi
movq 0x18(%r15), %rdx
addq %rsi, %rdx
leaq 0x70(%rsp), %rdi
callq 0xca12
leaq 0x60(%rsp), %r13
movq %r13, -0x10(%r13)
movq 0x10(%rbx), %rsi
movq 0x18(%rbx), %rdx
addq %rsi, %rdx
leaq 0x50(%rsp), %rdi
callq 0xca12
leaq 0x150(%rsp), %rdi
leaq 0x90(%rsp), %rsi
leaq 0x70(%rsp), %rdx
leaq 0x50(%rsp), %rcx
callq 0xbe58
movq 0x10(%rsp), %rdi
addq $0x20, %rdi
leaq 0x150(%rsp), %rsi
callq 0xcf0e
leaq 0x1a0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x260aa
movq 0x1a0(%rsp), %rsi
incq %rsi
callq 0x42a0
leaq 0x180(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x260cb
movq 0x180(%rsp), %rsi
incq %rsi
callq 0x42a0
leaq 0x160(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x260ec
movq 0x160(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x50(%rsp), %rdi
cmpq %r13, %rdi
je 0x26103
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x70(%rsp), %rdi
cmpq %r12, %rdi
je 0x2611d
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x90(%rsp), %rdi
cmpq %r14, %rdi
je 0x2613a
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 0xbf10
jmp 0x26169
movq %rax, %rbx
movq 0x50(%rsp), %rdi
cmpq %r13, %rdi
je 0x26185
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x26185
movq %rax, %rbx
movq 0x70(%rsp), %rdi
cmpq %r12, %rdi
je 0x261a4
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x261a4
movq %rax, %rbx
movq 0x90(%rsp), %rdi
cmpq %r14, %rdi
je 0x26293
movq 0xa0(%rsp), %rsi
jmp 0x2628b
movq %rax, %rbx
jmp 0x26293
movq %rax, %rbx
movq 0x18(%rsp), %rdi
cmpq %r12, %rdi
je 0x26293
movq 0x28(%rsp), %rsi
jmp 0x2628b
movq %rax, %rbx
movq 0xf0(%rsp), %rdi
cmpq %r12, %rdi
je 0x26293
movq 0x100(%rsp), %rsi
jmp 0x2628b
movq %rax, %rbx
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x26225
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
jmp 0x26225
movq %rax, %rbx
movq 0xb0(%rsp), %rdi
cmpq %r14, %rdi
je 0x26293
movq 0xc0(%rsp), %rsi
jmp 0x2628b
movq %rax, %rbx
movq 0x110(%rsp), %rdi
cmpq %r12, %rdi
je 0x26293
movq 0x120(%rsp), %rsi
jmp 0x2628b
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x26276
movq 0xe0(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
movq 0x130(%rsp), %rdi
cmpq %r14, %rdi
je 0x26293
movq 0x140(%rsp), %rsi
incq %rsi
callq 0x42a0
movq %rbx, %rdi
callq 0x44c0
nop