// File: /workspace/github_cpp_makefile_star2_O1/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 0x1f1bc
leaq 0xd0(%r12), %rcx
cmpq %rcx, %rax
jne 0x1cb61
movq 0xf8(%r12), %rdi
movq %rbx, %rsi
movq %rbx, %rdx
callq 0x1790e
movq 0xf8(%r12), %rsi
leaq 0x80(%rsp), %rdi
movq %rbx, %rdx
callq 0x180c6
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 0x5a1db(%rip), %rsi     # 0x76a9c
leaq 0xf8(%rsp), %rdi
leaq 0x80(%rsp), %rdx
callq 0xdbef
leaq 0x5f11b(%rip), %rsi     # 0x7b9f8
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 0x1c911
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x1c918
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 0x1c962
callq 0xa2b0
leaq 0x108(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1c978
callq 0xa2b0
movq 0x8(%rbp), %rax
subq (%rbp), %rax
shrq $0x6, %rax
testl %eax, %eax
jle 0x1ca01
xorl %r14d, %r14d
leaq 0x28(%rsp), %rbx
leaq 0x5a105(%rip), %r15     # 0x76a9c
leaq 0x5cd57(%rip), %r12     # 0x796f5
xorl %r13d, %r13d
testq %r14, %r14
je 0x1c9b1
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 0x8(%rbp), %rax
subq (%rbp), %rax
shrq $0x6, %rax
cltq
addq $0x40, %r14
cmpq %rax, %r13
jl 0x1c9a1
leaq 0x5dad9(%rip), %rsi     # 0x7a4e1
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 0xdde2
movq 0xf8(%r14), %rsi
leaq 0x70(%rsp), %rdi
callq 0x1786a
leaq 0x59fe3(%rip), %rsi     # 0x76a4f
movq %rbx, %rdi
callq 0xa0e0
testl %eax, %eax
je 0x1ca8e
leaq 0x5d900(%rip), %rsi     # 0x7a37f
movq %rbx, %rdi
callq 0xa0e0
testl %eax, %eax
setne %al
jmp 0x1ca90
xorl %eax, %eax
movb $0x1, %r14b
movzbl %al, %ecx
leaq 0xa0(%rsp), %rsi
leaq 0x70(%rsp), %rdx
movq %rbp, %rdi
callq 0x18224
leaq 0x10(%rsp), %rbx
movq %rbp, -0x8(%rbx)
xorl %r14d, %r14d
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x1f246
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x1cad1
callq 0xdcba
movq 0xa0(%rsp), %rdi
cmpq %r15, %rdi
je 0x1cae3
callq 0xa2b0
movq 0x50(%rsp), %rdi
movq %r12, %rsi
callq 0x1e37a
movq 0x8(%rsp), %rcx
movq %rcx, (%rax)
addq $0x8, %rax
movq %rax, %rdi
movq %rbx, %rsi
callq 0xde72
movq 0x8(%rsp), %rdi
movq 0x48(%rsp), %rsi
callq 0x1834e
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1cb25
callq 0xdcba
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x1cb39
callq 0xa2b0
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1cb4f
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 0x5a2d2(%rip), %rsi     # 0x76e47
leaq 0x80(%rsp), %rdi
movq %rbx, %rdx
callq 0xdbef
leaq 0x59e64(%rip), %rsi     # 0x769f0
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 0x1cbbd
movups (%rcx), %xmm0
movups %xmm0, (%r14)
jmp 0x1cbd0
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 0x200e4
xorl %ebp, %ebp
leaq 0x79a22(%rip), %rsi     # 0x96638
leaq -0x8325(%rip), %rdx     # 0x148f8
movq %r15, %rdi
callq 0xa4f0
movq %rax, %rbx
movq 0xe8(%rsp), %rdi
testq %rdi, %rdi
je 0x1cc3a
callq 0xdcba
movq 0xc0(%rsp), %rdi
cmpq %r14, %rdi
je 0x1cc54
callq 0xa2b0
jmp 0x1cc54
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1cc72
callq 0xa2b0
jmp 0x1cc72
movq %rax, %rbx
movb $0x1, %bpl
testb %bpl, %bpl
je 0x1cd3c
movq %r15, %rdi
callq 0xa240
jmp 0x1cd3c
movq %rax, %rbx
movb $0x1, %r14b
jmp 0x1ccec
movq %rax, %rbx
movb $0x1, %r14b
jmp 0x1ccfe
jmp 0x1cd0f
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x1ccb1
callq 0xa2b0
jmp 0x1ccb1
movq %rax, %rbx
leaq 0x108(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x1cd06
jmp 0x1cd12
jmp 0x1cd0f
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1cd12
callq 0xdcba
jmp 0x1cd12
movq %rax, %rbx
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x1ccec
callq 0xdcba
movq 0xa0(%rsp), %rdi
cmpq %r15, %rdi
je 0x1ccfe
callq 0xa2b0
testb %r14b, %r14b
je 0x1cd12
movq %rbp, %rdi
callq 0xa2b0
jmp 0x1cd12
jmp 0x1cd0f
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x1cd26
callq 0xa2b0
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1cd3c
callq 0xa2b0
movq %rbx, %rdi
callq 0xa510