// File: /workspace/github_c_makefile_star2_O1/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 0x192b3
movq (%r14), %rdi
movq %rdi, %rax
shrq $0x2f, %rax
cmpl $0x1fffe, %eax          # imm = 0x1FFFE
jne 0x2e0bd
callq 0x4f838
movq -0x10(%rax), %rax
cmpq 0x5807e(%rip), %rax     # 0x85fc8
jne 0x2e0bd
movq (%r14), %rdi
callq 0x2c5ee
movq %rax, %rbx
movsd 0x8(%r14), %xmm0
xorl %eax, %eax
ucomisd %xmm0, %xmm0
jp 0x2e0c9
cmpl $0xe, %eax
je 0x2dfdd
testl %eax, %eax
jne 0x2e08e
ucomisd %xmm0, %xmm0
jp 0x2e0d9
movl $0x1, %eax
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
ja 0x2e04c
movsd 0x30e11(%rip), %xmm1    # 0x5edb0
ucomisd %xmm0, %xmm1
jbe 0x2e00e
movq %rbx, %xmm1
punpckldq 0x2788e(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x27896(%rip), %xmm1    # 0x55850
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 0x2e04c
movq 0x8(%r14), %rdi
callq 0x4f838
movq -0x10(%rax), %rcx
cmpq 0x57fd7(%rip), %rcx     # 0x85fc8
je 0x2e003
cmpq 0x57fd6(%rip), %rcx     # 0x85fd0
je 0x2e05c
movb $0x1, %cl
jmp 0x2e08a
cmpq (%rax), %rbx
ja 0x2e071
xorpd %xmm0, %xmm0
jmp 0x2e079
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
ucomisd 0x30dad(%rip), %xmm0    # 0x5edc8
ja 0x2e04c
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x27067(%rip), %xmm0    # 0x55098
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 0x4fab8
movq (%rax), %rax
movq %rax, %rcx
orq %rbx, %rcx
jns 0x2e0a6
movsd 0x272a9(%rip), %xmm0    # 0x55318
jmp 0x2e083
movsd 0x2729f(%rip), %xmm0    # 0x55318
jae 0x2e083
movsd 0x2729d(%rip), %xmm0    # 0x55320
callq 0x4fab8
xorl %ecx, %ecx
testb %cl, %cl
je 0x2e0a1
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
popq %rbx
popq %r14
popq %rbp
jmp 0x4f95a
popq %rbx
popq %r14
popq %rbp
retq
cmpq %rax, %rbx
jg 0x2e0b1
xorpd %xmm0, %xmm0
jmp 0x2e0b9
movsd 0x2725f(%rip), %xmm0    # 0x55318
jl 0x2e07b
jmp 0x2e083
leaq 0x30f4b(%rip), %rdi     # 0x5f00f
callq 0x19263
movq 0x8(%r14), %rax
shrq $0x2f, %rax
andl $0xf, %eax
jmp 0x2df6d
xorl %eax, %eax
jmp 0x2e04c