// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterRedirectBlockedClientIfNeeded
int clusterRedirectBlockedClientIfNeeded(client *c) {
    if (c->flags & CLIENT_BLOCKED && c->btype == BLOCKED_LIST) {
        dictEntry *de;
        dictIterator *di;

        /* If the cluster is down, unblock the client with the right error. */
        if (server.cluster->state == CLUSTER_FAIL) {
            clusterRedirectClient(c,NULL,0,CLUSTER_REDIR_DOWN_STATE);
            return 1;
        }

        /* All keys must belong to the same slot, so check first key only. */
        di = dictGetIterator(c->bpop.keys);
        if ((de = dictNext(di)) != NULL) {
            robj *key = dictGetKey(de);
            int slot = keyHashSlot((char*)key->ptr, sdslen(key->ptr));
            clusterNode *node = server.cluster->slots[slot];

            /* We send an error and unblock the client if:
             * 1) The slot is unassigned, emitting a cluster down error.
             * 2) The slot is not handled by this node, nor being imported. */
            if (node != myself &&
                server.cluster->importing_slots_from[slot] == NULL)
            {
                if (node == NULL) {
                    clusterRedirectClient(c,NULL,0,
                        CLUSTER_REDIR_DOWN_UNBOUND);
                } else {
                    clusterRedirectClient(c,node,slot,
                        CLUSTER_REDIR_MOVED);
                }
                dictReleaseIterator(di);
                return 1;
            }
        }
        dictReleaseIterator(di);
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl 0x98(%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x8763b
movq -0x10(%rbp), %rax
cmpl $0x1, 0x168(%rax)
jne 0x8763b
leaq 0xf0cbe(%rip), %rax     # 0x1781d8
movq 0x9b0(%rax), %rax
cmpl $0x1, 0x10(%rax)
jne 0x87547
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
movl $0x5, %ecx
callq 0x87380
movl $0x1, -0x4(%rbp)
jmp 0x87642
movq -0x10(%rbp), %rax
movq 0x178(%rax), %rdi
callq 0x2e400
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x2e4a0
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0x87632
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x7cf60
movq -0x40(%rbp), %rdi
movl %eax, %esi
callq 0x7df10
movl %eax, -0x2c(%rbp)
leaq 0xf0c2d(%rip), %rax     # 0x1781d8
movq 0x9b0(%rax), %rax
movslq -0x2c(%rbp), %rcx
movq 0x40028(%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpq 0x105593(%rip), %rax    # 0x18cb60
je 0x87630
leaq 0xf0c02(%rip), %rax     # 0x1781d8
movq 0x9b0(%rax), %rax
movslq -0x2c(%rbp), %rcx
cmpq $0x0, 0x20028(%rax,%rcx,8)
jne 0x87630
cmpq $0x0, -0x38(%rbp)
jne 0x87609
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
movl $0x6, %ecx
callq 0x87380
jmp 0x8761e
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
movl -0x2c(%rbp), %edx
movl $0x4, %ecx
callq 0x87380
movq -0x20(%rbp), %rdi
callq 0x2e600
movl $0x1, -0x4(%rbp)
jmp 0x87642
jmp 0x87632
movq -0x20(%rbp), %rdi
callq 0x2e600
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)