// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/t_list.c
// Function: listTypeNext
int listTypeNext(listTypeIterator *li, listTypeEntry *entry) {
    /* Protect from converting when iterating */
    redisAssert(li->subject->encoding == li->encoding);

    entry->li = li;

    // 迭代 ZIPLIST
    if (li->encoding == REDIS_ENCODING_ZIPLIST) {

        // 记录当前节点到 entry
        entry->zi = li->zi;

        // 移动迭代器的指针
        if (entry->zi != NULL) {
            if (li->direction == REDIS_TAIL)
                li->zi = ziplistNext(li->subject->ptr,li->zi);
            else
                li->zi = ziplistPrev(li->subject->ptr,li->zi);
            return 1;
        }

    // 迭代双端链表
    } else if (li->encoding == REDIS_ENCODING_LINKEDLIST) {

        // 记录当前节点到 entry
        entry->ln = li->ln;

        // 移动迭代器的指针
        if (entry->ln != NULL) {
            if (li->direction == REDIS_TAIL)
                li->ln = li->ln->next;
            else
                li->ln = li->ln->prev;
            return 1;
        }

    // 未知编码
    } else {
        redisPanic("Unknown list encoding");
    }

    // 列表元素已经全部迭代完
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
movq -0x10(%rbp), %rcx
movzbl 0x8(%rcx), %ecx
cmpl %ecx, %eax
jne 0x482ad
jmp 0x482cf
leaq 0x9ad86(%rip), %rdi     # 0xe303a
leaq 0x9ad76(%rip), %rsi     # 0xe3031
movl $0xf7, %edx
callq 0x63ca0
movl $0x1, %edi
callq 0x1f3b0
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movzbl 0x8(%rax), %eax
cmpl $0x5, %eax
jne 0x4836c
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x48367
movq -0x10(%rbp), %rax
movzbl 0x9(%rax), %eax
cmpl $0x1, %eax
jne 0x48338
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x33330
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x4835b
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x333a0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movl $0x1, -0x4(%rbp)
jmp 0x48400
jmp 0x483f9
movq -0x10(%rbp), %rax
movzbl 0x8(%rax), %eax
cmpl $0x4, %eax
jne 0x483d5
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x483d3
movq -0x10(%rbp), %rax
movzbl 0x9(%rax), %eax
cmpl $0x1, %eax
jne 0x483b7
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
jmp 0x483ca
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movl $0x1, -0x4(%rbp)
jmp 0x48400
jmp 0x483f7
leaq 0x9a770(%rip), %rdi     # 0xe2b4c
leaq 0x9ac4e(%rip), %rsi     # 0xe3031
movl $0x11b, %edx            # imm = 0x11B
callq 0x63d40
movl $0x1, %edi
callq 0x1f3b0
jmp 0x483f9
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)