// File: /workspace/github_c_makefile_star2_O0/janet-lang[P]janet/src/core/value.c
// Function: janet_lengthv
Janet janet_lengthv(Janet x) {
    switch (janet_type(x)) {
        default:
            janet_panicf("expected %T, got %v", JANET_TFLAG_LENGTHABLE, x);
        case JANET_STRING:
        case JANET_SYMBOL:
        case JANET_KEYWORD:
            return janet_wrap_integer(janet_string_length(janet_unwrap_string(x)));
        case JANET_ARRAY:
            return janet_wrap_integer(janet_unwrap_array(x)->count);
        case JANET_BUFFER:
            return janet_wrap_integer(janet_unwrap_buffer(x)->count);
        case JANET_TUPLE:
            return janet_wrap_integer(janet_tuple_length(janet_unwrap_tuple(x)));
        case JANET_STRUCT:
            return janet_wrap_integer(janet_struct_length(janet_unwrap_struct(x)));
        case JANET_TABLE:
            return janet_wrap_integer(janet_unwrap_table(x)->count);
        case JANET_ABSTRACT: {
            void *abst = janet_unwrap_abstract(x);
            const JanetAbstractType *type = janet_abstract_type(abst);
            if (type->length != NULL) {
                size_t len = type->length(abst, janet_abstract_size(abst));
                /* If len is always less then double, we can never overflow */
#ifdef JANET_32
                return janet_wrap_number(len);
#else
                if (len < (size_t) JANET_INTMAX_INT64) {
                    return janet_wrap_number((double) len);
                } else {
                    janet_panicf("integer length %u too large", len);
                }
#endif
            }
            Janet argv[1] = { x };
            return janet_mcall("length", 1, argv);
        }
    }
}

// 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 0x701de
jmp 0x701ef
movq -0x10(%rbp), %rax
shrq $0x2f, %rax
andq $0xf, %rax
movl %eax, -0x34(%rbp)
jmp 0x701f6
xorl %eax, %eax
movl %eax, -0x34(%rbp)
jmp 0x701f6
movl -0x34(%rbp), %eax
addl $-0x4, %eax
movl %eax, %ecx
movq %rcx, -0x40(%rbp)
subl $0xa, %eax
ja 0x7021b
movq -0x40(%rbp), %rax
leaq 0x28a1e(%rip), %rcx     # 0x98c30
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rdx
leaq 0x10ec1(%rip), %rdi     # 0x810e7
movl $0xff0, %esi            # imm = 0xFF0
movb $0x0, %al
callq 0x1ac40
movq -0x10(%rbp), %rdi
callq 0x7b260
cvtsi2sdl -0x8(%rax), %xmm0
callq 0x7b820
movq %rax, -0x8(%rbp)
jmp 0x7038d
movq -0x10(%rbp), %rdi
callq 0x7b260
cvtsi2sdl 0x10(%rax), %xmm0
callq 0x7b820
movq %rax, -0x8(%rbp)
jmp 0x7038d
movq -0x10(%rbp), %rdi
callq 0x7b260
cvtsi2sdl 0x10(%rax), %xmm0
callq 0x7b820
movq %rax, -0x8(%rbp)
jmp 0x7038d
movq -0x10(%rbp), %rdi
callq 0x7b260
cvtsi2sdl -0x10(%rax), %xmm0
callq 0x7b820
movq %rax, -0x8(%rbp)
jmp 0x7038d
movq -0x10(%rbp), %rdi
callq 0x7b260
cvtsi2sdl -0x18(%rax), %xmm0
callq 0x7b820
movq %rax, -0x8(%rbp)
jmp 0x7038d
movq -0x10(%rbp), %rdi
callq 0x7b260
cvtsi2sdl 0x10(%rax), %xmm0
callq 0x7b820
movq %rax, -0x8(%rbp)
jmp 0x7038d
movq -0x10(%rbp), %rdi
callq 0x7b260
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x10(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x60(%rax)
je 0x7036c
movq -0x20(%rbp), %rax
movq 0x60(%rax), %rax
movq -0x18(%rbp), %rdi
movq -0x18(%rbp), %rcx
movq -0x8(%rcx), %rsi
callq *%rax
movq %rax, -0x28(%rbp)
movabsq $0x20000000000000, %rax # imm = 0x20000000000000
cmpq %rax, -0x28(%rbp)
jae 0x7035a
movaps 0x11551(%rip), %xmm1    # 0x81880
movq -0x28(%rbp), %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x11550(%rip), %xmm1    # 0x81890
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
callq 0x7b820
movq %rax, -0x8(%rbp)
jmp 0x7038d
movq -0x28(%rbp), %rsi
leaq 0x289e7(%rip), %rdi     # 0x98d4c
movb $0x0, %al
callq 0x1ac40
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
leaq -0x30(%rbp), %rdx
leaq 0x24f6b(%rip), %rdi     # 0x952ea
movl $0x1, %esi
callq 0x7a510
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)