// File: /workspace/github_c_makefile_star2_O1/janet-lang[P]janet/src/core/value.c
// Function: janet_compare
int janet_compare(Janet x, Janet y) {
    janet_vm.traversal = janet_vm.traversal_base;
    int status;
    do {
        JanetType tx = janet_type(x);
        JanetType ty = janet_type(y);
        if (tx != ty) return tx < ty ? -1 : 1;
        switch (tx) {
            case JANET_NIL:
                break;
            case JANET_BOOLEAN: {
                int diff = janet_unwrap_boolean(x) - janet_unwrap_boolean(y);
                if (diff) return diff;
                break;
            }
            case JANET_NUMBER: {
                double xx = janet_unwrap_number(x);
                double yy = janet_unwrap_number(y);
                if (xx == yy) {
                    break;
                } else {
                    return (xx < yy) ? -1 : 1;
                }
            }
            case JANET_STRING:
            case JANET_SYMBOL:
            case JANET_KEYWORD: {
                int diff = janet_string_compare(janet_unwrap_string(x), janet_unwrap_string(y));
                if (diff) return diff;
                break;
            }
            case JANET_ABSTRACT: {
                int diff = janet_compare_abstract(janet_unwrap_abstract(x), janet_unwrap_abstract(y));
                if (diff) return diff;
                break;
            }
            default: {
                if (janet_unwrap_pointer(x) == janet_unwrap_pointer(y)) {
                    break;
                } else {
                    return janet_unwrap_pointer(x) > janet_unwrap_pointer(y) ? 1 : -1;
                }
            }
            case JANET_TUPLE: {
                const Janet *lhs = janet_unwrap_tuple(x);
                const Janet *rhs = janet_unwrap_tuple(y);
                if (JANET_TUPLE_FLAG_BRACKETCTOR & (janet_tuple_flag(lhs) ^ janet_tuple_flag(rhs))) {
                    return (janet_tuple_flag(lhs) & JANET_TUPLE_FLAG_BRACKETCTOR) ? 1 : -1;
                }
                push_traversal_node(janet_tuple_head(lhs), janet_tuple_head(rhs), 1);
                break;
            }
            case JANET_STRUCT: {
                const JanetKV *lhs = janet_unwrap_struct(x);
                const JanetKV *rhs = janet_unwrap_struct(y);
                int32_t llen = janet_struct_capacity(lhs);
                int32_t rlen = janet_struct_capacity(rhs);
                int32_t lhash = janet_struct_hash(lhs);
                int32_t rhash = janet_struct_hash(rhs);
                if (llen < rlen) return -1;
                if (llen > rlen) return 1;
                if (lhash < rhash) return -1;
                if (lhash > rhash) return 1;
                push_traversal_node(janet_struct_head(lhs), janet_struct_head(rhs), 0);
                break;
            }
        }
    } while (!(status = traversal_next(&x, &y)));
    return status - 2;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq -0x38(%rbp), %r13
movq %rdi, (%r13)
leaq -0x30(%rbp), %r14
movq %rsi, (%r14)
movq %fs:0x0, %rax
leaq -0x348(%rax), %rax
movq 0x118(%rax), %rcx
movq %rcx, 0x108(%rax)
xorl %ebx, %ebx
movq -0x38(%rbp), %xmm0
movq %xmm0, %rdi
movq %rdi, %rdx
shrq $0x2f, %rdx
andl $0xf, %edx
ucomisd %xmm0, %xmm0
cmovnpl %ebx, %edx
movq -0x30(%rbp), %xmm1
movq %xmm1, %rax
movq %rax, %rsi
shrq $0x2f, %rsi
andl $0xf, %esi
ucomisd %xmm1, %xmm1
cmovnpl %ebx, %esi
cmpl %esi, %edx
jne 0x4b3d4
cmpl $0xe, %edx
ja 0x4b4e0
movl %edx, %ecx
leaq 0x213d0(%rip), %rdx     # 0x6c768
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movq -0x38(%rbp), %rdi
callq 0x4f838
movq %rax, %r12
movq -0x30(%rbp), %rdi
callq 0x4f838
movq %r12, %rdi
movq %rax, %rsi
callq 0x450ed
testl %eax, %eax
cmovnel %eax, %r15d
je 0x4b56f
xorl %ecx, %ecx
jmp 0x4b571
xorl %ecx, %ecx
cmpl %esi, %edx
movl $0x0, %r15d
sbbl %r15d, %r15d
orl $0x1, %r15d
jmp 0x4b571
andl $0x1, %edi
andl $0x1, %eax
movl %edi, %ecx
subl %eax, %ecx
cmpq %rax, %rdi
cmovnel %ecx, %r15d
jne 0x4b3cd
jmp 0x4b56f
movq %r13, %r14
callq 0x4f838
movq %rax, %r12
movq -0x30(%rbp), %rdi
callq 0x4f838
movl -0x20(%r12), %ecx
movl -0x20(%rax), %r13d
xorl %ecx, %r13d
btl $0x10, %r13d
jb 0x4b532
addq $-0x20, %r12
addq $-0x20, %rax
movq %r12, %rdi
movq %rax, %rsi
movl $0x1, %edx
callq 0x4aee9
jmp 0x4b544
callq 0x4f838
movq %rax, %r12
movq -0x30(%rbp), %rdi
callq 0x4f838
movl -0x10(%r12), %ecx
movl -0x10(%rax), %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmpl %esi, %ecx
jge 0x4b55f
xorl %eax, %eax
jmp 0x4b568
xorl %eax, %eax
ucomisd %xmm0, %xmm1
setbe %al
ucomisd %xmm1, %xmm0
leal -0x1(%rax,%rax), %eax
cmovnel %eax, %r15d
cmovpl %eax, %r15d
jne 0x4b3cd
jnp 0x4b56f
jmp 0x4b3cd
callq 0x4f838
movq %rax, %r12
movq -0x30(%rbp), %rdi
callq 0x4f838
cmpq %rax, %r12
je 0x4b591
movq -0x10(%r12), %rcx
movq -0x10(%rax), %rdx
cmpq %rdx, %rcx
je 0x4b5c6
cmpq %rcx, %rdx
movl $0x0, %eax
adcl $-0x1, %eax
orl $0x1, %eax
jmp 0x4b3c1
callq 0x4f838
movq %r14, %rbx
movq %r13, %r14
movq %rax, %r13
movq -0x30(%rbp), %r12
movq %r12, %rdi
callq 0x4f838
cmpq %rax, %r13
movq %r14, %r13
movq %rbx, %r14
movl $0x0, %ebx
je 0x4b56f
movq -0x38(%rbp), %rdi
callq 0x4f838
movq %rax, %r15
movq %r12, %rdi
callq 0x4f838
xorl %ecx, %ecx
cmpq %r15, %rax
movl $0x0, %r15d
adcl $-0x1, %r15d
jmp 0x4b3e1
btl $0x10, %ecx
movl $0x0, %r15d
adcl $-0x1, %r15d
orl $0x1, %r15d
btl $0x10, %r13d
jb 0x4b554
movq %r14, %r13
leaq -0x30(%rbp), %r14
jmp 0x4b56f
xorl %ecx, %ecx
movq %r14, %r13
leaq -0x30(%rbp), %r14
jmp 0x4b571
jle 0x4b598
xorl %eax, %eax
movl $0x1, %edx
testb %al, %al
je 0x4b58a
movl %edx, %r15d
movb $0x1, %cl
testb %cl, %cl
je 0x4b5ea
movq %r13, %rdi
movq %r14, %rsi
callq 0x4aff6
testl %eax, %eax
je 0x4b34c
jmp 0x4b5e4
xorl %ecx, %ecx
movl %edx, %r15d
jmp 0x4b571
xorl %eax, %eax
jmp 0x4b3c1
movl -0x14(%r12), %ecx
movl -0x14(%rax), %esi
cmpl %esi, %ecx
jl 0x4b470
jg 0x4b561
addq $-0x28, %r12
addq $-0x28, %rax
movq %r12, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x4aee9
movb $0x1, %al
movl %r15d, %edx
jmp 0x4b568
movq 0x40(%rcx), %rcx
testq %rcx, %rcx
je 0x4b5dc
movq %r12, %rdi
movq %rax, %rsi
callq *%rcx
jmp 0x4b3c1
cmpq %r12, %rax
jmp 0x4b4d0
addl $-0x2, %eax
movl %eax, %r15d
movl %r15d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq