// File: /workspace/github_c_makefile_star2_O2/janet-lang[P]janet/src/core/inttypes.c
// Function: cfun_it_u64_compare
static Janet cfun_it_u64_compare(int32_t argc, Janet *argv) {
    janet_fixarity(argc, 2);
    if (janet_is_int(argv[0]) != JANET_INT_U64) {
        janet_panic("compare method requires int/u64 as first argument");
    }
    uint64_t x = janet_unwrap_u64(argv[0]);
    switch (janet_type(argv[1])) {
        default:
            break;
        case JANET_NUMBER : {
            double y = janet_unwrap_number(argv[1]);
            return janet_wrap_number(compare_uint64_double(x, y));
        }
        case JANET_ABSTRACT: {
            void *abst = janet_unwrap_abstract(argv[1]);
            if (janet_abstract_type(abst) == &janet_u64_type) {
                uint64_t y = *(uint64_t *)abst;
                return janet_wrap_number((x < y) ? -1 : (x > y ? 1 : 0));
            } else if (janet_abstract_type(abst) == &janet_s64_type) {
                int64_t y = *(int64_t *)abst;
                if (y < 0) {
                    return janet_wrap_number(1);
                } else if (x > INT64_MAX) {
                    return janet_wrap_number(1);
                } else {
                    int64_t x2 = (int64_t) x;
                    return janet_wrap_number((x2 < y) ? -1 : (x2 > y ? 1 : 0));
                }
            }
            break;
        }
    }
    return janet_wrap_nil();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
pushq $0x2
popq %rsi
callq 0x17801
movq (%r14), %rdi
callq 0x29e35
cmpl $0x2, %eax
jne 0x2b4a8
movq (%r14), %rdi
callq 0x29d2d
movq %rax, %rbx
movsd 0x8(%r14), %xmm0
ucomisd %xmm0, %xmm0
jp 0x2b4b4
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x2b41c
pushq $0x1
popq %rax
jmp 0x2b49b
movsd 0x2e98c(%rip), %xmm1    # 0x59db0
ucomisd %xmm0, %xmm1
jbe 0x2b460
movq %rbx, %xmm1
punpckldq 0x25409(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x25411(%rip), %xmm1    # 0x50850
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
xorl %ecx, %ecx
ucomisd %xmm0, %xmm2
seta %cl
ucomisd %xmm2, %xmm0
pushq $-0x1
popq %rax
cmovbel %ecx, %eax
jmp 0x2b49b
ucomisd 0x2e960(%rip), %xmm0    # 0x59dc8
jbe 0x2b46e
pushq $-0x1
jmp 0x2b419
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x24c16(%rip), %xmm0    # 0x50098
cvttsd2si %xmm0, %rdx
andq %rcx, %rdx
orq %rax, %rdx
xorl %ecx, %ecx
cmpq %rdx, %rbx
seta %cl
pushq $-0x1
popq %rax
cmovael %ecx, %eax
cvtsi2sd %eax, %xmm0
popq %rbx
popq %r14
popq %rbp
jmp 0x4b471
leaq 0x2eb60(%rip), %rdi     # 0x5a00f
callq 0x177b1
movq %xmm0, %rdi
movq %rdi, %rax
shrq $0x2f, %rax
andl $0xf, %eax
je 0x2b49b
cmpl $0xe, %eax
jne 0x2b4e5
callq 0x4b1f1
movq -0x10(%rax), %rcx
cmpq 0x54aee(%rip), %rcx     # 0x7ffc8
je 0x2b4f8
cmpq 0x54aed(%rip), %rcx     # 0x7ffd0
je 0x2b503
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
popq %rbx
popq %r14
popq %rbp
jmp 0x4b313
cmpq (%rax), %rbx
ja 0x2b515
xorpd %xmm0, %xmm0
jmp 0x2b51d
movq (%rax), %rax
testq %rax, %rax
js 0x2b52c
testq %rbx, %rbx
js 0x2b52c
cmpq %rax, %rbx
jbe 0x2b4fd
movsd 0x24dfb(%rip), %xmm0    # 0x50318
jae 0x2b49f
movsd 0x24df9(%rip), %xmm0    # 0x50320
jmp 0x2b49f
movsd 0x24de4(%rip), %xmm0    # 0x50318
jmp 0x2b49f
nopl (%rax)