// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq -0x8(%rbp), %rcx
movl 0x38(%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rsi
leaq -0x20(%rbp), %rdx
xorl %ecx, %ecx
callq 0x9d6d0
cmpl $0x0, %eax
je 0x5b331
jmp 0x5b5c3
movl $0x1, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x8(%rbp), %rcx
movl 0x38(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x5b573
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x4a6f0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x5b563
movq -0x18(%rbp), %rax
movl (%rax), %eax
andl $0xf, %eax
cmpl $0x1, %eax
je 0x5b3a0
movq -0x8(%rbp), %rdi
leaq 0x11d8ae(%rip), %rax    # 0x178c40
movq 0x70(%rax), %rsi
callq 0x42cc0
jmp 0x5b5c3
movq -0x18(%rbp), %rdi
callq 0x59140
cmpq $0x0, %rax
je 0x5b55f
movl -0xc(%rbp), %edx
leaq 0xdc188(%rip), %rax     # 0x137545
leaq 0xdc199(%rip), %rcx     # 0x13755d
cmpl $0x0, %edx
cmoveq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x59090
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x5b3e8
jmp 0x5b40a
leaq 0xe26d7(%rip), %rdi     # 0x13dac6
leaq 0xe25ae(%rip), %rsi     # 0x13d9a4
movl $0x37a, %edx            # imm = 0x37A
callq 0x76ce0
movl $0x1, %edi
callq 0x263c0
movq -0x8(%rbp), %rdi
movl $0x2, %esi
callq 0x437f0
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x43630
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x43630
movq -0x38(%rbp), %rdi
callq 0x48f70
movq -0x30(%rbp), %rsi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl 0x30(%rax), %ecx
movl $0x10, %edi
callq 0x9ce20
movq -0x18(%rbp), %rdi
callq 0x59140
cmpq $0x0, %rax
jne 0x5b4c8
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x4ac10
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl 0x30(%rax), %ecx
movl $0x4, %edi
leaq 0xddfd5(%rip), %rsi     # 0x139498
callq 0x9ce20
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x4aa60
leaq 0x11ccec(%rip), %rax    # 0x1781d8
movq 0x720(%rax), %rcx
addq $0x1, %rcx
leaq 0x11ccda(%rip), %rax    # 0x1781d8
movq %rcx, 0x720(%rax)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpl $0x0, -0xc(%rbp)
jne 0x5b527
leaq 0x11d726(%rip), %rax    # 0x178c40
movq 0x138(%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0x5b539
leaq 0x11d712(%rip), %rax    # 0x178c40
movq 0x130(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rdx
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movl $0x2, %esi
movb $0x0, %al
callq 0x46840
jmp 0x5b5c3
jmp 0x5b561
jmp 0x5b563
jmp 0x5b565
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x5b338
movq -0x8(%rbp), %rax
movl 0x98(%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x5b59b
movq -0x8(%rbp), %rdi
leaq 0x11d6b0(%rip), %rax    # 0x178c40
movq 0x58(%rax), %rsi
callq 0x42cc0
jmp 0x5b5c3
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rsi
addq $0x8, %rsi
movq -0x8(%rbp), %rax
movl 0x38(%rax), %edx
subl $0x2, %edx
movq -0x20(%rbp), %rcx
xorl %eax, %eax
movl %eax, %r8d
callq 0x5aab0
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)