// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/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) {
        zipEntry(p, &entry);
        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 0x7b87a(%rip), %rdi     # 0xb17f0
xorl %eax, %eax
callq 0x260a0
leaq 0xa(%rbx), %r14
pushq $0xa
popq %rbp
xorl %r13d, %r13d
cmpb $-0x1, (%r14)
je 0x3608d
movq %r14, %rdi
leaq 0x8(%rsp), %rsi
callq 0x3532d
movq %r14, %rcx
subq %rbx, %rcx
movl 0x18(%rsp), %r12d
movl 0x14(%rsp), %r15d
leal (%r15,%r12), %r8d
movl 0x8(%rsp), %r10d
movl 0xc(%rsp), %r11d
subq $0x8, %rsp
leaq 0x7b858(%rip), %rdi     # 0xb181f
movq %r14, %rsi
movl %r13d, %edx
movl %r12d, %r9d
xorl %eax, %eax
pushq %r15
pushq %r10
pushq %r11
callq 0x260a0
addq $0x20, %rsp
addq %r12, %r14
movb 0x1c(%rsp), %al
cmpb $-0x41, %al
jbe 0x3600a
movzbl %al, %esi
movq %r14, %rdi
callq 0x352af
leaq 0x83df2(%rip), %rdi     # 0xb9df0
movq %rax, %rsi
xorl %eax, %eax
callq 0x260a0
jmp 0x3605f
cmpl $0x29, %r15d
jb 0x3603d
movq 0xbefd1(%rip), %rax     # 0xf4fe8
movq (%rax), %rcx
movq %r14, %rdi
pushq $0x28
popq %rsi
pushq $0x1
popq %rdx
callq 0x26b10
testq %rax, %rax
je 0x36071
leaq 0x8bd18(%rip), %rdi     # 0xc1d4c
xorl %eax, %eax
callq 0x260a0
jmp 0x3605f
testq %r15, %r15
je 0x3605f
movq 0xbef9f(%rip), %rax     # 0xf4fe8
movq (%rax), %rcx
movq %r14, %rdi
movq %r15, %rsi
pushq $0x1
popq %rdx
callq 0x26b10
testq %rax, %rax
je 0x3607f
movl %ebp, %edi
callq 0x26320
addq %r15, %r14
incl %r13d
jmp 0x35f87
leaq 0x7b800(%rip), %rdi     # 0xb1878
callq 0x26b60
jmp 0x3602d
leaq 0x7b7f2(%rip), %rdi     # 0xb1878
callq 0x26b60
jmp 0x3605f
leaq 0x7b7eb(%rip), %rdi     # 0xb187f
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x26250
nop