// File: lhydave[P]SysYCompilerLab/front/node.cpp
// Function: sysY_AST::func_call_exp_node::func_call_exp_node(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, sysY_AST::exp_node*)
func_call_exp_node::func_call_exp_node(
	const string &func_name, exp_node *first_param) :
	exp_node(EXP_FUNC_CALL)
{
	sysy_func_name = func_name;
	// tackle marcos
	if (sysy_func_name == "starttime" || sysy_func_name == "stoptime")
	{
		sysy_func_name = "_sysy_" + sysy_func_name;
		if (first_param)
		{
			string msg =
				"too many arguments provided to function-like macro '" +
				func_name + "'";
			yyerror(msg.c_str());
		}
		first_param = new exp_node(EXP_NUM, "", yylineno);
	}
	dbg_printf("func call to %s \n", sysy_func_name.c_str());
	while (first_param)
	{
		params.push_back(first_param);
		first_param = first_param->next;
	}
	check_valid();
	reduce();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xe8(%rbp)
leaq -0x39(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
callq 0x5620
movq -0xe0(%rbp), %rdx
leaq 0x3d700(%rip), %rsi     # 0x4ec60
leaq -0x38(%rbp), %rdi
callq 0x8780
jmp 0x1156b
movq -0xe8(%rbp), %rdi
xorl %r8d, %r8d
movl %r8d, %r9d
movl $0x3, %esi
leaq -0x38(%rbp), %rdx
movl %r8d, %ecx
callq 0xef50
jmp 0x1158b
leaq -0x38(%rbp), %rdi
callq 0x56c0
leaq -0x39(%rbp), %rdi
callq 0x5370
movq -0xe8(%rbp), %rdi
leaq 0x5fff5(%rip), %rax     # 0x715a0
movq %rax, (%rdi)
addq $0xa0, %rdi
movq %rdi, -0xf8(%rbp)
callq 0x12cd0
movq -0xe8(%rbp), %rdi
addq $0xb8, %rdi
movq %rdi, -0xf0(%rbp)
callq 0x54c0
movq -0xf0(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x5050
jmp 0x115ed
movq -0xe8(%rbp), %rdi
addq $0xb8, %rdi
leaq 0x3cb13(%rip), %rsi     # 0x4e115
callq 0x13dd0
movb %al, -0xf9(%rbp)
jmp 0x1160f
movb -0xf9(%rbp), %al
testb $0x1, %al
jne 0x1164c
jmp 0x1161b
movq -0xe8(%rbp), %rdi
addq $0xb8, %rdi
leaq 0x3caf5(%rip), %rsi     # 0x4e125
callq 0x13dd0
movb %al, -0xfa(%rbp)
jmp 0x1163d
movb -0xfa(%rbp), %al
testb $0x1, %al
jne 0x1164c
jmp 0x11850
movq -0xe8(%rbp), %rdx
addq $0xb8, %rdx
leaq 0x3c778(%rip), %rsi     # 0x4ddd9
leaq -0x70(%rbp), %rdi
callq 0x12d60
jmp 0x1166c
movq -0xe8(%rbp), %rdi
addq $0xb8, %rdi
leaq -0x70(%rbp), %rsi
callq 0x5410
leaq -0x70(%rbp), %rdi
callq 0x56c0
cmpq $0x0, -0x18(%rbp)
je 0x11762
movq -0x10(%rbp), %rdx
leaq 0x3c73e(%rip), %rsi     # 0x4dde0
leaq -0xb0(%rbp), %rdi
callq 0x12d60
jmp 0x116b0
leaq 0x3c577(%rip), %rdx     # 0x4dc2e
leaq -0x90(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x12d10
jmp 0x116cc
leaq -0xb0(%rbp), %rdi
callq 0x56c0
leaq -0x90(%rbp), %rdi
callq 0x5160
movq %rax, %rdi
leaq 0x60c82(%rip), %rax     # 0x72370
movl (%rax), %esi
callq 0xa6c0
leaq -0x90(%rbp), %rdi
callq 0x56c0
jmp 0x11762
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x11726
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x56c0
leaq -0x39(%rbp), %rdi
callq 0x5370
jmp 0x118cd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x118a9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x56c0
jmp 0x118a9
movl $0xa0, %edi
callq 0x5300
movq %rax, -0x108(%rbp)
jmp 0x11775
movb $0x1, -0xd2(%rbp)
leaq -0xd1(%rbp), %rdi
movq %rdi, -0x110(%rbp)
callq 0x5620
movq -0x110(%rbp), %rdx
leaq 0x3d4c3(%rip), %rsi     # 0x4ec60
leaq -0xd0(%rbp), %rdi
callq 0x8780
jmp 0x117ab
movq -0x108(%rbp), %rdi
leaq 0x60bb7(%rip), %rax     # 0x72370
movl (%rax), %ecx
xorl %r8d, %r8d
movl %r8d, %r9d
movl $0x2, %esi
leaq -0xd0(%rbp), %rdx
callq 0xef50
jmp 0x117d4
movq -0x108(%rbp), %rax
movb $0x0, -0xd2(%rbp)
movq %rax, -0x18(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x56c0
leaq -0xd1(%rbp), %rdi
callq 0x5370
jmp 0x11850
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x11826
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x56c0
leaq -0xd1(%rbp), %rdi
callq 0x5370
testb $0x1, -0xd2(%rbp)
jne 0x1183d
jmp 0x1184e
movq -0x108(%rbp), %rdi
movl $0xa0, %esi
callq 0x5320
jmp 0x118a9
jmp 0x11852
cmpq $0x0, -0x18(%rbp)
je 0x11880
movq -0xe8(%rbp), %rdi
addq $0xa0, %rdi
leaq -0x18(%rbp), %rsi
callq 0x135c0
jmp 0x11872
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x11852
movq -0xe8(%rbp), %rdi
callq 0x118e0
jmp 0x1188e
movq -0xe8(%rbp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
jmp 0x118a0
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
movq -0xf0(%rbp), %rdi
callq 0x56c0
movq -0xf8(%rbp), %rdi
callq 0x12ea0
movq -0xe8(%rbp), %rdi
callq 0x14050
movq -0x48(%rbp), %rdi
callq 0x5610
nopw %cs:(%rax,%rax)