// File: /workspace/github_c_makefile_star2_O0/janet-lang[P]janet/src/core/value.c
// Function: traversal_next
static int traversal_next(Janet *x, Janet *y) {
    JanetTraversalNode *t = janet_vm.traversal;
    while (t && t > janet_vm.traversal_base) {
        JanetGCObject *self = t->self;
        JanetTupleHead *tself = (JanetTupleHead *)self;
        JanetStructHead *sself = (JanetStructHead *)self;
        JanetGCObject *other = t->other;
        JanetTupleHead *tother = (JanetTupleHead *)other;
        JanetStructHead *sother = (JanetStructHead *)other;
        if ((self->flags & JANET_MEM_TYPEBITS) == JANET_MEMORY_TUPLE) {
            /* Node is a tuple at index t->index */
            if (t->index < tself->length && t->index < tother->length) {
                int32_t index = t->index++;
                *x = tself->data[index];
                *y = tother->data[index];
                janet_vm.traversal = t;
                return 0;
            }
            if (t->index2 && tself->length != tother->length) {
                return tself->length > tother->length ? 3 : 1;
            }
        } else {
            /* Node is a struct at index t->index: if t->index2 is true, we should return the values. */
            if (t->index2) {
                t->index2 = 0;
                int32_t index = t->index++;
                *x = sself->data[index].value;
                *y = sother->data[index].value;
                janet_vm.traversal = t;
                return 0;
            }
            for (int32_t i = t->index; i < sself->capacity; i++) {
                t->index2 = 1;
                *x = sself->data[t->index].key;
                *y = sother->data[t->index].key;
                janet_vm.traversal = t;
                return 0;
            }
            /* Traverse prototype */
            JanetStruct sproto = sself->proto;
            JanetStruct oproto = sother->proto;
            if (sproto && !oproto) return 3;
            if (!sproto && oproto) return 1;
            if (oproto && sproto) {
                *x = janet_wrap_struct(sproto);
                *y = janet_wrap_struct(oproto);
                janet_vm.traversal = t - 1;
                return 0;
            }
        }
        t--;
    }
    janet_vm.traversal = t;
    return 2;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %fs:0x0, %rax
leaq -0x348(%rax), %rax
movq 0x108(%rax), %rax
movq %rax, -0x20(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x20(%rbp)
movb %al, -0x81(%rbp)
je 0x6ec72
movq -0x20(%rbp), %rax
movq %rax, -0x90(%rbp)
movq %fs:0x0, %rax
leaq -0x348(%rax), %rax
movq %rax, %rcx
movq -0x90(%rbp), %rax
cmpq 0x118(%rcx), %rax
seta %al
movb %al, -0x81(%rbp)
movb -0x81(%rbp), %al
testb $0x1, %al
jne 0x6ec81
jmp 0x6efe8
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x28(%rbp), %rax
movl (%rax), %eax
andl $0xff, %eax
cmpl $0x4, %eax
jne 0x6ed9f
movq -0x20(%rbp), %rax
movl 0x10(%rax), %eax
movq -0x30(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0x6ed5b
movq -0x20(%rbp), %rax
movl 0x10(%rax), %eax
movq -0x48(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0x6ed5b
movq -0x20(%rbp), %rcx
movl 0x10(%rcx), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, 0x10(%rcx)
movl %eax, -0x54(%rbp)
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
movslq -0x54(%rbp), %rdx
movq 0x20(%rcx,%rdx,8), %rcx
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movq -0x48(%rbp), %rcx
movslq -0x54(%rbp), %rdx
movq 0x20(%rcx,%rdx,8), %rcx
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x98(%rbp)
movq %fs:0x0, %rax
leaq -0x348(%rax), %rax
movq -0x98(%rbp), %rcx
movq %rcx, 0x108(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x6f018
movq -0x20(%rbp), %rax
cmpl $0x0, 0x14(%rax)
je 0x6ed9a
movq -0x30(%rbp), %rax
movl 0x10(%rax), %eax
movq -0x48(%rbp), %rcx
cmpl 0x10(%rcx), %eax
je 0x6ed9a
movq -0x30(%rbp), %rax
movl 0x10(%rax), %edx
movq -0x48(%rbp), %rax
movl 0x10(%rax), %esi
movl $0x1, %eax
movl $0x3, %ecx
cmpl %esi, %edx
cmovgl %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0x6f018
jmp 0x6efd7
movq -0x20(%rbp), %rax
cmpl $0x0, 0x14(%rax)
je 0x6ee3b
movq -0x20(%rbp), %rax
movl $0x0, 0x14(%rax)
movq -0x20(%rbp), %rcx
movl 0x10(%rcx), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, 0x10(%rcx)
movl %eax, -0x58(%rbp)
movq -0x10(%rbp), %rax
movq -0x38(%rbp), %rcx
addq $0x28, %rcx
movslq -0x58(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq 0x8(%rcx), %rcx
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movq -0x50(%rbp), %rcx
addq $0x28, %rcx
movslq -0x58(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq 0x8(%rcx), %rcx
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq %fs:0x0, %rax
leaq -0x348(%rax), %rax
movq -0xa0(%rbp), %rcx
movq %rcx, 0x108(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x6f018
movq -0x20(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
movq -0x38(%rbp), %rcx
cmpl 0x18(%rcx), %eax
jge 0x6eed7
movq -0x20(%rbp), %rax
movl $0x1, 0x14(%rax)
movq -0x10(%rbp), %rax
movq -0x38(%rbp), %rcx
addq $0x28, %rcx
movq -0x20(%rbp), %rdx
movslq 0x10(%rdx), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rcx
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movq -0x50(%rbp), %rcx
addq $0x28, %rcx
movq -0x20(%rbp), %rdx
movslq 0x10(%rdx), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rcx
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq %fs:0x0, %rax
leaq -0x348(%rax), %rax
movq -0xa8(%rbp), %rcx
movq %rcx, 0x108(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x6f018
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x50(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x70(%rbp)
cmpq $0x0, -0x68(%rbp)
je 0x6ef09
cmpq $0x0, -0x70(%rbp)
jne 0x6ef09
movl $0x3, -0x4(%rbp)
jmp 0x6f018
cmpq $0x0, -0x68(%rbp)
jne 0x6ef23
cmpq $0x0, -0x70(%rbp)
je 0x6ef23
movl $0x1, -0x4(%rbp)
jmp 0x6f018
cmpq $0x0, -0x70(%rbp)
je 0x6efd5
cmpq $0x0, -0x68(%rbp)
je 0x6efd5
movq -0x10(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0x68(%rbp), %rdi
movabsq $-0x3000000000000, %rsi # imm = 0xFFFD000000000000
callq 0x7b550
movq %rax, %rcx
movq -0xc0(%rbp), %rax
movq %rcx, -0x78(%rbp)
movq -0x78(%rbp), %rcx
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x70(%rbp), %rdi
movabsq $-0x3000000000000, %rsi # imm = 0xFFFD000000000000
callq 0x7b550
movq %rax, %rcx
movq -0xb8(%rbp), %rax
movq %rcx, -0x80(%rbp)
movq -0x80(%rbp), %rcx
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
addq $-0x18, %rax
movq %rax, -0xb0(%rbp)
movq %fs:0x0, %rax
leaq -0x348(%rax), %rax
movq -0xb0(%rbp), %rcx
movq %rcx, 0x108(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x6f018
jmp 0x6efd7
movq -0x20(%rbp), %rax
addq $-0x18, %rax
movq %rax, -0x20(%rbp)
jmp 0x6ec2e
movq -0x20(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq %fs:0x0, %rax
leaq -0x348(%rax), %rax
movq -0xc8(%rbp), %rcx
movq %rcx, 0x108(%rax)
movl $0x2, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xd0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)