// File: /workspace/github_cpp_makefile_star2_O2/eniac[P]Mantis/src/compile/compile.cpp
// Function: compileCCode(std::vector<AstNode*, std::allocator<AstNode*>>, char*)
vector<UnanchoredNode *> compileCCode(std::vector<AstNode*> nodeArray, char * outFnBase) {
	vector<UnanchoredNode *> ret_vec = vector<UnanchoredNode *>(); 
    
    string out_fn_base_str = string(outFnBase);
    string base_fn = out_fn_base_str.substr(out_fn_base_str.find_last_of("/\\") + 1);
    PRINT_VERBOSE("Output filename base: %s\n", base_fn.c_str());    
    string prefix_str = "p4_pd_" + string(base_fn) + "_mantis_";

    ostringstream oss_preprocessor;
    ostringstream oss_mbl_init;
    ostringstream oss_init_end;
    ostringstream oss_reaction_mirror;
    ostringstream oss_reaction_update;

    extractReactionMacro(nodeArray, oss_preprocessor, string(outFnBase));

    generateMacroNonMblTable(nodeArray, oss_preprocessor, prefix_str);
 
    generatePrologueEnd(nodeArray, oss_init_end, ing_iso_opt, egr_iso_opt);

    generateHdlPool(nodeArray, oss_mbl_init, ing_iso_opt, egr_iso_opt);

    generateMacroInitMblsForIng(nodeArray, &mblUsages, oss_mbl_init, oss_reaction_mirror, oss_preprocessor, num_init_mbls_ing, ing_iso_opt, prefix_str, true);
    generateMacroInitMblsForIng(nodeArray, &mblUsages, oss_mbl_init, oss_reaction_mirror, oss_preprocessor, num_init_mbls_egr, egr_iso_opt, prefix_str, false);

    generateMacroXorVersionBits(oss_reaction_mirror, oss_preprocessor, ing_iso_opt, egr_iso_opt);

    generateDialogueArgStart(oss_reaction_mirror, ing_iso_opt, egr_iso_opt);

    mirrorFieldArg(nodeArray, oss_reaction_mirror, oss_preprocessor, global_ing_bins, prefix_str, true);
    mirrorFieldArg(nodeArray, oss_reaction_mirror, oss_preprocessor, global_egr_bins, prefix_str, false);

    mirrorRegisterArgForIng(nodeArray, oss_reaction_mirror, ing_iso_opt, prefix_str, true);
    mirrorRegisterArgForIng(nodeArray, oss_reaction_mirror, egr_iso_opt, prefix_str, false);

    generateMacroMblTable(nodeArray, oss_preprocessor, prefix_str, ing_iso_opt, egr_iso_opt, oss_reaction_mirror);

    generateDialogueEnd(nodeArray, oss_reaction_update, ing_iso_opt, egr_iso_opt);

    ret_vec.push_back(generateMacroNode(oss_preprocessor));
    ret_vec.push_back(generatePrologueNode(nodeArray, oss_mbl_init, oss_init_end));
    ret_vec.push_back(generateDialogueNode(nodeArray, oss_reaction_mirror, oss_reaction_update));    

	return ret_vec;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa68, %rsp            # imm = 0xA68
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
leaq -0x2f0(%rbp), %rdi
leaq -0x4a8(%rbp), %rdx
movq %r15, %rsi
callq 0x411c0
leaq 0x2b043(%rip), %rsi     # 0x79400
leaq -0x2f0(%rbp), %r12
pushq $-0x1
popq %r13
movq %r12, %rdi
movq %r13, %rdx
callq 0x413b0
leaq 0x1(%rax), %rdx
leaq -0x2d0(%rbp), %rdi
movq %r12, %rsi
movq %r13, %rcx
callq 0x41420
leaq -0x798(%rbp), %rdi
leaq -0x2d0(%rbp), %rsi
callq 0x415b0
leaq 0x2b000(%rip), %rsi     # 0x79403
leaq -0x4a8(%rbp), %rdi
leaq -0x798(%rbp), %rdx
callq 0x4ed5a
leaq 0x2afed(%rip), %rdx     # 0x7940a
leaq -0x50(%rbp), %rdi
leaq -0x4a8(%rbp), %rsi
callq 0x4ed31
leaq -0x4a8(%rbp), %rdi
callq 0x418c8
leaq -0x798(%rbp), %rdi
callq 0x418c8
leaq -0x4a8(%rbp), %rdi
callq 0x415a0
leaq -0x798(%rbp), %rdi
callq 0x415a0
leaq -0xa88(%rbp), %rdi
callq 0x415a0
leaq -0x620(%rbp), %rdi
callq 0x415a0
leaq -0x910(%rbp), %rdi
callq 0x415a0
leaq -0x1d0(%rbp), %rdi
movq %r14, %rsi
callq 0x4486c
leaq -0x2b0(%rbp), %rdi
leaq -0x30(%rbp), %rdx
movq %r15, %rsi
callq 0x411c0
leaq -0x1d0(%rbp), %rdi
leaq -0x4a8(%rbp), %rsi
leaq -0x2b0(%rbp), %rdx
callq 0x4fc38
leaq -0x2b0(%rbp), %rdi
callq 0x418c8
leaq -0x1d0(%rbp), %rdi
callq 0x44be0
leaq -0x1b8(%rbp), %rdi
movq %r14, %rsi
callq 0x4486c
leaq -0x290(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x415b0
leaq -0x1b8(%rbp), %rdi
leaq -0x4a8(%rbp), %rsi
leaq -0x290(%rbp), %rdx
callq 0x51f05
leaq -0x290(%rbp), %rdi
callq 0x418c8
leaq -0x1b8(%rbp), %rdi
callq 0x44be0
leaq -0x1a0(%rbp), %rdi
movq %r14, %rsi
callq 0x4486c
movl 0x47f49(%rip), %edx     # 0x96484
movl 0x47f47(%rip), %ecx     # 0x96488
leaq -0x1a0(%rbp), %rdi
leaq -0xa88(%rbp), %rsi
callq 0x578b2
leaq -0x1a0(%rbp), %rdi
callq 0x44be0
leaq -0x188(%rbp), %rdi
movq %r14, %rsi
callq 0x4486c
movl 0x47f0f(%rip), %edx     # 0x96484
movl 0x47f0d(%rip), %ecx     # 0x96488
leaq -0x188(%rbp), %rdi
leaq -0x798(%rbp), %rsi
callq 0x57783
leaq -0x188(%rbp), %rdi
callq 0x44be0
leaq -0x170(%rbp), %rdi
movq %r14, %rsi
callq 0x4486c
movl 0x47edc(%rip), %r15d    # 0x9648c
movl 0x47ecd(%rip), %r13d    # 0x96484
leaq -0x330(%rbp), %r12
leaq -0x50(%rbp), %rsi
movq %r12, %rdi
callq 0x415b0
subq $0x8, %rsp
leaq 0x4841b(%rip), %rsi     # 0x969f0
leaq -0x170(%rbp), %rdi
leaq -0x798(%rbp), %rdx
leaq -0x620(%rbp), %rcx
leaq -0x4a8(%rbp), %r8
movl %r15d, %r9d
pushq $0x1
pushq %r12
pushq %r13
callq 0x55ff0
addq $0x20, %rsp
leaq -0x330(%rbp), %rdi
callq 0x418c8
leaq -0x170(%rbp), %rdi
callq 0x44be0
leaq -0x158(%rbp), %rdi
movq %r14, %rsi
callq 0x4486c
movl 0x47e5f(%rip), %r15d    # 0x96490
movl 0x47e50(%rip), %r13d    # 0x96488
leaq -0x310(%rbp), %r12
leaq -0x50(%rbp), %rsi
movq %r12, %rdi
callq 0x415b0
subq $0x8, %rsp
leaq 0x4839a(%rip), %rsi     # 0x969f0
leaq -0x158(%rbp), %rdi
leaq -0x798(%rbp), %rdx
leaq -0x620(%rbp), %rcx
leaq -0x4a8(%rbp), %r8
movl %r15d, %r9d
pushq $0x0
pushq %r12
pushq %r13
callq 0x55ff0
addq $0x20, %rsp
leaq -0x310(%rbp), %rdi
callq 0x418c8
leaq -0x158(%rbp), %rdi
callq 0x44be0
movl 0x47de2(%rip), %edx     # 0x96484
movl 0x47de0(%rip), %ecx     # 0x96488
leaq -0x620(%rbp), %rdi
leaq -0x4a8(%rbp), %rsi
callq 0x51c9b
movl 0x47dc3(%rip), %esi     # 0x96484
movl 0x47dc1(%rip), %edx     # 0x96488
leaq -0x620(%rbp), %rdi
callq 0x51e04
leaq -0x140(%rbp), %rdi
movq %r14, %rsi
callq 0x4486c
leaq 0x482d7(%rip), %rsi     # 0x969c0
leaq -0x128(%rbp), %rdi
callq 0x4ed88
leaq -0x270(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x415b0
leaq -0x140(%rbp), %rdi
leaq -0x620(%rbp), %rsi
leaq -0x4a8(%rbp), %rdx
leaq -0x128(%rbp), %rcx
leaq -0x270(%rbp), %r8
pushq $0x1
popq %r9
callq 0x50810
leaq -0x270(%rbp), %rdi
callq 0x418c8
leaq -0x128(%rbp), %rdi
callq 0x4ec7c
leaq -0x140(%rbp), %rdi
callq 0x44be0
leaq -0x110(%rbp), %rdi
movq %r14, %rsi
callq 0x4486c
leaq 0x4826d(%rip), %rsi     # 0x969d8
leaq -0xf8(%rbp), %rdi
callq 0x4ed88
leaq -0x250(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x415b0
leaq -0x110(%rbp), %rdi
leaq -0x620(%rbp), %rsi
leaq -0x4a8(%rbp), %rdx
leaq -0xf8(%rbp), %rcx
leaq -0x250(%rbp), %r8
xorl %r9d, %r9d
callq 0x50810
leaq -0x250(%rbp), %rdi
callq 0x418c8
leaq -0xf8(%rbp), %rdi
callq 0x4ec7c
leaq -0x110(%rbp), %rdi
callq 0x44be0
leaq -0xe0(%rbp), %rdi
movq %r14, %rsi
callq 0x4486c
movl 0x47c98(%rip), %r15d    # 0x96484
leaq -0x230(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x415b0
leaq -0xe0(%rbp), %rdi
leaq -0x620(%rbp), %rsi
leaq -0x230(%rbp), %rcx
pushq $0x1
popq %r8
movl %r15d, %edx
callq 0x50d15
leaq -0x230(%rbp), %rdi
callq 0x418c8
leaq -0xe0(%rbp), %rdi
callq 0x44be0
leaq -0xc8(%rbp), %rdi
movq %r14, %rsi
callq 0x4486c
movl 0x47c3d(%rip), %r15d    # 0x96488
leaq -0x210(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x415b0
leaq -0xc8(%rbp), %rdi
leaq -0x620(%rbp), %rsi
leaq -0x210(%rbp), %rcx
movl %r15d, %edx
xorl %r8d, %r8d
callq 0x50d15
leaq -0x210(%rbp), %rdi
callq 0x418c8
leaq -0xc8(%rbp), %rdi
callq 0x44be0
leaq -0xb0(%rbp), %rdi
movq %r14, %rsi
callq 0x4486c
leaq -0x1f0(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x415b0
movl 0x47bcc(%rip), %ecx     # 0x96484
movl 0x47bc9(%rip), %r8d     # 0x96488
leaq -0xb0(%rbp), %rdi
leaq -0x4a8(%rbp), %rsi
leaq -0x1f0(%rbp), %rdx
leaq -0x620(%rbp), %r9
callq 0x53ae4
leaq -0x1f0(%rbp), %rdi
callq 0x418c8
leaq -0xb0(%rbp), %rdi
callq 0x44be0
leaq -0x98(%rbp), %rdi
movq %r14, %rsi
callq 0x4486c
movl 0x47b77(%rip), %edx     # 0x96484
movl 0x47b75(%rip), %ecx     # 0x96488
leaq -0x98(%rbp), %rdi
leaq -0x910(%rbp), %rsi
callq 0x58217
leaq -0x98(%rbp), %rdi
callq 0x44be0
leaq -0x4a8(%rbp), %rdi
callq 0x50747
leaq -0x30(%rbp), %rsi
movq %rax, (%rsi)
movq %rbx, %rdi
callq 0x4fac0
leaq -0x80(%rbp), %rdi
movq %r14, %rsi
callq 0x4486c
leaq -0x80(%rbp), %rdi
leaq -0x798(%rbp), %rsi
leaq -0xa88(%rbp), %rdx
callq 0x4fe97
leaq -0x30(%rbp), %rsi
movq %rax, (%rsi)
movq %rbx, %rdi
callq 0x4fac0
leaq -0x80(%rbp), %rdi
callq 0x44be0
leaq -0x68(%rbp), %rdi
movq %r14, %rsi
callq 0x4486c
leaq -0x68(%rbp), %rdi
leaq -0x620(%rbp), %rsi
leaq -0x910(%rbp), %rdx
callq 0x50107
leaq -0x30(%rbp), %rsi
movq %rax, (%rsi)
movq %rbx, %rdi
callq 0x4fac0
leaq -0x68(%rbp), %rdi
callq 0x44be0
leaq -0x910(%rbp), %rdi
callq 0x410e0
leaq -0x620(%rbp), %rdi
callq 0x410e0
leaq -0xa88(%rbp), %rdi
callq 0x410e0
leaq -0x798(%rbp), %rdi
callq 0x410e0
leaq -0x4a8(%rbp), %rdi
callq 0x410e0
leaq -0x50(%rbp), %rdi
callq 0x418c8
leaq -0x2d0(%rbp), %rdi
callq 0x418c8
leaq -0x2f0(%rbp), %rdi
callq 0x418c8
movq %rbx, %rax
addq $0xa68, %rsp            # imm = 0xA68
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4ec0c
jmp 0x4ec0c
movq %rax, %r14
leaq -0x98(%rbp), %rdi
jmp 0x4ec03
movq %rax, %r14
leaq -0x1f0(%rbp), %rdi
callq 0x418c8
jmp 0x4ea62
movq %rax, %r14
leaq -0xb0(%rbp), %rdi
jmp 0x4ec03
movq %rax, %r14
leaq -0x210(%rbp), %rdi
callq 0x418c8
jmp 0x4ea82
movq %rax, %r14
leaq -0xc8(%rbp), %rdi
jmp 0x4ec03
movq %rax, %r14
leaq -0x230(%rbp), %rdi
callq 0x418c8
jmp 0x4eaa2
movq %rax, %r14
leaq -0xe0(%rbp), %rdi
jmp 0x4ec03
movq %rax, %r14
leaq -0x250(%rbp), %rdi
callq 0x418c8
jmp 0x4eac2
movq %rax, %r14
leaq -0xf8(%rbp), %rdi
callq 0x4ec7c
jmp 0x4ead3
movq %rax, %r14
leaq -0x110(%rbp), %rdi
jmp 0x4ec03
movq %rax, %r14
leaq -0x270(%rbp), %rdi
callq 0x418c8
jmp 0x4eaf3
movq %rax, %r14
leaq -0x128(%rbp), %rdi
callq 0x4ec7c
jmp 0x4eb04
movq %rax, %r14
leaq -0x140(%rbp), %rdi
jmp 0x4ec03
movq %rax, %r14
leaq -0x310(%rbp), %rdi
callq 0x418c8
jmp 0x4eb24
movq %rax, %r14
leaq -0x158(%rbp), %rdi
jmp 0x4ec03
movq %rax, %r14
leaq -0x330(%rbp), %rdi
callq 0x418c8
jmp 0x4eb44
movq %rax, %r14
leaq -0x170(%rbp), %rdi
jmp 0x4ec03
movq %rax, %r14
leaq -0x188(%rbp), %rdi
jmp 0x4ec03
movq %rax, %r14
leaq -0x1a0(%rbp), %rdi
jmp 0x4ec03
movq %rax, %r14
leaq -0x290(%rbp), %rdi
callq 0x418c8
jmp 0x4eb82
movq %rax, %r14
leaq -0x1b8(%rbp), %rdi
jmp 0x4ec03
movq %rax, %r14
leaq -0x2b0(%rbp), %rdi
callq 0x418c8
jmp 0x4eb9f
movq %rax, %r14
leaq -0x1d0(%rbp), %rdi
jmp 0x4ec03
movq %rax, %r14
jmp 0x4ec1b
movq %rax, %r14
jmp 0x4ec27
movq %rax, %r14
jmp 0x4ec33
movq %rax, %r14
jmp 0x4ec3f
movq %rax, %r14
jmp 0x4ec4b
movq %rax, %r14
leaq -0x4a8(%rbp), %rdi
callq 0x418c8
jmp 0x4ebdb
movq %rax, %r14
leaq -0x798(%rbp), %rdi
jmp 0x4ec4f
movq %rax, %r14
jmp 0x4ec54
movq %rax, %r14
jmp 0x4ec60
movq %rax, %r14
jmp 0x4ec6c
movq %rax, %r14
leaq -0x68(%rbp), %rdi
jmp 0x4ec03
movq %rax, %r14
leaq -0x80(%rbp), %rdi
callq 0x44be0
jmp 0x4ec0f
jmp 0x4ec0c
movq %rax, %r14
leaq -0x910(%rbp), %rdi
callq 0x410e0
leaq -0x620(%rbp), %rdi
callq 0x410e0
leaq -0xa88(%rbp), %rdi
callq 0x410e0
leaq -0x798(%rbp), %rdi
callq 0x410e0
leaq -0x4a8(%rbp), %rdi
callq 0x410e0
leaq -0x50(%rbp), %rdi
callq 0x418c8
leaq -0x2d0(%rbp), %rdi
callq 0x418c8
leaq -0x2f0(%rbp), %rdi
callq 0x418c8
movq %rbx, %rdi
callq 0x45a16
movq %r14, %rdi
callq 0x41790