// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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 0x8058c
testl %eax, %eax
jne 0x51668
movl 0x38(%rbx), %edx
cmpl $0x3, %edx
jl 0x51519
movl $0x1, %r13d
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq (%rax,%r13,8), %rsi
callq 0x44f66
testq %rax, %rax
je 0x51509
movq %rax, %r14
movl (%rax), %eax
andl $0xf, %eax
cmpl $0x1, %eax
jne 0x5154e
movq %r14, %rdi
callq 0x4fc1c
testq %rax, %rax
jne 0x51566
incq %r13
movslq 0x38(%rbx), %rdx
leaq -0x1(%rdx), %rax
cmpq %rax, %r13
jl 0x514d9
testb $0x8, 0x98(%rbx)
jne 0x51541
movq 0x40(%rbx), %rsi
addq $0x8, %rsi
addl $-0x2, %edx
movq (%rsp), %rcx
movq %rbx, %rdi
xorl %r8d, %r8d
callq 0x50e96
jmp 0x51668
leaq 0xb5d68(%rip), %rax     # 0x1072b0
movq 0x58(%rax), %rsi
jmp 0x51559
leaq 0xb5d5b(%rip), %rax     # 0x1072b0
movq 0x70(%rax), %rsi
movq %rbx, %rdi
callq 0x3fc19
jmp 0x51668
movq %r14, %rdi
movl %ebp, %esi
callq 0x4fb96
testq %rax, %rax
je 0x51677
movq %rax, %r12
testl %ebp, %ebp
leaq 0x6e018(%rip), %rax     # 0xbf59d
leaq 0x6dff9(%rip), %r15     # 0xbf585
cmoveq %rax, %r15
movl $0x2, %esi
movq %rbx, %rdi
callq 0x4063b
movq 0x40(%rbx), %rax
movq (%rax,%r13,8), %rsi
movq %rbx, %rdi
callq 0x40537
movq %rbx, %rdi
movq %r12, %rsi
callq 0x40537
movq %r12, %rdi
callq 0x440f3
movq 0x10(%rbx), %rax
movq 0x40(%rbx), %rcx
movq (%rcx,%r13,8), %rdx
movl 0x30(%rax), %ecx
movl $0x10, %edi
movq %r15, %rsi
callq 0x800c9
movq %r14, %rdi
callq 0x4fc1c
testq %rax, %rax
jne 0x5161a
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq (%rax,%r13,8), %rsi
callq 0x452f3
movq 0x10(%rbx), %rax
movq 0x40(%rbx), %rcx
movq (%rcx,%r13,8), %rdx
movl 0x30(%rax), %ecx
leaq 0x6fea6(%rip), %rsi     # 0xc14b6
movl $0x4, %edi
callq 0x800c9
xorl %r14d, %r14d
testl %ebp, %ebp
sete %r14b
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq (%rax,%r13,8), %rsi
callq 0x45220
leaq 0xb521d(%rip), %rax     # 0x106858
incq 0x710(%rax)
leaq 0xb5c67(%rip), %rax     # 0x1072b0
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 0x42a6f
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x74d60(%rip), %rdi     # 0xc63de
leaq 0x74c37(%rip), %rsi     # 0xc62bc
movl $0x37a, %edx            # imm = 0x37A
callq 0x654e1
movl $0x1, %edi
callq 0x263d0