// File: /workspace/github_c_makefile_star2_O0/janet-lang[P]janet/src/core/inttypes.c
// Function: janet_unwrap_u64
uint64_t janet_unwrap_u64(Janet x) {
    switch (janet_type(x)) {
        default:
            break;
        case JANET_NUMBER : {
            double d = janet_unwrap_number(x);
            if (!janet_checkuint64range(d)) break;
            return (uint64_t) d;
        }
        case JANET_STRING: {
            uint64_t value;
            const uint8_t *str = janet_unwrap_string(x);
            if (janet_scan_uint64(str, janet_string_length(str), &value))
                return value;
            break;
        }
        case JANET_ABSTRACT: {
            void *abst = janet_unwrap_abstract(x);
            if (janet_abstract_type(abst) == &janet_s64_type ||
                    (janet_abstract_type(abst) == &janet_u64_type))
                return *(uint64_t *)abst;
            break;
        }
    }
    janet_panicf("can not convert %t %q to a 64 bit unsigned integer", x, x);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movsd -0x10(%rbp), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x3b61e
jmp 0x3b62f
movq -0x10(%rbp), %rax
shrq $0x2f, %rax
andq $0xf, %rax
movl %eax, -0x34(%rbp)
jmp 0x3b636
xorl %eax, %eax
movl %eax, -0x34(%rbp)
jmp 0x3b636
movl -0x34(%rbp), %eax
movl %eax, -0x38(%rbp)
testl %eax, %eax
je 0x3b663
jmp 0x3b642
movl -0x38(%rbp), %eax
subl $0x4, %eax
je 0x3b722
jmp 0x3b650
movl -0x38(%rbp), %eax
subl $0xe, %eax
je 0x3b754
jmp 0x3b65e
jmp 0x3b792
movsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x18(%rbp)
movsd -0x18(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x3b6e9
movsd 0x4f745(%rip), %xmm0    # 0x8adc8
ucomisd -0x18(%rbp), %xmm0
jb 0x3b6e9
movsd -0x18(%rbp), %xmm0
movsd 0x45a01(%rip), %xmm2    # 0x81098
movaps %xmm0, %xmm1
subsd %xmm2, %xmm1
cvttsd2si %xmm1, %rcx
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
andq %rdx, %rcx
orq %rcx, %rax
movq %rax, %xmm1
movaps 0x461bc(%rip), %xmm2    # 0x81880
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x461c0(%rip), %xmm2    # 0x81890
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jne 0x3b6e9
jp 0x3b6e9
jmp 0x3b6ee
jmp 0x3b792
movsd -0x18(%rbp), %xmm0
movsd 0x4599d(%rip), %xmm2    # 0x81098
movaps %xmm0, %xmm1
subsd %xmm2, %xmm1
cvttsd2si %xmm1, %rcx
cvttsd2si %xmm0, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
andq %rdx, %rcx
orq %rcx, %rax
movq %rax, -0x8(%rbp)
jmp 0x3b7a8
movq -0x10(%rbp), %rdi
callq 0x7b260
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
movq -0x28(%rbp), %rax
movl -0x8(%rax), %esi
leaq -0x20(%rbp), %rdx
callq 0x66fe0
cmpl $0x0, %eax
je 0x3b752
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x3b7a8
jmp 0x3b792
movq -0x10(%rbp), %rdi
callq 0x7b260
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
leaq 0x714f4(%rip), %rcx     # 0xacc60
cmpq %rcx, -0x10(%rax)
je 0x3b783
movq -0x30(%rbp), %rax
leaq 0x71553(%rip), %rcx     # 0xaccd0
cmpq %rcx, -0x10(%rax)
jne 0x3b790
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0x3b7a8
jmp 0x3b792
movq -0x10(%rbp), %rsi
movq -0x10(%rbp), %rdx
leaq 0x4f680(%rip), %rdi     # 0x8ae21
movb $0x0, %al
callq 0x1ac40
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)