// File: johan-bjareholt[P]lua-compiler/src/convert.cc
// Function: outMainBlock(std::ostream&, BBlock&)
void outMainBlock(std::ostream& ss, BBlock& startblock){
    std::stringstream headss;
    std::stringstream mainss;
    std::stringstream bodyss;
    
    // Standard functions
    headss << "// Standard functions" << std::endl;
	headss << "#include <stdlib.h>" << std::endl;
	headss << "#include <stdio.h>" << std::endl;
    headss << "long io_write(const char* msg){printf(\"%s\", msg); return 0;}" << std::endl;
    headss << "long io_write_i(long num){ printf(\"%ld\", num); return 0;}" << std::endl;
    headss << "long print(const char* msg){ printf(\"%s\\n\", msg); return 0;}" << std::endl;
    headss << "long print_i(long num){ printf(\"%ld\\n\", num);; return 0;}" << std::endl;
    headss << "long io_read(const char* msg){ long num; scanf(\"%ld\", &num); return num; }" << std::endl;
	
    mainss << "int main(){" << std::endl;

	std::set<std::string> inputSymbols = std::set<std::string>();
	
    std::set<std::string> outputSymbols = std::set<std::string>();

	bodyss << "    asm (" << std::endl;
    bodyss << "    // main" << std::endl;
    // Output global
	outBlock(startblock, bodyss, outputSymbols, inputSymbols, true, false);
    // Output functions
    for (auto funcentry : funcdefs){
        std::string funcname = funcentry.first;
        BBlock* funcblock = funcentry.second;
        outFunctionBlock(funcname, *funcblock, bodyss, outputSymbols, inputSymbols);
    }
    bodyss << std::endl;
    bodyss << pre_in << "label_end:" << post_in;
    bodyss << pre_in << "movq $0, %%rdi" << post_in;
    bodyss << pre_in << "call exit" << post_in;
    
    // Define storage variables
    headss << std::endl;
    headss << "// Variables" << std::endl;
    for (auto var : vars2){
        std::string name = var.first;
        std::string val = var.second.second;
        int type = var.second.first;
        switch (type){
            case VT_STRING:
                headss << "const char* " << name << " = " << val << ";"<< std::endl;
                break;
            case VT_INT:
            case VT_UNKNOWN:
	            headss << "long " << name << ";" << std::endl;
                break;
            case VT_POINTER:
                headss << "void* " << name << ";" << std::endl;
                break;
            case VT_FUNCTION:
            case VT_LABEL:
                break;
            default:
                std::cout << "Unknown vartype" << std::endl;
                exit(1);
                break;
        }
    }
    headss << std::endl;

    // Strings
    //mainss << "    // Strings decl" << std::endl;
    //for (std::pair<int, std::string> strp : strings){
    //    mainss << "    const char* " << "_s" << strp.first << " = " << strp.second << ";"<< std::endl;
    //}

	mainss << bodyss.str();
	mainss << "    : // Output symbols" << std::endl;
	for (auto iter = outputSymbols.begin(); iter!=outputSymbols.end(); iter++){
        if (inputSymbols.find(*iter) != inputSymbols.end()){
            inputSymbols.erase(*iter);
		    mainss << "      [" << *iter << "] \"+m\" (" << *iter << ")";
        }
        else
		    mainss << "      [" << *iter << "] \"=m\" (" << *iter << ")";
		if (std::next(iter) != outputSymbols.end())
			mainss << ",";
		mainss << std::endl;
	}
	mainss << "    : // Input symbols" << std::endl;
	for (auto iter = inputSymbols.begin(); iter!=inputSymbols.end(); iter++){
		mainss << "      [" << *iter << "] \"m\" (" << *iter << ")";
		if (std::next(iter) != inputSymbols.end())
			mainss << ",";
		mainss << std::endl;
	}

    mainss << "    : // Clobbers" << std::endl;
    mainss << "      \"cc\", \"rax\", \"rbx\", \"rcx\", \"rdx\", \"rsi\", \"rdi\", \"rsp\"" << std::endl;
    //mainss << "      ,\"r8\", \"r9\", \"r10\", \"r11\", \"r12\", \"r13\", \"r14\", \"r15\"" << std::endl;
	mainss << "    );" << std::endl;
	mainss << "    return 0;" << std::endl;
	mainss << "}" << std::endl;

    ss << headss.str();
    ss << mainss.str();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x920, %rsp            # imm = 0x920
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x198(%rbp), %rdi
callq 0x31d0
leaq -0x320(%rbp), %rdi
callq 0x31d0
jmp 0x11b5d
leaq -0x4b8(%rbp), %rdi
callq 0x31d0
jmp 0x11b6b
leaq -0x188(%rbp), %rdi
leaq 0x199a8(%rip), %rsi     # 0x2b521
callq 0x3260
movq %rax, -0x748(%rbp)
jmp 0x11b87
movq -0x748(%rbp), %rdi
movq 0x2c40b(%rip), %rsi     # 0x3dfa0
callq 0x32a0
jmp 0x11b9c
leaq -0x188(%rbp), %rdi
leaq 0x1998d(%rip), %rsi     # 0x2b537
callq 0x3260
movq %rax, -0x750(%rbp)
jmp 0x11bb8
movq -0x750(%rbp), %rdi
movq 0x2c3da(%rip), %rsi     # 0x3dfa0
callq 0x32a0
jmp 0x11bcd
leaq -0x188(%rbp), %rdi
leaq 0x19970(%rip), %rsi     # 0x2b54b
callq 0x3260
movq %rax, -0x758(%rbp)
jmp 0x11be9
movq -0x758(%rbp), %rdi
movq 0x2c3a9(%rip), %rsi     # 0x3dfa0
callq 0x32a0
jmp 0x11bfe
leaq -0x188(%rbp), %rdi
leaq 0x19952(%rip), %rsi     # 0x2b55e
callq 0x3260
movq %rax, -0x760(%rbp)
jmp 0x11c1a
movq -0x760(%rbp), %rdi
movq 0x2c378(%rip), %rsi     # 0x3dfa0
callq 0x32a0
jmp 0x11c2f
leaq -0x188(%rbp), %rdi
leaq 0x1995e(%rip), %rsi     # 0x2b59b
callq 0x3260
movq %rax, -0x768(%rbp)
jmp 0x11c4b
movq -0x768(%rbp), %rdi
movq 0x2c347(%rip), %rsi     # 0x3dfa0
callq 0x32a0
jmp 0x11c60
leaq -0x188(%rbp), %rdi
leaq 0x19967(%rip), %rsi     # 0x2b5d5
callq 0x3260
movq %rax, -0x770(%rbp)
jmp 0x11c7c
movq -0x770(%rbp), %rdi
movq 0x2c316(%rip), %rsi     # 0x3dfa0
callq 0x32a0
jmp 0x11c91
leaq -0x188(%rbp), %rdi
leaq 0x19973(%rip), %rsi     # 0x2b612
callq 0x3260
movq %rax, -0x778(%rbp)
jmp 0x11cad
movq -0x778(%rbp), %rdi
movq 0x2c2e5(%rip), %rsi     # 0x3dfa0
callq 0x32a0
jmp 0x11cc2
leaq -0x188(%rbp), %rdi
leaq 0x1997c(%rip), %rsi     # 0x2b64c
callq 0x3260
movq %rax, -0x780(%rbp)
jmp 0x11cde
movq -0x780(%rbp), %rdi
movq 0x2c2b4(%rip), %rsi     # 0x3dfa0
callq 0x32a0
jmp 0x11cf3
leaq -0x310(%rbp), %rdi
leaq 0x19996(%rip), %rsi     # 0x2b697
callq 0x3260
movq %rax, -0x788(%rbp)
jmp 0x11d0f
movq -0x788(%rbp), %rdi
movq 0x2c283(%rip), %rsi     # 0x3dfa0
callq 0x32a0
jmp 0x11d24
xorps %xmm0, %xmm0
movaps %xmm0, -0x7a0(%rbp)
movaps %xmm0, -0x4d0(%rbp)
movaps %xmm0, -0x4e0(%rbp)
movaps %xmm0, -0x4f0(%rbp)
leaq -0x4f0(%rbp), %rdi
callq 0x15820
movaps -0x7a0(%rbp), %xmm0
movaps %xmm0, -0x500(%rbp)
movaps %xmm0, -0x510(%rbp)
movaps %xmm0, -0x520(%rbp)
leaq -0x520(%rbp), %rdi
callq 0x15820
leaq -0x4a8(%rbp), %rdi
leaq 0x1991e(%rip), %rsi     # 0x2b6a3
callq 0x3260
movq %rax, -0x790(%rbp)
jmp 0x11d93
movq -0x790(%rbp), %rdi
movq 0x2c1ff(%rip), %rsi     # 0x3dfa0
callq 0x32a0
jmp 0x11da8
leaq -0x4a8(%rbp), %rdi
leaq 0x198f7(%rip), %rsi     # 0x2b6ad
callq 0x3260
movq %rax, -0x7a8(%rbp)
jmp 0x11dc4
movq -0x7a8(%rbp), %rdi
movq 0x2c1ce(%rip), %rsi     # 0x3dfa0
callq 0x32a0
jmp 0x11dd9
movq -0x10(%rbp), %rsi
leaq -0x4a8(%rbp), %rdx
movq %rsp, %rax
movl $0x0, (%rax)
leaq -0x540(%rbp), %rdi
leaq -0x520(%rbp), %rcx
leaq -0x4f0(%rbp), %r8
movl $0x1, %r9d
callq 0x12b90
jmp 0x11e0f
leaq -0x540(%rbp), %rdi
callq 0x3528
leaq 0x2c53e(%rip), %rax     # 0x3e360
movq %rax, -0x548(%rbp)
leaq 0x2c530(%rip), %rdi     # 0x3e360
callq 0x58c0
movq %rax, -0x550(%rbp)
leaq 0x2c51d(%rip), %rdi     # 0x3e360
callq 0x58f0
movq %rax, -0x558(%rbp)
leaq -0x550(%rbp), %rdi
leaq -0x558(%rbp), %rsi
callq 0x5920
testb $0x1, %al
jne 0x11e6b
jmp 0x11fde
leaq -0x550(%rbp), %rdi
callq 0x5950
movq %rax, %rsi
leaq -0x580(%rbp), %rdi
callq 0x5980
jmp 0x11e88
leaq -0x5a0(%rbp), %rdi
leaq -0x580(%rbp), %rsi
callq 0x3100
jmp 0x11e9d
movq -0x560(%rbp), %rax
movq %rax, -0x5a8(%rbp)
leaq -0x5c8(%rbp), %rdi
leaq -0x5a0(%rbp), %rsi
callq 0x3100
jmp 0x11ec0
movq -0x5a8(%rbp), %rsi
leaq -0x4a8(%rbp), %rdx
leaq -0x5c8(%rbp), %rdi
leaq -0x520(%rbp), %rcx
leaq -0x4f0(%rbp), %r8
callq 0x133e0
jmp 0x11eea
leaq -0x5c8(%rbp), %rdi
callq 0x3528
leaq -0x5a0(%rbp), %rdi
callq 0x3528
leaq -0x580(%rbp), %rdi
callq 0x59c0
leaq -0x550(%rbp), %rdi
callq 0x59e0
jmp 0x11e4f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x328(%rbp)
movl %eax, -0x32c(%rbp)
jmp 0x12b74
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x328(%rbp)
movl %eax, -0x32c(%rbp)
jmp 0x12b68
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x328(%rbp)
movl %eax, -0x32c(%rbp)
jmp 0x12b5c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x328(%rbp)
movl %eax, -0x32c(%rbp)
jmp 0x12b44
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x328(%rbp)
movl %eax, -0x32c(%rbp)
jmp 0x11fcd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x328(%rbp)
movl %eax, -0x32c(%rbp)
jmp 0x11fc1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x328(%rbp)
movl %eax, -0x32c(%rbp)
leaq -0x5c8(%rbp), %rdi
callq 0x3528
leaq -0x5a0(%rbp), %rdi
callq 0x3528
leaq -0x580(%rbp), %rdi
callq 0x59c0
jmp 0x12b44
leaq -0x4a8(%rbp), %rdi
movq 0x2bfb4(%rip), %rsi     # 0x3dfa0
callq 0x32a0
jmp 0x11ff3
leaq -0x4a8(%rbp), %rdi
leaq 0x2c3cf(%rip), %rsi     # 0x3e3d0
callq 0x3220
movq %rax, -0x7b0(%rbp)
jmp 0x1200f
movq -0x7b0(%rbp), %rdi
leaq 0x1969c(%rip), %rsi     # 0x2b6b9
callq 0x3260
movq %rax, -0x7b8(%rbp)
jmp 0x1202b
movq -0x7b8(%rbp), %rdi
leaq 0x2c3b7(%rip), %rsi     # 0x3e3f0
callq 0x3220
jmp 0x12040
leaq -0x4a8(%rbp), %rdi
leaq 0x2c382(%rip), %rsi     # 0x3e3d0
callq 0x3220
movq %rax, -0x7c0(%rbp)
jmp 0x1205c
movq -0x7c0(%rbp), %rdi
leaq 0x1965a(%rip), %rsi     # 0x2b6c4
callq 0x3260
movq %rax, -0x7c8(%rbp)
jmp 0x12078
movq -0x7c8(%rbp), %rdi
leaq 0x2c36a(%rip), %rsi     # 0x3e3f0
callq 0x3220
jmp 0x1208d
leaq -0x4a8(%rbp), %rdi
leaq 0x2c335(%rip), %rsi     # 0x3e3d0
callq 0x3220
movq %rax, -0x7d0(%rbp)
jmp 0x120a9
movq -0x7d0(%rbp), %rdi
leaq 0x1961c(%rip), %rsi     # 0x2b6d3
callq 0x3260
movq %rax, -0x7d8(%rbp)
jmp 0x120c5
movq -0x7d8(%rbp), %rdi
leaq 0x2c31d(%rip), %rsi     # 0x3e3f0
callq 0x3220
jmp 0x120da
leaq -0x188(%rbp), %rdi
movq 0x2beb8(%rip), %rsi     # 0x3dfa0
callq 0x32a0
jmp 0x120ef
leaq -0x188(%rbp), %rdi
leaq 0x195e0(%rip), %rsi     # 0x2b6dd
callq 0x3260
movq %rax, -0x7e0(%rbp)
jmp 0x1210b
movq -0x7e0(%rbp), %rdi
movq 0x2be87(%rip), %rsi     # 0x3dfa0
callq 0x32a0
jmp 0x12120
leaq 0x2c2e9(%rip), %rax     # 0x3e410
movq %rax, -0x5d0(%rbp)
leaq 0x2c2db(%rip), %rdi     # 0x3e410
callq 0x15840
movq %rax, -0x5d8(%rbp)
leaq 0x2c2c8(%rip), %rdi     # 0x3e410
callq 0x15870
movq %rax, -0x5e0(%rbp)
leaq -0x5d8(%rbp), %rdi
leaq -0x5e0(%rbp), %rsi
callq 0x158a0
testb $0x1, %al
jne 0x12170
jmp 0x12450
leaq -0x5d8(%rbp), %rdi
callq 0x158d0
movq %rax, %rsi
leaq -0x628(%rbp), %rdi
callq 0x158f0
jmp 0x1218d
leaq -0x648(%rbp), %rdi
leaq -0x628(%rbp), %rsi
callq 0x3100
jmp 0x121a2
leaq -0x600(%rbp), %rsi
leaq -0x668(%rbp), %rdi
callq 0x3100
jmp 0x121b7
movl -0x608(%rbp), %eax
movl %eax, -0x66c(%rbp)
movl -0x66c(%rbp), %eax
movq %rax, -0x7e8(%rbp)
subq $0x5, %rax
ja 0x123c3
movq -0x7e8(%rbp), %rax
leaq 0x191c4(%rip), %rcx     # 0x2b3ac
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x328(%rbp)
movl %eax, -0x32c(%rbp)
jmp 0x1243f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x328(%rbp)
movl %eax, -0x32c(%rbp)
jmp 0x12433
leaq -0x188(%rbp), %rdi
leaq 0x194bd(%rip), %rsi     # 0x2b6ea
callq 0x3260
movq %rax, -0x7f0(%rbp)
jmp 0x1223b
movq -0x7f0(%rbp), %rdi
leaq -0x648(%rbp), %rsi
callq 0x3220
movq %rax, -0x7f8(%rbp)
jmp 0x12257
movq -0x7f8(%rbp), %rdi
leaq 0x19492(%rip), %rsi     # 0x2b6f7
callq 0x3260
movq %rax, -0x800(%rbp)
jmp 0x12273
movq -0x800(%rbp), %rdi
leaq -0x668(%rbp), %rsi
callq 0x3220
movq %rax, -0x808(%rbp)
jmp 0x1228f
movq -0x808(%rbp), %rdi
leaq 0x18f38(%rip), %rsi     # 0x2b1d5
callq 0x3260
movq %rax, -0x810(%rbp)
jmp 0x122ab
movq -0x810(%rbp), %rdi
movq 0x2bce7(%rip), %rsi     # 0x3dfa0
callq 0x32a0
jmp 0x122c0
jmp 0x123fe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x328(%rbp)
movl %eax, -0x32c(%rbp)
leaq -0x668(%rbp), %rdi
callq 0x3528
jmp 0x12433
leaq -0x188(%rbp), %rdi
leaq 0x19405(%rip), %rsi     # 0x2b6fb
callq 0x3260
movq %rax, -0x818(%rbp)
jmp 0x12304
movq -0x818(%rbp), %rdi
leaq -0x648(%rbp), %rsi
callq 0x3220
movq %rax, -0x820(%rbp)
jmp 0x12320
movq -0x820(%rbp), %rdi
leaq 0x18ea7(%rip), %rsi     # 0x2b1d5
callq 0x3260
movq %rax, -0x828(%rbp)
jmp 0x1233c
movq -0x828(%rbp), %rdi
movq 0x2bc56(%rip), %rsi     # 0x3dfa0
callq 0x32a0
jmp 0x12351
jmp 0x123fe
leaq -0x188(%rbp), %rdi
leaq 0x1939d(%rip), %rsi     # 0x2b701
callq 0x3260
movq %rax, -0x830(%rbp)
jmp 0x12372
movq -0x830(%rbp), %rdi
leaq -0x648(%rbp), %rsi
callq 0x3220
movq %rax, -0x838(%rbp)
jmp 0x1238e
movq -0x838(%rbp), %rdi
leaq 0x18e39(%rip), %rsi     # 0x2b1d5
callq 0x3260
movq %rax, -0x840(%rbp)
jmp 0x123aa
movq -0x840(%rbp), %rdi
movq 0x2bbe8(%rip), %rsi     # 0x3dfa0
callq 0x32a0
jmp 0x123bf
jmp 0x123fe
jmp 0x123fe
movq 0x2bbfe(%rip), %rdi     # 0x3dfc8
leaq 0x19337(%rip), %rsi     # 0x2b708
callq 0x3260
movq %rax, -0x848(%rbp)
jmp 0x123df
movq -0x848(%rbp), %rdi
movq 0x2bbb3(%rip), %rsi     # 0x3dfa0
callq 0x32a0
jmp 0x123f4
movl $0x1, %edi
callq 0x3330
leaq -0x668(%rbp), %rdi
callq 0x3528
leaq -0x648(%rbp), %rdi
callq 0x3528
leaq -0x628(%rbp), %rdi
callq 0x15950
leaq -0x5d8(%rbp), %rdi
callq 0x15980
jmp 0x12154
leaq -0x648(%rbp), %rdi
callq 0x3528
leaq -0x628(%rbp), %rdi
callq 0x15950
jmp 0x12b44
leaq -0x188(%rbp), %rdi
movq 0x2bb42(%rip), %rsi     # 0x3dfa0
callq 0x32a0
jmp 0x12465
leaq -0x310(%rbp), %rax
movq %rax, -0x850(%rbp)
leaq -0x690(%rbp), %rdi
leaq -0x4b8(%rbp), %rsi
callq 0x3250
jmp 0x12488
movq -0x850(%rbp), %rdi
leaq -0x690(%rbp), %rsi
callq 0x3220
jmp 0x1249d
leaq -0x690(%rbp), %rdi
callq 0x3528
leaq -0x310(%rbp), %rdi
leaq 0x19261(%rip), %rsi     # 0x2b718
callq 0x3260
movq %rax, -0x858(%rbp)
jmp 0x124c5
movq -0x858(%rbp), %rdi
movq 0x2bacd(%rip), %rsi     # 0x3dfa0
callq 0x32a0
jmp 0x124da
leaq -0x520(%rbp), %rdi
callq 0x159b0
movq %rax, -0x698(%rbp)
leaq -0x520(%rbp), %rdi
callq 0x15a10
movq %rax, -0x6a0(%rbp)
leaq -0x698(%rbp), %rdi
leaq -0x6a0(%rbp), %rsi
callq 0x159e0
testb $0x1, %al
jne 0x1251c
jmp 0x12798
leaq -0x698(%rbp), %rdi
callq 0x15a80
movq %rax, %rsi
leaq -0x4f0(%rbp), %rdi
callq 0x15a40
movq %rax, -0x860(%rbp)
jmp 0x12540
movq -0x860(%rbp), %rax
movq %rax, -0x6a8(%rbp)
leaq -0x4f0(%rbp), %rdi
callq 0x15a10
movq %rax, -0x6b0(%rbp)
leaq -0x6a8(%rbp), %rdi
leaq -0x6b0(%rbp), %rsi
callq 0x159e0
testb $0x1, %al
jne 0x1257d
jmp 0x12657
leaq -0x698(%rbp), %rdi
callq 0x15a80
movq %rax, %rsi
leaq -0x4f0(%rbp), %rdi
callq 0x15ab0
jmp 0x1259a
leaq -0x310(%rbp), %rdi
leaq 0x19188(%rip), %rsi     # 0x2b730
callq 0x3260
movq %rax, -0x868(%rbp)
jmp 0x125b6
leaq -0x698(%rbp), %rdi
callq 0x15a80
movq -0x868(%rbp), %rdi
movq %rax, %rsi
callq 0x3220
movq %rax, -0x870(%rbp)
jmp 0x125da
movq -0x870(%rbp), %rdi
leaq 0x19150(%rip), %rsi     # 0x2b738
callq 0x3260
movq %rax, -0x878(%rbp)
jmp 0x125f6
leaq -0x698(%rbp), %rdi
callq 0x15a80
movq -0x878(%rbp), %rdi
movq %rax, %rsi
callq 0x3220
movq %rax, -0x880(%rbp)
jmp 0x1261a
movq -0x880(%rbp), %rdi
leaq 0x1a9f8(%rip), %rsi     # 0x2d020
callq 0x3260
jmp 0x1262f
jmp 0x126ee
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x328(%rbp)
movl %eax, -0x32c(%rbp)
leaq -0x690(%rbp), %rdi
callq 0x3528
jmp 0x12b44
leaq -0x310(%rbp), %rdi
leaq 0x190cb(%rip), %rsi     # 0x2b730
callq 0x3260
movq %rax, -0x888(%rbp)
jmp 0x12673
leaq -0x698(%rbp), %rdi
callq 0x15a80
movq -0x888(%rbp), %rdi
movq %rax, %rsi
callq 0x3220
movq %rax, -0x890(%rbp)
jmp 0x12697
movq -0x890(%rbp), %rdi
leaq 0x1909c(%rip), %rsi     # 0x2b741
callq 0x3260
movq %rax, -0x898(%rbp)
jmp 0x126b3
leaq -0x698(%rbp), %rdi
callq 0x15a80
movq -0x898(%rbp), %rdi
movq %rax, %rsi
callq 0x3220
movq %rax, -0x8a0(%rbp)
jmp 0x126d7
movq -0x8a0(%rbp), %rdi
leaq 0x1a93b(%rip), %rsi     # 0x2d020
callq 0x3260
jmp 0x126ec
jmp 0x126ee
movq -0x698(%rbp), %rax
movq %rax, -0x6c0(%rbp)
movq -0x6c0(%rbp), %rdi
movl $0x1, %esi
callq 0x15ae0
movq %rax, -0x8a8(%rbp)
jmp 0x12716
movq -0x8a8(%rbp), %rax
movq %rax, -0x6b8(%rbp)
leaq -0x520(%rbp), %rdi
callq 0x15a10
movq %rax, -0x6c8(%rbp)
leaq -0x6b8(%rbp), %rdi
leaq -0x6c8(%rbp), %rsi
callq 0x159e0
testb $0x1, %al
jne 0x12750
jmp 0x12767
leaq -0x310(%rbp), %rdi
leaq 0x18fec(%rip), %rsi     # 0x2b74a
callq 0x3260
jmp 0x12765
jmp 0x12767
leaq -0x310(%rbp), %rdi
movq 0x2b82b(%rip), %rsi     # 0x3dfa0
callq 0x32a0
jmp 0x1277c
jmp 0x1277e
leaq -0x698(%rbp), %rdi
xorl %esi, %esi
callq 0x15b10
movq %rax, -0x6d0(%rbp)
jmp 0x124ed
leaq -0x310(%rbp), %rdi
leaq 0x18fa6(%rip), %rsi     # 0x2b74c
callq 0x3260
movq %rax, -0x8b0(%rbp)
jmp 0x127b4
movq -0x8b0(%rbp), %rdi
movq 0x2b7de(%rip), %rsi     # 0x3dfa0
callq 0x32a0
jmp 0x127c9
leaq -0x4f0(%rbp), %rdi
callq 0x159b0
movq %rax, -0x6d8(%rbp)
leaq -0x4f0(%rbp), %rdi
callq 0x15a10
movq %rax, -0x6e0(%rbp)
leaq -0x6d8(%rbp), %rdi
leaq -0x6e0(%rbp), %rsi
callq 0x159e0
testb $0x1, %al
jne 0x1280b
jmp 0x1294a
leaq -0x310(%rbp), %rdi
leaq 0x18f17(%rip), %rsi     # 0x2b730
callq 0x3260
movq %rax, -0x8b8(%rbp)
jmp 0x12827
leaq -0x6d8(%rbp), %rdi
callq 0x15a80
movq -0x8b8(%rbp), %rdi
movq %rax, %rsi
callq 0x3220
movq %rax, -0x8c0(%rbp)
jmp 0x1284b
movq -0x8c0(%rbp), %rdi
leaq 0x18f0a(%rip), %rsi     # 0x2b763
callq 0x3260
movq %rax, -0x8c8(%rbp)
jmp 0x12867
leaq -0x6d8(%rbp), %rdi
callq 0x15a80
movq -0x8c8(%rbp), %rdi
movq %rax, %rsi
callq 0x3220
movq %rax, -0x8d0(%rbp)
jmp 0x1288b
movq -0x8d0(%rbp), %rdi
leaq 0x1a787(%rip), %rsi     # 0x2d020
callq 0x3260
jmp 0x128a0
movq -0x6d8(%rbp), %rax
movq %rax, -0x6f0(%rbp)
movq -0x6f0(%rbp), %rdi
movl $0x1, %esi
callq 0x15ae0
movq %rax, -0x8d8(%rbp)
jmp 0x128c8
movq -0x8d8(%rbp), %rax
movq %rax, -0x6e8(%rbp)
leaq -0x4f0(%rbp), %rdi
callq 0x15a10
movq %rax, -0x6f8(%rbp)
leaq -0x6e8(%rbp), %rdi
leaq -0x6f8(%rbp), %rsi
callq 0x159e0
testb $0x1, %al
jne 0x12902
jmp 0x12919
leaq -0x310(%rbp), %rdi
leaq 0x18e3a(%rip), %rsi     # 0x2b74a
callq 0x3260
jmp 0x12917
jmp 0x12919
leaq -0x310(%rbp), %rdi
movq 0x2b679(%rip), %rsi     # 0x3dfa0
callq 0x32a0
jmp 0x1292e
jmp 0x12930
leaq -0x6d8(%rbp), %rdi
xorl %esi, %esi
callq 0x15b10
movq %rax, -0x700(%rbp)
jmp 0x127dc
leaq -0x310(%rbp), %rdi
leaq 0x18e13(%rip), %rsi     # 0x2b76b
callq 0x3260
movq %rax, -0x8e0(%rbp)
jmp 0x12966
movq -0x8e0(%rbp), %rdi
movq 0x2b62c(%rip), %rsi     # 0x3dfa0
callq 0x32a0
jmp 0x1297b
leaq -0x310(%rbp), %rdi
leaq 0x18df4(%rip), %rsi     # 0x2b77d
callq 0x3260
movq %rax, -0x8e8(%rbp)
jmp 0x12997
movq -0x8e8(%rbp), %rdi
movq 0x2b5fb(%rip), %rsi     # 0x3dfa0
callq 0x32a0
jmp 0x129ac
leaq -0x310(%rbp), %rdi
leaq 0x18dff(%rip), %rsi     # 0x2b7b9
callq 0x3260
movq %rax, -0x8f0(%rbp)
jmp 0x129c8
movq -0x8f0(%rbp), %rdi
movq 0x2b5ca(%rip), %rsi     # 0x3dfa0
callq 0x32a0
jmp 0x129dd
leaq -0x310(%rbp), %rdi
leaq 0x18dd5(%rip), %rsi     # 0x2b7c0
callq 0x3260
movq %rax, -0x8f8(%rbp)
jmp 0x129f9
movq -0x8f8(%rbp), %rdi
movq 0x2b599(%rip), %rsi     # 0x3dfa0
callq 0x32a0
jmp 0x12a0e
leaq -0x310(%rbp), %rdi
leaq 0x18c79(%rip), %rsi     # 0x2b695
callq 0x3260
movq %rax, -0x900(%rbp)
jmp 0x12a2a
movq -0x900(%rbp), %rdi
movq 0x2b568(%rip), %rsi     # 0x3dfa0
callq 0x32a0
jmp 0x12a3f
movq -0x8(%rbp), %rax
movq %rax, -0x908(%rbp)
leaq -0x720(%rbp), %rdi
leaq -0x198(%rbp), %rsi
callq 0x3250
jmp 0x12a5f
movq -0x908(%rbp), %rdi
leaq -0x720(%rbp), %rsi
callq 0x3220
jmp 0x12a74
leaq -0x720(%rbp), %rdi
callq 0x3528
movq -0x8(%rbp), %rax
movq %rax, -0x910(%rbp)
leaq -0x740(%rbp), %rdi
leaq -0x320(%rbp), %rsi
callq 0x3250
jmp 0x12aa0
movq -0x910(%rbp), %rdi
leaq -0x740(%rbp), %rsi
callq 0x3220
jmp 0x12ab5
leaq -0x740(%rbp), %rdi
callq 0x3528
leaq -0x520(%rbp), %rdi
callq 0x15b50
leaq -0x4f0(%rbp), %rdi
callq 0x15b50
leaq -0x4b8(%rbp), %rdi
callq 0x31e0
leaq -0x320(%rbp), %rdi
callq 0x31e0
leaq -0x198(%rbp), %rdi
callq 0x31e0
addq $0x920, %rsp            # imm = 0x920
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x328(%rbp)
movl %eax, -0x32c(%rbp)
leaq -0x720(%rbp), %rdi
callq 0x3528
jmp 0x12b44
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x328(%rbp)
movl %eax, -0x32c(%rbp)
leaq -0x740(%rbp), %rdi
callq 0x3528
leaq -0x520(%rbp), %rdi
callq 0x15b50
leaq -0x4f0(%rbp), %rdi
callq 0x15b50
leaq -0x4b8(%rbp), %rdi
callq 0x31e0
leaq -0x320(%rbp), %rdi
callq 0x31e0
leaq -0x198(%rbp), %rdi
callq 0x31e0
movq -0x328(%rbp), %rdi
callq 0x34b0
nopl (%rax)