// File: /workspace/github_c_makefile_star2_O1/janet-lang[P]janet/src/core/inttypes.c
// Function: cfun_it_s64_compare
static Janet cfun_it_s64_compare(int32_t argc, Janet *argv) {
    janet_fixarity(argc, 2);
    if (janet_is_int(argv[0]) != JANET_INT_S64) {
        janet_panic("compare method requires int/s64 as first argument");
    }
    int64_t x = janet_unwrap_s64(argv[0]);
    switch (janet_type(argv[1])) {
        default:
            break;
        case JANET_NUMBER : {
            double y = janet_unwrap_number(argv[1]);
            return janet_wrap_number(compare_int64_double(x, y));
        }
        case JANET_ABSTRACT: {
            void *abst = janet_unwrap_abstract(argv[1]);
            if (janet_abstract_type(abst) == &janet_s64_type) {
                int64_t y = *(int64_t *)abst;
                return janet_wrap_number((x < y) ? -1 : (x > y ? 1 : 0));
            } else if (janet_abstract_type(abst) == &janet_u64_type) {
                uint64_t y = *(uint64_t *)abst;
                if (x < 0) {
                    return janet_wrap_number(-1);
                } else if (y > INT64_MAX) {
                    return janet_wrap_number(-1);
                } else {
                    int64_t y2 = (int64_t) y;
                    return janet_wrap_number((x < y2) ? -1 : (x > y2 ? 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 0x2d673
callq 0x4f838
movq -0x10(%rax), %rax
cmpq 0x58a8c(%rip), %rax     # 0x85fd0
jne 0x2d673
movq (%r14), %rdi
callq 0x2c513
movq %rax, %rbx
movsd 0x8(%r14), %xmm0
xorl %eax, %eax
ucomisd %xmm0, %xmm0
jp 0x2d67f
cmpl $0xe, %eax
je 0x2d5b7
testl %eax, %eax
jne 0x2d65b
ucomisd %xmm0, %xmm0
jp 0x2d68f
movapd 0x3181a(%rip), %xmm1    # 0x5eda0
andpd %xmm0, %xmm1
movsd 0x3181e(%rip), %xmm2    # 0x5edb0
ucomisd %xmm1, %xmm2
jbe 0x2d5da
xorps %xmm1, %xmm1
cvtsi2sd %rbx, %xmm1
xorl %ecx, %ecx
ucomisd %xmm0, %xmm1
seta %cl
ucomisd %xmm1, %xmm0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovbel %ecx, %eax
jmp 0x2d611
movq 0x8(%r14), %rdi
callq 0x4f838
movq -0x10(%rax), %rcx
cmpq 0x58a05(%rip), %rcx     # 0x85fd0
je 0x2d621
cmpq 0x589f4(%rip), %rcx     # 0x85fc8
je 0x2d62e
movb $0x1, %cl
jmp 0x2d657
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
ucomisd 0x27ab1(%rip), %xmm0    # 0x55098
ja 0x2d611
movl $0x1, %eax
movsd 0x317ca(%rip), %xmm1    # 0x5edc0
ucomisd %xmm0, %xmm1
ja 0x2d611
cvttsd2si %xmm0, %rax
xorl %ecx, %ecx
cmpq %rax, %rbx
setg %cl
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovgel %ecx, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
popq %rbx
popq %r14
popq %rbp
jmp 0x4fab8
cmpq (%rax), %rbx
jg 0x2d63e
xorpd %xmm0, %xmm0
jl 0x2d648
jmp 0x2d650
movq (%rax), %rax
movq %rbx, %rcx
orq %rax, %rcx
js 0x2d648
cmpq %rax, %rbx
jle 0x2d626
movsd 0x27cd2(%rip), %xmm0    # 0x55318
jge 0x2d650
movsd 0x27cd0(%rip), %xmm0    # 0x55320
callq 0x4fab8
xorl %ecx, %ecx
testb %cl, %cl
je 0x2d66e
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
popq %rbx
popq %r14
popq %rbp
jmp 0x4f95a
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x31963(%rip), %rdi     # 0x5efdd
callq 0x19263
movq 0x8(%r14), %rax
shrq $0x2f, %rax
andl $0xf, %eax
jmp 0x2d567
xorl %eax, %eax
jmp 0x2d611