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

    b.lines.push_back({"PUT", r.name});     
    updateRegisterState(b, rb, r, l.one);

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movq %rcx, %r15
movq %rdx, %r13
movq %rsi, %rbx
movq %rdi, %rbp
leaq 0xe0(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x20(%rcx), %rsi
movq 0x28(%rcx), %rdx
addq %rsi, %rdx
leaq 0xd0(%rsp), %r12
movq %r12, %rdi
callq 0xca12
xorps %xmm0, %xmm0
leaq 0x90(%rsp), %rcx
movaps %xmm0, (%rcx)
movq $0x0, 0x10(%rcx)
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
movl $0x1, %r8d
movl $0x1, %r9d
callq 0x7d06
movq %rax, %rbx
movq %rbp, %r12
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x256b7
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
leaq 0x20(%r15), %rbp
movq 0xd0(%rsp), %rdi
cmpq %r14, %rdi
je 0x256d8
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x42a0
leaq 0x30(%rbx), %rdi
movq %rdi, 0x28(%rsp)
movq %rbp, %rsi
callq 0x4170
leaq 0x80(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x12e2b(%rip), %rsi     # 0x38527
leaq 0x12e27(%rip), %rdx     # 0x3852a
leaq 0x70(%rsp), %rdi
callq 0x54fc
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x10(%rbx), %rsi
movq 0x18(%rbx), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0xca12
leaq 0x60(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x129a8(%rip), %rdx     # 0x380e3
leaq 0x50(%rsp), %rdi
movq %rdx, %rsi
callq 0x54fc
leaq 0xf0(%rsp), %rdi
leaq 0x70(%rsp), %rsi
leaq 0x8(%rsp), %rdx
leaq 0x50(%rsp), %rcx
callq 0xbe58
addq $0x20, %r13
leaq 0xf0(%rsp), %rsi
movq %r13, %rdi
callq 0xcf0e
leaq 0x140(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x25799
movq 0x140(%rsp), %rsi
incq %rsi
callq 0x42a0
leaq 0x120(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x257ba
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x42a0
leaq 0x100(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x257db
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x50(%rsp), %rdi
cmpq %rbp, %rdi
je 0x257f2
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x2580e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x70(%rsp), %rdi
cmpq %r14, %rdi
je 0x25828
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x42a0
leaq 0xc0(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x20(%r15), %rsi
movq 0x28(%r15), %rdx
addq %rsi, %rdx
leaq 0xb0(%rsp), %r13
movq %r13, %rdi
callq 0xca12
movq %r12, %rdi
movq %rbx, %rcx
movq %r13, %r8
callq 0x28ed2
movq 0xb0(%rsp), %rdi
cmpq %r14, %rdi
je 0x2587a
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x42a0
movq (%r12), %r13
leaq 0x40(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x20(%r15), %rsi
movq 0x28(%r15), %rdx
addq %rsi, %rdx
leaq 0x30(%rsp), %r15
movq %r15, %rdi
callq 0xca12
movq %r13, %rdi
movq %r15, %rsi
callq 0x1a9b6
testb %al, %al
je 0x258f4
movb 0xd0(%r12), %bpl
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0x258cd
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x42a0
testb %bpl, %bpl
je 0x2590b
movq 0x38(%rbx), %rdx
leaq 0x12806(%rip), %rcx     # 0x380e3
movq 0x28(%rsp), %rdi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0x4440
movl $0x0, (%rbx)
jmp 0x2590b
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0x2590b
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x42a0
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0x25a01
movq 0x40(%rsp), %rsi
jmp 0x259f9
movq %rax, %rbx
movq 0xb0(%rsp), %rdi
cmpq %r14, %rdi
je 0x25a01
movq 0xc0(%rsp), %rsi
jmp 0x259f9
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
callq 0xbf10
jmp 0x2596e
movq %rax, %rbx
movq 0x50(%rsp), %rdi
cmpq %rbp, %rdi
je 0x2598a
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x2598a
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x259ab
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x259ab
movq %rax, %rbx
movq 0x70(%rsp), %rdi
cmpq %r14, %rdi
je 0x25a01
movq 0x80(%rsp), %rsi
jmp 0x259f9
movq %rax, %rbx
jmp 0x25a01
movq %rax, %rbx
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x259e4
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
movq 0xd0(%rsp), %rdi
cmpq %r14, %rdi
je 0x25a01
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x42a0
movq %rbx, %rdi
callq 0x44c0
nop