// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/t_list.c
// Function: blockingPopGenericCommand
void blockingPopGenericCommand(client *c, int where) {
    robj *o;
    mstime_t timeout;
    int j;

    if (getTimeoutFromObjectOrReply(c,c->argv[c->argc-1],&timeout,UNIT_SECONDS)
        != C_OK) return;

    for (j = 1; j < c->argc-1; j++) {
        o = lookupKeyWrite(c->db,c->argv[j]);
        if (o != NULL) {
            if (o->type != OBJ_LIST) {
                addReply(c,shared.wrongtypeerr);
                return;
            } else {
                if (listTypeLength(o) != 0) {
                    /* Non empty list, this is like a non normal [LR]POP. */
                    char *event = (where == LIST_HEAD) ? "lpop" : "rpop";
                    robj *value = listTypePop(o,where);
                    serverAssert(value != NULL);

                    addReplyMultiBulkLen(c,2);
                    addReplyBulk(c,c->argv[j]);
                    addReplyBulk(c,value);
                    decrRefCount(value);
                    notifyKeyspaceEvent(NOTIFY_LIST,event,
                                        c->argv[j],c->db->id);
                    if (listTypeLength(o) == 0) {
                        dbDelete(c->db,c->argv[j]);
                        notifyKeyspaceEvent(NOTIFY_GENERIC,"del",
                                            c->argv[j],c->db->id);
                    }
                    signalModifiedKey(c->db,c->argv[j]);
                    server.dirty++;

                    /* Replicate it as an [LR]POP instead of B[LR]POP. */
                    rewriteClientCommandVector(c,2,
                        (where == LIST_HEAD) ? shared.lpop : shared.rpop,
                        c->argv[j]);
                    return;
                }
            }
        }
    }

    /* If we are inside a MULTI/EXEC and the list is empty the only thing
     * we can do is treating it as a timeout (even with timeout 0). */
    if (c->flags & CLIENT_MULTI) {
        addReply(c,shared.nullmultibulk);
        return;
    }

    /* If the list is empty or the key does not exists we must block */
    blockForKeys(c, c->argv + 1, c->argc - 2, timeout, NULL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
movq 0x40(%rdi), %rax
movslq 0x38(%rdi), %rcx
movq -0x8(%rax,%rcx,8), %rsi
movq %rsp, %rdx
xorl %ecx, %ecx
callq 0x7cb4c
testl %eax, %eax
jne 0x4df2b
movl 0x38(%rbx), %edx
cmpl $0x3, %edx
jl 0x4dddc
movl $0x1, %r13d
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq (%rax,%r13,8), %rsi
callq 0x41ad6
testq %rax, %rax
je 0x4ddcc
movq %rax, %r14
movl (%rax), %eax
andl $0xf, %eax
cmpl $0x1, %eax
jne 0x4de11
movq %r14, %rdi
callq 0x4c4aa
testq %rax, %rax
jne 0x4de29
incq %r13
movslq 0x38(%rbx), %rdx
leaq -0x1(%rdx), %rax
cmpq %rax, %r13
jl 0x4dd9c
testb $0x8, 0x98(%rbx)
jne 0x4de04
movq 0x40(%rbx), %rsi
addq $0x8, %rsi
addl $-0x2, %edx
movq (%rsp), %rcx
movq %rbx, %rdi
xorl %r8d, %r8d
callq 0x4d747
jmp 0x4df2b
leaq 0xb4505(%rip), %rax     # 0x102310
movq 0x58(%rax), %rsi
jmp 0x4de1c
leaq 0xb44f8(%rip), %rax     # 0x102310
movq 0x70(%rax), %rsi
movq %rbx, %rdi
callq 0x3c854
jmp 0x4df2b
movq %r14, %rdi
movl %ebp, %esi
callq 0x4c426
testq %rax, %rax
je 0x4df3a
movq %rax, %r12
testl %ebp, %ebp
leaq 0x6e7a5(%rip), %rax     # 0xbc5ed
leaq 0x6e786(%rip), %r15     # 0xbc5d5
cmoveq %rax, %r15
movl $0x2, %esi
movq %rbx, %rdi
callq 0x3d274
movq 0x40(%rbx), %rax
movq (%rax,%r13,8), %rsi
movq %rbx, %rdi
callq 0x3d170
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3d170
movq %r12, %rdi
callq 0x40c8f
movq 0x10(%rbx), %rax
movq 0x40(%rbx), %rcx
movq (%rcx,%r13,8), %rdx
movl 0x30(%rax), %ecx
movl $0x10, %edi
movq %r15, %rsi
callq 0x7c665
movq %r14, %rdi
callq 0x4c4aa
testq %rax, %rax
jne 0x4dedd
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq (%rax,%r13,8), %rsi
callq 0x41e5f
movq 0x10(%rbx), %rax
movq 0x40(%rbx), %rcx
movq (%rcx,%r13,8), %rdx
movl 0x30(%rax), %ecx
leaq 0x70655(%rip), %rsi     # 0xbe528
movl $0x4, %edi
callq 0x7c665
xorl %r14d, %r14d
testl %ebp, %ebp
sete %r14b
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq (%rax,%r13,8), %rsi
callq 0x41d90
leaq 0xb39aa(%rip), %rax     # 0x1018a8
incq 0x720(%rax)
leaq 0xb4404(%rip), %rax     # 0x102310
movq 0x130(%rax,%r14,8), %rdx
movq 0x40(%rbx), %rax
movq (%rax,%r13,8), %rcx
movq %rbx, %rdi
movl $0x2, %esi
xorl %eax, %eax
callq 0x3f61d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x7551d(%rip), %rdi     # 0xc345e
leaq 0x753f4(%rip), %rsi     # 0xc333c
movl $0x37a, %edx            # imm = 0x37A
callq 0x61908
movl $0x1, %edi
callq 0x263c0