// File: /workspace/github_c_makefile_star2_O0/janet-lang[P]janet/src/core/value.c
// Function: janet_get
Janet janet_get(Janet ds, Janet key) {
    JanetType t = janet_type(ds);
    switch (t) {
        default:
            return janet_wrap_nil();
        case JANET_STRING:
        case JANET_SYMBOL:
        case JANET_KEYWORD: {
            if (!janet_checkint(key)) return janet_wrap_nil();
            int32_t index = janet_unwrap_integer(key);
            if (index < 0) return janet_wrap_nil();
            const uint8_t *str = janet_unwrap_string(ds);
            if (index >= janet_string_length(str)) return janet_wrap_nil();
            return janet_wrap_integer(str[index]);
        }
        case JANET_ABSTRACT: {
            Janet value;
            void *abst = janet_unwrap_abstract(ds);
            JanetAbstractType *type = (JanetAbstractType *)janet_abstract_type(abst);
            if (!type->get) return janet_wrap_nil();
            if ((type->get)(abst, key, &value))
                return value;
            return janet_wrap_nil();
        }
        case JANET_ARRAY:
        case JANET_TUPLE:
        case JANET_BUFFER: {
            if (!janet_checkint(key)) return janet_wrap_nil();
            int32_t index = janet_unwrap_integer(key);
            if (index < 0) return janet_wrap_nil();
            if (t == JANET_ARRAY) {
                JanetArray *a = janet_unwrap_array(ds);
                if (index >= a->count) return janet_wrap_nil();
                return a->data[index];
            } else if (t == JANET_BUFFER) {
                JanetBuffer *b = janet_unwrap_buffer(ds);
                if (index >= b->count) return janet_wrap_nil();
                return janet_wrap_integer(b->data[index]);
            } else {
                const Janet *t = janet_unwrap_tuple(ds);
                if (index >= janet_tuple_length(t)) return janet_wrap_nil();
                return t[index];
            }
        }
        case JANET_TABLE: {
            return janet_table_get(janet_unwrap_table(ds), key);
        }
        case JANET_STRUCT: {
            const JanetKV *st = janet_unwrap_struct(ds);
            return janet_struct_get(st, key);
        }
        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 {
                return janet_wrap_nil();
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movsd -0x10(%rbp), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x6f965
jmp 0x6f976
movq -0x10(%rbp), %rax
shrq $0x2f, %rax
andq $0xf, %rax
movl %eax, -0x74(%rbp)
jmp 0x6f97d
xorl %eax, %eax
movl %eax, -0x74(%rbp)
jmp 0x6f97d
movl -0x74(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
addl $-0x3, %eax
movl %eax, %ecx
movq %rcx, -0x80(%rbp)
subl $0xb, %eax
ja 0x6f9a8
movq -0x80(%rbp), %rax
leaq 0x29205(%rip), %rcx     # 0x98ba4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
callq 0x7b460
movq %rax, -0x8(%rbp)
jmp 0x6fc8e
movq -0x18(%rbp), %rdi
callq 0x6d480
cmpl $0x0, %eax
jne 0x6f9e6
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
callq 0x7b460
movq %rax, -0x8(%rbp)
jmp 0x6fc8e
cvttsd2si -0x18(%rbp), %eax
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x20(%rbp)
jge 0x6fa0c
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
callq 0x7b460
movq %rax, -0x8(%rbp)
jmp 0x6fc8e
movq -0x10(%rbp), %rdi
callq 0x7b260
movq %rax, -0x28(%rbp)
movl -0x20(%rbp), %eax
movq -0x28(%rbp), %rcx
cmpl -0x8(%rcx), %eax
jl 0x6fa3d
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
callq 0x7b460
movq %rax, -0x8(%rbp)
jmp 0x6fc8e
movq -0x28(%rbp), %rax
movslq -0x20(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cvtsi2sd %eax, %xmm0
callq 0x7b820
movq %rax, -0x8(%rbp)
jmp 0x6fc8e
movq -0x10(%rbp), %rdi
callq 0x7b260
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq -0x10(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x6fa97
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
callq 0x7b460
movq %rax, -0x8(%rbp)
jmp 0x6fc8e
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq *%rax
cmpl $0x0, %eax
je 0x6fabf
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6fc8e
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
callq 0x7b460
movq %rax, -0x8(%rbp)
jmp 0x6fc8e
movq -0x18(%rbp), %rdi
callq 0x6d480
cmpl $0x0, %eax
jne 0x6fafd
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
callq 0x7b460
movq %rax, -0x8(%rbp)
jmp 0x6fc8e
cvttsd2si -0x18(%rbp), %eax
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
jge 0x6fb23
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
callq 0x7b460
movq %rax, -0x8(%rbp)
jmp 0x6fc8e
cmpl $0x7, -0x1c(%rbp)
jne 0x6fb73
movq -0x10(%rbp), %rdi
callq 0x7b260
movq %rax, -0x50(%rbp)
movl -0x44(%rbp), %eax
movq -0x50(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jl 0x6fb5a
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
callq 0x7b460
movq %rax, -0x8(%rbp)
jmp 0x6fc8e
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x44(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x8(%rbp)
jmp 0x6fc8e
cmpl $0xb, -0x1c(%rbp)
jne 0x6fbcc
movq -0x10(%rbp), %rdi
callq 0x7b260
movq %rax, -0x58(%rbp)
movl -0x44(%rbp), %eax
movq -0x58(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jl 0x6fbaa
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
callq 0x7b460
movq %rax, -0x8(%rbp)
jmp 0x6fc8e
movq -0x58(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x44(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cvtsi2sd %eax, %xmm0
callq 0x7b820
movq %rax, -0x8(%rbp)
jmp 0x6fc8e
movq -0x10(%rbp), %rdi
callq 0x7b260
movq %rax, -0x60(%rbp)
movl -0x44(%rbp), %eax
movq -0x60(%rbp), %rcx
cmpl -0x10(%rcx), %eax
jl 0x6fbfd
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
callq 0x7b460
movq %rax, -0x8(%rbp)
jmp 0x6fc8e
movq -0x60(%rbp), %rax
movslq -0x44(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x8(%rbp)
jmp 0x6fc8e
movq -0x10(%rbp), %rdi
callq 0x7b260
movq %rax, %rdi
movq -0x18(%rbp), %rsi
callq 0x69420
movq %rax, -0x8(%rbp)
jmp 0x6fc8e
movq -0x10(%rbp), %rdi
callq 0x7b260
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x67ed0
movq %rax, -0x8(%rbp)
jmp 0x6fc8e
xorps %xmm0, %xmm0
callq 0x7b820
movq %rax, -0x70(%rbp)
movq -0x18(%rbp), %rdi
movq -0x70(%rbp), %rsi
callq 0x6e560
cmpl $0x0, %eax
je 0x6fc7b
movq -0x10(%rbp), %rdi
callq 0x7b260
movq 0x40(%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0x6fc8e
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
callq 0x7b460
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax,%rax)