// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/ziplist.c
// Function: ziplistIndex
unsigned char *ziplistIndex(unsigned char *zl, int index) {
    unsigned char *p;
    unsigned int prevlensize, prevlen = 0;
    if (index < 0) {
        index = (-index)-1;
        p = ZIPLIST_ENTRY_TAIL(zl);
        if (p[0] != ZIP_END) {
            ZIP_DECODE_PREVLEN(p, prevlensize, prevlen);
            while (prevlen > 0 && index--) {
                p -= prevlen;
                ZIP_DECODE_PREVLEN(p, prevlensize, prevlen);
            }
        }
    } else {
        p = ZIPLIST_ENTRY_HEAD(zl);
        while (p[0] != ZIP_END && index--) {
            p += zipRawEntryLength(p);
        }
    }
    return (p[0] == ZIP_END || index > 0) ? NULL : p;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl $0x0, -0x20(%rbp)
cmpl $0x0, -0xc(%rbp)
jge 0x4124b
xorl %eax, %eax
subl -0xc(%rbp), %eax
subl $0x1, %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x4(%rcx), %ecx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xff, %eax
je 0x41249
jmp 0x41171
jmp 0x41173
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xfe, %eax
jge 0x4118a
movl $0x1, -0x1c(%rbp)
jmp 0x41191
movl $0x5, -0x1c(%rbp)
jmp 0x41193
cmpl $0x1, -0x1c(%rbp)
jne 0x411a5
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x20(%rbp)
jmp 0x411b7
cmpl $0x5, -0x1c(%rbp)
jne 0x411b5
movq -0x18(%rbp), %rax
movl 0x1(%rax), %eax
movl %eax, -0x20(%rbp)
jmp 0x411b7
jmp 0x411b9
jmp 0x411bb
xorl %eax, %eax
cmpl $0x0, -0x20(%rbp)
movb %al, -0x21(%rbp)
jbe 0x411da
movl -0xc(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0xc(%rbp)
cmpl $0x0, %eax
setne %al
movb %al, -0x21(%rbp)
movb -0x21(%rbp), %al
testb $0x1, %al
jne 0x411e3
jmp 0x41247
movl -0x20(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, %ecx
movl %ecx, %edx
xorl %ecx, %ecx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
jmp 0x411fc
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xfe, %eax
jge 0x41213
movl $0x1, -0x1c(%rbp)
jmp 0x4121a
movl $0x5, -0x1c(%rbp)
jmp 0x4121c
cmpl $0x1, -0x1c(%rbp)
jne 0x4122e
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x20(%rbp)
jmp 0x41240
cmpl $0x5, -0x1c(%rbp)
jne 0x4123e
movq -0x18(%rbp), %rax
movl 0x1(%rax), %eax
movl %eax, -0x20(%rbp)
jmp 0x41240
jmp 0x41242
jmp 0x411bb
jmp 0x41249
jmp 0x412a4
movq -0x8(%rbp), %rax
addq $0xa, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl $0xff, %ecx
movb %al, -0x22(%rbp)
je 0x4127f
movl -0xc(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0xc(%rbp)
cmpl $0x0, %eax
setne %al
movb %al, -0x22(%rbp)
movb -0x22(%rbp), %al
testb $0x1, %al
jne 0x41288
jmp 0x412a2
movq -0x18(%rbp), %rdi
callq 0x3ff20
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
jmp 0x41257
jmp 0x412a4
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xff, %eax
je 0x412b8
cmpl $0x0, -0xc(%rbp)
jle 0x412c0
xorl %eax, %eax
movq %rax, -0x30(%rbp)
jmp 0x412c8
movq -0x18(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)