// File: /workspace/github_c_makefile_star2_O1/voithos[P]awl/src/types.c
// Function: awlval_eq
bool awlval_eq(awlval* x, awlval* y) {
    awlval_maybe_promote_numeric(x, y);
    if (x->type != y->type) {
        return false;
    }

    switch (x->type) {
        case AWLVAL_BUILTIN:
            return y->type == AWLVAL_BUILTIN && x->builtin == y->builtin;
            break;

        case AWLVAL_FN:
        case AWLVAL_MACRO:
            return y->type == x->type && awlval_eq(x->formals, y->formals) && awlval_eq(x->body, y->body);
            break;

        case AWLVAL_INT:
            return x->lng == y->lng;
            break;

        case AWLVAL_FLOAT:
            return x->dbl == y->dbl;
            break;

        case AWLVAL_ERR:
            return streq(x->err, y->err);
            break;

        case AWLVAL_SYM:
        case AWLVAL_QSYM:
            return x->length == y->length && streq(x->sym, y->sym);
            break;

        case AWLVAL_STR:
            return x->length == y->length && streq(x->str, y->str);
            break;

        case AWLVAL_BOOL:
            return x->bln == y->bln;
            break;

        case AWLVAL_DICT:
            return dict_equal(x->d, y->d);
            break;

        case AWLVAL_SEXPR:
        case AWLVAL_QEXPR:
        case AWLVAL_EEXPR:
        case AWLVAL_CEXPR:
            if (x->count != y->count) {
                return false;
            }
            for (int i = 0; i < x->count; i++) {
                if (!awlval_eq(x->cell[i], y->cell[i])) {
                    return false;
                }
            }
            return true;
            break;
    }
    return false;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x10fb2
movl (%r14), %ecx
movl (%rbx), %eax
cmpl %eax, %ecx
jne 0x113a4
leal -0x8(%rcx), %edx
cmpl $0x2, %edx
jae 0x112e5
movq 0x20(%r14), %rdi
movq 0x20(%rbx), %rsi
callq 0x11298
testb %al, %al
je 0x113a4
movq 0x28(%r14), %r14
movq 0x28(%rbx), %rbx
jmp 0x112a6
xorl %r15d, %r15d
cmpl $0xe, %ecx
ja 0x113a7
movl %ecx, %ecx
leaq 0x2392(%rip), %rdx      # 0x1368c
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movl 0x4(%r14), %eax
cmpl 0x4(%rbx), %eax
jne 0x113a4
cmpl $0x0, 0x4(%r14)
setle %r15b
jle 0x113a7
movq 0x8(%r14), %rax
movq (%rax), %rdi
movq 0x8(%rbx), %rax
movq (%rax), %rsi
callq 0x11298
testb %al, %al
je 0x113a7
movl $0x1, %r12d
movslq 0x4(%r14), %rax
cmpq %rax, %r12
setge %r15b
jge 0x113a7
movq 0x8(%r14), %rax
movq (%rax,%r12,8), %rdi
movq 0x8(%rbx), %rax
movq (%rax,%r12,8), %rsi
callq 0x11298
incq %r12
testb %al, %al
jne 0x1133c
jmp 0x113a7
movl 0x10(%r14), %eax
cmpl 0x10(%rbx), %eax
jne 0x113a4
movq 0x18(%r14), %rdi
movq 0x18(%rbx), %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x11b89
movb 0x18(%r14), %al
cmpb 0x18(%rbx), %al
jmp 0x1139e
cmpl $0x7, %eax
jne 0x113a4
movq 0x18(%r14), %rax
cmpq 0x18(%rbx), %rax
sete %r15b
jmp 0x113a7
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movsd 0x18(%rbx), %xmm0
cmpeqsd 0x18(%r14), %xmm0
movq %xmm0, %r15
andl $0x1, %r15d
jmp 0x113a7
movq 0x18(%r14), %rdi
movq 0x18(%rbx), %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x5e7e