// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/ziplist.c
// Function: ziplistRepr
void ziplistRepr(unsigned char *zl) {
    unsigned char *p;
    int index = 0;
    zlentry entry;

    printf(
        "{total bytes %d} "
        "{length %u}\n"
        "{tail offset %u}\n",
        intrev32ifbe(ZIPLIST_BYTES(zl)),
        intrev16ifbe(ZIPLIST_LENGTH(zl)),
        intrev32ifbe(ZIPLIST_TAIL_OFFSET(zl)));
    p = ZIPLIST_ENTRY_HEAD(zl);
    while(*p != ZIP_END) {
        entry = zipEntry(p);
        printf(
            "{"
                "addr 0x%08lx, "
                "index %2d, "
                "offset %5ld, "
                "rl: %5u, "
                "hs %2u, "
                "pl: %5u, "
                "pls: %2u, "
                "payload %5u"
            "} ",
            (long unsigned)p,
            index,
            (unsigned long) (p-zl),
            entry.headersize+entry.len,
            entry.headersize,
            entry.prevrawlen,
            entry.prevrawlensize,
            entry.len);
        p += entry.headersize;
        if (ZIP_IS_STR(entry.encoding)) {
            if (entry.len > 40) {
                if (fwrite(p,40,1,stdout) == 0) perror("fwrite");
                printf("...");
            } else {
                if (entry.len &&
                    fwrite(p,entry.len,1,stdout) == 0) perror("fwrite");
            }
        } else {
            printf("%lld", (long long) zipLoadInteger(p,entry.encoding));
        }
        printf("\n");
        p += entry.len;
        index++;
    }
    printf("{end}\n\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movzwl 0x8(%rdi), %edx
movl (%rdi), %esi
movl 0x4(%rdi), %ecx
leaq 0x6a250(%rip), %rdi     # 0x96c69
xorl %eax, %eax
callq 0x1f0a0
movq %rbx, (%rsp)
cmpb $-0x1, 0xa(%rbx)
je 0x2cb49
movq (%rsp), %rax
leaq 0xa(%rax), %r12
xorl %r13d, %r13d
leaq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0x2c0a0
movl 0x8(%rsp), %r10d
movl 0xc(%rsp), %r11d
movl 0x14(%rsp), %ebp
movl 0x18(%rsp), %r15d
movb 0x1c(%rsp), %bl
movq %r12, %rcx
subq (%rsp), %rcx
leal (%r15,%rbp), %r8d
subq $0x8, %rsp
leaq 0x6a225(%rip), %rdi     # 0x96c98
movq %r12, %rsi
movl %r13d, %edx
movl %r15d, %r9d
xorl %eax, %eax
pushq %rbp
pushq %r10
pushq %r11
callq 0x1f0a0
addq $0x20, %rsp
movq %r12, %r14
addq %r15, %r14
cmpb $-0x41, %bl
jbe 0x2cab5
movzbl %bl, %esi
movq %r14, %rdi
callq 0x2c3e1
leaq 0x7042b(%rip), %rdi     # 0x9ced4
movq %rax, %rsi
xorl %eax, %eax
callq 0x1f0a0
jmp 0x2cb0f
cmpl $0x29, %ebp
jb 0x2caeb
movq 0x9952f(%rip), %rax     # 0xc5ff0
movq (%rax), %rcx
movl $0x28, %esi
movl $0x1, %edx
movq %r14, %rdi
callq 0x1fa90
testq %rax, %rax
je 0x2cb2d
leaq 0x751ae(%rip), %rdi     # 0xa1c90
xorl %eax, %eax
callq 0x1f0a0
jmp 0x2cb0f
testq %rbp, %rbp
je 0x2cb0f
movq 0x994f9(%rip), %rax     # 0xc5ff0
movq (%rax), %rcx
movl $0x1, %edx
movq %r14, %rdi
movq %rbp, %rsi
callq 0x1fa90
testq %rax, %rax
je 0x2cb3b
movl $0xa, %edi
callq 0x1f310
leaq (%r14,%rbp), %r12
incl %r13d
cmpb $-0x1, (%r14,%rbp)
jne 0x2ca39
jmp 0x2cb49
leaq 0x6a1bd(%rip), %rdi     # 0x96cf1
callq 0x1fae0
jmp 0x2cadb
leaq 0x6a1af(%rip), %rdi     # 0x96cf1
callq 0x1fae0
jmp 0x2cb0f
leaq 0x6a1a8(%rip), %rdi     # 0x96cf8
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1f240