// File: lhydave[P]SysYCompilerLab/front/node.cpp
// Function: sysY_AST::check_single(sysY_AST::exp_node*, sysY_AST::var_entry const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
static void check_single(
	exp_node *RParam, const var_entry &FParam, const string &func_name)
{
	RParam->reduce();
	RParam->new_temp();
	dbg_printf("param : %s,\n", RParam->sysy_name.c_str());
	if (FParam.is_array) // an array
	{
		if (RParam->exp_type != EXP_PTR)
		{
			string msg = "mismatch type of parameter '" + FParam.sysy_name +
				"' in call to '" + func_name + "'";
			yyerror(msg.c_str());
			return;
		}
		auto r_array_exp = static_cast<array_exp_node *>(RParam);
		var_entry query;
		find_var(r_array_exp->sysy_array_name, query);
		if (query.is_const) // should not be const
		{
			string msg = "mismatch type of parameter '" + FParam.sysy_name +
				"' in call to '" + func_name + "'";
			yyerror(msg.c_str());
			return;
		}
		auto start_dim = r_array_exp->sysy_idx.size() + 1;
		auto dim_n = FParam.dim.size();
		if (query.dim.size() - r_array_exp->sysy_idx.size() != dim_n)
		{
			string msg = "mismatch type of parameter '" + FParam.sysy_name +
				"' in call to '" + func_name + "'";
			yyerror(msg.c_str());
			return;
		}
		for (auto i = start_dim; i < dim_n; i++)
			if (query.dim[i] != FParam.dim[i])
			{
				string msg = "mismatch type of parameter '" + FParam.sysy_name +
					"' in call to '" + func_name + "'";
				yyerror(msg.c_str());
				return;
			}
	}
	// an int
	else if (RParam->exp_type == EXP_PTR)
	{
		string msg = "mismatch type of parameter '" + FParam.sysy_name +
			"' in call to '" + func_name + "'";
		yyerror(msg.c_str());
		return;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x370, %rsp            # imm = 0x370
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
movq -0x8(%rbp), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
movq -0x10(%rbp), %rax
testb $0x1, 0x40(%rax)
je 0x122f5
movq -0x8(%rbp), %rax
cmpl $0x6, 0x98(%rax)
je 0x11de1
movq -0x10(%rbp), %rdx
addq $0x20, %rdx
leaq 0x3c1c3(%rip), %rsi     # 0x4deac
leaq -0x98(%rbp), %rdi
movq %rdi, -0x350(%rbp)
callq 0x12d60
movq -0x350(%rbp), %rsi
leaq 0x3c1bf(%rip), %rdx     # 0x4dec9
leaq -0x78(%rbp), %rdi
callq 0x12d10
jmp 0x11d15
movq -0x18(%rbp), %rdx
leaq -0x58(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x132d0
jmp 0x11d28
leaq 0x3beff(%rip), %rdx     # 0x4dc2e
leaq -0x38(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x12d10
jmp 0x11d3e
leaq -0x58(%rbp), %rdi
callq 0x56c0
leaq -0x78(%rbp), %rdi
callq 0x56c0
leaq -0x98(%rbp), %rdi
callq 0x56c0
leaq -0x38(%rbp), %rdi
callq 0x5160
movq %rax, %rdi
leaq 0x60601(%rip), %rax     # 0x72370
movl (%rax), %esi
callq 0xa6c0
leaq -0x38(%rbp), %rdi
callq 0x56c0
jmp 0x12434
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x11dd0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x11dc7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x56c0
leaq -0x78(%rbp), %rdi
callq 0x56c0
leaq -0x98(%rbp), %rdi
callq 0x56c0
jmp 0x1243d
movq -0x8(%rbp), %rax
movq %rax, -0xb0(%rbp)
leaq -0x128(%rbp), %rdi
movq %rdi, -0x358(%rbp)
callq 0x13220
movq -0x358(%rbp), %rsi
movq -0xb0(%rbp), %rdi
addq $0xc0, %rdi
callq 0x1c4c0
jmp 0x11e1b
testb $0x1, -0xe7(%rbp)
je 0x11f6c
movq -0x10(%rbp), %rdx
addq $0x20, %rdx
leaq 0x3c075(%rip), %rsi     # 0x4deac
leaq -0x1a8(%rbp), %rdi
callq 0x12d60
jmp 0x11e45
leaq 0x3c07d(%rip), %rdx     # 0x4dec9
leaq -0x188(%rbp), %rdi
leaq -0x1a8(%rbp), %rsi
callq 0x12d10
jmp 0x11e61
movq -0x18(%rbp), %rdx
leaq -0x168(%rbp), %rdi
leaq -0x188(%rbp), %rsi
callq 0x132d0
jmp 0x11e7a
leaq 0x3bdad(%rip), %rdx     # 0x4dc2e
leaq -0x148(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0x12d10
jmp 0x11e96
leaq -0x168(%rbp), %rdi
callq 0x56c0
leaq -0x188(%rbp), %rdi
callq 0x56c0
leaq -0x1a8(%rbp), %rdi
callq 0x56c0
leaq -0x148(%rbp), %rdi
callq 0x5160
movq %rax, %rdi
leaq 0x604a0(%rip), %rax     # 0x72370
movl (%rax), %esi
callq 0xa6c0
movl $0x1, -0x1ac(%rbp)
leaq -0x148(%rbp), %rdi
callq 0x56c0
jmp 0x122c2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x122e4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x11f5b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x11f4f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x56c0
leaq -0x188(%rbp), %rdi
callq 0x56c0
leaq -0x1a8(%rbp), %rdi
callq 0x56c0
jmp 0x122e4
movq -0xb0(%rbp), %rdi
addq $0xa0, %rdi
callq 0x13320
addq $0x1, %rax
movq %rax, -0x1b8(%rbp)
movq -0x10(%rbp), %rdi
addq $0x48, %rdi
callq 0x12cf0
movq %rax, -0x1c0(%rbp)
leaq -0x128(%rbp), %rdi
addq $0x48, %rdi
callq 0x12cf0
movq %rax, -0x360(%rbp)
movq -0xb0(%rbp), %rdi
addq $0xa0, %rdi
callq 0x13320
movq %rax, %rcx
movq -0x360(%rbp), %rax
subq %rcx, %rax
cmpq -0x1c0(%rbp), %rax
je 0x1210f
movq -0x10(%rbp), %rdx
addq $0x20, %rdx
leaq 0x3bebb(%rip), %rsi     # 0x4deac
leaq -0x240(%rbp), %rdi
callq 0x12d60
jmp 0x11fff
leaq 0x3bec3(%rip), %rdx     # 0x4dec9
leaq -0x220(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x12d10
jmp 0x1201b
movq -0x18(%rbp), %rdx
leaq -0x200(%rbp), %rdi
leaq -0x220(%rbp), %rsi
callq 0x132d0
jmp 0x12034
leaq 0x3bbf3(%rip), %rdx     # 0x4dc2e
leaq -0x1e0(%rbp), %rdi
leaq -0x200(%rbp), %rsi
callq 0x12d10
jmp 0x12050
leaq -0x200(%rbp), %rdi
callq 0x56c0
leaq -0x220(%rbp), %rdi
callq 0x56c0
leaq -0x240(%rbp), %rdi
callq 0x56c0
leaq -0x1e0(%rbp), %rdi
callq 0x5160
movq %rax, %rdi
leaq 0x602e6(%rip), %rax     # 0x72370
movl (%rax), %esi
callq 0xa6c0
movl $0x1, -0x1ac(%rbp)
leaq -0x1e0(%rbp), %rdi
callq 0x56c0
jmp 0x122c2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x120fe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x120f2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x200(%rbp), %rdi
callq 0x56c0
leaq -0x220(%rbp), %rdi
callq 0x56c0
leaq -0x240(%rbp), %rdi
callq 0x56c0
jmp 0x122e4
movq -0x1b8(%rbp), %rax
movq %rax, -0x248(%rbp)
movq -0x248(%rbp), %rax
cmpq -0x1c0(%rbp), %rax
jae 0x122b8
leaq -0x128(%rbp), %rdi
addq $0x48, %rdi
movq -0x248(%rbp), %rsi
callq 0x136c0
movl (%rax), %eax
movl %eax, -0x364(%rbp)
movq -0x10(%rbp), %rdi
addq $0x48, %rdi
movq -0x248(%rbp), %rsi
callq 0x14bc0
movq %rax, %rcx
movl -0x364(%rbp), %eax
cmpl (%rcx), %eax
je 0x1229f
movq -0x10(%rbp), %rdx
addq $0x20, %rdx
leaq 0x3bd28(%rip), %rsi     # 0x4deac
leaq -0x2c8(%rbp), %rdi
callq 0x12d60
jmp 0x12192
leaq 0x3bd30(%rip), %rdx     # 0x4dec9
leaq -0x2a8(%rbp), %rdi
leaq -0x2c8(%rbp), %rsi
callq 0x12d10
jmp 0x121ae
movq -0x18(%rbp), %rdx
leaq -0x288(%rbp), %rdi
leaq -0x2a8(%rbp), %rsi
callq 0x132d0
jmp 0x121c7
leaq 0x3ba60(%rip), %rdx     # 0x4dc2e
leaq -0x268(%rbp), %rdi
leaq -0x288(%rbp), %rsi
callq 0x12d10
jmp 0x121e3
leaq -0x288(%rbp), %rdi
callq 0x56c0
leaq -0x2a8(%rbp), %rdi
callq 0x56c0
leaq -0x2c8(%rbp), %rdi
callq 0x56c0
leaq -0x268(%rbp), %rdi
callq 0x5160
movq %rax, %rdi
leaq 0x60153(%rip), %rax     # 0x72370
movl (%rax), %esi
callq 0xa6c0
movl $0x1, -0x1ac(%rbp)
leaq -0x268(%rbp), %rdi
callq 0x56c0
jmp 0x122c2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x12291
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x12285
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x288(%rbp), %rdi
callq 0x56c0
leaq -0x2a8(%rbp), %rdi
callq 0x56c0
leaq -0x2c8(%rbp), %rdi
callq 0x56c0
jmp 0x122e4
jmp 0x122a1
movq -0x248(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x248(%rbp)
jmp 0x1211d
movl $0x0, -0x1ac(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x13530
movl -0x1ac(%rbp), %eax
testl %eax, %eax
je 0x122df
jmp 0x122da
jmp 0x12434
jmp 0x12434
leaq -0x128(%rbp), %rdi
callq 0x13530
jmp 0x1243d
movq -0x8(%rbp), %rax
cmpl $0x6, 0x98(%rax)
jne 0x12432
movq -0x10(%rbp), %rdx
addq $0x20, %rdx
leaq 0x3bb97(%rip), %rsi     # 0x4deac
leaq -0x348(%rbp), %rdi
movq %rdi, -0x370(%rbp)
callq 0x12d60
movq -0x370(%rbp), %rsi
leaq 0x3bb93(%rip), %rdx     # 0x4dec9
leaq -0x328(%rbp), %rdi
callq 0x12d10
jmp 0x12344
movq -0x18(%rbp), %rdx
leaq -0x308(%rbp), %rdi
leaq -0x328(%rbp), %rsi
callq 0x132d0
jmp 0x1235d
leaq 0x3b8ca(%rip), %rdx     # 0x4dc2e
leaq -0x2e8(%rbp), %rdi
leaq -0x308(%rbp), %rsi
callq 0x12d10
jmp 0x12379
leaq -0x308(%rbp), %rdi
callq 0x56c0
leaq -0x328(%rbp), %rdi
callq 0x56c0
leaq -0x348(%rbp), %rdi
callq 0x56c0
leaq -0x2e8(%rbp), %rdi
callq 0x5160
movq %rax, %rdi
leaq 0x5ffbd(%rip), %rax     # 0x72370
movl (%rax), %esi
callq 0xa6c0
movl $0x1, -0x1ac(%rbp)
leaq -0x2e8(%rbp), %rdi
callq 0x56c0
jmp 0x12434
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x12424
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x12418
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x308(%rbp), %rdi
callq 0x56c0
leaq -0x328(%rbp), %rdi
callq 0x56c0
leaq -0x348(%rbp), %rdi
callq 0x56c0
jmp 0x1243d
jmp 0x12434
addq $0x370, %rsp            # imm = 0x370
popq %rbp
retq
movq -0xa0(%rbp), %rdi
callq 0x5610
nopl (%rax)