// File: /workspace/github_c_makefile_star2_O2/Ihsoh[P]ilang/compiler/frontend/semantics.c
// Function: is_compatible_func_type
static bool _is_compatible_func_type(
	ParserContext *ctx,
	ParserASTNode *target,
	ParserASTNode *source,
	bool same
) {
	assert(ctx);
	assert(target);
	assert(source);

	if (_get_type_by_type_node(ctx, target) == FE_TYPE_FUNC
			&& _get_type_by_type_node(ctx, source) == FE_TYPE_FUNC
			&& target->nchilds == source->nchilds) {
		ParserASTNode *target_params = target->childs[0];
		ParserASTNode *source_params = source->childs[0];
		if (target_params->nchilds == source_params->nchilds) {
			for (int32_t i = 0; i < target_params->nchilds; i++) {
				ParserASTNode *target_param = target_params->childs[i];
				ParserASTNode *source_param = source_params->childs[i];

				if (target_param->type == FE_NODE_FUNC_PARAMS_ELLIPSIS_ITEM
						&& source_param->type != FE_NODE_FUNC_PARAMS_ELLIPSIS_ITEM) {
					return false;
				}
				if (target_param->type != FE_NODE_FUNC_PARAMS_ELLIPSIS_ITEM
						&& source_param->type == FE_NODE_FUNC_PARAMS_ELLIPSIS_ITEM) {
					return false;
				}

				if (target_param->type != FE_NODE_FUNC_PARAMS_ELLIPSIS_ITEM
						&& source_param->type != FE_NODE_FUNC_PARAMS_ELLIPSIS_ITEM) {
					ParserASTNode *target_param_type = target_param->childs[1];
					ParserASTNode *source_param_type = source_param->childs[1];
					if (!_is_compatible_type(ctx, target_param_type, source_param_type, true)) {
						return false;
					}
				}
			}
		} else {
			return false;
		}

		if (target->nchilds == 2) {
			ParserASTNode *target_ret_type = target->childs[1];
			ParserASTNode *source_ret_type = source->childs[1];
			if (!_is_compatible_type(ctx, target_ret_type, source_ret_type, true)) {
				return false;
			}
		}

		return true;
	} else {
		return false;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rsi, %rsi
je 0x3061e
movq %rdx, %r14
testq %rdx, %rdx
je 0x3063d
movq %rsi, %r15
movq %rdi, %rbx
callq 0x285a5
cmpb $0xf, %al
jne 0x3060d
movq %rbx, %rdi
movq %r14, %rsi
callq 0x285a5
cmpb $0xf, %al
jne 0x3060d
movl 0x44(%r15), %eax
cmpl 0x44(%r14), %eax
jne 0x3060d
movq 0x48(%r15), %rax
movq (%rax), %r8
movq 0x48(%r14), %rax
movq (%rax), %r13
movl 0x44(%r8), %eax
cmpl 0x44(%r13), %eax
jne 0x3060d
movq %rbx, -0x30(%rbp)
xorl %r12d, %r12d
movslq %eax, %rcx
cmpq %rcx, %r12
jge 0x305e2
movq 0x48(%r8), %rcx
movq (%rcx,%r12,8), %rcx
movq 0x48(%r13), %rdx
movq (%rdx,%r12,8), %rdx
cmpl $0xa03, (%rcx)          # imm = 0xA03
movl (%rdx), %esi
jne 0x305ac
cmpl $0xa03, %esi            # imm = 0xA03
je 0x305dd
jmp 0x3060d
cmpl $0xa03, %esi            # imm = 0xA03
je 0x3060d
movq %r8, %rbx
movq 0x48(%rcx), %rax
movq 0x8(%rax), %rsi
movq 0x48(%rdx), %rax
movq 0x8(%rax), %rdx
movq -0x30(%rbp), %rdi
pushq $0x1
popq %rcx
callq 0x2834e
testb %al, %al
je 0x3060d
movq %rbx, %r8
movl 0x44(%rbx), %eax
incq %r12
jmp 0x30580
cmpl $0x2, 0x44(%r15)
jne 0x30609
movq 0x48(%r15), %rax
movq 0x8(%rax), %rsi
movq 0x48(%r14), %rax
movq 0x8(%rax), %rdx
pushq $0x1
popq %rcx
movq -0x30(%rbp), %rdi
callq 0x2834e
testb %al, %al
je 0x3060d
movb $0x1, %al
jmp 0x3060f
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1467b(%rip), %rdi     # 0x44ca0
leaq 0x1730e(%rip), %rsi     # 0x4793a
leaq 0x191be(%rip), %rcx     # 0x497f1
movl $0x2a0, %edx            # imm = 0x2A0
callq 0x30a0
leaq 0xaee2(%rip), %rdi      # 0x3b526
leaq 0x172ef(%rip), %rsi     # 0x4793a
leaq 0x1919f(%rip), %rcx     # 0x497f1
movl $0x2a1, %edx            # imm = 0x2A1
callq 0x30a0