// File: /workspace/github_c_makefile_star2_O2/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 0x4708f
movq %rsi, %rbx
leaq 0x2086e(%rip), %rcx     # 0x677a4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r14, %rdi
callq 0x4b1f1
movq %rax, %r14
movl -0x8(%rax), %edx
movl %r15d, %edi
movq %rbx, %rsi
callq 0x470c2
movl %eax, %eax
movzbl (%r14,%rax), %eax
jmp 0x4702a
movq %r14, %rdi
callq 0x4b1f1
movq %rax, %rdi
movq %rbx, %rsi
callq 0x430d3
jmp 0x47033
movq %r14, %rdi
callq 0x4b1f1
movq %rax, %r14
movl 0x10(%rax), %edx
pushq $0x7
popq %rdi
movq %rbx, %rsi
callq 0x470c2
movq 0x18(%r14), %rcx
movl %eax, %eax
movq (%rcx,%rax,8), %rax
jmp 0x47033
xorpd %xmm0, %xmm0
callq 0x4b471
movq %rbx, %rdi
movq %rax, %rsi
callq 0x466c8
testl %eax, %eax
je 0x470a5
movq %r14, %rdi
callq 0x4b1f1
movq %rax, %r15
addq $0x40, %r15
jmp 0x4703a
movq %r14, %rdi
callq 0x4b1f1
movq %rax, %rdi
movq %rbx, %rsi
callq 0x43c35
jmp 0x47033
movq %r14, %rdi
callq 0x4b1f1
movq %rax, %r14
movl -0x10(%rax), %edx
pushq $0x8
popq %rdi
movq %rbx, %rsi
callq 0x470c2
movl %eax, %eax
movq (%r14,%rax,8), %rax
jmp 0x47033
movq %r14, %rdi
callq 0x4b1f1
movq %rax, %r14
movl 0x10(%rax), %edx
pushq $0xb
popq %rdi
movq %rbx, %rsi
callq 0x470c2
movq 0x18(%r14), %rcx
movl %eax, %eax
movzbl (%rcx,%rax), %eax
cvtsi2sd %eax, %xmm0
callq 0x4b471
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 0x4b1f1
movq -0x10(%rax), %rax
movq 0x18(%rax), %r12
testq %r12, %r12
je 0x470b1
movq %r14, %rdi
callq 0x4b1f1
leaq -0x28(%rbp), %r15
movq %rax, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq *%r12
testl %eax, %eax
jne 0x4703a
leaq 0x20895(%rip), %rdi     # 0x67917
movq %rbx, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x176c9
leaq 0x9051(%rip), %rdi      # 0x500e7
movl $0xff0, %esi            # imm = 0xFF0
movq %r14, %rdx
xorl %eax, %eax
callq 0x176c9
leaq 0x20895(%rip), %rdi     # 0x67941
movq %rbx, %rsi
jmp 0x470bb
leaq 0x20877(%rip), %rdi     # 0x6792f
movq %r14, %rsi
xorl %eax, %eax
callq 0x176c9