// File: /workspace/github_cpp_makefile_star2_O3/menhits[P]phplus/src/CppProgram.cpp
// Function: CppProgram::addFunc(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void CppProgram::addFunc(const string& name, vector<std::pair<string, string>> args, string returnType, string contents)
{
	if (hasFunc(name))
	{
		throw PhplusError("called CppProgram::addFunc with function name '"+name+"', which already exists", INTERNAL_ERROR);
	}
	
	globalNames->addPp(name, name);
	
	string cppName=globalNames->getCpp(name);
	
	string prototype;
	
	prototype+=returnType;
	
	prototype+=" "+cppName+"(";
	
	for (int i=0; i<int(args.size()); i++)
	{
		if (i)
			prototype+=", ";
		
		prototype+=args[i].first;
		
		prototype+=" ";
		
		prototype+=args[i].second;
	}
	
	prototype+=")";
	
	auto func=CppFunc(new CppFuncBase(prototype, globalNames->makeChild(), (returnType!="" && returnType!="void")));
	funcs[name]=func;
	func->code(contents);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %r8, 0x48(%rsp)
movq %rcx, %r15
movq %rdx, %rbp
movq %rsi, %rbx
movq %rdi, %r12
addq $0xc8, %rdi
movq %rdi, 0x50(%rsp)
callq 0x1f51a
leaq 0xd0(%r12), %rcx
cmpq %rcx, %rax
jne 0x1cea4
movq 0xf8(%r12), %rdi
movq %rbx, %rsi
movq %rbx, %rdx
callq 0x17b94
movq 0xf8(%r12), %rsi
leaq 0x80(%rsp), %rdi
movq %rbx, %rdx
callq 0x18386
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
leaq 0x28(%rsp), %rdi
callq 0xa110
leaq 0x5ae9f(%rip), %rsi     # 0x77a9c
leaq 0xf8(%rsp), %rdi
leaq 0x80(%rsp), %rdx
callq 0xdc11
leaq 0x5fd9f(%rip), %rsi     # 0x7c9b8
leaq 0xf8(%rsp), %rdi
callq 0xa560
leaq 0x18(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x1cc4d
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x1cc54
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
movq %rdx, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
leaq 0x28(%rsp), %rdi
callq 0xa110
movq %r12, 0x58(%rsp)
movq %r15, 0x60(%rsp)
movq %rbx, 0x68(%rsp)
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x1cc9e
callq 0xa2b0
leaq 0x108(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1ccb4
callq 0xa2b0
movq (%rbp), %rax
movq 0x8(%rbp), %rcx
subq %rax, %rcx
shrq $0x6, %rcx
testl %ecx, %ecx
jle 0x1cd44
xorl %r14d, %r14d
leaq 0x28(%rsp), %rbx
leaq 0x5adc6(%rip), %r15     # 0x77a9c
leaq 0x5d9d8(%rip), %r12     # 0x7a6b5
xorl %r13d, %r13d
testq %r14, %r14
je 0x1ccf4
movq %rbx, %rdi
movq %r12, %rsi
callq 0xa560
movq (%rbp), %rax
movq (%rax,%r14), %rsi
movq 0x8(%rax,%r14), %rdx
movq %rbx, %rdi
callq 0xa110
movq %rbx, %rdi
movq %r15, %rsi
callq 0xa560
movq (%rbp), %rax
movq 0x20(%rax,%r14), %rsi
movq 0x28(%rax,%r14), %rdx
movq %rbx, %rdi
callq 0xa110
incq %r13
movq (%rbp), %rax
movq 0x8(%rbp), %rcx
subq %rax, %rcx
shrq $0x6, %rcx
movslq %ecx, %rcx
addq $0x40, %r14
cmpq %rcx, %r13
jl 0x1cce0
leaq 0x5e756(%rip), %rsi     # 0x7b4a1
leaq 0x28(%rsp), %rdi
callq 0xa560
movq 0x68(%rsp), %r12
movq 0x60(%rsp), %rbx
movq 0x58(%rsp), %r14
movl $0xb0, %edi
callq 0xa2d0
movq %rax, %rbp
leaq 0xb0(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
addq %rsi, %rdx
leaq 0xa0(%rsp), %rdi
callq 0xde0c
movq 0xf8(%r14), %rsi
leaq 0x70(%rsp), %rdi
callq 0x17af0
leaq 0x5aca0(%rip), %rsi     # 0x77a4f
movq %rbx, %rdi
callq 0xa0e0
testl %eax, %eax
je 0x1cdd1
leaq 0x5e57d(%rip), %rsi     # 0x7b33f
movq %rbx, %rdi
callq 0xa0e0
testl %eax, %eax
setne %al
jmp 0x1cdd3
xorl %eax, %eax
movb $0x1, %r14b
movzbl %al, %ecx
leaq 0xa0(%rsp), %rsi
leaq 0x70(%rsp), %rdx
movq %rbp, %rdi
callq 0x184f0
leaq 0x10(%rsp), %rbx
movq %rbp, -0x8(%rbx)
xorl %r14d, %r14d
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x1f5a4
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x1ce14
callq 0xdce4
movq 0xa0(%rsp), %rdi
cmpq %r15, %rdi
je 0x1ce26
callq 0xa2b0
movq 0x50(%rsp), %rdi
movq %r12, %rsi
callq 0x1e6ec
movq 0x8(%rsp), %rcx
movq %rcx, (%rax)
addq $0x8, %rax
movq %rax, %rdi
movq %rbx, %rsi
callq 0xdea2
movq 0x8(%rsp), %rdi
movq 0x48(%rsp), %rsi
callq 0x1861a
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1ce68
callq 0xdce4
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x1ce7c
callq 0xa2b0
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1ce92
callq 0xa2b0
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x38, %edi
callq 0xa1b0
movq %rax, %r15
leaq 0x5af8f(%rip), %rsi     # 0x77e47
leaq 0x80(%rsp), %rdi
movq %rbx, %rdx
callq 0xdc11
leaq 0x5ab21(%rip), %rsi     # 0x779f0
leaq 0x80(%rsp), %rdi
callq 0xa560
leaq 0xd0(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x1cf00
movups (%rcx), %xmm0
movups %xmm0, (%r14)
jmp 0x1cf13
movq %rdx, 0xc0(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xd0(%rsp)
movq 0x8(%rax), %rdx
leaq 0xc0(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
xorps %xmm0, %xmm0
leaq 0xe0(%rsp), %rcx
movaps %xmm0, (%rcx)
movb $0x1, %bpl
movq %r15, %rdi
movl $0x3, %edx
callq 0x203f4
xorl %ebp, %ebp
leaq 0x7a6df(%rip), %rsi     # 0x97638
leaq -0x843a(%rip), %rdx     # 0x14b26
movq %r15, %rdi
callq 0xa4f0
movq %rax, %rbx
movq 0xe8(%rsp), %rdi
testq %rdi, %rdi
je 0x1cf7d
callq 0xdce4
movq 0xc0(%rsp), %rdi
cmpq %r14, %rdi
je 0x1cf8f
callq 0xa2b0
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1cfa5
callq 0xa2b0
testb %bpl, %bpl
jne 0x1cfcd
jmp 0x1d09a
movq %rax, %rbx
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1cfcd
callq 0xa2b0
jmp 0x1cfcd
movq %rax, %rbx
movq %r15, %rdi
callq 0xa240
jmp 0x1d09a
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
cmpq %r15, %rdi
je 0x1d061
callq 0xa2b0
jmp 0x1d061
movq %rax, %rbx
jmp 0x1d061
jmp 0x1d06d
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x1d00f
callq 0xa2b0
jmp 0x1d00f
movq %rax, %rbx
leaq 0x108(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x1d064
jmp 0x1d070
jmp 0x1d06d
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1d070
callq 0xdce4
jmp 0x1d070
movq %rax, %rbx
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x1d04a
callq 0xdce4
movq 0xa0(%rsp), %rdi
cmpq %r15, %rdi
je 0x1d05c
callq 0xa2b0
testb %r14b, %r14b
je 0x1d070
movq %rbp, %rdi
callq 0xa2b0
jmp 0x1d070
jmp 0x1d06d
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x1d084
callq 0xa2b0
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1d09a
callq 0xa2b0
movq %rbx, %rdi
callq 0xa510