// File: /workspace/github_c_makefile_star2_O0/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
subq $0xc0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movsd -0x10(%rbp), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x6f615
jmp 0x6f629
movq -0x10(%rbp), %rax
shrq $0x2f, %rax
andq $0xf, %rax
movl %eax, -0x9c(%rbp)
jmp 0x6f633
xorl %eax, %eax
movl %eax, -0x9c(%rbp)
jmp 0x6f633
movl -0x9c(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
addl $-0x3, %eax
movl %eax, %ecx
movq %rcx, -0xa8(%rbp)
subl $0xb, %eax
ja 0x6f667
movq -0xa8(%rbp), %rax
leaq 0x29516(%rip), %rcx     # 0x98b74
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rdx
leaq 0x11a75(%rip), %rdi     # 0x810e7
movl $0xff0, %esi            # imm = 0xFF0
movb $0x0, %al
callq 0x1ac40
movq -0x10(%rbp), %rdi
callq 0x7b260
movq %rax, %rdi
movq -0x18(%rbp), %rsi
callq 0x67ed0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x6f8b7
movq -0x10(%rbp), %rdi
callq 0x7b260
movq %rax, %rdi
movq -0x18(%rbp), %rsi
callq 0x69420
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x6f8b7
movq -0x10(%rbp), %rdi
callq 0x7b260
movq %rax, -0x40(%rbp)
movl -0x24(%rbp), %edi
movq -0x40(%rbp), %rax
movl 0x10(%rax), %edx
movq -0x18(%rbp), %rsi
callq 0x6f8d0
movl %eax, -0x44(%rbp)
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x44(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
jmp 0x6f8b7
movq -0x10(%rbp), %rdi
callq 0x7b260
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movl -0x10(%rax), %eax
movl %eax, -0x54(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0xb0(%rbp)
movl -0x24(%rbp), %edi
movl -0x54(%rbp), %edx
movq -0x18(%rbp), %rsi
callq 0x6f8d0
movl %eax, %ecx
movq -0xb0(%rbp), %rax
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
jmp 0x6f8b7
movq -0x10(%rbp), %rdi
callq 0x7b260
movq %rax, -0x60(%rbp)
movl -0x24(%rbp), %edi
movq -0x60(%rbp), %rax
movl 0x10(%rax), %edx
movq -0x18(%rbp), %rsi
callq 0x6f8d0
movl %eax, -0x64(%rbp)
movq -0x60(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x64(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cvtsi2sd %eax, %xmm0
callq 0x7b820
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x6f8b7
movq -0x10(%rbp), %rdi
callq 0x7b260
movq %rax, -0x78(%rbp)
movl -0x24(%rbp), %edi
movq -0x78(%rbp), %rax
movl -0x8(%rax), %edx
movq -0x18(%rbp), %rsi
callq 0x6f8d0
movl %eax, -0x7c(%rbp)
movq -0x78(%rbp), %rax
movslq -0x7c(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cvtsi2sd %eax, %xmm0
callq 0x7b820
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x6f8b7
movq -0x10(%rbp), %rdi
callq 0x7b260
movq -0x10(%rax), %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x6f85a
movq -0x90(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0xb8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x7b260
movq %rax, %rdi
movq -0xb8(%rbp), %rax
movq -0x18(%rbp), %rsi
leaq -0x20(%rbp), %rdx
callq *%rax
cmpl $0x0, %eax
jne 0x6f858
movq -0x18(%rbp), %rsi
movq -0x10(%rbp), %rdx
leaq 0x2946a(%rip), %rdi     # 0x98cbb
movb $0x0, %al
callq 0x1ac40
jmp 0x6f86c
movq -0x10(%rbp), %rsi
leaq 0x2946e(%rip), %rdi     # 0x98cd3
movb $0x0, %al
callq 0x1ac40
jmp 0x6f8b7
xorps %xmm0, %xmm0
callq 0x7b820
movq %rax, -0x98(%rbp)
movq -0x18(%rbp), %rdi
movq -0x98(%rbp), %rsi
callq 0x6e560
cmpl $0x0, %eax
je 0x6f8a5
movq -0x10(%rbp), %rdi
callq 0x7b260
movq 0x40(%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0x6f8bf
movq -0x18(%rbp), %rsi
leaq 0x29435(%rip), %rdi     # 0x98ce5
movb $0x0, %al
callq 0x1ac40
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xc0, %rsp
popq %rbp
retq
nopl (%rax)