// File: /workspace/github_cpp_makefile_star2_O1/Merulo[P]CompilerJFTT/src/IRs/FourthIR.cpp
// Function: FourthIR::parse(std::vector<Block, std::allocator<Block>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool)
void FourthIR::parse(std::vector<Block> bs, std::string fileName, bool useEmulator)
{
    for(auto& b : bs)
    {
        Pair p;
        p.block = b;
        _notYetConvertedBlocks.push_back(p);
    }

    if (isDeterministic() && useEmulator)
    {
        _blocks = bs;
        std::string tmpFile = "tmp.ir";
        print(tmpFile);
        EmulatorRunner er;
        bool value = er.emulate(tmpFile, fileName);
        _blocks = {};
        if (value)
        {
            exit(0);
        }
    }

    _symbolTable->assignMemory();
    convertToAssembler();

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movl %ecx, 0xc(%rsp)
movq %rdx, 0x18(%rsp)
movq %rdi, 0x10(%rsp)
movq (%rsi), %r12
movq %rsi, 0x20(%rsp)
movq 0x8(%rsi), %rax
movq %rax, 0x28(%rsp)
cmpq %rax, %r12
je 0x246a2
leaq 0x80(%rsp), %rbx
leaq 0x90(%rsp), %r13
movq 0x10(%rsp), %rax
leaq 0xb8(%rax), %r15
xorl %ebp, %ebp
leaq 0x70(%rsp), %r14
movq %rbx, 0x70(%rsp)
movq %rbp, 0x78(%rsp)
movb %bpl, 0x80(%rsp)
movq %rbp, 0x10(%r13)
xorps %xmm0, %xmm0
movups %xmm0, (%r13)
leaq 0xb8(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq %rbp, 0xb0(%rsp)
movb %bpl, 0xb8(%rsp)
leaq 0xd8(%rsp), %rax
movq %rax, 0xc8(%rsp)
movq %rbp, 0xd0(%rsp)
movb %bpl, 0xd8(%rsp)
leaq 0xf8(%rsp), %rax
movq %rax, 0xe8(%rsp)
movq %rbp, 0xf0(%rsp)
movb %bpl, 0xf8(%rsp)
movb %bpl, 0x108(%rsp)
movups %xmm0, 0x90(%rbx)
leaq 0x140(%rsp), %rax
movq %rax, 0x130(%rsp)
movq %rbp, 0x138(%rsp)
movb %bpl, 0x140(%rsp)
leaq 0x160(%rsp), %rax
movq %rax, 0x150(%rsp)
movq %rbp, 0x158(%rsp)
movb %bpl, 0x160(%rsp)
movb %bpl, 0x170(%rsp)
callq 0x40b0
cltq
movq %rax, 0x128(%rsp)
movl %ebp, 0x120(%rsp)
movq %rbp, 0x108(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0xf8(%rbx)
movups %xmm0, 0x118(%rbx)
leaq 0x1c8(%rsp), %rax
movq %rax, 0x1b8(%rsp)
movq %rbp, 0x1c0(%rsp)
movb %bpl, 0x1c8(%rsp)
leaq 0x1e8(%rsp), %rax
movq %rax, 0x1d8(%rsp)
movq %rbp, 0x1e0(%rsp)
movb %bpl, 0x1e8(%rsp)
movb %bpl, 0x1f8(%rsp)
callq 0x40b0
cltq
movq %rax, 0x1b0(%rsp)
movl %ebp, 0x1a8(%rsp)
movq %rbp, 0x190(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x180(%rbx)
movb %bpl, 0x220(%rsp)
movq %r14, %rdi
movq %r12, %rsi
callq 0x4170
addq $0x20, %r12
movq %r13, %rdi
movq %r12, %rsi
callq 0x2a1be
addq $0x18, %r12
leaq 0xa8(%rsp), %rdi
movq %r12, %rsi
callq 0x4170
addq $0x20, %r12
leaq 0xc8(%rsp), %rdi
movq %r12, %rsi
callq 0x4170
addq $0x20, %r12
leaq 0xe8(%rsp), %rdi
movq %r12, %rsi
callq 0x4170
movb 0x20(%r12), %al
movb %al, 0x108(%rsp)
movq %r15, %rdi
movq %r14, %rsi
callq 0x29e36
movq %r14, %rdi
callq 0x29e62
addq $0x28, %r12
cmpq 0x28(%rsp), %r12
jne 0x244a4
movq 0x10(%rsp), %r13
movq %r13, %rdi
callq 0x2484a
testb %al, 0xc(%rsp)
je 0x247ad
leaq 0x10(%r13), %rbx
movq %rbx, %rdi
movq 0x20(%rsp), %rsi
callq 0x29f86
leaq 0x80(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x13e2e(%rip), %rsi     # 0x3850b
leaq 0x13e2d(%rip), %rdx     # 0x38511
leaq 0x70(%rsp), %rdi
callq 0x54fc
leaq 0x70(%rsp), %rsi
movq %r13, %rdi
callq 0x2c010
leaq 0x60(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x70(%rsp), %rsi
movq 0x78(%rsp), %rdx
addq %rsi, %rdx
leaq 0x50(%rsp), %rdi
callq 0xca12
leaq 0x40(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x18(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x30(%rsp), %rdi
callq 0xca12
leaq 0xb(%rsp), %rdi
leaq 0x50(%rsp), %rsi
leaq 0x30(%rsp), %rdx
callq 0x518c
movl %eax, %ebp
movq 0x30(%rsp), %rdi
cmpq %r12, %rdi
je 0x2476b
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x50(%rsp), %rdi
cmpq %r15, %rdi
je 0x24782
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x42a0
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2aeb4
testb %bpl, %bpl
jne 0x247d0
movq 0x70(%rsp), %rdi
cmpq %r14, %rdi
je 0x247ad
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x42a0
movq (%r13), %rdi
callq 0x1a8da
movq %r13, %rdi
callq 0x248e2
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %edi, %edi
callq 0x4360
movq %rax, %rbx
movq 0x30(%rsp), %rdi
cmpq %r12, %rdi
je 0x247f6
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x247f6
movq %rax, %rbx
movq 0x50(%rsp), %rdi
cmpq %r15, %rdi
je 0x24819
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x24819
jmp 0x24816
movq %rax, %rbx
jmp 0x24842
movq %rax, %rbx
movq 0x70(%rsp), %rdi
cmpq %r14, %rdi
je 0x24842
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x24842
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x29e62
movq %rbx, %rdi
callq 0x44c0