// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movb $0x0, -0x25(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xff, %eax
je 0x419a5
jmp 0x4174d
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xfe, %eax
jge 0x41764
movl $0x1, -0x34(%rbp)
jmp 0x4176b
movl $0x5, -0x34(%rbp)
jmp 0x4176d
jmp 0x4176f
jmp 0x41771
movq -0x10(%rbp), %rax
movl -0x34(%rbp), %ecx
movzbl (%rax,%rcx), %eax
movl %eax, -0x38(%rbp)
cmpl $0xc0, -0x38(%rbp)
jae 0x41793
movl -0x38(%rbp), %eax
andl $0xc0, %eax
movl %eax, -0x38(%rbp)
jmp 0x41795
cmpl $0xc0, -0x38(%rbp)
jae 0x41881
cmpl $0x0, -0x38(%rbp)
jne 0x417c5
movl $0x1, -0x3c(%rbp)
movq -0x10(%rbp), %rax
movl -0x34(%rbp), %ecx
movzbl (%rax,%rcx), %eax
andl $0x3f, %eax
movl %eax, -0x40(%rbp)
jmp 0x4187f
cmpl $0x40, -0x38(%rbp)
jne 0x417f9
movl $0x2, -0x3c(%rbp)
movq -0x10(%rbp), %rax
movl -0x34(%rbp), %ecx
movzbl (%rax,%rcx), %eax
andl $0x3f, %eax
shll $0x8, %eax
movq -0x10(%rbp), %rcx
movl -0x34(%rbp), %edx
movzbl 0x1(%rcx,%rdx), %ecx
orl %ecx, %eax
movl %eax, -0x40(%rbp)
jmp 0x4187d
cmpl $0x80, -0x38(%rbp)
jne 0x4184d
movl $0x5, -0x3c(%rbp)
movq -0x10(%rbp), %rax
movl -0x34(%rbp), %ecx
movzbl 0x1(%rax,%rcx), %eax
shll $0x18, %eax
movq -0x10(%rbp), %rcx
movl -0x34(%rbp), %edx
movzbl 0x2(%rcx,%rdx), %ecx
shll $0x10, %ecx
orl %ecx, %eax
movq -0x10(%rbp), %rcx
movl -0x34(%rbp), %edx
movzbl 0x3(%rcx,%rdx), %ecx
shll $0x8, %ecx
orl %ecx, %eax
movq -0x10(%rbp), %rcx
movl -0x34(%rbp), %edx
movzbl 0x4(%rcx,%rdx), %ecx
orl %ecx, %eax
movl %eax, -0x40(%rbp)
jmp 0x4187b
xorl %eax, %eax
testb $0x1, %al
jne 0x41855
jmp 0x41857
jmp 0x41879
leaq 0xfc4c1(%rip), %rdi     # 0x13dd1f
leaq 0xf9083(%rip), %rsi     # 0x13a8e8
movl $0x3c1, %edx            # imm = 0x3C1
callq 0x76ce0
movl $0x1, %edi
callq 0x263c0
jmp 0x4187b
jmp 0x4187d
jmp 0x4187f
jmp 0x41896
movl $0x1, -0x3c(%rbp)
movl -0x38(%rbp), %eax
movzbl %al, %edi
callq 0x3fc70
movl %eax, -0x40(%rbp)
jmp 0x41898
movq -0x10(%rbp), %rax
movl -0x34(%rbp), %ecx
addq %rcx, %rax
movl -0x3c(%rbp), %ecx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0x41989
movl -0x38(%rbp), %eax
andl $0xc0, %eax
cmpl $0xc0, %eax
jae 0x418f6
movl -0x40(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jne 0x418f1
movq -0x48(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %eax
movl %eax, %edx
callq 0x269b0
cmpl $0x0, %eax
jne 0x418f1
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x419ad
jmp 0x41981
movzbl -0x25(%rbp), %eax
cmpl $0x0, %eax
jne 0x4194b
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
leaq -0x30(%rbp), %rdx
leaq -0x25(%rbp), %rcx
callq 0x40090
cmpl $0x0, %eax
jne 0x4191c
movb $-0x1, -0x25(%rbp)
movzbl -0x25(%rbp), %eax
cmpl $0x0, %eax
je 0x41927
jmp 0x41949
leaq 0xf8fd0(%rip), %rdi     # 0x13a8fe
leaq 0xf8fb3(%rip), %rsi     # 0x13a8e8
movl $0x3d6, %edx            # imm = 0x3D6
callq 0x76ce0
movl $0x1, %edi
callq 0x263c0
jmp 0x4194b
movzbl -0x25(%rbp), %eax
cmpl $0xff, %eax
je 0x4197f
movq -0x48(%rbp), %rdi
movl -0x38(%rbp), %eax
movzbl %al, %esi
callq 0x402c0
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x30(%rbp), %rax
jne 0x4197d
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x419ad
jmp 0x4197f
jmp 0x41981
movl -0x20(%rbp), %eax
movl %eax, -0x24(%rbp)
jmp 0x41992
movl -0x24(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x24(%rbp)
movq -0x48(%rbp), %rax
movl -0x40(%rbp), %ecx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x41739
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)