// File: /workspace/github_cpp_makefile_star2_O2/menhits[P]phplus/src/Actions/MakeTupleAction.cpp
// Function: CppTupleCastAction::addToProg(std::shared_ptr<ActionData>, std::shared_ptr<ActionData>, CppProgram*)
void addToProg(Action inLeft, Action inRight, CppProgram* prog)
	{
		if (getReturnType()->getAllSubTypes()->size()==1)
		{
			action->addToProg(prog);
		}
		else if (typeid(*action)==typeid(MakeTupleAction))
		{
			MakeTupleAction * realAction=(MakeTupleAction*)&*action;
			
			prog->code(prog->getTypeCode(getReturnType()));
			prog->pushExpr();
				for (auto i: realAction->sourceActions)
				{
					i->addToProg(prog);
					if (i!=realAction->sourceActions.back())
						prog->code(", ");
				}
			prog->popExpr();
		}
		else if (typeid(*action)==typeid(*listAction({voidAction, voidAction}, {})))
		{
			addListToProgWithCppCasting((ListAction*)&*action, getReturnType(), prog);
		}
		else if (getReturnType()->getType()!=TypeBase::TUPLE)
		{
			action->addToProg(prog);
			prog->code(".");
			prog->code(action->getReturnType()->getAllSubTypes()[0][0].name);
		}
		else
		{
			string funcName=action->getReturnType()->getCompactString()+"=>"+getReturnType()->getCompactString();
			
			if (!prog->hasFunc(funcName))
			{
				Type argType=makeTuple({{"in", action->getReturnType()}}, true);
				
				prog->pushFunc(funcName, "", Void, argType, getReturnType());
					prog->declareVar("-out", getReturnType());
					
					auto outTypes=*getReturnType()->getAllSubTypes();
					
					if (action->getReturnType()->getType()==TypeBase::TUPLE)
					{
						auto inTypes=*action->getReturnType()->getAllSubTypes();
						
						for (int i=0; i<int(inTypes.size()); i++)
						{
							//if (inTypes[i].type==outTypes[i].type)
							{
								prog->name("-out");
								prog->code(".");
								prog->code(outTypes[i].name);
								prog->code(" = ");
								prog->name("in");
								prog->code(".");
								prog->code(inTypes[i].name);
								prog->endln();
							}
						}
					}
					else
					{
						prog->name("-out");
						prog->code(".");
						prog->code(outTypes[0].name);
						prog->code(" = ");
						prog->name("in");
						prog->endln();
					}
					
					prog->code("return ");
					prog->name("-out");
					prog->endln();
					
				prog->popFunc();
			}
			
			prog->name(funcName);
			prog->pushExpr();
				action->addToProg(prog);
			prog->popExpr();
		}
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %rcx, %rbx
movq %rdi, %r14
movq 0x28(%rdi), %rdi
movq (%rdi), %rax
callq *0x58(%rax)
movq 0x8(%rax), %rcx
subq (%rax), %rcx
movq 0x78(%r14), %rdi
cmpq $0x30, %rcx
jne 0x4d185
movq %rbx, %rsi
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3a606
movq %rbx, (%rsp)
leaq 0x28(%r14), %r15
movq (%rdi), %rax
movq -0x8(%rax), %rdi
leaq 0x2c785(%rip), %rsi     # 0x79920
callq 0x21f04
movq 0x78(%r14), %rbp
testb %al, %al
je 0x4d28d
leaq 0x108(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x12c0a
leaq 0x10(%rsp), %rdi
movq (%rsp), %r14
movq %r14, %rsi
movq %rbx, %rdx
callq 0x15e88
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x39d6c
leaq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0xa558
leaq 0x110(%rsp), %rdi
callq 0xc984
movq %r14, %rdi
callq 0x3a5fa
movq 0x78(%rbp), %r12
movq 0x80(%rbp), %rbx
leaq 0x90(%rsp), %r14
leaq 0x88(%rsp), %r13
cmpq %rbx, %r12
je 0x4d387
movq %r13, %rdi
movq %r12, %rsi
callq 0x12c1e
movq 0x88(%rsp), %rdi
movq (%rsp), %rsi
callq 0x3a606
movq 0x80(%rbp), %rax
movq 0x88(%rsp), %rcx
cmpq -0x10(%rax), %rcx
je 0x4d27f
movq %r15, %rdi
leaq 0xac34(%rip), %rsi      # 0x57e95
leaq 0x60(%rsp), %rdx
callq 0xa150
movq (%rsp), %rdi
movq %r15, %rsi
callq 0x39d6c
movq %r15, %rdi
callq 0xa558
movq %r14, %rdi
callq 0xc984
addq $0x10, %r12
jmp 0x4d21d
movq (%rbp), %rax
movq -0x8(%rax), %rbx
leaq 0x2d0b4(%rip), %r12     # 0x7a350
leaq 0x10(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x12c1e
leaq 0x20(%rsp), %rdi
movq %r12, %rsi
callq 0x12c1e
leaq 0x88(%rsp), %rdi
pushq $0x2
popq %rdx
leaq 0xa8(%rsp), %rcx
movq %r13, %rsi
callq 0x4db38
xorps %xmm0, %xmm0
leaq 0x60(%rsp), %rdx
movaps %xmm0, (%rdx)
andq $0x0, 0x10(%rdx)
leaq 0x40(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x4ab39
leaq 0x48(%rsp), %r12
movq -0x8(%r12), %rax
movq (%rax), %rax
movq -0x8(%rax), %rsi
movq %rbx, %rdi
callq 0x21f04
movl %eax, %ebx
movq %r12, %rdi
callq 0xc984
leaq 0x60(%rsp), %rdi
callq 0x119e8
leaq 0x88(%rsp), %rdi
callq 0x119e8
pushq $0x18
popq %r12
leaq (%rsp,%r12), %rdi
addq $0x10, %rdi
callq 0xc984
addq $-0x10, %r12
cmpq $-0x8, %r12
jne 0x4d334
testb %bl, %bl
je 0x4d395
movq 0x78(%r14), %rbx
leaq 0xf8(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x12c0a
movq %rbx, %rdi
movq %r14, %rsi
movq (%rsp), %rdx
callq 0x4aae8
leaq 0x100(%rsp), %rdi
callq 0xc984
jmp 0x4d92c
movq (%rsp), %rdi
callq 0x3a692
jmp 0x4d92c
movq (%r15), %rdi
movq (%rdi), %rax
callq *0x40(%rax)
cmpl $0x7, %eax
jne 0x4d72b
movq 0x78(%r14), %rax
movq 0x28(%rax), %rsi
movq (%rsi), %rax
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
callq *0x10(%rax)
leaq 0x6c7f(%rip), %rdx      # 0x54043
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0xc882
movq (%r15), %rsi
movq (%rsi), %rax
leaq 0x40(%rsp), %rdi
callq *0x10(%rax)
leaq 0x88(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0x40(%rsp), %rdx
callq 0x1205e
leaq 0x40(%rsp), %rdi
callq 0xa558
leaq 0x10(%rsp), %rdi
callq 0xa558
leaq 0x60(%rsp), %rdi
callq 0xa558
leaq 0x88(%rsp), %rsi
movq (%rsp), %rdi
callq 0x17166
testb %al, %al
jne 0x4d8ef
leaq 0x7a49(%rip), %rsi      # 0x54e7d
leaq 0x10(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0xa150
leaq 0x30(%rsp), %rdi
movq 0x78(%r14), %rsi
addq $0x28, %rsi
callq 0x12c0a
leaq 0x60(%rsp), %rdi
leaq 0x10(%rsp), %rsi
pushq $0x1
popq %rdx
leaq 0xf(%rsp), %rcx
callq 0x39d84
leaq 0xa8(%rsp), %rdi
leaq 0x60(%rsp), %rsi
pushq $0x1
popq %rdx
callq 0x3e156
leaq 0x60(%rsp), %rdi
callq 0x12f12
leaq 0x10(%rsp), %rdi
callq 0x12f68
leaq 0x7583(%rip), %rsi      # 0x54a1f
leaq 0x10(%rsp), %rdi
leaq 0x60(%rsp), %rdx
callq 0xa150
leaq 0x2cf2e(%rip), %rsi     # 0x7a3e0
leaq 0xe8(%rsp), %rbx
movq %rbx, %rdi
callq 0x12c0a
leaq 0xd8(%rsp), %r12
leaq 0xa8(%rsp), %rsi
movq %r12, %rdi
callq 0x12c0a
leaq 0xc8(%rsp), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0x12c0a
leaq 0x88(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq (%rsp), %rdi
movq %rbx, %rcx
movq %r12, %r8
movq %r13, %r9
callq 0x17532
leaq 0xd0(%rsp), %rdi
callq 0xc984
leaq 0xe0(%rsp), %rdi
callq 0xc984
leaq 0xf0(%rsp), %rdi
callq 0xc984
leaq 0x10(%rsp), %rdi
callq 0xa558
leaq 0xc7e3(%rip), %rsi      # 0x59d27
leaq 0x10(%rsp), %rdi
leaq 0x60(%rsp), %rdx
callq 0xa150
leaq 0xb8(%rsp), %rdi
movq %r15, %rsi
callq 0x12c0a
leaq 0x74b5(%rip), %rsi      # 0x54a1f
leaq 0x118(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0xa150
leaq 0x10(%rsp), %rsi
leaq 0xb8(%rsp), %rdx
leaq 0x118(%rsp), %rcx
movq (%rsp), %rdi
callq 0x16cbc
leaq 0x118(%rsp), %rdi
callq 0xa558
leaq 0xc0(%rsp), %rdi
callq 0xc984
leaq 0x10(%rsp), %rdi
callq 0xa558
movq (%r15), %rdi
movq (%rdi), %rax
callq *0x58(%rax)
leaq 0x60(%rsp), %rdi
movq %rax, %rsi
callq 0x3e7be
movq 0x78(%r14), %rax
movq 0x28(%rax), %rdi
movq (%rdi), %rax
callq *0x40(%rax)
cmpl $0x7, %eax
jne 0x4d789
movq 0x78(%r14), %rax
movq 0x28(%rax), %rdi
movq (%rdi), %rax
callq *0x58(%rax)
leaq 0x40(%rsp), %rdi
movq %rax, %rsi
callq 0x3e7be
xorl %ebx, %ebx
leaq 0x10(%rsp), %r12
leaq 0xf(%rsp), %r13
xorl %r15d, %r15d
movq 0x48(%rsp), %rax
subq 0x40(%rsp), %rax
cqto
pushq $0x30
popq %rcx
idivq %rcx
cltq
cmpq %rax, %r15
jge 0x4d85e
movq %r12, %rdi
leaq 0xc6eb(%rip), %rsi      # 0x59d27
movq %r13, %rdx
callq 0xa150
movq (%rsp), %rdi
movq %r12, %rsi
callq 0x39d78
movq %r12, %rdi
callq 0xa558
movq %r12, %rdi
leaq 0xa5c2(%rip), %rsi      # 0x57c24
movq %r13, %rdx
callq 0xa150
movq (%rsp), %rbp
movq %rbp, %rdi
movq %r12, %rsi
callq 0x39d6c
movq %r12, %rdi
callq 0xa558
movq 0x60(%rsp), %rsi
addq %rbx, %rsi
movq %rbp, %rdi
callq 0x39d6c
movq %r12, %rdi
leaq 0xa377(%rip), %rsi      # 0x57a12
movq %r13, %rdx
callq 0xa150
movq (%rsp), %rdi
movq %r12, %rsi
callq 0x39d6c
movq %r12, %rdi
callq 0xa558
movq %r12, %rdi
leaq 0x77bc(%rip), %rsi      # 0x54e7d
movq %r13, %rdx
callq 0xa150
movq (%rsp), %rdi
movq %r12, %rsi
callq 0x39d78
movq %r12, %rdi
callq 0xa558
movq %r12, %rdi
leaq 0xa53d(%rip), %rsi      # 0x57c24
movq %r13, %rdx
callq 0xa150
movq (%rsp), %rbp
movq %rbp, %rdi
movq %r12, %rsi
callq 0x39d6c
movq %r12, %rdi
callq 0xa558
movq 0x40(%rsp), %rsi
addq %rbx, %rsi
movq %rbp, %rdi
callq 0x39d6c
movq (%rsp), %rdi
callq 0x3b712
incq %r15
addq $0x30, %rbx
jmp 0x4d615
movq 0x78(%r14), %rdi
movq (%rsp), %rbx
movq %rbx, %rsi
callq 0x3a606
leaq 0xa4e2(%rip), %rsi      # 0x57c24
leaq 0x10(%rsp), %rdi
leaq 0x88(%rsp), %rdx
callq 0xa150
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x39d6c
leaq 0x10(%rsp), %rdi
callq 0xa558
movq 0x78(%r14), %rax
movq 0x28(%rax), %rdi
movq (%rdi), %rax
callq *0x58(%rax)
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x39d6c
jmp 0x4d92c
leaq 0xc597(%rip), %rsi      # 0x59d27
leaq 0x10(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0xa150
leaq 0x10(%rsp), %rsi
movq (%rsp), %rdi
callq 0x39d78
leaq 0x10(%rsp), %rdi
callq 0xa558
leaq 0xa466(%rip), %rsi      # 0x57c24
leaq 0x10(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0xa150
leaq 0x10(%rsp), %rsi
movq (%rsp), %rbx
movq %rbx, %rdi
callq 0x39d6c
leaq 0x10(%rsp), %rdi
callq 0xa558
movq 0x60(%rsp), %rsi
movq %rbx, %rdi
callq 0x39d6c
leaq 0xa216(%rip), %rsi      # 0x57a12
leaq 0x10(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0xa150
leaq 0x10(%rsp), %rsi
movq (%rsp), %rdi
callq 0x39d6c
leaq 0x10(%rsp), %rdi
callq 0xa558
leaq 0x7653(%rip), %rsi      # 0x54e7d
leaq 0x10(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0xa150
leaq 0x10(%rsp), %rsi
movq (%rsp), %rbx
movq %rbx, %rdi
callq 0x39d78
leaq 0x10(%rsp), %rdi
callq 0xa558
movq %rbx, %rdi
callq 0x3b712
jmp 0x4d868
leaq 0x40(%rsp), %rdi
callq 0x12f12
leaq 0xa0ca(%rip), %rsi      # 0x57939
leaq 0x10(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0xa150
leaq 0x10(%rsp), %rsi
movq (%rsp), %rdi
callq 0x39d6c
leaq 0x10(%rsp), %rdi
callq 0xa558
leaq 0xc48a(%rip), %rsi      # 0x59d27
leaq 0x10(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0xa150
leaq 0x10(%rsp), %rsi
movq (%rsp), %rbx
movq %rbx, %rdi
callq 0x39d78
leaq 0x10(%rsp), %rdi
callq 0xa558
movq %rbx, %rdi
callq 0x3b712
movq (%rsp), %rdi
callq 0x17b0a
leaq 0x60(%rsp), %rdi
callq 0x12f12
leaq 0xb0(%rsp), %rdi
callq 0xc984
leaq 0x88(%rsp), %rsi
movq (%rsp), %rbx
movq %rbx, %rdi
callq 0x39d78
movq %rbx, %rdi
callq 0x3a5fa
movq 0x78(%r14), %rdi
movq %rbx, %rsi
callq 0x3a606
movq %rbx, %rdi
callq 0x3a692
leaq 0x88(%rsp), %rdi
callq 0xa558
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4d961
jmp 0x4da47
jmp 0x4d961
jmp 0x4da47
jmp 0x4d961
jmp 0x4da47
jmp 0x4d961
jmp 0x4da47
jmp 0x4d961
jmp 0x4da47
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0xa558
jmp 0x4daed
jmp 0x4da47
jmp 0x4da47
movq %rax, %rbx
leaq 0x118(%rsp), %rdi
callq 0xa558
jmp 0x4d992
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
jmp 0x4d9c3
jmp 0x4d9ff
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0xc984
leaq 0xe0(%rsp), %rdi
callq 0xc984
leaq 0xf0(%rsp), %rdi
callq 0xc984
leaq 0x10(%rsp), %rdi
callq 0xa558
jmp 0x4daf7
jmp 0x4d9ff
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x12f12
jmp 0x4d9eb
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x12f68
jmp 0x4db04
jmp 0x4daba
movq %rax, %rbx
jmp 0x4daf7
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0xa558
jmp 0x4da26
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
jmp 0x4db0c
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0xa558
jmp 0x4da3d
movq %rax, %rbx
jmp 0x4db2f
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
jmp 0x4db0c
movq %rax, %rbx
jmp 0x4daed
movq %rax, %rbx
leaq 0x100(%rsp), %rdi
jmp 0x4db2a
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x119e8
leaq 0x88(%rsp), %rdi
callq 0x119e8
jmp 0x4da8d
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0xa558
jmp 0x4dab0
movq %rax, %rbx
pushq $0x18
popq %r14
leaq (%rsp,%r14), %rdi
addq $0x10, %rdi
callq 0xc984
addq $-0x10, %r14
cmpq $-0x8, %r14
jne 0x4da91
jmp 0x4db2f
movq %rax, %rbx
leaq 0x110(%rsp), %rdi
jmp 0x4db2a
movq %rax, %rbx
jmp 0x4db04
jmp 0x4dad1
jmp 0x4dae0
jmp 0x4dae0
jmp 0x4dad1
jmp 0x4dae0
jmp 0x4dad1
jmp 0x4dad1
jmp 0x4dae0
jmp 0x4dae0
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0xa558
jmp 0x4dae3
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x12f12
leaq 0x60(%rsp), %rdi
callq 0x12f12
leaq 0xb0(%rsp), %rdi
callq 0xc984
leaq 0x88(%rsp), %rdi
callq 0xa558
jmp 0x4db2f
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0xa558
jmp 0x4db27
jmp 0x4db24
movq %rax, %rbx
movq %r14, %rdi
callq 0xc984
movq %rbx, %rdi
callq 0xa500
nop