// File: ryuichiueda[P]GlueLang/src/Executable.cc
// Function: Executable::makeArgv()
char** Executable::makeArgv(void)
{
	auto argv = new char* [m_nodes.size() + 1 + m_add_args.size()];
	
	argv[0] = (char *)((ArgIntCom *)m_nodes[0])->m_evaled_text.c_str();

	int i = 1;
	for (;i < (int)m_nodes.size();i++){
		argv[i] = (char *)((Arg *)m_nodes[i])->getEvaledString();
	}
	for(auto a : m_add_args){
		argv[i] = new char [a.size()+1];
		strcpy(argv[i],a.c_str());
		argv[i][a.size()] = '\0';
		i++;
	}

	argv[m_nodes.size() + m_add_args.size()] = NULL;
	return argv;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x68(%rbp)
addq $0x18, %rdi
callq 0xd900
movq -0x68(%rbp), %rdi
addq $0x1, %rax
movq %rax, -0x70(%rbp)
addq $0x98, %rdi
callq 0xb6a0
movq %rax, %rcx
movq -0x70(%rbp), %rax
addq %rcx, %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x6040
movq -0x68(%rbp), %rdi
movq %rax, -0x10(%rbp)
addq $0x18, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x14640
movq (%rax), %rdi
addq $0xa8, %rdi
callq 0x6190
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movl $0x1, -0x14(%rbp)
movq -0x68(%rbp), %rdi
movl -0x14(%rbp), %eax
movl %eax, -0x74(%rbp)
addq $0x18, %rdi
callq 0xd900
movq %rax, %rcx
movl -0x74(%rbp), %eax
cmpl %ecx, %eax
jge 0x15cc9
movq -0x68(%rbp), %rdi
addq $0x18, %rdi
movslq -0x14(%rbp), %rsi
callq 0x14640
movq (%rax), %rdi
movq (%rdi), %rax
callq *0x40(%rax)
movq %rax, %rdx
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x15c78
movq -0x68(%rbp), %rax
addq $0x98, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x7af0
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rdi
callq 0x7b20
movq %rax, -0x30(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x7b50
testb $0x1, %al
jne 0x15d07
jmp 0x15ddc
leaq -0x28(%rbp), %rdi
callq 0x7b90
movq %rax, %rsi
leaq -0x50(%rbp), %rdi
movq %rdi, -0x88(%rbp)
callq 0x61a0
movq -0x88(%rbp), %rdi
callq 0x62c0
movq %rax, %rdi
incq %rdi
callq 0x6040
movq %rax, -0x80(%rbp)
jmp 0x15d40
movq -0x80(%rbp), %rdx
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x98(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x6190
movq -0x98(%rbp), %rdi
movq %rax, %rsi
callq 0x63e0
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x90(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x62c0
movq %rax, %rcx
movq -0x90(%rbp), %rax
movb $0x0, (%rax,%rcx)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x6280
leaq -0x28(%rbp), %rdi
callq 0x7bb0
jmp 0x15cf1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x6280
jmp 0x15e34
movq -0x68(%rbp), %rdi
movq -0x10(%rbp), %rax
movq %rax, -0xa0(%rbp)
addq $0x18, %rdi
callq 0xd900
movq -0x68(%rbp), %rdi
movq %rax, -0xa8(%rbp)
addq $0x98, %rdi
callq 0xb6a0
movq -0xa8(%rbp), %rcx
movq %rax, %rdx
movq -0xa0(%rbp), %rax
addq %rdx, %rcx
movq $0x0, (%rax,%rcx,8)
movq -0x10(%rbp), %rax
addq $0xb0, %rsp
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x6700
nopl (%rax)