// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/t_list.c
// Function: serveClientBlockedOnList
int serveClientBlockedOnList(client *receiver, robj *key, robj *dstkey, redisDb *db, robj *value, int where)
{
    robj *argv[3];

    if (dstkey == NULL) {
        /* Propagate the [LR]POP operation. */
        argv[0] = (where == LIST_HEAD) ? shared.lpop :
                                          shared.rpop;
        argv[1] = key;
        propagate((where == LIST_HEAD) ?
            server.lpopCommand : server.rpopCommand,
            db->id,argv,2,PROPAGATE_AOF|PROPAGATE_REPL);

        /* BRPOP/BLPOP */
        addReplyMultiBulkLen(receiver,2);
        addReplyBulk(receiver,key);
        addReplyBulk(receiver,value);
    } else {
        /* BRPOPLPUSH */
        robj *dstobj =
            lookupKeyWrite(receiver->db,dstkey);
        if (!(dstobj &&
             checkType(receiver,dstobj,OBJ_LIST)))
        {
            /* Propagate the RPOP operation. */
            argv[0] = shared.rpop;
            argv[1] = key;
            propagate(server.rpopCommand,
                db->id,argv,2,
                PROPAGATE_AOF|
                PROPAGATE_REPL);
            rpoplpushHandlePush(receiver,dstkey,dstobj,
                value);
            /* Propagate the LPUSH operation. */
            argv[0] = shared.lpush;
            argv[1] = dstkey;
            argv[2] = value;
            propagate(server.lpushCommand,
                db->id,argv,3,
                PROPAGATE_AOF|
                PROPAGATE_REPL);
        } else {
            /* BRPOPLPUSH failed because of wrong
             * destination type. */
            return C_ERR;
        }
    }
    return C_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %rbx
movq %rcx, %r15
movq %rsi, %r12
movq %rdi, %r14
testq %rdx, %rdx
je 0x4dad0
movq %rdx, %r13
movq 0x10(%r14), %rdi
movq %rdx, %rsi
callq 0x41ad6
movq %rax, %rbp
testq %rax, %rax
je 0x4da39
movq %r14, %rdi
movq %rbp, %rsi
movl $0x1, %edx
callq 0x40d47
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
jne 0x4db4d
leaq 0xb48d0(%rip), %rax     # 0x102310
movq 0x130(%rax), %rax
movq %r15, %rcx
movq %rbx, %r15
movq %rsp, %rbx
movq %rax, (%rbx)
movq %r12, 0x8(%rbx)
leaq 0xb3e4a(%rip), %rax     # 0x1018a8
movq 0x360(%rax), %rdi
movl 0x30(%rcx), %esi
movq %rcx, %r12
movq %rbx, %rdx
movl $0x2, %ecx
movl $0x3, %r8d
callq 0x32d75
movq %r14, %rdi
movq %r13, %rsi
movq %rbp, %rdx
movq %r15, %rcx
callq 0x4d560
leaq 0xb487a(%rip), %rax     # 0x102310
movq 0x140(%rax), %rax
movq %rax, (%rbx)
movq %r13, 0x8(%rbx)
movq %r15, 0x10(%rbx)
leaq 0xb3df9(%rip), %rax     # 0x1018a8
movq 0x350(%rax), %rdi
movl 0x30(%r12), %esi
movq %rbx, %rdx
movl $0x3, %ecx
movl $0x3, %r8d
callq 0x32d75
jmp 0x4db4b
leaq 0xb4839(%rip), %rax     # 0x102310
leaq 0x138(%rax), %rcx
addq $0x130, %rax            # imm = 0x130
leaq 0xb3dbd(%rip), %rsi     # 0x1018a8
leaq 0x358(%rsi), %rdi
addq $0x360, %rsi            # imm = 0x360
testl %r9d, %r9d
cmoveq %rcx, %rax
movq (%rax), %rax
movq %rsp, %rdx
movq %rax, (%rdx)
movq %r12, 0x8(%rdx)
cmoveq %rdi, %rsi
movq (%rsi), %rdi
movl 0x30(%r15), %esi
movl $0x2, %ecx
movl $0x3, %r8d
callq 0x32d75
movl $0x2, %esi
movq %r14, %rdi
callq 0x3d274
movq %r14, %rdi
movq %r12, %rsi
callq 0x3d170
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3d170
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq