// File: Merulo[P]CompilerJFTT/src/Register/RegisterBlock.cpp
// Function: RegisterBlock::loadFromMemory(Block&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, Register&, Register&)
void RegisterBlock::loadFromMemory(Block& b, std::string name, Register& r, Register& freeRegister)
{
    r.needToSafe = false;
    if (_symbolTable->isItVariable(name))
    {
        if (name == "IF_CONTROL_VARIABLE")
        {
            return;
        }        
        loadVariableFromMemory(b, name, r, freeRegister);
    }
    else if (_symbolTable->isItTable(name))
    {
        std::string rest = name.substr(name.find("(") + 1, std::string::npos);
        rest.pop_back();
        if (isDigits(rest))
        {
            loadConstTableFromMemory(b, name, r, freeRegister, std::stoull(rest));
        }
        else
        {
            loadVarTableFromMemory(b, name, r, freeRegister, rest);
        }
    }   
}

// Assembly:
subq $0x1b8, %rsp            # imm = 0x1B8
movq %rdx, 0x80(%rsp)
movq %rdi, 0x1b0(%rsp)
movq %rsi, 0x1a8(%rsp)
movq %rdx, 0x1a0(%rsp)
movq %rcx, 0x198(%rsp)
movq %r8, 0x190(%rsp)
movq 0x1b0(%rsp), %rdi
movq %rdi, 0x78(%rsp)
movq 0x198(%rsp), %rax
movb $0x0, 0x50(%rax)
callq 0xdde0
movq 0x80(%rsp), %rsi
movq %rax, 0x88(%rsp)
leaq 0x170(%rsp), %rdi
movq %rdi, 0x90(%rsp)
callq 0x4180
movq 0x88(%rsp), %rdi
movq 0x90(%rsp), %rsi
callq 0x21540
movb %al, 0x9f(%rsp)
jmp 0x63a8
leaq 0x170(%rsp), %rdi
callq 0x46e8
movb 0x9f(%rsp), %al
testb $0x1, %al
jne 0x63c5
jmp 0x648f
movq 0x80(%rsp), %rdi
leaq 0x4ad0a(%rip), %rsi     # 0x510de
callq 0xdd10
testb $0x1, %al
jne 0x63df
jmp 0x640a
jmp 0x674e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x168(%rsp)
movl %eax, 0x164(%rsp)
leaq 0x170(%rsp), %rdi
callq 0x46e8
jmp 0x6756
movq 0x80(%rsp), %rsi
movq 0x1a8(%rsp), %rax
movq %rax, 0x68(%rsp)
leaq 0x140(%rsp), %rdi
movq %rdi, 0x70(%rsp)
callq 0x4180
movq 0x78(%rsp), %rdi
movq 0x68(%rsp), %rsi
movq 0x70(%rsp), %rdx
movq 0x198(%rsp), %rcx
movq 0x190(%rsp), %r8
callq 0xa6e0
jmp 0x6457
leaq 0x140(%rsp), %rdi
callq 0x46e8
jmp 0x674e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x168(%rsp)
movl %eax, 0x164(%rsp)
leaq 0x140(%rsp), %rdi
callq 0x46e8
jmp 0x6756
movq 0x78(%rsp), %rdi
callq 0xdde0
movq 0x80(%rsp), %rsi
movq %rax, 0x50(%rsp)
leaq 0x120(%rsp), %rdi
movq %rdi, 0x58(%rsp)
callq 0x4180
movq 0x50(%rsp), %rdi
movq 0x58(%rsp), %rsi
callq 0x213e0
movb %al, 0x67(%rsp)
jmp 0x64cd
leaq 0x120(%rsp), %rdi
callq 0x46e8
movb 0x67(%rsp), %al
testb $0x1, %al
jne 0x64e7
jmp 0x674c
movq 0x80(%rsp), %rdi
leaq 0x4c1d9(%rip), %rsi     # 0x526cf
xorl %eax, %eax
movl %eax, %edx
callq 0x46b0
movq 0x80(%rsp), %rsi
movq %rax, %rdx
incq %rdx
leaq 0x100(%rsp), %rdi
movq %rdi, 0x40(%rsp)
movq $-0x1, %rcx
callq 0x4350
movq 0x40(%rsp), %rdi
callq 0x4430
movq 0x78(%rsp), %rdi
movq 0x40(%rsp), %rsi
callq 0xdd40
movb %al, 0x4f(%rsp)
jmp 0x6545
movb 0x4f(%rsp), %al
testb $0x1, %al
jne 0x6552
jmp 0x664c
movq 0x80(%rsp), %rsi
movq 0x1a8(%rsp), %rax
movq %rax, 0x38(%rsp)
leaq 0xe0(%rsp), %rdi
callq 0x4180
jmp 0x6576
movq 0x198(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x190(%rsp), %rax
movq %rax, 0x28(%rsp)
xorl %eax, %eax
movl %eax, %esi
leaq 0x100(%rsp), %rdi
movl $0xa, %edx
callq 0xdd90
movq %rax, 0x30(%rsp)
jmp 0x65ad
movq 0x30(%rsp), %r9
movq 0x28(%rsp), %r8
movq 0x20(%rsp), %rcx
movq 0x38(%rsp), %rsi
movq 0x78(%rsp), %rdi
leaq 0xe0(%rsp), %rdx
callq 0xae80
jmp 0x65d5
leaq 0xe0(%rsp), %rdi
callq 0x46e8
jmp 0x672e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x168(%rsp)
movl %eax, 0x164(%rsp)
leaq 0x120(%rsp), %rdi
callq 0x46e8
jmp 0x6756
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x168(%rsp)
movl %eax, 0x164(%rsp)
jmp 0x673d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x168(%rsp)
movl %eax, 0x164(%rsp)
leaq 0xe0(%rsp), %rdi
callq 0x46e8
jmp 0x673d
movq 0x80(%rsp), %rsi
movq 0x1a8(%rsp), %rax
movq %rax, 0x18(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0x4180
jmp 0x6670
movq 0x198(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x190(%rsp), %rax
movq %rax, 0x10(%rsp)
leaq 0xa0(%rsp), %rdi
leaq 0x100(%rsp), %rsi
callq 0x4180
jmp 0x66a1
movq 0x10(%rsp), %r8
movq 0x8(%rsp), %rcx
movq 0x18(%rsp), %rsi
movq 0x78(%rsp), %rdi
leaq 0xc0(%rsp), %rdx
leaq 0xa0(%rsp), %r9
callq 0xb4c0
jmp 0x66cc
leaq 0xa0(%rsp), %rdi
callq 0x46e8
leaq 0xc0(%rsp), %rdi
callq 0x46e8
jmp 0x672e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x168(%rsp)
movl %eax, 0x164(%rsp)
jmp 0x671f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x168(%rsp)
movl %eax, 0x164(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x46e8
leaq 0xc0(%rsp), %rdi
callq 0x46e8
jmp 0x673d
leaq 0x100(%rsp), %rdi
callq 0x46e8
jmp 0x674c
leaq 0x100(%rsp), %rdi
callq 0x46e8
jmp 0x6756
jmp 0x674e
addq $0x1b8, %rsp            # imm = 0x1B8
retq
movq 0x168(%rsp), %rdi
callq 0x45f0
nopw %cs:(%rax,%rax)