// File: /workspace/github_c_makefile_star2_O0/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
subq $0xb0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %fs:0x0, %rax
leaq -0x348(%rax), %rax
movq 0x118(%rax), %rax
movq %rax, -0x78(%rbp)
movq %fs:0x0, %rax
leaq -0x348(%rax), %rax
movq -0x78(%rbp), %rcx
movq %rcx, 0x108(%rax)
movsd -0x10(%rbp), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x6f29b
jmp 0x6f2ac
movq -0x10(%rbp), %rax
shrq $0x2f, %rax
andq $0xf, %rax
movl %eax, -0x7c(%rbp)
jmp 0x6f2b3
xorl %eax, %eax
movl %eax, -0x7c(%rbp)
jmp 0x6f2b3
movl -0x7c(%rbp), %eax
movl %eax, -0x20(%rbp)
movsd -0x18(%rbp), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x6f2cb
jmp 0x6f2dc
movq -0x18(%rbp), %rax
shrq $0x2f, %rax
andq $0xf, %rax
movl %eax, -0x80(%rbp)
jmp 0x6f2e3
xorl %eax, %eax
movl %eax, -0x80(%rbp)
jmp 0x6f2e3
movl -0x80(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x24(%rbp), %eax
je 0x6f30e
movl -0x20(%rbp), %edx
movl -0x24(%rbp), %esi
movl $0x1, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpl %esi, %edx
cmovbl %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0x6f5dc
movl -0x20(%rbp), %eax
movq %rax, -0x88(%rbp)
subq $0xe, %rax
ja 0x6f436
movq -0x88(%rbp), %rax
leaq 0x29808(%rip), %rcx     # 0x98b38
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
jmp 0x6f5b1
movq -0x10(%rbp), %rax
andq $0x1, %rax
movq -0x18(%rbp), %rcx
andq $0x1, %rcx
subq %rcx, %rax
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
je 0x6f365
movl -0x28(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x6f5dc
jmp 0x6f5b1
movsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
movsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0x30(%rbp), %xmm0
ucomisd -0x38(%rbp), %xmm0
jne 0x6f391
jp 0x6f391
jmp 0x6f5b1
movsd -0x30(%rbp), %xmm1
movsd -0x38(%rbp), %xmm0
movl $0x1, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
ucomisd %xmm1, %xmm0
cmoval %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0x6f5dc
movq -0x10(%rbp), %rdi
callq 0x7b260
movq %rax, -0x90(%rbp)
movq -0x18(%rbp), %rdi
callq 0x7b260
movq -0x90(%rbp), %rdi
movq %rax, %rsi
callq 0x64900
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0x6f3f0
movl -0x3c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x6f5dc
jmp 0x6f5b1
movq -0x10(%rbp), %rdi
callq 0x7b260
movq %rax, -0x98(%rbp)
movq -0x18(%rbp), %rdi
callq 0x7b260
movq -0x98(%rbp), %rdi
movq %rax, %rsi
callq 0x6e8e0
movl %eax, -0x40(%rbp)
cmpl $0x0, -0x40(%rbp)
je 0x6f431
movl -0x40(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x6f5dc
jmp 0x6f5b1
movq -0x10(%rbp), %rdi
callq 0x7b260
movq %rax, -0xa0(%rbp)
movq -0x18(%rbp), %rdi
callq 0x7b260
movq %rax, %rcx
movq -0xa0(%rbp), %rax
cmpq %rcx, %rax
jne 0x6f463
jmp 0x6f5b1
movq -0x10(%rbp), %rdi
callq 0x7b260
movq %rax, -0xa8(%rbp)
movq -0x18(%rbp), %rdi
callq 0x7b260
movq -0xa8(%rbp), %rdx
movq %rax, %rsi
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl $0x1, %ecx
cmpq %rsi, %rdx
cmoval %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0x6f5dc
movq -0x10(%rbp), %rdi
callq 0x7b260
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rdi
callq 0x7b260
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rax
movl -0x20(%rax), %eax
movq -0x50(%rbp), %rcx
xorl -0x20(%rcx), %eax
andl $0x10000, %eax          # imm = 0x10000
cmpl $0x0, %eax
je 0x6f4f5
movq -0x48(%rbp), %rax
movl -0x20(%rax), %edx
andl $0x10000, %edx          # imm = 0x10000
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl $0x1, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0x6f5dc
movq -0x48(%rbp), %rdi
addq $-0x20, %rdi
movq -0x50(%rbp), %rsi
addq $-0x20, %rsi
movl $0x1, %edx
callq 0x6e990
jmp 0x6f5b1
movq -0x10(%rbp), %rdi
callq 0x7b260
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rdi
callq 0x7b260
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rax
movl -0x10(%rax), %eax
movl %eax, -0x64(%rbp)
movq -0x60(%rbp), %rax
movl -0x10(%rax), %eax
movl %eax, -0x68(%rbp)
movq -0x58(%rbp), %rax
movl -0x14(%rax), %eax
movl %eax, -0x6c(%rbp)
movq -0x60(%rbp), %rax
movl -0x14(%rax), %eax
movl %eax, -0x70(%rbp)
movl -0x64(%rbp), %eax
cmpl -0x68(%rbp), %eax
jge 0x6f567
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6f5dc
movl -0x64(%rbp), %eax
cmpl -0x68(%rbp), %eax
jle 0x6f578
movl $0x1, -0x4(%rbp)
jmp 0x6f5dc
movl -0x6c(%rbp), %eax
cmpl -0x70(%rbp), %eax
jge 0x6f589
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6f5dc
movl -0x6c(%rbp), %eax
cmpl -0x70(%rbp), %eax
jle 0x6f59a
movl $0x1, -0x4(%rbp)
jmp 0x6f5dc
movq -0x58(%rbp), %rdi
addq $-0x28, %rdi
movq -0x60(%rbp), %rsi
addq $-0x28, %rsi
xorl %edx, %edx
callq 0x6e990
jmp 0x6f5b3
leaq -0x10(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x6ec00
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x6f289
movl -0x1c(%rbp), %eax
subl $0x2, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax,%rax)