// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/quicklist.c
// Function: quicklistNext
int quicklistNext(quicklistIter *iter, quicklistEntry *entry) {
    initEntry(entry);

    if (!iter) {
        D("Returning because no iter!");
        return 0;
    }

    entry->quicklist = iter->quicklist;
    entry->node = iter->current;

    if (!iter->current) {
        D("Returning because current node is NULL")
        return 0;
    }

    unsigned char *(*nextFn)(unsigned char *, unsigned char *) = NULL;
    int offset_update = 0;

    if (!iter->zi) {
        /* If !zi, use current index. */
        quicklistDecompressNodeForUse(iter->current);
        iter->zi = ziplistIndex(iter->current->zl, iter->offset);
    } else {
        /* else, use existing iterator offset and get prev/next as necessary. */
        if (iter->direction == AL_START_HEAD) {
            nextFn = ziplistNext;
            offset_update = 1;
        } else if (iter->direction == AL_START_TAIL) {
            nextFn = ziplistPrev;
            offset_update = -1;
        }
        iter->zi = nextFn(iter->current->zl, iter->zi);
        iter->offset += offset_update;
    }

    entry->zi = iter->zi;
    entry->offset = iter->offset;

    if (iter->zi) {
        /* Populate value from existing ziplist position */
        ziplistGet(entry->zi, &entry->value, &entry->sz, &entry->longval);
        return 1;
    } else {
        /* We ran out of ziplist entries.
         * Pick next node, update offset, then re-run retrieval. */
        quicklistCompress(iter->quicklist, iter->current);
        if (iter->direction == AL_START_HEAD) {
            /* Forward traversal */
            D("Jumping to start of next node");
            iter->current = iter->current->next;
            iter->offset = 0;
        } else if (iter->direction == AL_START_TAIL) {
            /* Reverse traversal */
            D("Jumping to end of previous node");
            iter->current = iter->current->prev;
            iter->offset = -1;
        }
        iter->zi = NULL;
        return quicklistNext(iter, entry);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x18(%rbp), %rax
movq $-0x75bcd15, 0x20(%rax) # imm = 0xF8A432EB
movq -0x18(%rbp), %rax
movq $0x0, (%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x18(%rbp), %rax
movl $0x75bcd15, 0x2c(%rax)  # imm = 0x75BCD15
movq -0x18(%rbp), %rax
movl $0x0, 0x28(%rax)
cmpq $0x0, -0x10(%rbp)
jne 0x29d24
movl $0x0, -0x4(%rbp)
jmp 0x29f8a
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x29d59
movl $0x0, -0x4(%rbp)
jmp 0x29f8a
movq $0x0, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x29de7
jmp 0x29d75
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x29dbd
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x1c(%rax), %eax
shrl $0x10, %eax
andl $0x3, %eax
cmpl $0x2, %eax
jne 0x29dbd
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x27a80
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x1c(%rax), %ecx
andl $0xffefffff, %ecx       # imm = 0xFFEFFFFF
orl $0x100000, %ecx         # imm = 0x100000
movl %ecx, 0x1c(%rax)
jmp 0x29dbf
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movl %eax, %esi
callq 0x41120
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x29e58
movq -0x10(%rbp), %rax
cmpl $0x0, 0x20(%rax)
jne 0x29e05
leaq 0x174e8(%rip), %rax     # 0x412e0
movq %rax, -0x20(%rbp)
movl $0x1, -0x24(%rbp)
jmp 0x29e23
movq -0x10(%rbp), %rax
cmpl $0x1, 0x20(%rax)
jne 0x29e21
leaq 0x1753a(%rip), %rax     # 0x41350
movq %rax, -0x20(%rbp)
movl $0xffffffff, -0x24(%rbp) # imm = 0xFFFFFFFF
jmp 0x29e23
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rcx
movq 0x10(%rcx), %rdi
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rsi
callq *%rax
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movslq -0x24(%rbp), %rcx
movq -0x10(%rbp), %rax
addq 0x18(%rax), %rcx
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x2c(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x29eb5
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x18(%rbp), %rsi
addq $0x18, %rsi
movq -0x18(%rbp), %rdx
addq $0x28, %rdx
movq -0x18(%rbp), %rcx
addq $0x20, %rcx
callq 0x41470
movl $0x1, -0x4(%rbp)
jmp 0x29f8a
jmp 0x29eb7
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x1c(%rax), %eax
shrl $0x14, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x29f01
jmp 0x29ecf
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x29efd
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x1c(%rax), %eax
shrl $0x10, %eax
andl $0x3, %eax
cmpl $0x1, %eax
jne 0x29efd
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x27980
jmp 0x29eff
jmp 0x29f15
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x27b50
jmp 0x29f17
movq -0x10(%rbp), %rax
cmpl $0x0, 0x20(%rax)
jne 0x29f43
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x18(%rax)
jmp 0x29f6e
movq -0x10(%rbp), %rax
cmpl $0x1, 0x20(%rax)
jne 0x29f6c
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq $-0x1, 0x18(%rax)
jmp 0x29f6e
movq -0x10(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x29cb0
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)