// File: lhydave[P]SysYCompilerLab/front/node.cpp
// Function: sysY_AST::func_call_exp_node::check_valid()
void func_call_exp_node::check_valid()
{
	func_entry query;
	if (!find_func(sysy_func_name, query))
	{
		string msg = "function '" + sysy_func_name + "' is not defined";
		yyerror(msg.c_str());
		return;
	}
	auto size = params.size();
	dbg_printf("size: %lu\n", size);
	if (size != query.params.size())
	{
		dbg_printf("real %lu : formal %lu\n", size, query.params.size());
		string msg;
		if (size > query.params.size())
			msg = "too many arguments in call to '" + sysy_func_name + "'";
		else
			msg = "too few arguments in call to '" + sysy_func_name + "'";
		yyerror(msg.c_str());
		return;
	}
	for (auto i = 0; i < size; i++)
		check_single(params[i], query.params[i], sysy_func_name);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x190, %rsp            # imm = 0x190
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x178(%rbp)
leaq -0x60(%rbp), %rdi
movq %rdi, -0x170(%rbp)
callq 0x13ac0
movq -0x178(%rbp), %rdi
movq -0x170(%rbp), %rsi
addq $0xb8, %rdi
callq 0x1c5b0
movb %al, -0x165(%rbp)
jmp 0x1192c
movb -0x165(%rbp), %al
testb $0x1, %al
jne 0x119ed
jmp 0x1193c
movq -0x178(%rbp), %rdx
addq $0xb8, %rdx
leaq 0x3c322(%rip), %rsi     # 0x4dc73
leaq -0xb0(%rbp), %rdi
callq 0x12d60
jmp 0x1195f
leaq 0x3c38f(%rip), %rdx     # 0x4dcf5
leaq -0x90(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x12d10
jmp 0x1197b
leaq -0xb0(%rbp), %rdi
callq 0x56c0
leaq -0x90(%rbp), %rdi
callq 0x5160
movq %rax, %rdi
leaq 0x609d3(%rip), %rax     # 0x72370
movl (%rax), %esi
callq 0xa6c0
movl $0x1, -0xb4(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x56c0
jmp 0x11c65
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x11c77
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x56c0
jmp 0x11c77
movq -0x178(%rbp), %rdi
addq $0xa0, %rdi
callq 0x13320
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0x180(%rbp)
leaq -0x60(%rbp), %rdi
addq $0x20, %rdi
callq 0x13be0
movq %rax, %rcx
movq -0x180(%rbp), %rax
cmpq %rcx, %rax
je 0x11bdb
leaq -0xe0(%rbp), %rdi
callq 0x54c0
movq -0xc0(%rbp), %rax
movq %rax, -0x188(%rbp)
leaq -0x60(%rbp), %rdi
addq $0x20, %rdi
callq 0x13be0
movq %rax, %rcx
movq -0x188(%rbp), %rax
cmpq %rcx, %rax
jbe 0x11b0c
movq -0x178(%rbp), %rdx
addq $0xb8, %rdx
leaq 0x3c391(%rip), %rsi     # 0x4de15
leaq -0x120(%rbp), %rdi
callq 0x12d60
jmp 0x11a92
leaq 0x3c195(%rip), %rdx     # 0x4dc2e
leaq -0x100(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x12d10
jmp 0x11aae
leaq -0xe0(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x5410
leaq -0x100(%rbp), %rdi
callq 0x56c0
leaq -0x120(%rbp), %rdi
callq 0x56c0
jmp 0x11b92
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x11bca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x56c0
jmp 0x11bca
movq -0x178(%rbp), %rdx
addq $0xb8, %rdx
leaq 0x3c314(%rip), %rsi     # 0x4de35
leaq -0x160(%rbp), %rdi
callq 0x12d60
jmp 0x11b2f
leaq 0x3c0f8(%rip), %rdx     # 0x4dc2e
leaq -0x140(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0x12d10
jmp 0x11b4b
leaq -0xe0(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0x5410
leaq -0x140(%rbp), %rdi
callq 0x56c0
leaq -0x160(%rbp), %rdi
callq 0x56c0
jmp 0x11b92
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x56c0
jmp 0x11bca
leaq -0xe0(%rbp), %rdi
callq 0x5160
movq %rax, %rdi
leaq 0x607c8(%rip), %rax     # 0x72370
movl (%rax), %esi
callq 0xa6c0
movl $0x1, -0xb4(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x56c0
jmp 0x11c65
leaq -0xe0(%rbp), %rdi
callq 0x56c0
jmp 0x11c77
movl $0x0, -0x164(%rbp)
movslq -0x164(%rbp), %rax
cmpq -0xc0(%rbp), %rax
jae 0x11c5b
movq -0x178(%rbp), %rdi
addq $0xa0, %rdi
movslq -0x164(%rbp), %rsi
callq 0x132b0
movq (%rax), %rax
movq %rax, -0x190(%rbp)
leaq -0x40(%rbp), %rdi
movslq -0x164(%rbp), %rsi
callq 0x14120
movq -0x178(%rbp), %rdx
movq -0x190(%rbp), %rdi
movq %rax, %rsi
addq $0xb8, %rdx
callq 0x11c90
jmp 0x11c48
jmp 0x11c4a
movl -0x164(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x164(%rbp)
jmp 0x11be5
movl $0x0, -0xb4(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x13fa0
addq $0x190, %rsp            # imm = 0x190
popq %rbp
retq
leaq -0x60(%rbp), %rdi
callq 0x13fa0
movq -0x68(%rbp), %rdi
callq 0x5610
nopl (%rax)