// File: /workspace/github_cpp_makefile_star2_O2/Merulo[P]CompilerJFTT/src/Register/RegisterBlock.cpp
// Function: RegisterBlock::saveVariableToMemory(Block&, Register&, Register&)
void RegisterBlock::saveVariableToMemory(Block& b, Register& r, Register& freeRegister)
 {
    unsigned long long memoryCell = _symbolTable->getMemoryCell(r.variableName);
    
    if (_addressRegister.state == RegisterState::UNKNOWN)
    {
        b.lines.push_back({"SUB", "A", "A"});
        _addressRegister.state = RegisterState::CONST;
        _addressRegister.constValue = 0;
    }
    auto lines = generateNumberFrom(_addressRegister.constValue, memoryCell, freeRegister);

    lines.push_back({"STORE", r.name});
    b.insert(lines);
 }

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x170, %rsp            # imm = 0x170
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
movq (%rdi), %r12
leaq 0x30(%rdx), %rsi
leaq 0xe8(%rsp), %r13
movq %r13, %rdi
callq 0x4390
movq %r12, %rdi
movq %r13, %rsi
callq 0x100f2
movq %rax, %r12
leaq 0xe8(%rsp), %rdi
callq 0x4548
cmpl $0x0, 0x10(%r15)
jne 0x6d1c
leaq 0x1c435(%rip), %rsi     # 0x23096
leaq 0xc8(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x4a54
leaq 0x1c41a(%rip), %rsi     # 0x23094
leaq 0xa8(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x4a54
leaq 0x1c401(%rip), %rsi     # 0x23094
leaq 0x88(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0x4a54
leaq 0x108(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
leaq 0xa8(%rsp), %rdx
leaq 0x88(%rsp), %rcx
callq 0x816a
leaq 0x20(%rbx), %rdi
leaq 0x108(%rsp), %rsi
callq 0x8f90
leaq 0x108(%rsp), %rdi
callq 0x81fe
leaq 0x88(%rsp), %rdi
callq 0x4548
leaq 0xa8(%rsp), %rdi
callq 0x4548
leaq 0xc8(%rsp), %rdi
callq 0x4548
movl $0x2, 0x10(%r15)
andq $0x0, 0x18(%r15)
addq $0x18, %r15
leaq 0x10(%rsp), %rdi
movq %r15, %rdx
movq %r12, %rcx
callq 0x5530
leaq 0x1c383(%rip), %rsi     # 0x230ba
leaq 0x68(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x4a54
addq $0x10, %r14
leaq 0x48(%rsp), %rdi
movq %r14, %rsi
callq 0x4390
leaq 0x1c385(%rip), %rsi     # 0x230e3
leaq 0x28(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0x4a54
leaq 0x108(%rsp), %rdi
leaq 0x68(%rsp), %rsi
leaq 0x48(%rsp), %rdx
leaq 0x28(%rsp), %rcx
callq 0x816a
leaq 0x10(%rsp), %rdi
leaq 0x108(%rsp), %rsi
callq 0x8f90
leaq 0x108(%rsp), %rdi
callq 0x81fe
leaq 0x28(%rsp), %rdi
callq 0x4548
leaq 0x48(%rsp), %rdi
callq 0x4548
leaq 0x68(%rsp), %rdi
callq 0x4548
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x821e
leaq 0x10(%rsp), %rdi
callq 0x8236
addq $0x170, %rsp            # imm = 0x170
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x108(%rsp), %rdi
callq 0x81fe
jmp 0x6e03
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x4548
jmp 0x6e15
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x4548
jmp 0x6e27
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
jmp 0x6e91
movq %rax, %rbx
jmp 0x6e96
jmp 0x6e77
movq %rax, %rbx
leaq 0x108(%rsp), %rdi
callq 0x81fe
jmp 0x6e4d
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x4548
jmp 0x6e5c
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x4548
jmp 0x6e6b
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x4548
jmp 0x6e7a
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x8236
jmp 0x6e96
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0x4548
movq %rbx, %rdi
callq 0x4490