// File: /workspace/github_c_makefile_star2_O3/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 0x32a54
movq %rdx, %r14
testq %rdx, %rdx
je 0x32a73
movq %rsi, %r15
movq %rdi, %rbx
callq 0x2a712
cmpb $0xf, %al
jne 0x32a43
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2a712
cmpb $0xf, %al
jne 0x32a43
movl 0x44(%r15), %ecx
cmpl 0x44(%r14), %ecx
jne 0x32a43
movq 0x48(%r15), %rax
movq (%rax), %r8
movq 0x48(%r14), %rax
movq (%rax), %r12
movl 0x44(%r8), %eax
cmpl 0x44(%r12), %eax
jne 0x32a43
testl %eax, %eax
jle 0x32a19
movq %rbx, -0x30(%rbp)
xorl %r13d, %r13d
movq 0x48(%r8), %rcx
movq (%rcx,%r13,8), %rcx
movq 0x48(%r12), %rdx
movq (%rdx,%r13,8), %rdx
cmpl $0xa03, (%rcx)          # imm = 0xA03
movl (%rdx), %esi
jne 0x329d3
cmpl $0xa03, %esi            # imm = 0xA03
je 0x32a06
jmp 0x32a43
cmpl $0xa03, %esi            # imm = 0xA03
je 0x32a43
movq %r8, %rbx
movq 0x48(%rcx), %rax
movq 0x8(%rax), %rsi
movq 0x48(%rdx), %rax
movq 0x8(%rax), %rdx
movq -0x30(%rbp), %rdi
movl $0x1, %ecx
callq 0x2a4b9
testb %al, %al
je 0x32a43
movq %rbx, %r8
movl 0x44(%rbx), %eax
incq %r13
movslq %eax, %rcx
cmpq %rcx, %r13
jl 0x329ae
movl 0x44(%r15), %ecx
movq -0x30(%rbp), %rbx
cmpl $0x2, %ecx
jne 0x32a3f
movq 0x48(%r15), %rax
movq 0x8(%rax), %rsi
movq 0x48(%r14), %rax
movq 0x8(%rax), %rdx
movq %rbx, %rdi
movl $0x1, %ecx
callq 0x2a4b9
testb %al, %al
je 0x32a43
movb $0x1, %al
jmp 0x32a45
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x15201(%rip), %rdi     # 0x47c5c
leaq 0x17e98(%rip), %rsi     # 0x4a8fa
leaq 0x19d48(%rip), %rcx     # 0x4c7b1
movl $0x2a0, %edx            # imm = 0x2A0
callq 0x30a0
leaq 0xbaac(%rip), %rdi      # 0x3e526
leaq 0x17e79(%rip), %rsi     # 0x4a8fa
leaq 0x19d29(%rip), %rcx     # 0x4c7b1
movl $0x2a1, %edx            # imm = 0x2A1
callq 0x30a0