// File: /workspace/github_c_makefile_star2_O0/hsjoihs[P]c-compiler/typecheck_expression.c
// Function: is_compatible
static int is_compatible(const struct AnalyzerState *ptr_ps,
                         const struct Type *ref_t1, const struct Type *ref_t2)
{
	if (is_strictly_equal(ptr_ps, ref_t1, ref_t2)) {
		return 1;
	}

	if (is_integral(ref_t1) && is_integral(ref_t2)) {
		return 1;
	}

	const struct Type t1 = *ref_t1;
	const struct Type t2 = *ref_t2;

	if (t1.type_category == PTR_ && t2.type_category == PTR_) {
		return t1.derived_from->type_category == VOID_ ||
		       t2.derived_from->type_category == VOID_;
	}

	if (t1.type_category == PTR_ && t2.type_category == ARRAY) {
		struct Type t3 = t2; /* copy of t2 */
		t3.type_category = PTR_;
		return is_compatible(ptr_ps, &t1, &t3);
	}

	if (t1.type_category == ARRAY && t2.type_category == PTR_) {
		return is_compatible(ptr_ps, &t2, &t1);
	}

	if (t1.type_category == FN && t2.type_category == FN) {
		if (!is_strictly_equal(ptr_ps, t1.derived_from, t2.derived_from)) {
			return 0;
		}

		if (t1.param_infos_validity == INVALID ||
		    t2.param_infos_validity == INVALID) {
			return 1;
		}

		if (t1.param_infos_validity == VA_ARGS ||
		    t2.param_infos_validity == VA_ARGS) {
#ifdef __STDC__
#warning should typecheck
#endif
			return 1;
		}

		if (t1.param_infos.length != t2.param_infos.length) {
			return 0;
		}

		for (int i = 0; i < t1.param_infos.length; i++) {
			const struct TypeAndIdent *ptr_ti1 = t1.param_infos.vector[i];
			const struct TypeAndIdent *ptr_ti2 = t2.param_infos.vector[i];

			if (!is_strictly_equal(ptr_ps, &ptr_ti1->type, &ptr_ti2->type)) {
				return 0;
			}
		}
		return 1;
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x9470
cmpl $0x0, %eax
je 0x6729
movl $0x1, -0x4(%rbp)
jmp 0x694b
movq -0x18(%rbp), %rdi
callq 0x6aa0
cmpl $0x0, %eax
je 0x6751
movq -0x20(%rbp), %rdi
callq 0x6aa0
cmpl $0x0, %eax
je 0x6751
movl $0x1, -0x4(%rbp)
jmp 0x694b
movq -0x18(%rbp), %rsi
leaq -0x70(%rbp), %rdi
movl $0x50, %edx
callq 0x10e0
movq -0x20(%rbp), %rsi
leaq -0xc0(%rbp), %rdi
movl $0x50, %edx
callq 0x10e0
cmpl $0x1, -0x70(%rbp)
jne 0x67be
cmpl $0x1, -0xc0(%rbp)
jne 0x67be
movq -0x68(%rbp), %rcx
movb $0x1, %al
cmpl $0x7, (%rcx)
movb %al, -0x129(%rbp)
je 0x67ab
movq -0xb8(%rbp), %rax
cmpl $0x7, (%rax)
sete %al
movb %al, -0x129(%rbp)
movb -0x129(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x4(%rbp)
jmp 0x694b
cmpl $0x1, -0x70(%rbp)
jne 0x680b
cmpl $0x2, -0xc0(%rbp)
jne 0x680b
leaq -0x110(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
movl $0x50, %edx
callq 0x10e0
movl $0x1, -0x110(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x110(%rbp), %rdx
callq 0x66f0
movl %eax, -0x4(%rbp)
jmp 0x694b
cmpl $0x2, -0x70(%rbp)
jne 0x6836
cmpl $0x1, -0xc0(%rbp)
jne 0x6836
movq -0x10(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
leaq -0x70(%rbp), %rdx
callq 0x66f0
movl %eax, -0x4(%rbp)
jmp 0x694b
cmpl $0x3, -0x70(%rbp)
jne 0x6944
cmpl $0x3, -0xc0(%rbp)
jne 0x6944
movq -0x10(%rbp), %rdi
movq -0x68(%rbp), %rsi
movq -0xb8(%rbp), %rdx
callq 0x9470
cmpl $0x0, %eax
jne 0x6872
movl $0x0, -0x4(%rbp)
jmp 0x694b
cmpl $0x0, -0x48(%rbp)
je 0x6881
cmpl $0x0, -0x98(%rbp)
jne 0x688d
movl $0x1, -0x4(%rbp)
jmp 0x694b
cmpl $0x2, -0x48(%rbp)
je 0x689c
cmpl $0x2, -0x98(%rbp)
jne 0x68a8
movl $0x1, -0x4(%rbp)
jmp 0x694b
movl -0x58(%rbp), %eax
cmpl -0xa8(%rbp), %eax
je 0x68bf
movl $0x0, -0x4(%rbp)
jmp 0x694b
movl $0x0, -0x114(%rbp)
movl -0x114(%rbp), %eax
cmpl -0x58(%rbp), %eax
jge 0x693b
movq -0x50(%rbp), %rax
movslq -0x114(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x120(%rbp)
movq -0xa0(%rbp), %rax
movslq -0x114(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x128(%rbp)
movq -0x10(%rbp), %rdi
movq -0x120(%rbp), %rsi
movq -0x128(%rbp), %rdx
callq 0x9470
cmpl $0x0, %eax
jne 0x6928
movl $0x0, -0x4(%rbp)
jmp 0x694b
jmp 0x692a
movl -0x114(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x114(%rbp)
jmp 0x68c9
movl $0x1, -0x4(%rbp)
jmp 0x694b
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
nopw (%rax,%rax)