// File: /workspace/github_c_makefile_star2_O0/Ihsoh[P]ilang/compiler/frontend/semantics.c
// Function: check_fncall_params
static void _check_fncall_params(
	ParserContext *ctx,
	ParserASTNode *node_expr,
	ParserASTNode *node_func_sym_params,
	ParserASTNode *node_func_params
) {
	assert(ctx);
	assert(node_expr);
	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 == FE_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 == FE_NODE_FUNC_PARAMS_ELLIPSIS_ITEM) {
				break;
			}

			ParserASTNode *node_func_param = node_func_params->childs[i];

			_expr_parenthesis(ctx, node_func_param);

			uint8_t param_type = FE_EXPR_AST_NODE_GET_TYPE(node_func_param);
			if (param_type == FE_TYPE_STRUCT
					|| param_type == FE_TYPE_ARRAY
					|| param_type == FE_TYPE_FUNC) {
				_SYNERR_NODE(
					ctx, node_func_param, "parameter type cannot be struct type or array type or function type operand."
				);
			}

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

		for (; i < node_func_params->nchilds; i++) {
			ParserASTNode *node_func_param = node_func_params->childs[i];
			_expr_parenthesis(ctx, node_func_param);

			uint8_t param_type = FE_EXPR_AST_NODE_GET_TYPE(node_func_param);
			if (param_type == FE_TYPE_STRUCT
					|| param_type == FE_TYPE_ARRAY
					|| param_type == FE_TYPE_FUNC) {
				_SYNERR_NODE(
					ctx, node_func_param, "parameter type cannot be struct type or array type or function type operand."
				);
			}
		}
	} else {
		_SYNERR_NODE(ctx, node_expr, "function call parameter count not matched.");
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1060, %rsp           # imm = 0x1060
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x5a754
jmp 0x5a773
leaq 0x21dfb(%rip), %rdi     # 0x7c556
leaq 0x23ae8(%rip), %rsi     # 0x7e24a
movl $0xcd8, %edx            # imm = 0xCD8
leaq 0x24ad8(%rip), %rcx     # 0x7f246
callq 0x30a0
cmpq $0x0, -0x10(%rbp)
je 0x5a77c
jmp 0x5a79b
leaq 0x1c972(%rip), %rdi     # 0x770f5
leaq 0x23ac0(%rip), %rsi     # 0x7e24a
movl $0xcd9, %edx            # imm = 0xCD9
leaq 0x24ab0(%rip), %rcx     # 0x7f246
callq 0x30a0
cmpq $0x0, -0x18(%rbp)
je 0x5a7a4
jmp 0x5a7c3
leaq 0x24af9(%rip), %rdi     # 0x7f2a4
leaq 0x23a98(%rip), %rsi     # 0x7e24a
movl $0xcda, %edx            # imm = 0xCDA
leaq 0x24a88(%rip), %rcx     # 0x7f246
callq 0x30a0
cmpq $0x0, -0x20(%rbp)
je 0x5a7cc
jmp 0x5a7eb
leaq 0x1c8c0(%rip), %rdi     # 0x77093
leaq 0x23a70(%rip), %rsi     # 0x7e24a
movl $0xcdb, %edx            # imm = 0xCDB
leaq 0x24a60(%rip), %rcx     # 0x7f246
callq 0x30a0
movb $0x0, -0x21(%rbp)
movq -0x20(%rbp), %rax
movl 0x44(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x44(%rcx), %eax
jne 0x5a803
movb $0x1, -0x21(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x44(%rax)
jle 0x5a847
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 0x5a847
movq -0x20(%rbp), %rax
movl 0x44(%rax), %eax
movq -0x18(%rbp), %rcx
movl 0x44(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jl 0x5a847
movb $0x1, -0x21(%rbp)
testb $0x1, -0x21(%rbp)
je 0x5aa2e
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x44(%rcx), %eax
jge 0x5a97e
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 0x5a88d
jmp 0x5a97e
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
callq 0x5a6a0
movq -0x38(%rbp), %rax
movb 0x60(%rax), %al
movb %al, -0x39(%rbp)
movzbl -0x39(%rbp), %eax
cmpl $0xd, %eax
je 0x5a8d3
movzbl -0x39(%rbp), %eax
cmpl $0xe, %eax
je 0x5a8d3
movzbl -0x39(%rbp), %eax
cmpl $0xf, %eax
jne 0x5a901
leaq -0x440(%rbp), %rdi
leaq 0x249d8(%rip), %rsi     # 0x7f2b9
movb $0x0, %al
callq 0x3160
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
leaq -0x440(%rbp), %rdx
callq *%rax
movq -0x30(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x448(%rbp)
movq -0x38(%rbp), %rax
movq 0x68(%rax), %rax
movq %rax, -0x450(%rbp)
movq -0x8(%rbp), %rdi
movq -0x448(%rbp), %rsi
movq -0x450(%rbp), %rdx
xorl %ecx, %ecx
callq 0x4f750
testb $0x1, %al
jne 0x5a96e
leaq -0x850(%rbp), %rdi
leaq 0x249b8(%rip), %rsi     # 0x7f306
movb $0x0, %al
callq 0x3160
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x850(%rbp), %rdx
callq *%rax
jmp 0x5a970
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x5a858
jmp 0x5a980
movl -0x28(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x44(%rcx), %eax
jge 0x5aa2c
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x858(%rbp)
movq -0x8(%rbp), %rdi
movq -0x858(%rbp), %rsi
callq 0x5a6a0
movq -0x858(%rbp), %rax
movb 0x60(%rax), %al
movb %al, -0x859(%rbp)
movzbl -0x859(%rbp), %eax
cmpl $0xd, %eax
je 0x5a9eb
movzbl -0x859(%rbp), %eax
cmpl $0xe, %eax
je 0x5a9eb
movzbl -0x859(%rbp), %eax
cmpl $0xf, %eax
jne 0x5aa1c
leaq -0xc60(%rbp), %rdi
leaq 0x248c0(%rip), %rsi     # 0x7f2b9
movb $0x0, %al
callq 0x3160
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x8(%rbp), %rdi
movq -0x858(%rbp), %rsi
leaq -0xc60(%rbp), %rdx
callq *%rax
jmp 0x5aa1e
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x5a980
jmp 0x5aa5c
leaq -0x1060(%rbp), %rdi
leaq 0x248f5(%rip), %rsi     # 0x7f331
movb $0x0, %al
callq 0x3160
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x1060(%rbp), %rdx
callq *%rax
addq $0x1060, %rsp           # imm = 0x1060
popq %rbp
retq
nopw %cs:(%rax,%rax)