// File: /workspace/github_c_makefile_star2_O3/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 0xabffe(%rip), %rax     # 0x116230
xorl %ebx, %ebx
testb $0x2, 0x30(%rax)
jne 0x6a35b
leaq 0x97663(%rip), %r13     # 0x1018a8
movslq 0x610(%r13), %rax
cmpq $0x1, %rax
jle 0x6a27a
movq 0x28(%r13), %rcx
shlq $0x6, %rax
movl $0x40, %edx
movq (%rcx,%rdx), %rsi
movq 0x28(%rsi), %rdi
addq 0x48(%rsi), %rdi
jne 0x6a356
addq $0x40, %rdx
cmpq %rdx, %rax
jne 0x6a25f
leaq 0x5e36d(%rip), %rbx     # 0xc85ee
leaq 0x5e3a8(%rip), %r14     # 0xc8630
xorl %r15d, %r15d
xorl %ebp, %ebp
movl %r15d, %edi
callq 0x43ddd
testl %eax, %eax
je 0x6a30f
movq 0x9b0(%r13), %rcx
movq 0x40028(%rcx,%r15,8), %rax
cmpq 0xabf81(%rip), %rax     # 0x116230
je 0x6a30f
cmpq $0x0, 0x20028(%rcx,%r15,8)
jne 0x6a30f
incl %ebp
movl $0x3, %edi
testq %rax, %rax
je 0x6a2f0
movq %r14, %rsi
movl %r15d, %edx
xorl %eax, %eax
callq 0x2fdad
movq 0x9b0(%r13), %rax
movq 0x40028(%rax,%r15,8), %r12
addq $0x20028, %rax          # imm = 0x20028
movq %r12, (%rax,%r15,8)
jmp 0x6a30f
movq %rbx, %rsi
movl %r15d, %edx
xorl %eax, %eax
callq 0x2fdad
movq 0x9b0(%r13), %rax
cmpq $0x0, 0x40028(%rax,%r15,8)
je 0x6a321
incq %r15
cmpq $0x4000, %r15           # imm = 0x4000
jne 0x6a28d
jmp 0x6a344
movq 0xabf08(%rip), %r12     # 0x116230
movq %r12, %rdi
movl %r15d, %esi
callq 0x6a187
movq 0x9b0(%r13), %rax
movl $0x40028, %ecx          # imm = 0x40028
addq %rcx, %rax
jmp 0x6a2ea
xorl %ebx, %ebx
testl %ebp, %ebp
je 0x6a35b
movl $0x1, %edi
callq 0x65cb7
jmp 0x6a35b
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq