// File: /workspace/github_cpp_makefile_star2_O3/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 0xc7aa
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 0x7b6c
movq %rax, %rbx
movq %rbp, %r12
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x25449
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
leaq 0x20(%r15), %rbp
movq 0xd0(%rsp), %rdi
cmpq %r14, %rdi
je 0x2546a
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 0x12099(%rip), %rsi     # 0x37527
leaq 0x12095(%rip), %rdx     # 0x3752a
leaq 0x70(%rsp), %rdi
callq 0x53cc
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x10(%rbx), %rsi
movq 0x18(%rbx), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0xc7aa
leaq 0x60(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x11c16(%rip), %rdx     # 0x370e3
leaq 0x50(%rsp), %rdi
movq %rdx, %rsi
callq 0x53cc
leaq 0xf0(%rsp), %rdi
leaq 0x70(%rsp), %rsi
leaq 0x8(%rsp), %rdx
leaq 0x50(%rsp), %rcx
callq 0xbbea
addq $0x20, %r13
leaq 0xf0(%rsp), %rsi
movq %r13, %rdi
callq 0xccac
leaq 0x140(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2552b
movq 0x140(%rsp), %rsi
incq %rsi
callq 0x42a0
leaq 0x120(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2554c
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x42a0
leaq 0x100(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2556d
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x50(%rsp), %rdi
cmpq %rbp, %rdi
je 0x25584
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x255a0
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x70(%rsp), %rdi
cmpq %r14, %rdi
je 0x255ba
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 0xc7aa
movq %r12, %rdi
movq %rbx, %rcx
movq %r13, %r8
callq 0x28c64
movq 0xb0(%rsp), %rdi
cmpq %r14, %rdi
je 0x2560c
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 0xc7aa
movq %r13, %rdi
movq %r15, %rsi
callq 0x1a6f8
testb %al, %al
je 0x25686
movb 0xd0(%r12), %bpl
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0x2565f
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x42a0
testb %bpl, %bpl
je 0x2569d
movq 0x38(%rbx), %rdx
leaq 0x11a74(%rip), %rcx     # 0x370e3
movq 0x28(%rsp), %rdi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0x4440
movl $0x0, (%rbx)
jmp 0x2569d
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0x2569d
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 0x25793
movq 0x40(%rsp), %rsi
jmp 0x2578b
movq %rax, %rbx
movq 0xb0(%rsp), %rdi
cmpq %r14, %rdi
je 0x25793
movq 0xc0(%rsp), %rsi
jmp 0x2578b
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
callq 0xbca2
jmp 0x25700
movq %rax, %rbx
movq 0x50(%rsp), %rdi
cmpq %rbp, %rdi
je 0x2571c
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x2571c
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x2573d
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x2573d
movq %rax, %rbx
movq 0x70(%rsp), %rdi
cmpq %r14, %rdi
je 0x25793
movq 0x80(%rsp), %rsi
jmp 0x2578b
movq %rax, %rbx
jmp 0x25793
movq %rax, %rbx
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x25776
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
movq 0xd0(%rsp), %rdi
cmpq %r14, %rdi
je 0x25793
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x42a0
movq %rbx, %rdi
callq 0x44c0
nop