// File: /workspace/github_c_makefile_star2_O2/janet-lang[P]janet/src/core/value.c
// Function: janet_next_impl
Janet janet_next_impl(Janet ds, Janet key, int is_interpreter) {
    JanetType t = janet_type(ds);
    switch (t) {
        default:
            janet_panicf("expected iterable type, got %v", ds);
        case JANET_TABLE:
        case JANET_STRUCT: {
            const JanetKV *start;
            int32_t cap;
            if (t == JANET_TABLE) {
                JanetTable *tab = janet_unwrap_table(ds);
                cap = tab->capacity;
                start = tab->data;
            } else {
                JanetStruct st = janet_unwrap_struct(ds);
                cap = janet_struct_capacity(st);
                start = st;
            }
            const JanetKV *end = start + cap;
            const JanetKV *kv = janet_checktype(key, JANET_NIL)
                                ? start
                                : janet_dict_find(start, cap, key) + 1;
            while (kv < end) {
                if (!janet_checktype(kv->key, JANET_NIL)) return kv->key;
                kv++;
            }
            break;
        }
        case JANET_STRING:
        case JANET_KEYWORD:
        case JANET_SYMBOL:
        case JANET_BUFFER:
        case JANET_ARRAY:
        case JANET_TUPLE: {
            int32_t i;
            if (janet_checktype(key, JANET_NIL)) {
                i = 0;
            } else if (janet_checkint(key)) {
                i = janet_unwrap_integer(key) + 1;
            } else {
                break;
            }
            int32_t len;
            if (t == JANET_BUFFER) {
                len = janet_unwrap_buffer(ds)->count;
            } else if (t == JANET_ARRAY) {
                len = janet_unwrap_array(ds)->count;
            } else if (t == JANET_TUPLE) {
                len = janet_tuple_length(janet_unwrap_tuple(ds));
            } else {
                len = janet_string_length(janet_unwrap_string(ds));
            }
            if (i < len && i >= 0) {
                return janet_wrap_integer(i);
            }
            break;
        }
        case JANET_ABSTRACT: {
            JanetAbstract abst = janet_unwrap_abstract(ds);
            const JanetAbstractType *at = janet_abstract_type(abst);
            if (NULL == at->next) break;
            return at->next(abst, key);
        }
        case JANET_FIBER: {
            JanetFiber *child = janet_unwrap_fiber(ds);
            Janet retreg;
            JanetFiberStatus status = janet_fiber_status(child);
            if (status == JANET_STATUS_ALIVE ||
                    status == JANET_STATUS_DEAD ||
                    status == JANET_STATUS_ERROR ||
                    status == JANET_STATUS_USER0 ||
                    status == JANET_STATUS_USER1 ||
                    status == JANET_STATUS_USER2 ||
                    status == JANET_STATUS_USER3 ||
                    status == JANET_STATUS_USER4) {
                return janet_wrap_nil();
            }
            janet_vm.fiber->child = child;
            JanetSignal sig = janet_continue(child, janet_wrap_nil(), &retreg);
            if (sig != JANET_SIGNAL_OK && !(child->flags & (1 << sig))) {
                if (is_interpreter) {
                    janet_signalv(sig, retreg);
                } else {
                    janet_vm.fiber->child = NULL;
                    janet_panicv(retreg);
                }
            }
            janet_vm.fiber->child = NULL;
            if (sig == JANET_SIGNAL_OK ||
                    sig == JANET_SIGNAL_ERROR ||
                    sig == JANET_SIGNAL_USER0 ||
                    sig == JANET_SIGNAL_USER1 ||
                    sig == JANET_SIGNAL_USER2 ||
                    sig == JANET_SIGNAL_USER3 ||
                    sig == JANET_SIGNAL_USER4) {
                /* Fiber cannot be resumed, so discard last value. */
                return janet_wrap_nil();
            } else {
                return janet_wrap_integer(0);
            }
        }
    }
    return janet_wrap_nil();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r12
movq %rdi, %xmm0
movq %rdi, %rax
shrq $0x2f, %rax
andl $0xf, %eax
xorl %r13d, %r13d
ucomisd %xmm0, %xmm0
cmovpl %eax, %r13d
leal -0x3(%r13), %eax
cmpl $0xb, %eax
ja 0x46694
movq %rsi, %r14
movabsq $-0x77fffffffffff, %rbx # imm = 0xFFF8800000000001
leaq 0x2124c(%rip), %rcx     # 0x676c0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movabsq $-0x800000000000, %rax  # imm = 0xFFFF800000000000
andq %r14, %rax
leaq -0x1(%rbx), %rcx
xorl %r15d, %r15d
cmpq %rcx, %rax
je 0x464b3
movq %r14, %rdi
callq 0x45e2b
testl %eax, %eax
je 0x46605
movq %r14, %xmm0
cvttsd2si %xmm0, %r15d
incl %r15d
movq %r12, %rdi
callq 0x4b1f1
addl $-0x7, %r13d
cmpl $0x4, %r13d
ja 0x464d5
movl %r13d, %ecx
leaq 0x21401(%rip), %rdx     # 0x678d0
movq (%rdx,%rcx,8), %rcx
jmp 0x464d8
pushq $-0x8
popq %rcx
testl %r15d, %r15d
js 0x46605
cmpl (%rax,%rcx), %r15d
jge 0x46605
cvtsi2sd %r15d, %xmm0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4b471
movq %r12, %rdi
callq 0x4b1f1
movq %rax, %r15
addq $-0x10, %rax
jmp 0x46590
movl %edx, %r15d
movq %r12, %rdi
callq 0x4b1f1
movq %rax, %r14
movq %rax, %rdi
callq 0x27553
cmpl $0xf, %eax
ja 0x4661b
movl $0x81f3, %ecx           # imm = 0x81F3
btl %eax, %ecx
jae 0x4661b
movq %rbx, %rdi
callq 0x4b313
movq %rax, %rcx
jmp 0x465f3
movq %r12, %rdi
callq 0x4b1f1
movq -0x10(%rax), %rcx
movq 0x50(%rcx), %rcx
testq %rcx, %rcx
je 0x46605
movq %rax, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rcx
movq %r12, %rdi
callq 0x4b1f1
movq 0x20(%rax), %r15
addq $0x14, %rax
movabsq $-0x800000000000, %r12  # imm = 0xFFFF800000000000
movslq (%rax), %rsi
movq %rsi, %rbx
shlq $0x4, %rbx
movq %r14, %rcx
andq %r12, %rcx
movabsq $-0x77fffffffffff, %rax # imm = 0xFFF8800000000001
leaq -0x1(%rax), %r13
movq %r15, %rax
cmpq %r13, %rcx
je 0x465cf
movq %r15, %rdi
movq %r14, %rdx
callq 0x44af3
addq $0x10, %rax
addq %rbx, %r15
movabsq $-0x77fffffffffff, %rbx # imm = 0xFFF8800000000001
cmpq %r15, %rax
jae 0x46605
movq (%rax), %rcx
movq %rcx, %rdx
andq %r12, %rdx
addq $0x10, %rax
cmpq %r13, %rdx
je 0x465dc
movq %rcx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4b313
movq %fs:0x0, %rax
leaq -0x348(%rax), %rax
movq %rax, %r12
movq 0x20(%rax), %rax
movq %r14, 0x38(%rax)
movq %rbx, %rdi
callq 0x4b313
leaq -0x30(%rbp), %rdx
movq %r14, %rdi
movq %rax, %rsi
callq 0x47bb8
testl %eax, %eax
je 0x46685
movl 0x10(%r14), %ecx
btl %eax, %ecx
jae 0x466a5
movq 0x20(%r12), %rcx
andq $0x0, 0x38(%rcx)
cmpl $0x8, %eax
ja 0x46677
movl $0x1f2, %ecx            # imm = 0x1F2
btl %eax, %ecx
jb 0x46541
xorpd %xmm0, %xmm0
callq 0x4b471
jmp 0x46549
movq 0x20(%r12), %rax
andq $0x0, 0x38(%rax)
jmp 0x46541
leaq 0x2125d(%rip), %rdi     # 0x678f8
movq %r12, %rsi
xorl %eax, %eax
callq 0x176c9
testl %r15d, %r15d
jne 0x466bd
movq 0x20(%r12), %rax
andq $0x0, 0x38(%rax)
movq -0x30(%rbp), %rdi
callq 0x176ba
movq -0x30(%rbp), %rsi
movl %eax, %edi
callq 0x175d0