// File: /workspace/github_c_makefile_star2_O0/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
subq $0xb0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movsd -0x10(%rbp), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x6e0b8
jmp 0x6e0cc
movq -0x10(%rbp), %rax
shrq $0x2f, %rax
andq $0xf, %rax
movl %eax, -0x8c(%rbp)
jmp 0x6e0d6
xorl %eax, %eax
movl %eax, -0x8c(%rbp)
jmp 0x6e0d6
movl -0x8c(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
addl $-0x3, %eax
movl %eax, %ecx
movq %rcx, -0x98(%rbp)
subl $0xb, %eax
ja 0x6e10a
movq -0x98(%rbp), %rax
leaq 0x2a98f(%rip), %rcx     # 0x98a90
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rsi
leaq 0x2ab87(%rip), %rdi     # 0x98c9c
movb $0x0, %al
callq 0x1ac40
cmpl $0x9, -0x20(%rbp)
jne 0x6e147
movq -0x10(%rbp), %rdi
callq 0x7b260
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x6e166
movq -0x10(%rbp), %rdi
callq 0x7b260
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movl -0x10(%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
xorl %eax, %eax
testb $0x1, %al
jne 0x6e181
jmp 0x6e1a7
movsd -0x18(%rbp), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x6e193
jmp 0x6e1c4
movq -0x18(%rbp), %rax
shrq $0x2f, %rax
andq $0xf, %rax
cmpq $0x0, %rax
je 0x6e1c4
jmp 0x6e1d1
movabsq $-0x800000000000, %rax  # imm = 0xFFFF800000000000
andq -0x18(%rbp), %rax
movabsq $-0x7800000000000, %rcx # imm = 0xFFF8800000000000
cmpq %rcx, %rax
jne 0x6e1d1
movq -0x28(%rbp), %rax
movq %rax, -0xa0(%rbp)
jmp 0x6e1ec
movq -0x28(%rbp), %rdi
movl -0x2c(%rbp), %esi
movq -0x18(%rbp), %rdx
callq 0x6ae80
addq $0x10, %rax
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x48(%rbp), %rax
jae 0x6e273
xorl %eax, %eax
testb $0x1, %al
jne 0x6e209
jmp 0x6e235
movq -0x50(%rbp), %rax
movsd (%rax), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x6e21e
jmp 0x6e265
movq -0x50(%rbp), %rax
movq (%rax), %rax
shrq $0x2f, %rax
andq $0xf, %rax
cmpq $0x0, %rax
je 0x6e265
jmp 0x6e255
movq -0x50(%rbp), %rcx
movabsq $-0x800000000000, %rax  # imm = 0xFFFF800000000000
andq (%rcx), %rax
movabsq $-0x7800000000000, %rcx # imm = 0xFFF8800000000000
cmpq %rcx, %rax
je 0x6e265
movq -0x50(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0x6e54a
movq -0x50(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x50(%rbp)
jmp 0x6e1f7
jmp 0x6e537
xorl %eax, %eax
testb $0x1, %al
jne 0x6e280
jmp 0x6e2a6
movsd -0x18(%rbp), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x6e292
jmp 0x6e2c3
movq -0x18(%rbp), %rax
shrq $0x2f, %rax
andq $0xf, %rax
cmpq $0x0, %rax
je 0x6e2c3
jmp 0x6e2cc
movabsq $-0x800000000000, %rax  # imm = 0xFFFF800000000000
andq -0x18(%rbp), %rax
movabsq $-0x7800000000000, %rcx # imm = 0xFFF8800000000000
cmpq %rcx, %rax
jne 0x6e2cc
movl $0x0, -0x54(%rbp)
jmp 0x6e2ee
movq -0x18(%rbp), %rdi
callq 0x6d480
cmpl $0x0, %eax
je 0x6e2e7
cvttsd2si -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x6e2ec
jmp 0x6e537
jmp 0x6e2ee
cmpl $0xb, -0x20(%rbp)
jne 0x6e305
movq -0x10(%rbp), %rdi
callq 0x7b260
movl 0x10(%rax), %eax
movl %eax, -0x58(%rbp)
jmp 0x6e346
cmpl $0x7, -0x20(%rbp)
jne 0x6e31c
movq -0x10(%rbp), %rdi
callq 0x7b260
movl 0x10(%rax), %eax
movl %eax, -0x58(%rbp)
jmp 0x6e344
cmpl $0x8, -0x20(%rbp)
jne 0x6e333
movq -0x10(%rbp), %rdi
callq 0x7b260
movl -0x10(%rax), %eax
movl %eax, -0x58(%rbp)
jmp 0x6e342
movq -0x10(%rbp), %rdi
callq 0x7b260
movl -0x8(%rax), %eax
movl %eax, -0x58(%rbp)
jmp 0x6e344
jmp 0x6e346
movl -0x54(%rbp), %eax
cmpl -0x58(%rbp), %eax
jge 0x6e367
cmpl $0x0, -0x54(%rbp)
jl 0x6e367
cvtsi2sdl -0x54(%rbp), %xmm0
callq 0x7b820
movq %rax, -0x8(%rbp)
jmp 0x6e54a
jmp 0x6e537
movq -0x10(%rbp), %rdi
callq 0x7b260
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq -0x10(%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rcx
xorl %eax, %eax
cmpq 0x50(%rcx), %rax
jne 0x6e396
jmp 0x6e537
movq -0x68(%rbp), %rax
movq 0x50(%rax), %rax
movq -0x60(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq *%rax
movq %rax, -0x8(%rbp)
jmp 0x6e54a
movq -0x10(%rbp), %rdi
callq 0x7b260
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rdi
callq 0x36a40
movl %eax, -0x7c(%rbp)
cmpl $0xf, -0x7c(%rbp)
je 0x6e3fa
cmpl $0x0, -0x7c(%rbp)
je 0x6e3fa
cmpl $0x1, -0x7c(%rbp)
je 0x6e3fa
cmpl $0x4, -0x7c(%rbp)
je 0x6e3fa
cmpl $0x5, -0x7c(%rbp)
je 0x6e3fa
cmpl $0x6, -0x7c(%rbp)
je 0x6e3fa
cmpl $0x7, -0x7c(%rbp)
je 0x6e3fa
cmpl $0x8, -0x7c(%rbp)
jne 0x6e412
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
callq 0x7b460
movq %rax, -0x8(%rbp)
jmp 0x6e54a
movq -0x70(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq %fs:0x0, %rax
leaq -0x348(%rax), %rax
movq -0xb0(%rbp), %rcx
movq 0x20(%rax), %rax
movq %rcx, 0x38(%rax)
movq -0x70(%rbp), %rax
movq %rax, -0xa8(%rbp)
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
callq 0x7b460
movq -0xa8(%rbp), %rdi
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rsi
leaq -0x78(%rbp), %rdx
callq 0x70a80
movl %eax, -0x80(%rbp)
cmpl $0x0, -0x80(%rbp)
je 0x6e4ce
movq -0x70(%rbp), %rax
movl 0x10(%rax), %eax
movl -0x80(%rbp), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
andl %ecx, %eax
cmpl $0x0, %eax
jne 0x6e4ce
cmpl $0x0, -0x1c(%rbp)
je 0x6e4a9
movl -0x80(%rbp), %edi
movq -0x78(%rbp), %rsi
callq 0x1aa80
movq %fs:0x0, %rax
leaq -0x348(%rax), %rax
movq 0x20(%rax), %rax
movq $0x0, 0x38(%rax)
movq -0x78(%rbp), %rdi
callq 0x1ac20
movq %fs:0x0, %rax
leaq -0x348(%rax), %rax
movq 0x20(%rax), %rax
movq $0x0, 0x38(%rax)
cmpl $0x0, -0x80(%rbp)
je 0x6e514
cmpl $0x1, -0x80(%rbp)
je 0x6e514
cmpl $0x4, -0x80(%rbp)
je 0x6e514
cmpl $0x5, -0x80(%rbp)
je 0x6e514
cmpl $0x6, -0x80(%rbp)
je 0x6e514
cmpl $0x7, -0x80(%rbp)
je 0x6e514
cmpl $0x8, -0x80(%rbp)
jne 0x6e529
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
callq 0x7b460
movq %rax, -0x8(%rbp)
jmp 0x6e54a
xorps %xmm0, %xmm0
callq 0x7b820
movq %rax, -0x8(%rbp)
jmp 0x6e54a
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
callq 0x7b460
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xb0, %rsp
popq %rbp
retq
nopw (%rax,%rax)