// File: /workspace/github_cpp_makefile_star2_O3/menhits[P]phplus/src/CppProgram.cpp
// Function: CppProgram::pushFunc(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::shared_ptr<TypeBase>, std::shared_ptr<TypeBase>, std::shared_ptr<TypeBase>)
void CppProgram::pushFunc(const string& name, const string& cppNameHint, Type leftIn, Type rightIn, Type returnType)
{
	if (hasFunc(name))
	{
		throw PhplusError("called CppProgram::pushFunc with function name '"+name+"', which already exists", INTERNAL_ERROR);
	}
	
	globalNames->addPp(name, cppNameHint);
	
	string cppName=globalNames->getCpp(name);
	
	auto funcNames=globalNames->makeChild();
	
	string prototype;
	
	prototype+=getTypeCode(returnType);
	
	prototype+=" "+cppName+"(";
	
	bool keepTuplesTogether=true;
	
	if (keepTuplesTogether)
	{
		if (leftIn->isCreatable())
		{
			prototype+=getTypeCode(leftIn)+" me";
			funcNames->addPp("me");
		}
		
		if (rightIn->isCreatable())
		{
			if (leftIn->isCreatable())
				prototype+=", ";
			
			prototype+=getTypeCode(rightIn)+" in";
			funcNames->addPp("in");
		}
	}
	else
	{
		vector<std::pair<string, string>> args;
		
		if (leftIn->getType()==TypeBase::TUPLE)
		{
			for (auto i: *leftIn->getAllSubTypes())
			{
				args.push_back({getTypeCode(i.type), i.name});
			}
		}
		else if (!leftIn->isCreatable())
		{
			// do nothing
		}
		else
		{
			args.push_back({getTypeCode(leftIn), "me"});
		}
		
		if (rightIn->getType()==TypeBase::TUPLE)
		{
			for (auto i: *rightIn->getAllSubTypes())
			{
				args.push_back({getTypeCode(i.type), i.name});
			}
		}
		else if (!rightIn->isCreatable())
		{
			// do nothing
		}
		else
		{
			args.push_back({getTypeCode(rightIn), "in"});
		}
		
		for (int i=0; i<int(args.size()); i++)
		{
			if (i)
				prototype+=", ";
			
			prototype+=args[i].first;
			
			prototype+=" ";
			
			funcNames->addPp(args[i].second, args[i].second);
			
			prototype+=funcNames->getCpp(args[i].second);
		}
	}
	
	prototype+=")";
	
	activeFunc=CppFunc(new CppFuncBase(prototype, funcNames, returnType->isCreatable()));
	funcs[name]=activeFunc;
	funcStack.push_back(name);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %r9, 0x70(%rsp)
movq %r8, %r13
movq %rcx, %rbp
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
addq $0xc8, %rdi
movq %rdi, 0xb8(%rsp)
callq 0x1f51a
leaq 0xd0(%r14), %rcx
cmpq %rcx, %rax
jne 0x1d6cf
movq 0xf8(%r14), %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x17b94
movq 0xf8(%r14), %rsi
leaq 0xc0(%rsp), %rdi
movq %rbx, %rdx
callq 0x18386
movq 0xf8(%r14), %rsi
leaq 0x40(%rsp), %rdi
callq 0x17af0
leaq 0x60(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x70(%rsp), %rcx
movq (%rcx), %rax
movq %rax, 0xa8(%rsp)
movq 0x8(%rcx), %rax
movq %rax, 0xb0(%rsp)
testq %rax, %rax
je 0x1d16f
movq 0x7ce47(%rip), %rcx     # 0x99fa8
cmpb $0x0, (%rcx)
je 0x1d16b
incl 0x8(%rax)
jmp 0x1d16f
lock
incl 0x8(%rax)
movq %rsp, %rdi
leaq 0xa8(%rsp), %rdx
movq %r14, %rsi
callq 0x1aab2
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
leaq 0x50(%rsp), %rdi
callq 0xa110
leaq 0x10(%rsp), %r12
movq -0x10(%r12), %rdi
cmpq %r12, %rdi
je 0x1d1a9
callq 0xa2b0
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x1d1bb
callq 0xdce4
leaq 0x5a8da(%rip), %rsi     # 0x77a9c
leaq 0x20(%rsp), %rdi
leaq 0xc0(%rsp), %rdx
callq 0xdc11
leaq 0x5f7dd(%rip), %rsi     # 0x7c9b8
leaq 0x20(%rsp), %rdi
callq 0xa560
movq %r12, (%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x1d206
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x1d20e
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
leaq 0x50(%rsp), %rdi
callq 0xa110
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x1d247
callq 0xa2b0
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1d25a
callq 0xa2b0
movq (%rbp), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
testb %al, %al
je 0x1d3bc
movq (%rbp), %rax
movq %rax, 0x98(%rsp)
movq 0x8(%rbp), %rax
movq %rax, 0xa0(%rsp)
testq %rax, %rax
je 0x1d29e
movq 0x7cd18(%rip), %rcx     # 0x99fa8
cmpb $0x0, (%rcx)
je 0x1d29a
incl 0x8(%rax)
jmp 0x1d29e
lock
incl 0x8(%rax)
leaq 0x20(%rsp), %rdi
leaq 0x98(%rsp), %rdx
movq %r14, %rsi
callq 0x1aab2
leaq 0x5abee(%rip), %rsi     # 0x77ea8
leaq 0x20(%rsp), %rdi
callq 0xa560
movq %r12, (%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x1d2e5
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x1d2ed
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
leaq 0x50(%rsp), %rdi
callq 0xa110
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x1d326
callq 0xa2b0
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x1d33a
callq 0xa2b0
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x1d34c
callq 0xdce4
movq 0x40(%rsp), %r15
movq %rsp, %rdi
movq %r12, (%rdi)
leaq 0x5ab4b(%rip), %rsi     # 0x77ea9
leaq 0x5ab46(%rip), %rdx     # 0x77eab
callq 0xdfa8
leaq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
movq %rax, (%rdi)
leaq 0x5a5c7(%rip), %rsi     # 0x77945
leaq 0x5a5e5(%rip), %rdx     # 0x7796a
callq 0xdfa8
movq %rsp, %rsi
leaq 0x20(%rsp), %rdx
movq %r15, %rdi
callq 0x17b94
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x1d3ae
callq 0xa2b0
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x1d3bc
callq 0xa2b0
movq (%r13), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
testb %al, %al
je 0x1d53d
movq (%rbp), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
testb %al, %al
je 0x1d3ed
leaq 0x5d2d2(%rip), %rsi     # 0x7a6b5
leaq 0x50(%rsp), %rdi
callq 0xa560
movq (%r13), %rax
movq %rax, 0x88(%rsp)
movq 0x8(%r13), %rax
movq %rax, 0x90(%rsp)
testq %rax, %rax
je 0x1d41f
movq 0x7cb97(%rip), %rcx     # 0x99fa8
cmpb $0x0, (%rcx)
je 0x1d41b
incl 0x8(%rax)
jmp 0x1d41f
lock
incl 0x8(%rax)
leaq 0x20(%rsp), %rdi
leaq 0x88(%rsp), %rdx
movq %r14, %rsi
callq 0x1aab2
leaq 0x5aa71(%rip), %rsi     # 0x77eac
leaq 0x20(%rsp), %rdi
callq 0xa560
movq %r12, (%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x1d466
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x1d46e
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
leaq 0x50(%rsp), %rdi
callq 0xa110
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x1d4a7
callq 0xa2b0
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x1d4bb
callq 0xa2b0
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x1d4cd
callq 0xdce4
movq 0x40(%rsp), %r15
movq %rsp, %rdi
movq %r12, (%rdi)
leaq 0x5a9ce(%rip), %rsi     # 0x77ead
leaq 0x5a9c9(%rip), %rdx     # 0x77eaf
callq 0xdfa8
leaq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
movq %rax, (%rdi)
leaq 0x5a446(%rip), %rsi     # 0x77945
leaq 0x5a464(%rip), %rdx     # 0x7796a
callq 0xdfa8
movq %rsp, %rsi
leaq 0x20(%rsp), %rdx
movq %r15, %rdi
callq 0x17b94
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x1d52f
callq 0xa2b0
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x1d53d
callq 0xa2b0
leaq 0x5df5d(%rip), %rsi     # 0x7b4a1
leaq 0x50(%rsp), %rdi
callq 0xa560
movl $0xb0, %edi
callq 0xa2d0
movq %rax, %r13
leaq 0xf0(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %rdx
addq %rsi, %rdx
leaq 0xe0(%rsp), %rdi
callq 0xde0c
movq 0x40(%rsp), %rcx
movq 0x48(%rsp), %rax
movq %rcx, 0x78(%rsp)
movq %rax, 0x80(%rsp)
testq %rax, %rax
je 0x1d5b2
movq 0x7ca04(%rip), %rcx     # 0x99fa8
cmpb $0x0, (%rcx)
je 0x1d5ae
incl 0x8(%rax)
jmp 0x1d5b2
lock
incl 0x8(%rax)
movq 0x70(%rsp), %rax
movq (%rax), %rdi
movq (%rdi), %rax
movb $0x1, %bpl
callq *0x20(%rax)
movzbl %al, %ecx
leaq 0xe0(%rsp), %rsi
leaq 0x78(%rsp), %rdx
movq %r13, %rdi
callq 0x184f0
leaq 0x8(%rsp), %rdi
movq %r13, -0x8(%rdi)
xorl %ebp, %ebp
movq %r13, %rsi
callq 0x1f5a4
movaps (%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, (%rsp)
movq 0xa8(%r14), %rdi
movups %xmm0, 0xa0(%r14)
testq %rdi, %rdi
je 0x1d621
callq 0xdce4
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1d621
callq 0xdce4
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x1d633
callq 0xdce4
movq 0xe0(%rsp), %rdi
cmpq %r15, %rdi
je 0x1d645
callq 0xa2b0
movq 0xb8(%rsp), %rdi
movq %rbx, %rsi
callq 0x1e6ec
leaq 0xa8(%r14), %rsi
movq 0xa0(%r14), %rcx
movq %rcx, (%rax)
addq $0x8, %rax
movq %rax, %rdi
callq 0xdea2
addq $0xb0, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1e768
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x1d698
callq 0xa2b0
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x1d6a7
callq 0xdce4
leaq 0xd0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1d6bd
callq 0xa2b0
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x38, %edi
callq 0xa1b0
movq %rax, %r14
leaq 0x5a794(%rip), %rsi     # 0x77e77
leaq 0xc0(%rsp), %rdi
movq %rbx, %rdx
callq 0xdc11
leaq 0x5a2f6(%rip), %rsi     # 0x779f0
leaq 0xc0(%rsp), %rdi
callq 0xa560
leaq 0x110(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x1d72b
movups (%rcx), %xmm0
movups %xmm0, (%r15)
jmp 0x1d73e
movq %rdx, 0x100(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x110(%rsp)
movq 0x8(%rax), %rdx
leaq 0x100(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
xorps %xmm0, %xmm0
leaq 0x120(%rsp), %rcx
movaps %xmm0, (%rcx)
movb $0x1, %bpl
movq %r14, %rdi
movl $0x3, %edx
callq 0x203f4
xorl %ebp, %ebp
leaq 0x79eb4(%rip), %rsi     # 0x97638
leaq -0x8c65(%rip), %rdx     # 0x14b26
movq %r14, %rdi
callq 0xa4f0
movq %rax, %rbx
movq 0x128(%rsp), %rdi
testq %rdi, %rdi
je 0x1d7a8
callq 0xdce4
movq 0x100(%rsp), %rdi
cmpq %r15, %rdi
je 0x1d7ba
callq 0xa2b0
leaq 0xd0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1d7d0
callq 0xa2b0
testb %bpl, %bpl
jne 0x1d8b4
jmp 0x1d99c
movq %rax, %rbx
leaq 0xd0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1d8b4
callq 0xa2b0
jmp 0x1d8b4
jmp 0x1d845
jmp 0x1d85e
jmp 0x1d960
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x1d81f
callq 0xa2b0
jmp 0x1d81f
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x1d838
callq 0xa2b0
jmp 0x1d838
movq %rax, %rbx
movq 0x90(%rsp), %rdi
jmp 0x1d919
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x1d861
callq 0xa2b0
jmp 0x1d861
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r12, %rdi
jne 0x1d959
jmp 0x1d963
jmp 0x1d960
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x1d88e
callq 0xa2b0
jmp 0x1d88e
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x1d8a7
callq 0xa2b0
jmp 0x1d8a7
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
jmp 0x1d919
movq %rax, %rbx
movq %r14, %rdi
callq 0xa240
jmp 0x1d99c
movq %rax, %rbx
jmp 0x1d956
jmp 0x1d960
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x1d8e4
callq 0xa2b0
jmp 0x1d8e4
movq %rax, %rbx
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x1d959
jmp 0x1d963
jmp 0x1d960
movq %rax, %rbx
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1d911
callq 0xa2b0
jmp 0x1d911
movq %rax, %rbx
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x1d963
callq 0xdce4
jmp 0x1d963
movq %rax, %rbx
jmp 0x1d986
movq %rax, %rbx
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x1d93f
callq 0xdce4
movq 0xe0(%rsp), %rdi
cmpq %r15, %rdi
je 0x1d951
callq 0xa2b0
testb %bpl, %bpl
je 0x1d963
movq %r13, %rdi
callq 0xa2b0
jmp 0x1d963
movq %rax, %rbx
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x1d977
callq 0xa2b0
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x1d986
callq 0xdce4
leaq 0xd0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1d99c
callq 0xa2b0
movq %rbx, %rdi
callq 0xa510