// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/ziplist.c
// Function: ziplistFind
unsigned char *ziplistFind(unsigned char *p, unsigned char *vstr, unsigned int vlen, unsigned int skip) {
    int skipcnt = 0;
    unsigned char vencoding = 0;
    long long vll = 0;

    while (p[0] != ZIP_END) {
        unsigned int prevlensize, encoding, lensize, len;
        unsigned char *q;

        ZIP_DECODE_PREVLENSIZE(p, prevlensize);
        ZIP_DECODE_LENGTH(p + prevlensize, encoding, lensize, len);
        q = p + prevlensize + lensize;

        if (skipcnt == 0) {
            /* Compare current entry with specified entry */
            if (ZIP_IS_STR(encoding)) {
                if (len == vlen && memcmp(q, vstr, vlen) == 0) {
                    return p;
                }
            } else {
                /* Find out if the searched field can be encoded. Note that
                 * we do it only the first time, once done vencoding is set
                 * to non-zero and vll is set to the integer value. */
                if (vencoding == 0) {
                    if (!zipTryEncoding(vstr, vlen, &vll, &vencoding)) {
                        /* If the entry can't be encoded we set it to
                         * UCHAR_MAX so that we don't retry again the next
                         * time. */
                        vencoding = UCHAR_MAX;
                    }
                    /* Must be non-zero by now */
                    assert(vencoding);
                }

                /* Compare current entry with specified entry, do it only
                 * if vencoding != UCHAR_MAX because if there is no encoding
                 * possible for the field it can't be a valid integer. */
                if (vencoding != UCHAR_MAX) {
                    long long ll = zipLoadInteger(q, encoding);
                    if (ll == vll) {
                        return p;
                    }
                }
            }

            /* Reset skip count */
            skipcnt = skip;
        } else {
            /* Skip entry */
            skipcnt--;
        }

        /* Move to next entry */
        p = q + len;
    }

    return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %ecx, %ebx
movq %rsi, 0x10(%rsp)
movq %rdi, %r12
leaq 0xb(%rsp), %rax
movb $0x0, (%rax)
leaq 0x18(%rsp), %rax
movq $0x0, (%rax)
movl %edx, 0xc(%rsp)
movl %edx, %eax
movq %rax, 0x20(%rsp)
xorl %r14d, %r14d
xorl %ecx, %ecx
movzbl (%r12), %edx
cmpl $0xfe, %edx
je 0x3b9d6
movl $0x1, %eax
cmpl $0xff, %edx
jne 0x3b9db
jmp 0x3bb2c
movl $0x5, %eax
leaq (%r12,%rax), %r15
movzbl (%r12,%rax), %ebp
movl %ebp, %r13d
andl $-0x40, %r13d
cmpl $0xc0, %ebp
cmovael %ebp, %r13d
movzbl %r13b, %edx
cmpl $0xbf, %r13d
ja 0x3ba1f
cmpb $-0x80, %r13b
je 0x3ba76
cmpl $0x40, %edx
je 0x3ba62
testl %edx, %edx
jne 0x3bb41
andl $0x3f, %ebp
movl $0x1, %eax
jmp 0x3ba9a
movl $0x1, %eax
cmpl $0xdf, %edx
jle 0x3ba4b
cmpl $0xe0, %edx
je 0x3ba83
cmpl $0xf0, %edx
je 0x3ba8a
movl $0x1, %ebp
cmpl $0xfe, %edx
je 0x3ba9a
jmp 0x3ba98
cmpl $0xc0, %edx
je 0x3ba91
cmpl $0xd0, %edx
jne 0x3ba98
movl $0x4, %ebp
jmp 0x3ba9a
andl $0x3f, %ebp
shll $0x8, %ebp
movzbl 0x1(%r15), %eax
orl %eax, %ebp
movl $0x2, %eax
jmp 0x3ba9a
movl 0x1(%r15), %ebp
bswapl %ebp
movl $0x5, %eax
jmp 0x3ba9a
movl $0x8, %ebp
jmp 0x3ba9a
movl $0x3, %ebp
jmp 0x3ba9a
movl $0x2, %ebp
jmp 0x3ba9a
xorl %ebp, %ebp
addq %rax, %r15
testl %ecx, %ecx
je 0x3baa5
decl %ecx
jmp 0x3bb1f
cmpl $0xbf, %r13d
ja 0x3bace
cmpl 0xc(%rsp), %ebp
jne 0x3bb1d
movq %r15, %rdi
movq 0x10(%rsp), %rsi
movq 0x20(%rsp), %rdx
callq 0x266f0
movl %ebx, %ecx
testl %eax, %eax
jne 0x3bb1f
jmp 0x3bb2f
testb %r14b, %r14b
jne 0x3baf9
movq 0x10(%rsp), %rdi
movl 0xc(%rsp), %esi
leaq 0x18(%rsp), %rdx
leaq 0xb(%rsp), %rcx
callq 0x3abdf
testl %eax, %eax
je 0x3bb15
movb 0xb(%rsp), %r14b
testb %r14b, %r14b
je 0x3bb56
cmpb $-0x1, %r14b
je 0x3bb1a
movq %r15, %rdi
movl %r13d, %esi
callq 0x3acda
movl %ebx, %ecx
cmpq 0x18(%rsp), %rax
jne 0x3bb1f
jmp 0x3bb2f
movb $-0x1, 0xb(%rsp)
movb $-0x1, %r14b
movl %ebx, %ecx
movl %ebp, %eax
addq %rax, %r15
movq %r15, %r12
jmp 0x3b9b7
xorl %r12d, %r12d
movq %r12, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x87c8b(%rip), %rdi     # 0xc37d3
leaq 0x84071(%rip), %rsi     # 0xbfbc0
movl $0x3c1, %edx            # imm = 0x3C1
jmp 0x3bb69
leaq 0x84079(%rip), %rdi     # 0xbfbd6
leaq 0x8405c(%rip), %rsi     # 0xbfbc0
movl $0x3d6, %edx            # imm = 0x3D6
callq 0x61908
movl $0x1, %edi
callq 0x263c0