// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/quicklist.c
// Function: quicklistPopCustom
int quicklistPopCustom(quicklist *quicklist, int where, unsigned char **data,
                       unsigned int *sz, long long *sval,
                       void *(*saver)(unsigned char *data, unsigned int sz)) {
    unsigned char *p;
    unsigned char *vstr;
    unsigned int vlen;
    long long vlong;
    int pos = (where == QUICKLIST_HEAD) ? 0 : -1;

    if (quicklist->count == 0)
        return 0;

    if (data)
        *data = NULL;
    if (sz)
        *sz = 0;
    if (sval)
        *sval = -123456789;

    quicklistNode *node;
    if (where == QUICKLIST_HEAD && quicklist->head) {
        node = quicklist->head;
    } else if (where == QUICKLIST_TAIL && quicklist->tail) {
        node = quicklist->tail;
    } else {
        return 0;
    }

    p = ziplistIndex(node->zl, pos);
    if (ziplistGet(p, &vstr, &vlen, &vlong)) {
        if (vstr) {
            if (data)
                *data = saver(vstr, vlen);
            if (sz)
                *sz = vlen;
        } else {
            if (data)
                *data = NULL;
            if (sval)
                *sval = vlong;
        }
        quicklistDelIndex(quicklist, node, &p);
        return 1;
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movl -0x14(%rbp), %edx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
cmpl $0x0, %edx
cmovel %ecx, %eax
movl %eax, -0x5c(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x2a259
movl $0x0, -0x4(%rbp)
jmp 0x2a384
cmpq $0x0, -0x20(%rbp)
je 0x2a26b
movq -0x20(%rbp), %rax
movq $0x0, (%rax)
cmpq $0x0, -0x28(%rbp)
je 0x2a27c
movq -0x28(%rbp), %rax
movl $0x0, (%rax)
cmpq $0x0, -0x30(%rbp)
je 0x2a28e
movq -0x30(%rbp), %rax
movq $-0x75bcd15, (%rax)     # imm = 0xF8A432EB
cmpl $0x0, -0x14(%rbp)
jne 0x2a2ab
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x2a2ab
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x68(%rbp)
jmp 0x2a2d8
cmpl $-0x1, -0x14(%rbp)
jne 0x2a2ca
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x2a2ca
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x68(%rbp)
jmp 0x2a2d6
movl $0x0, -0x4(%rbp)
jmp 0x2a384
jmp 0x2a2d8
movq -0x68(%rbp), %rax
movq 0x10(%rax), %rdi
movl -0x5c(%rbp), %esi
callq 0x41120
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
leaq -0x48(%rbp), %rsi
leaq -0x4c(%rbp), %rdx
leaq -0x58(%rbp), %rcx
callq 0x41470
cmpl $0x0, %eax
je 0x2a37d
cmpq $0x0, -0x48(%rbp)
je 0x2a33d
cmpq $0x0, -0x20(%rbp)
je 0x2a32b
movq -0x38(%rbp), %rax
movq -0x48(%rbp), %rdi
movl -0x4c(%rbp), %esi
callq *%rax
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
cmpq $0x0, -0x28(%rbp)
je 0x2a33b
movl -0x4c(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
jmp 0x2a363
cmpq $0x0, -0x20(%rbp)
je 0x2a34f
movq -0x20(%rbp), %rax
movq $0x0, (%rax)
cmpq $0x0, -0x30(%rbp)
je 0x2a361
movq -0x58(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
jmp 0x2a363
movq -0x10(%rbp), %rdi
movq -0x68(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x28620
movl $0x1, -0x4(%rbp)
jmp 0x2a384
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax)