// File: /workspace/github_c_makefile_star2_O0/ryvnf[P]czc/type.c
// Function: type_equals
bool type_equals(struct type *a, struct type *b)
{
    if (type_type(a->tag) != type_type(b->tag))
        return false;

    switch (type_type(a->tag)) {
        case PTR_TYPE_FLAG: {
            struct ptr_type *a2 = ptr_type(a);
            struct ptr_type *b2 = ptr_type(b);

            return type_equals(a2->to, b2->to);
        }
        case ARRAY_TYPE_FLAG: {
            struct array_type *a2 = array_type(a);
            struct array_type *b2 = array_type(b);

            if (a2->len != b2->len)
                return false;

            return type_equals(a2->of, b2->of);
        }
        case FUNC_TYPE_FLAG: {
            struct func_type *a2 = func_type(a);
            struct func_type *b2 = func_type(b);

            if (a2->n_params != b2->n_params)
                return false;

            for (size_t i = 0; i < a2->n_params; ++i) {
                if (!type_equals(a2->params[i], b2->params[i]))
                    return false;
            }

            return type_equals(a2->ret, b2->ret);
        }

        case VOID_TYPE_FLAG:
        case BOOL_TYPE_FLAG:
        case INT_TYPE_FLAG:
        case FLOAT_TYPE_FLAG:
            return (a->tag & ~LVAL_TYPE_FLAG) == (b->tag & ~LVAL_TYPE_FLAG);

        case STRUCT_TYPE_FLAG:
            return struct_type(a)->id == struct_type(b)->id;

        case EXTERN_TYPE_FLAG:
            return extern_type(a)->id == extern_type(b)->id;
    }

    unreachable();
    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %edi
callq 0x10f30
movl %eax, -0x54(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %edi
callq 0x10f30
movl %eax, %ecx
movl -0x54(%rbp), %eax
cmpl %ecx, %eax
je 0x10ccb
movb $0x0, -0x1(%rbp)
jmp 0x10f18
movq -0x10(%rbp), %rax
movl (%rax), %edi
callq 0x10f30
movl %eax, %ecx
movl %ecx, %eax
decl %eax
movl %ecx, -0x58(%rbp)
subl $0x2, %eax
jb 0x10e7e
jmp 0x10cea
movl -0x58(%rbp), %eax
subl $0x4, %eax
je 0x10e7e
jmp 0x10cf8
movl -0x58(%rbp), %eax
subl $0x8, %eax
je 0x10d4b
jmp 0x10d02
movl -0x58(%rbp), %eax
subl $0x10, %eax
je 0x10d84
jmp 0x10d0c
movl -0x58(%rbp), %eax
subl $0x20, %eax
je 0x10dd8
jmp 0x10d1a
movl -0x58(%rbp), %eax
subl $0x40, %eax
je 0x10ea1
jmp 0x10d28
movl -0x58(%rbp), %eax
subl $0x80, %eax
je 0x10e7e
jmp 0x10d38
movl -0x58(%rbp), %eax
subl $0x200, %eax            # imm = 0x200
je 0x10ecc
jmp 0x10ef7
movq -0x10(%rbp), %rdi
callq 0x10420
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
callq 0x10420
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x10c90
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x10f18
movq -0x10(%rbp), %rdi
callq 0x10490
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rdi
callq 0x10490
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x38(%rbp), %rcx
cmpq 0x10(%rcx), %rax
je 0x10db9
movb $0x0, -0x1(%rbp)
jmp 0x10f18
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x10c90
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x10f18
movq -0x10(%rbp), %rdi
callq 0x10500
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rdi
callq 0x10500
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x48(%rbp), %rcx
cmpq 0x10(%rcx), %rax
je 0x10e0d
movb $0x0, -0x1(%rbp)
jmp 0x10f18
movq $0x0, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq -0x40(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jae 0x10e5f
movq -0x40(%rbp), %rax
movq -0x50(%rbp), %rcx
movq 0x20(%rax,%rcx,8), %rdi
movq -0x48(%rbp), %rax
movq -0x50(%rbp), %rcx
movq 0x20(%rax,%rcx,8), %rsi
callq 0x10c90
testb $0x1, %al
jne 0x10e4f
movb $0x0, -0x1(%rbp)
jmp 0x10f18
jmp 0x10e51
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x10e15
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x10c90
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x10f18
movq -0x10(%rbp), %rax
movl (%rax), %eax
andl $0xfffffbff, %eax       # imm = 0xFFFFFBFF
movq -0x18(%rbp), %rcx
movl (%rcx), %ecx
andl $0xfffffbff, %ecx       # imm = 0xFFFFFBFF
cmpl %ecx, %eax
sete %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x10f18
movq -0x10(%rbp), %rdi
callq 0x10570
movl 0x1c(%rax), %eax
movl %eax, -0x5c(%rbp)
movq -0x18(%rbp), %rdi
callq 0x10570
movq %rax, %rcx
movl -0x5c(%rbp), %eax
cmpl 0x1c(%rcx), %eax
sete %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x10f18
movq -0x10(%rbp), %rdi
callq 0x10580
movl 0x4(%rax), %eax
movl %eax, -0x60(%rbp)
movq -0x18(%rbp), %rdi
callq 0x10580
movq %rax, %rcx
movl -0x60(%rbp), %eax
cmpl 0x4(%rcx), %eax
sete %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x10f18
leaq 0x2292(%rip), %rdi      # 0x13190
leaq 0x3839(%rip), %rsi      # 0x1473e
movl $0x1bb, %edx            # imm = 0x1BB
leaq 0x391d(%rip), %rcx      # 0x1482e
movb $0x0, %al
callq 0x6510
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)