// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: verifyClusterConfigWithData
int verifyClusterConfigWithData(void) {
    int j;
    int update_config = 0;

    /* If this node is a slave, don't perform the check at all as we
     * completely depend on the replication stream. */
    if (nodeIsSlave(myself)) return C_OK;

    /* Make sure we only have keys in DB0. */
    for (j = 1; j < server.dbnum; j++) {
        if (dictSize(server.db[j].dict)) return C_ERR;
    }

    /* Check that all the slots we see populated memory have a corresponding
     * entry in the cluster table. Otherwise fix the table. */
    for (j = 0; j < CLUSTER_SLOTS; j++) {
        if (!countKeysInSlot(j)) continue; /* No keys in this slot. */
        /* Check if we are assigned to this slot or if we are importing it.
         * In both cases check the next slot as the configuration makes
         * sense. */
        if (server.cluster->slots[j] == myself ||
            server.cluster->importing_slots_from[j] != NULL) continue;

        /* If we are here data and cluster config don't agree, and we have
         * slot 'j' populated even if we are not importing it, nor we are
         * assigned to this slot. Fix this condition. */

        update_config++;
        /* Case A: slot is unassigned. Take responsibility for it. */
        if (server.cluster->slots[j] == NULL) {
            serverLog(LL_WARNING, "I have keys for unassigned slot %d. "
                                    "Taking responsibility for it.",j);
            clusterAddSlot(myself,j);
        } else {
            serverLog(LL_WARNING, "I have keys for slot %d, but the slot is "
                                    "assigned to another node. "
                                    "Setting it to importing state.",j);
            server.cluster->importing_slots_from[j] = server.cluster->slots[j];
        }
    }
    if (update_config) clusterSaveConfigOrDie(1);
    return C_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0xaed65(%rip), %rax     # 0x10e230
xorl %ebx, %ebx
testb $0x2, 0x30(%rax)
jne 0x5f5ca
leaq 0x9a3ca(%rip), %r12     # 0xf98a8
movslq 0x610(%r12), %rax
movq 0x28(%r12), %rcx
addq $0x40, %rcx
xorl %edx, %edx
pushq $-0x1
popq %rbx
incq %rdx
cmpq %rax, %rdx
jge 0x5f512
movq (%rcx), %rsi
addq $0x40, %rcx
movq 0x28(%rsi), %rdi
addq 0x48(%rsi), %rdi
je 0x5f4f4
jmp 0x5f5ca
leaq 0x5a0bd(%rip), %rbx     # 0xb95d6
pushq $0x3
popq %rbp
leaq 0x5a0f5(%rip), %r14     # 0xb9618
xorl %r15d, %r15d
xorl %r13d, %r13d
cmpq $0x4000, %r15           # imm = 0x4000
je 0x5f5bb
movl %r15d, %edi
callq 0x3cb9a
testl %eax, %eax
je 0x5f5b3
movq 0x9b0(%r12), %rcx
movq 0x40028(%rcx,%r15,8), %rax
cmpq 0xaecd7(%rip), %rax     # 0x10e230
je 0x5f5b3
cmpq $0x0, 0x20028(%rcx,%r15,8)
jne 0x5f5b3
incl %r13d
movl %ebp, %edi
testq %rax, %rax
je 0x5f597
movq %r14, %rsi
movl %r15d, %edx
xorl %eax, %eax
callq 0x2b699
movq 0x9b0(%r12), %rax
movq 0x40028(%rax,%r15,8), %rcx
movq %rcx, 0x20028(%rax,%r15,8)
jmp 0x5f5b3
movq %rbx, %rsi
movl %r15d, %edx
xorl %eax, %eax
callq 0x2b699
movq 0xaec85(%rip), %rdi     # 0x10e230
movl %r15d, %esi
callq 0x5b377
incq %r15
jmp 0x5f529
xorl %ebx, %ebx
testl %r13d, %r13d
je 0x5f5ca
pushq $0x1
popq %rdi
callq 0x5b635
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq