// File: /workspace/github_c_makefile_star2_O2/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 0x7001c
testl %eax, %eax
jne 0x45b5f
pushq $0x1
popq %r13
movslq 0x38(%rbx), %rdx
leaq -0x1(%rdx), %rax
cmpq %rax, %r13
jge 0x45a14
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq (%rax,%r13,8), %rsi
callq 0x3aec2
testq %rax, %rax
je 0x45a0f
movq %rax, %r14
movl (%rax), %eax
andl $0xf, %eax
cmpl $0x1, %eax
jne 0x45a40
movq %r14, %rdi
callq 0x4427e
testq %rax, %rax
jne 0x45a50
incq %r13
jmp 0x459d2
testb $0x8, 0x98(%rbx)
jne 0x45b4c
movq 0x40(%rbx), %rsi
addq $0x8, %rsi
addl $-0x2, %edx
movq (%rsp), %rcx
movq %rbx, %rdi
xorl %r8d, %r8d
callq 0x453e9
jmp 0x45b5f
leaq 0xb48c9(%rip), %rax     # 0xfa310
movq 0x70(%rax), %rsi
jmp 0x45b57
movq %r14, %rdi
movl %ebp, %esi
callq 0x44201
testq %rax, %rax
je 0x45b6e
movq %rax, %r12
testl %ebp, %ebp
leaq 0x68a6e(%rip), %rax     # 0xae4dd
leaq 0x68a4f(%rip), %r15     # 0xae4c5
cmoveq %rax, %r15
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x370d9
movq 0x40(%rbx), %rax
movq (%rax,%r13,8), %rsi
movq %rbx, %rdi
callq 0x36fd9
movq %rbx, %rdi
movq %r12, %rsi
callq 0x36fd9
movq %r12, %rdi
callq 0x3a265
movq 0x10(%rbx), %rax
movq 0x40(%rbx), %rcx
movq (%rcx,%r13,8), %rdx
movl 0x30(%rax), %ecx
pushq $0x10
popq %rdi
movq %r15, %rsi
callq 0x6fb58
movq %r14, %rdi
callq 0x4427e
testq %rax, %rax
jne 0x45afe
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq (%rax,%r13,8), %rsi
callq 0x3b1df
movq 0x10(%rbx), %rax
movq 0x40(%rbx), %rcx
movq (%rcx,%r13,8), %rdx
movl 0x30(%rax), %ecx
leaq 0x6a922(%rip), %rsi     # 0xb0418
pushq $0x4
popq %rdi
callq 0x6fb58
xorl %r14d, %r14d
testl %ebp, %ebp
sete %r14b
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq (%rax,%r13,8), %rsi
callq 0x3b125
leaq 0xb3d89(%rip), %rax     # 0xf98a8
incq 0x720(%rax)
leaq 0xb47e3(%rip), %rax     # 0xfa310
movq 0x130(%rax,%r14,8), %rdx
movq 0x40(%rbx), %rax
movq (%rax,%r13,8), %rcx
pushq $0x2
popq %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x38eb8
jmp 0x45b5f
leaq 0xb47bd(%rip), %rax     # 0xfa310
movq 0x58(%rax), %rsi
movq %rbx, %rdi
callq 0x36987
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6ee7d(%rip), %rdi     # 0xb49f2
leaq 0x6ed54(%rip), %rsi     # 0xb48d0
movl $0x37a, %edx            # imm = 0x37A
callq 0x57ac8
pushq $0x1
popq %rdi
callq 0x263c0