// File: /workspace/github_c_makefile_star2_O3/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
movl $0x2, %esi
callq 0x191f3
movq (%r14), %rdi
movq %rdi, %rax
shrq $0x2f, %rax
cmpl $0x1fffe, %eax          # imm = 0x1FFFE
jne 0x2dab6
callq 0x4ebc4
movq -0x10(%rax), %rax
cmpq 0x575da(%rip), %rax     # 0x84fc8
jne 0x2dab6
movq (%r14), %rdi
callq 0x2c122
movq %rax, %rbx
movsd 0x8(%r14), %xmm0
ucomisd %xmm0, %xmm0
jp 0x2dac2
movl $0x1, %eax
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
ja 0x2daa6
movsd 0x30386(%rip), %xmm1    # 0x5ddb0
ucomisd %xmm0, %xmm1
jbe 0x2da68
movq %rbx, %xmm1
punpckldq 0x26e03(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x26e0b(%rip), %xmm1    # 0x54850
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
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovbel %ecx, %eax
jmp 0x2daa6
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
ucomisd 0x30353(%rip), %xmm0    # 0x5ddc8
ja 0x2daa6
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x2660d(%rip), %xmm0    # 0x54098
cvttsd2si %xmm0, %rdx
andq %rcx, %rdx
orq %rax, %rdx
xorl %ecx, %ecx
cmpq %rdx, %rbx
seta %cl
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovael %ecx, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
popq %rbx
popq %r14
popq %rbp
jmp 0x4ee44
leaq 0x30552(%rip), %rdi     # 0x5e00f
callq 0x191a3
movq %xmm0, %rdi
movq %rdi, %rax
shrq $0x2f, %rax
andl $0xf, %eax
je 0x2daa6
cmpl $0xe, %eax
jne 0x2daf3
callq 0x4ebc4
movq -0x10(%rax), %rcx
cmpq 0x574e0(%rip), %rcx     # 0x84fc8
je 0x2db06
cmpq 0x574df(%rip), %rcx     # 0x84fd0
je 0x2db11
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
popq %rbx
popq %r14
popq %rbp
jmp 0x4ece6
cmpq (%rax), %rbx
ja 0x2db23
xorpd %xmm0, %xmm0
jmp 0x2db2b
movq (%rax), %rax
testq %rax, %rax
js 0x2db3a
testq %rbx, %rbx
js 0x2db3a
cmpq %rax, %rbx
jbe 0x2db0b
movsd 0x267ed(%rip), %xmm0    # 0x54318
jae 0x2daad
movsd 0x267eb(%rip), %xmm0    # 0x54320
jmp 0x2daad
movsd 0x267d6(%rip), %xmm0    # 0x54318
jmp 0x2daad
nop