// File: /workspace/github_c_makefile_star2_O0/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
subq $0x60, %rsp
movl %edi, -0xc(%rbp)
movq %rsi, -0x18(%rbp)
movl -0xc(%rbp), %edi
movl $0x2, %esi
callq 0x1ae00
movq -0x18(%rbp), %rax
movq (%rax), %rdi
callq 0x3b7c0
cmpl $0x1, %eax
je 0x3cd29
leaq 0x4e2c9(%rip), %rdi     # 0x8afed
callq 0x1ad60
movq -0x18(%rbp), %rax
movq (%rax), %rdi
callq 0x3b4b0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movsd 0x8(%rax), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x3cd4f
jmp 0x3cd64
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
shrq $0x2f, %rax
andq $0xf, %rax
movl %eax, -0x4c(%rbp)
jmp 0x3cd6b
xorl %eax, %eax
movl %eax, -0x4c(%rbp)
jmp 0x3cd6b
movl -0x4c(%rbp), %eax
movl %eax, -0x50(%rbp)
testl %eax, %eax
je 0x3cd86
jmp 0x3cd77
movl -0x50(%rbp), %eax
subl $0xe, %eax
je 0x3cdb4
jmp 0x3cd81
jmp 0x3cecc
movq -0x18(%rbp), %rax
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x28(%rbp)
movq -0x20(%rbp), %rdi
movsd -0x28(%rbp), %xmm0
callq 0x3cef0
cvtsi2sd %eax, %xmm0
callq 0x7b820
movq %rax, -0x8(%rbp)
jmp 0x3cedf
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x7b260
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
leaq 0x6fe90(%rip), %rcx     # 0xacc60
cmpq %rcx, -0x10(%rax)
jne 0x3ce22
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x38(%rbp), %rax
jge 0x3cdf5
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x54(%rbp)
jmp 0x3ce0d
movq -0x20(%rbp), %rdx
movq -0x38(%rbp), %rsi
xorl %eax, %eax
movl $0x1, %ecx
cmpq %rsi, %rdx
cmovgl %ecx, %eax
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
cvtsi2sd %eax, %xmm0
callq 0x7b820
movq %rax, -0x8(%rbp)
jmp 0x3cedf
movq -0x30(%rbp), %rax
leaq 0x6fea3(%rip), %rcx     # 0xaccd0
cmpq %rcx, -0x10(%rax)
jne 0x3cec8
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x20(%rbp)
jge 0x3ce5f
movsd 0x444d7(%rip), %xmm0    # 0x81328
callq 0x7b820
movq %rax, -0x8(%rbp)
jmp 0x3cedf
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
cmpq %rax, -0x40(%rbp)
jbe 0x3ce82
movsd 0x444b1(%rip), %xmm0    # 0x81328
callq 0x7b820
movq %rax, -0x8(%rbp)
jmp 0x3cedf
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x48(%rbp), %rax
jge 0x3ce9e
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x58(%rbp)
jmp 0x3ceb6
movq -0x20(%rbp), %rdx
movq -0x48(%rbp), %rsi
xorl %eax, %eax
movl $0x1, %ecx
cmpq %rsi, %rdx
cmovgl %ecx, %eax
movl %eax, -0x58(%rbp)
movl -0x58(%rbp), %eax
cvtsi2sd %eax, %xmm0
callq 0x7b820
movq %rax, -0x8(%rbp)
jmp 0x3cedf
jmp 0x3ceca
jmp 0x3cecc
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
callq 0x7b460
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)