// File: /workspace/github_c_makefile_star2_O3/janet-lang[P]janet/src/core/value.c
// Function: janet_in
Janet janet_in(Janet ds, Janet key) {
    Janet value;
    JanetType type = janet_type(ds);
    switch (type) {
        default:
            janet_panicf("expected %T, got %v", JANET_TFLAG_LENGTHABLE, ds);
            break;
        case JANET_STRUCT:
            value = janet_struct_get(janet_unwrap_struct(ds), key);
            break;
        case JANET_TABLE:
            value = janet_table_get(janet_unwrap_table(ds), key);
            break;
        case JANET_ARRAY: {
            JanetArray *array = janet_unwrap_array(ds);
            int32_t index = getter_checkint(type, key, array->count);
            value = array->data[index];
            break;
        }
        case JANET_TUPLE: {
            const Janet *tuple = janet_unwrap_tuple(ds);
            int32_t len = janet_tuple_length(tuple);
            value = tuple[getter_checkint(type, key, len)];
            break;
        }
        case JANET_BUFFER: {
            JanetBuffer *buffer = janet_unwrap_buffer(ds);
            int32_t index = getter_checkint(type, key, buffer->count);
            value = janet_wrap_integer(buffer->data[index]);
            break;
        }
        case JANET_STRING:
        case JANET_SYMBOL:
        case JANET_KEYWORD: {
            const uint8_t *str = janet_unwrap_string(ds);
            int32_t index = getter_checkint(type, key, janet_string_length(str));
            value = janet_wrap_integer(str[index]);
            break;
        }
        case JANET_ABSTRACT: {
            JanetAbstractType *type = (JanetAbstractType *)janet_abstract_type(janet_unwrap_abstract(ds));
            if (type->get) {
                if (!(type->get)(janet_unwrap_abstract(ds), key, &value))
                    janet_panicf("key %v not found in %v ", key, ds);
            } else {
                janet_panicf("no getter for %v ", ds);
            }
            break;
        }
        case JANET_FIBER: {
            /* Bit of a hack to allow iterating over fibers. */
            if (janet_equals(key, janet_wrap_integer(0))) {
                return janet_unwrap_fiber(ds)->last_value;
            } else {
                janet_panicf("expected key 0, got %v", key);
            }
        }
    }
    return value;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %r14
movq %rdi, %xmm0
movq %rdi, %rax
shrq $0x2f, %rax
andl $0xf, %eax
xorl %r15d, %r15d
ucomisd %xmm0, %xmm0
cmovpl %eax, %r15d
leal -0x3(%r15), %eax
cmpl $0xb, %eax
ja 0x4aba9
movq %rsi, %rbx
leaq 0x20d3d(%rip), %rcx     # 0x6b784
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r14, %rdi
callq 0x4ebc4
movq %rax, %r14
movl -0x8(%rax), %edx
movl %r15d, %edi
movq %rbx, %rsi
callq 0x4abdc
movl %eax, %eax
movzbl (%r14,%rax), %eax
jmp 0x4ab41
movq %r14, %rdi
callq 0x4ebc4
movq %rax, %rdi
movq %rbx, %rsi
callq 0x46988
jmp 0x4ab4d
movq %r14, %rdi
callq 0x4ebc4
movq %rax, %r14
movl 0x10(%rax), %edx
movl $0x7, %edi
movq %rbx, %rsi
callq 0x4abdc
movq 0x18(%r14), %rcx
movl %eax, %eax
movq (%rcx,%rax,8), %rax
jmp 0x4ab4d
xorpd %xmm0, %xmm0
callq 0x4ee44
movq %rbx, %rdi
movq %rax, %rsi
callq 0x4a1bd
testl %eax, %eax
je 0x4abbf
movq %r14, %rdi
callq 0x4ebc4
movq %rax, %r15
addq $0x40, %r15
jmp 0x4ab54
movq %r14, %rdi
callq 0x4ebc4
movq %rax, %rdi
movq %rbx, %rsi
callq 0x474e0
jmp 0x4ab4d
movq %r14, %rdi
callq 0x4ebc4
movq %rax, %r14
movl -0x10(%rax), %edx
movl $0x8, %edi
movq %rbx, %rsi
callq 0x4abdc
movl %eax, %eax
movq (%r14,%rax,8), %rax
jmp 0x4ab4d
movq %r14, %rdi
callq 0x4ebc4
movq %rax, %r14
movl 0x10(%rax), %edx
movl $0xb, %edi
movq %rbx, %rsi
callq 0x4abdc
movq 0x18(%r14), %rcx
movl %eax, %eax
movzbl (%rcx,%rax), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
callq 0x4ee44
leaq -0x28(%rbp), %r15
movq %rax, (%r15)
movq (%r15), %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
callq 0x4ebc4
movq -0x10(%rax), %rax
movq 0x18(%rax), %r12
testq %r12, %r12
je 0x4abcb
movq %r14, %rdi
callq 0x4ebc4
leaq -0x28(%rbp), %r15
movq %rax, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq *%r12
testl %eax, %eax
jne 0x4ab54
leaq 0x20d5b(%rip), %rdi     # 0x6b8f7
movq %rbx, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x190bb
leaq 0x9537(%rip), %rdi      # 0x540e7
movl $0xff0, %esi            # imm = 0xFF0
movq %r14, %rdx
xorl %eax, %eax
callq 0x190bb
leaq 0x20d5b(%rip), %rdi     # 0x6b921
movq %rbx, %rsi
jmp 0x4abd5
leaq 0x20d3d(%rip), %rdi     # 0x6b90f
movq %r14, %rsi
xorl %eax, %eax
callq 0x190bb