// File: /workspace/github_cpp_makefile_star2_O1/menhits[P]phplus/src/CppProgram.cpp
// Function: CppProgram::getCppCode[abi:cxx11]()
string CppProgram::getCppCode()
{
	string out;
	
	if (!globalTopCode.empty())
		out+=globalTopCode+"\n";
	
	if (!globalIncludesCode.empty())
		out+=globalIncludesCode+"\n";
	
	if (!globalTypesCode.empty())
		out+=globalTypesCode+"\n";
	
	if (funcs.size()>1)
	{
		for (auto i: funcs)
		{
			if (i.first!="main")
				out+=i.second->getPrototype()+";\n";
		}
		
		out+="\n";
	}
	
	if (!globalVarCode.empty())
		out+=globalVarCode+"\n";
	
	for (auto i: funcs)
	{
		out+=i.second->getPrototype();
		
		string funcSrc=i.second->getSource();
		
		if (funcSrc.size()<2)
		{
			out+="\n{\n\t// empty function\n}\n\n";
		}
		else
		{
			if (i.second->getIfReturnsVal() && funcSrc[0]!='{' && searchInString(funcSrc, ";")==int(funcSrc.size())-2)
				funcSrc="return "+funcSrc;
			out+="\n{\n";
			if (!i.second->varDeclareSource.empty())
				out+=indentString(i.second->varDeclareSource+"\n", indent);
			out+=indentString(funcSrc, indent);
			if (!out.empty() && out.back()!='\n')
				out+=";\n";
			//if (i.first=="main")
			//	out+=indentString("return 0;\n", indent);
			//if (out.substr(out.size()-2, 2)!=";\n")
			//	out+=";\n";
			out+="}\n\n";
		}
	}
	
	out+=
"int main(int argcIn, char** argvIn)\n\
{\n\
	argc = argcIn;\n\
	argv = argvIn;\n\
	if (argc >= 2 && strcmp(argv[1], \"--running-from-Phplus\") == 0)\n\
	{\n\
		argc -= 2;\n\
		if (argc == 0)\n\
			argv = 0;\n\
		else\n\
			argv += 2;\n\
	}\n\
	_main();\n\
	return 0;\n\
}\n";
	
	return out;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, (%rsp)
movq %rax, (%rdi)
movq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
movq 0x28(%rsi), %rdx
testq %rdx, %rdx
je 0x1d873
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x20(%r14), %rsi
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0xdde2
leaq 0x596e0(%rip), %rsi     # 0x76f28
leaq 0x8(%rsp), %rdi
callq 0xa560
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0xa110
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x1d873
callq 0xa2b0
movq 0x48(%r14), %rdx
testq %rdx, %rdx
je 0x1d8c8
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x40(%r14), %rsi
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0xdde2
leaq 0x5968b(%rip), %rsi     # 0x76f28
leaq 0x8(%rsp), %rdi
callq 0xa560
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0xa110
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x1d8c8
callq 0xa2b0
movq 0x88(%r14), %rdx
testq %rdx, %rdx
je 0x1d923
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x80(%r14), %rsi
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0xdde2
leaq 0x59630(%rip), %rsi     # 0x76f28
leaq 0x8(%rsp), %rdi
callq 0xa560
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0xa110
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x1d923
callq 0xa2b0
cmpq $0x2, 0xf0(%r14)
movq %r14, 0x78(%rsp)
jb 0x1da81
movq 0xe0(%r14), %r15
leaq 0xd0(%r14), %r13
cmpq %r13, %r15
je 0x1da6d
leaq 0x48(%rsp), %rbp
leaq 0x8(%rsp), %r12
leaq 0x20(%r15), %rsi
movq %r12, %rdi
callq 0x1e434
movq %r12, %rdi
leaq 0x59470(%rip), %rsi     # 0x76ddd
callq 0xa0e0
testl %eax, %eax
je 0x1da36
movq 0x28(%rsp), %rax
leaq 0x90(%rsp), %rcx
movq %rcx, 0x80(%rsp)
movq 0x70(%rax), %rsi
movq 0x78(%rax), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %r14
movq %r14, %rdi
callq 0xdde2
movq %r14, %rdi
leaq 0x5bd48(%rip), %rsi     # 0x796fc
callq 0xa560
movq %rbp, 0x38(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x1d9dc
movq %rdx, 0x38(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x48(%rsp)
jmp 0x1d9e3
movups (%rcx), %xmm0
movups %xmm0, (%rbp)
movq 0x8(%rax), %rdx
movq %rdx, 0x40(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
movq %rbx, %rdi
callq 0xa110
movq 0x38(%rsp), %rdi
cmpq %rbp, %rdi
je 0x1da1c
callq 0xa2b0
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x1da36
callq 0xa2b0
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x1da45
callq 0xdcba
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x1da59
callq 0xa2b0
movq %r15, %rdi
callq 0xa210
movq %rax, %r15
cmpq %r13, %rax
jne 0x1d957
leaq 0x594b4(%rip), %rsi     # 0x76f28
movq %rbx, %rdi
callq 0xa560
movq 0x78(%rsp), %r14
movq 0x68(%r14), %rdx
testq %rdx, %rdx
je 0x1dad6
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x60(%r14), %rsi
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0xdde2
leaq 0x5947d(%rip), %rsi     # 0x76f28
leaq 0x8(%rsp), %rdi
callq 0xa560
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0xa110
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x1dad6
callq 0xa2b0
movq 0xe0(%r14), %r15
leaq 0xd0(%r14), %rax
movq %rax, 0xc0(%rsp)
cmpq %rax, %r15
je 0x1de3c
leaq 0x48(%rsp), %r12
leaq 0x38(%rsp), %r13
leaq 0x20(%r15), %rsi
leaq 0x8(%rsp), %rdi
callq 0x1e434
movq 0x28(%rsp), %rax
movq %r12, 0x38(%rsp)
movq 0x70(%rax), %rsi
movq 0x78(%rax), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0xdde2
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
movq %rbx, %rdi
callq 0xa110
movq 0x38(%rsp), %rdi
cmpq %r12, %rdi
je 0x1db4b
callq 0xa2b0
movq 0x28(%rsp), %rax
movq %r12, 0x38(%rsp)
movq 0x50(%rax), %rsi
movq 0x58(%rax), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0xdde2
cmpq $0x2, 0x40(%rsp)
leaq 0x5939b(%rip), %rsi     # 0x76f10
jb 0x1dde9
movq 0x28(%rsp), %rax
cmpb $0x1, 0x90(%rax)
jne 0x1db93
movq 0x38(%rsp), %rax
cmpb $0x7b, (%rax)
jne 0x1db99
xorl %eax, %eax
xorl %ebp, %ebp
jmp 0x1dbe3
leaq 0x90(%rsp), %rax
movq %rax, 0x80(%rsp)
leaq 0x80(%rsp), %rbp
movq %rbp, %rdi
leaq 0x5cb6f(%rip), %rsi     # 0x7a72a
leaq 0x5cb69(%rip), %rdx     # 0x7a72b
callq 0xdf6a
movq %r13, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0x59ec5
movl 0x40(%rsp), %ecx
addl $-0x2, %ecx
cmpl %ecx, %eax
sete %bpl
movb $0x1, %al
testb %al, %al
je 0x1dc01
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x1dc01
callq 0xa2b0
testb %bpl, %bpl
leaq 0xf8(%rsp), %rbp
je 0x1dc44
leaq 0x58(%rsp), %r14
movq %r14, %rdi
leaq 0x5bc85(%rip), %rsi     # 0x798a2
movq %r13, %rdx
callq 0xdbef
movq %r13, %rdi
movq %r14, %rsi
callq 0xa370
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x1dc44
callq 0xa2b0
movq %rbx, %rdi
leaq 0x591b1(%rip), %rsi     # 0x76dff
callq 0xa560
movq 0x28(%rsp), %rax
movq 0x38(%rax), %rdx
testq %rdx, %rdx
je 0x1dd3e
leaq 0xb0(%rsp), %rcx
movq %rcx, 0xa0(%rsp)
movq 0x30(%rax), %rsi
addq %rsi, %rdx
leaq 0xa0(%rsp), %r14
movq %r14, %rdi
callq 0xdde2
movq %r14, %rdi
leaq 0x59292(%rip), %rsi     # 0x76f28
callq 0xa560
leaq 0xd8(%rsp), %rax
movq %rax, 0xc8(%rsp)
movq 0x78(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0xc8(%rsp), %r14
movq %r14, %rdi
callq 0xdde2
leaq 0x58(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
movq %r14, %rdx
movl $0x1, %ecx
callq 0x5a113
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
movq %rbx, %rdi
callq 0xa110
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x1dd0a
callq 0xa2b0
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0x1dd24
callq 0xa2b0
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x1dd3e
callq 0xa2b0
movq %rbp, 0xe8(%rsp)
movq 0x78(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0xe8(%rsp), %r14
movq %r14, %rdi
callq 0xdde2
leaq 0x58(%rsp), %rdi
movq %r13, %rsi
movq %r14, %rdx
movl $0x1, %ecx
callq 0x5a113
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
movq %rbx, %rdi
callq 0xa110
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x1dda0
callq 0xa2b0
movq 0xe8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x1ddb2
callq 0xa2b0
movq 0x8(%rbx), %rax
leaq 0x59169(%rip), %rsi     # 0x76f26
testq %rax, %rax
je 0x1dde9
movq (%rbx), %rcx
cmpb $0xa, -0x1(%rcx,%rax)
leaq 0x59155(%rip), %rsi     # 0x76f26
je 0x1dde9
movq %rbx, %rdi
leaq 0x5b91f(%rip), %rsi     # 0x796fc
callq 0xa560
leaq 0x5913d(%rip), %rsi     # 0x76f26
movq %rbx, %rdi
callq 0xa560
movq 0x38(%rsp), %rdi
cmpq %r12, %rdi
je 0x1de00
callq 0xa2b0
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x1de0f
callq 0xdcba
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x1de23
callq 0xa2b0
movq %r15, %rdi
callq 0xa210
movq %rax, %r15
cmpq 0xc0(%rsp), %rax
jne 0x1daff
leaq 0x590e7(%rip), %rsi     # 0x76f2a
movq %rbx, %rdi
callq 0xa560
movq %rbx, %rax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1de7d
jmp 0x1de7d
jmp 0x1df96
jmp 0x1de7d
jmp 0x1de7d
jmp 0x1de7d
jmp 0x1df96
jmp 0x1de7d
jmp 0x1de7d
jmp 0x1df96
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x1df99
callq 0xa2b0
jmp 0x1df99
jmp 0x1df96
jmp 0x1df96
movq %rax, %r14
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
jmp 0x1df88
jmp 0x1dfa8
jmp 0x1dfa8
jmp 0x1df03
jmp 0x1dfa8
movq %rax, %r14
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x1dee7
callq 0xa2b0
jmp 0x1dee7
movq %rax, %r14
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0x1df06
callq 0xa2b0
jmp 0x1df06
movq %rax, %r14
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
jmp 0x1df88
movq %rax, %r14
movq 0x38(%rsp), %rdi
cmpq %rbp, %rdi
je 0x1df34
callq 0xa2b0
jmp 0x1df34
movq %rax, %r14
jmp 0x1df4e
movq %rax, %r14
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x1df4e
callq 0xa2b0
leaq 0x8(%rsp), %rdi
callq 0x1e486
jmp 0x1df99
jmp 0x1dfa8
movq %rax, %r14
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x1df78
callq 0xa2b0
jmp 0x1df78
movq %rax, %r14
movq 0xe8(%rsp), %rdi
leaq 0xf8(%rsp), %rax
cmpq %rax, %rdi
je 0x1dfab
callq 0xa2b0
jmp 0x1dfab
jmp 0x1df96
movq %rax, %r14
movq (%rsp), %r15
jmp 0x1dfc8
jmp 0x1dfa3
jmp 0x1dfa8
movq %rax, %r14
jmp 0x1dfba
movq %rax, %r14
movq 0x38(%rsp), %rdi
cmpq %r12, %rdi
je 0x1dfba
callq 0xa2b0
movq (%rsp), %r15
leaq 0x8(%rsp), %rdi
callq 0x1e486
movq (%rbx), %rdi
cmpq %r15, %rdi
je 0x1dfd5
callq 0xa2b0
movq %r14, %rdi
callq 0xa510
nop