// File: /workspace/github_cpp_makefile_star2_O1/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 0x1f1bc
leaq 0xd0(%r14), %rcx
cmpq %rcx, %rax
jne 0x1d371
movq 0xf8(%r14), %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x1790e
movq 0xf8(%r14), %rsi
leaq 0xc0(%rsp), %rdi
movq %rbx, %rdx
callq 0x180c6
movq 0xf8(%r14), %rsi
leaq 0x40(%rsp), %rdi
callq 0x1786a
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 0x1ce11
movq 0x7c1a5(%rip), %rcx     # 0x98fa8
cmpb $0x0, (%rcx)
je 0x1ce0d
incl 0x8(%rax)
jmp 0x1ce11
lock
incl 0x8(%rax)
movq %rsp, %rdi
leaq 0xa8(%rsp), %rdx
movq %r14, %rsi
callq 0x1a7f4
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 0x1ce4b
callq 0xa2b0
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x1ce5d
callq 0xdcba
leaq 0x59c38(%rip), %rsi     # 0x76a9c
leaq 0x20(%rsp), %rdi
leaq 0xc0(%rsp), %rdx
callq 0xdbef
leaq 0x5eb7b(%rip), %rsi     # 0x7b9f8
leaq 0x20(%rsp), %rdi
callq 0xa560
movq %r12, (%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x1cea8
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x1ceb0
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 0x1cee9
callq 0xa2b0
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1cefc
callq 0xa2b0
movq (%rbp), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
testb %al, %al
je 0x1d05e
movq (%rbp), %rax
movq %rax, 0x98(%rsp)
movq 0x8(%rbp), %rax
movq %rax, 0xa0(%rsp)
testq %rax, %rax
je 0x1cf40
movq 0x7c076(%rip), %rcx     # 0x98fa8
cmpb $0x0, (%rcx)
je 0x1cf3c
incl 0x8(%rax)
jmp 0x1cf40
lock
incl 0x8(%rax)
leaq 0x20(%rsp), %rdi
leaq 0x98(%rsp), %rdx
movq %r14, %rsi
callq 0x1a7f4
leaq 0x59f4c(%rip), %rsi     # 0x76ea8
leaq 0x20(%rsp), %rdi
callq 0xa560
movq %r12, (%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x1cf87
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x1cf8f
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 0x1cfc8
callq 0xa2b0
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x1cfdc
callq 0xa2b0
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x1cfee
callq 0xdcba
movq 0x40(%rsp), %r15
movq %rsp, %rdi
movq %r12, (%rdi)
leaq 0x59ea9(%rip), %rsi     # 0x76ea9
leaq 0x59ea4(%rip), %rdx     # 0x76eab
callq 0xdf6a
leaq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
movq %rax, (%rdi)
leaq 0x59925(%rip), %rsi     # 0x76945
leaq 0x59943(%rip), %rdx     # 0x7696a
callq 0xdf6a
movq %rsp, %rsi
leaq 0x20(%rsp), %rdx
movq %r15, %rdi
callq 0x1790e
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x1d050
callq 0xa2b0
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x1d05e
callq 0xa2b0
movq (%r13), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
testb %al, %al
je 0x1d1df
movq (%rbp), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
testb %al, %al
je 0x1d08f
leaq 0x5c670(%rip), %rsi     # 0x796f5
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 0x1d0c1
movq 0x7bef5(%rip), %rcx     # 0x98fa8
cmpb $0x0, (%rcx)
je 0x1d0bd
incl 0x8(%rax)
jmp 0x1d0c1
lock
incl 0x8(%rax)
leaq 0x20(%rsp), %rdi
leaq 0x88(%rsp), %rdx
movq %r14, %rsi
callq 0x1a7f4
leaq 0x59dcf(%rip), %rsi     # 0x76eac
leaq 0x20(%rsp), %rdi
callq 0xa560
movq %r12, (%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x1d108
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x1d110
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 0x1d149
callq 0xa2b0
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x1d15d
callq 0xa2b0
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x1d16f
callq 0xdcba
movq 0x40(%rsp), %r15
movq %rsp, %rdi
movq %r12, (%rdi)
leaq 0x59d2c(%rip), %rsi     # 0x76ead
leaq 0x59d27(%rip), %rdx     # 0x76eaf
callq 0xdf6a
leaq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
movq %rax, (%rdi)
leaq 0x597a4(%rip), %rsi     # 0x76945
leaq 0x597c2(%rip), %rdx     # 0x7696a
callq 0xdf6a
movq %rsp, %rsi
leaq 0x20(%rsp), %rdx
movq %r15, %rdi
callq 0x1790e
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x1d1d1
callq 0xa2b0
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x1d1df
callq 0xa2b0
leaq 0x5d2fb(%rip), %rsi     # 0x7a4e1
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 0xdde2
movq 0x40(%rsp), %rcx
movq 0x48(%rsp), %rax
movq %rcx, 0x78(%rsp)
movq %rax, 0x80(%rsp)
testq %rax, %rax
je 0x1d254
movq 0x7bd62(%rip), %rcx     # 0x98fa8
cmpb $0x0, (%rcx)
je 0x1d250
incl 0x8(%rax)
jmp 0x1d254
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 0x18224
leaq 0x8(%rsp), %rdi
movq %r13, -0x8(%rdi)
xorl %ebp, %ebp
movq %r13, %rsi
callq 0x1f246
movaps (%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, (%rsp)
movq 0xa8(%r14), %rdi
movups %xmm0, 0xa0(%r14)
testq %rdi, %rdi
je 0x1d2b4
callq 0xdcba
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1d2c3
callq 0xdcba
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x1d2d5
callq 0xdcba
movq 0xe0(%rsp), %rdi
cmpq %r15, %rdi
je 0x1d2e7
callq 0xa2b0
movq 0xb8(%rsp), %rdi
movq %rbx, %rsi
callq 0x1e37a
leaq 0xa8(%r14), %rsi
movq 0xa0(%r14), %rcx
movq %rcx, (%rax)
addq $0x8, %rax
movq %rax, %rdi
callq 0xde72
addq $0xb0, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1e3f6
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x1d33a
callq 0xa2b0
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x1d349
callq 0xdcba
leaq 0xd0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1d35f
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 0x59af2(%rip), %rsi     # 0x76e77
leaq 0xc0(%rsp), %rdi
movq %rbx, %rdx
callq 0xdbef
leaq 0x59654(%rip), %rsi     # 0x769f0
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 0x1d3cd
movups (%rcx), %xmm0
movups %xmm0, (%r15)
jmp 0x1d3e0
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 0x200e4
xorl %ebp, %ebp
leaq 0x79212(%rip), %rsi     # 0x96638
leaq -0x8b35(%rip), %rdx     # 0x148f8
movq %r14, %rdi
callq 0xa4f0
movq %rax, %rbx
movq 0x128(%rsp), %rdi
testq %rdi, %rdi
je 0x1d44a
callq 0xdcba
movq 0x100(%rsp), %rdi
cmpq %r15, %rdi
je 0x1d464
callq 0xa2b0
jmp 0x1d464
movq %rax, %rbx
movb $0x1, %bpl
leaq 0xd0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1d53a
callq 0xa2b0
jmp 0x1d53a
jmp 0x1d4c8
jmp 0x1d4e1
jmp 0x1d5f2
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x1d4a2
callq 0xa2b0
jmp 0x1d4a2
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x1d4bb
callq 0xa2b0
jmp 0x1d4bb
movq %rax, %rbx
movq 0x90(%rsp), %rdi
jmp 0x1d5ab
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x1d4e4
callq 0xa2b0
jmp 0x1d4e4
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r12, %rdi
jne 0x1d5eb
jmp 0x1d5f5
jmp 0x1d5f2
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x1d511
callq 0xa2b0
jmp 0x1d511
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x1d52a
callq 0xa2b0
jmp 0x1d52a
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
jmp 0x1d5ab
movq %rax, %rbx
movb $0x1, %bpl
testb %bpl, %bpl
je 0x1d62e
movq %r14, %rdi
callq 0xa240
jmp 0x1d62e
movq %rax, %rbx
movb $0x1, %bpl
jmp 0x1d5e3
jmp 0x1d5f2
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x1d576
callq 0xa2b0
jmp 0x1d576
movq %rax, %rbx
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x1d5eb
jmp 0x1d5f5
jmp 0x1d5f2
movq %rax, %rbx
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1d5a3
callq 0xa2b0
jmp 0x1d5a3
movq %rax, %rbx
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x1d5f5
callq 0xdcba
jmp 0x1d5f5
movq %rax, %rbx
jmp 0x1d618
movq %rax, %rbx
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x1d5d1
callq 0xdcba
movq 0xe0(%rsp), %rdi
cmpq %r15, %rdi
je 0x1d5e3
callq 0xa2b0
testb %bpl, %bpl
je 0x1d5f5
movq %r13, %rdi
callq 0xa2b0
jmp 0x1d5f5
movq %rax, %rbx
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x1d609
callq 0xa2b0
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x1d618
callq 0xdcba
leaq 0xd0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1d62e
callq 0xa2b0
movq %rbx, %rdi
callq 0xa510