// File: /workspace/github_c_makefile_star2_O3/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 0x191f3
movq (%r14), %rdi
movq %rdi, %rax
shrq $0x2f, %rax
cmpl $0x1fffe, %eax          # imm = 0x1FFFE
jne 0x2d107
callq 0x4ebc4
movq -0x10(%rax), %rax
cmpq 0x57f6a(%rip), %rax     # 0x84fd0
jne 0x2d107
movq (%r14), %rdi
callq 0x2c05b
movq %rax, %rbx
movsd 0x8(%r14), %xmm0
ucomisd %xmm0, %xmm0
jp 0x2d113
movapd 0x30d11(%rip), %xmm1    # 0x5dda0
andpd %xmm0, %xmm1
movsd 0x30d15(%rip), %xmm2    # 0x5ddb0
ucomisd %xmm1, %xmm2
jbe 0x2d0c0
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 0x2d0f7
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
ucomisd 0x26fcb(%rip), %xmm0    # 0x54098
ja 0x2d0f7
movl $0x1, %eax
movsd 0x30ce4(%rip), %xmm1    # 0x5ddc0
ucomisd %xmm0, %xmm1
ja 0x2d0f7
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 0x4ee44
leaq 0x30ecf(%rip), %rdi     # 0x5dfdd
callq 0x191a3
movq %xmm0, %rdi
movq %rdi, %rax
shrq $0x2f, %rax
andl $0xf, %eax
je 0x2d0f7
cmpl $0xe, %eax
jne 0x2d144
callq 0x4ebc4
movq -0x10(%rax), %rcx
cmpq 0x57e97(%rip), %rcx     # 0x84fd0
je 0x2d157
cmpq 0x57e86(%rip), %rcx     # 0x84fc8
je 0x2d162
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
popq %rbx
popq %r14
popq %rbp
jmp 0x4ece6
cmpq (%rax), %rbx
jg 0x2d17a
xorpd %xmm0, %xmm0
jmp 0x2d182
testq %rbx, %rbx
js 0x2d188
movq (%rax), %rax
testq %rax, %rax
js 0x2d188
cmpq %rax, %rbx
ja 0x2d195
xorpd %xmm0, %xmm0
jmp 0x2d19d
movsd 0x27196(%rip), %xmm0    # 0x54318
jge 0x2d0fe
movsd 0x27190(%rip), %xmm0    # 0x54320
jmp 0x2d0fe
movsd 0x2717b(%rip), %xmm0    # 0x54318
jae 0x2d0fe
jmp 0x2d188