// File: /workspace/github_c_makefile_star2_O0/Ihsoh[P]ilang/compiler/backend/semantics.c
// Function: check_fncall_params
static void _check_fncall_params(
	ParserContext *ctx,
	ParserASTNode *node,
	ParserASTNode *node_func_sym_params,
	ParserASTNode *node_func_params
) {
	assert(ctx);
	assert(node);
	assert(node_func_sym_params);
	assert(node_func_params);

	bool func_param_count_matched = false;

	if (node_func_params->nchilds == node_func_sym_params->nchilds) {
		func_param_count_matched = true;
	}

	if (node_func_sym_params->nchilds > 0
			&& node_func_sym_params->childs[node_func_sym_params->nchilds - 1]->type == BE_NODE_FUNC_PARAMS_ELLIPSIS_ITEM
			&& node_func_params->nchilds >= node_func_sym_params->nchilds - 1) {
		func_param_count_matched = true;
	}

	if (func_param_count_matched) {
		int i;
		for (i = 0; i < node_func_sym_params->nchilds; i++) {
			ParserASTNode *node_func_sym_param = node_func_sym_params->childs[i];

			if (node_func_sym_param->type == BE_NODE_FUNC_PARAMS_ELLIPSIS_ITEM) {
				break;
			}

			ParserASTNode *node_func_param = node_func_params->childs[i];
			_GetParamInfoResult result_func_param;
			_get_param_info(ctx, node_func_param, &result_func_param);
			ParserASTNode *node_func_param_type = result_func_param.node_type;

			ParserASTNode *node_func_sym_param_type = node_func_sym_param->childs[1];
			if (!_is_compatible_type_for_assign(ctx, node_func_sym_param_type, node_func_param_type, false)) {
				_SYNERR_NODE(ctx, node, "function call parameter type incompatible.");
			}
		}

		for (; i < node_func_params->nchilds; i++) {
			ParserASTNode *node_func_param = node_func_params->childs[i];
			_GetParamInfoResult result_func_param;
			_get_param_info(ctx, node_func_param, &result_func_param);
			ParserASTNode *node_func_param_type = result_func_param.node_type;

			uint8_t param_type = _get_type_by_type_node(ctx, node_func_param_type);
			if (param_type == BE_TYPE_STRUCT
					|| param_type == BE_TYPE_ARRAY
					|| param_type == BE_TYPE_FUNC) {
				_SYNERR_NODE(
					ctx, node, "parameter type cannot be struct type or array type or function type operand."
				);
			}
		}
	} else {
		_SYNERR_NODE(ctx, node, "function call parameter count not matched.");
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc90, %rsp            # imm = 0xC90
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x5fb24
jmp 0x5fb43
leaq 0x20636(%rip), %rdi     # 0x80161
leaq 0x22d4e(%rip), %rsi     # 0x82880
movl $0x130b, %edx           # imm = 0x130B
leaq 0x259fb(%rip), %rcx     # 0x85539
callq 0x30a0
cmpq $0x0, -0x10(%rbp)
je 0x5fb4c
jmp 0x5fb6b
leaq 0x16a09(%rip), %rdi     # 0x7655c
leaq 0x22d26(%rip), %rsi     # 0x82880
movl $0x130c, %edx           # imm = 0x130C
leaq 0x259d3(%rip), %rcx     # 0x85539
callq 0x30a0
cmpq $0x0, -0x18(%rbp)
je 0x5fb74
jmp 0x5fb93
leaq 0x25a1c(%rip), %rdi     # 0x85597
leaq 0x22cfe(%rip), %rsi     # 0x82880
movl $0x130d, %edx           # imm = 0x130D
leaq 0x259ab(%rip), %rcx     # 0x85539
callq 0x30a0
cmpq $0x0, -0x20(%rbp)
je 0x5fb9c
jmp 0x5fbbb
leaq 0x25a09(%rip), %rdi     # 0x855ac
leaq 0x22cd6(%rip), %rsi     # 0x82880
movl $0x130e, %edx           # imm = 0x130E
leaq 0x25983(%rip), %rcx     # 0x85539
callq 0x30a0
movb $0x0, -0x21(%rbp)
movq -0x20(%rbp), %rax
movl 0x44(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x44(%rcx), %eax
jne 0x5fbd3
movb $0x1, -0x21(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x44(%rax)
jle 0x5fc17
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x18(%rbp), %rcx
movl 0x44(%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
cmpl $0xa03, (%rax)          # imm = 0xA03
jne 0x5fc17
movq -0x20(%rbp), %rax
movl 0x44(%rax), %eax
movq -0x18(%rbp), %rcx
movl 0x44(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jl 0x5fc17
movb $0x1, -0x21(%rbp)
testb $0x1, -0x21(%rbp)
je 0x5fdb7
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x44(%rcx), %eax
jge 0x5fcef
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpl $0xa03, (%rax)          # imm = 0xA03
jne 0x5fc5d
jmp 0x5fcef
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
leaq -0x48(%rbp), %rdx
callq 0x5efc0
movq -0x48(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x30(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
xorl %ecx, %ecx
callq 0x4f6a0
testb $0x1, %al
jne 0x5fcdf
leaq -0x460(%rbp), %rdi
leaq 0x258fe(%rip), %rsi     # 0x855bd
movb $0x0, %al
callq 0x3160
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x460(%rbp), %rdx
callq *%rax
jmp 0x5fce1
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x5fc28
jmp 0x5fcf1
movl -0x28(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x44(%rcx), %eax
jge 0x5fdb5
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x468(%rbp)
movq -0x8(%rbp), %rdi
movq -0x468(%rbp), %rsi
leaq -0x478(%rbp), %rdx
callq 0x5efc0
movq -0x478(%rbp), %rax
movq %rax, -0x480(%rbp)
movq -0x8(%rbp), %rdi
movq -0x480(%rbp), %rsi
callq 0x56560
movb %al, -0x481(%rbp)
movzbl -0x481(%rbp), %eax
cmpl $0xd, %eax
je 0x5fd77
movzbl -0x481(%rbp), %eax
cmpl $0xe, %eax
je 0x5fd77
movzbl -0x481(%rbp), %eax
cmpl $0xf, %eax
jne 0x5fda5
leaq -0x890(%rbp), %rdi
leaq 0x25863(%rip), %rsi     # 0x855e8
movb $0x0, %al
callq 0x3160
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x890(%rbp), %rdx
callq *%rax
jmp 0x5fda7
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x5fcf1
jmp 0x5fde5
leaq -0xc90(%rbp), %rdi
leaq 0x25870(%rip), %rsi     # 0x85635
movb $0x0, %al
callq 0x3160
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0xc90(%rbp), %rdx
callq *%rax
addq $0xc90, %rsp            # imm = 0xC90
popq %rbp
retq
nop