// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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 0xad459(%rip), %rax     # 0x11b1d0
xorl %ebx, %ebx
testb $0x2, 0x30(%rax)
jne 0x6dea0
leaq 0x98ace(%rip), %r13     # 0x106858
movslq 0x600(%r13), %rax
cmpq $0x1, %rax
jle 0x6ddbf
movq 0x28(%r13), %rcx
shlq $0x6, %rax
movl $0x40, %edx
movq (%rcx,%rdx), %rsi
movq 0x28(%rsi), %rdi
addq 0x48(%rsi), %rdi
jne 0x6de9b
addq $0x40, %rdx
cmpq %rdx, %rax
jne 0x6dda4
leaq 0x5d7a0(%rip), %rbx     # 0xcb566
leaq 0x5d7db(%rip), %r14     # 0xcb5a8
xorl %r15d, %r15d
xorl %ebp, %ebp
movl %r15d, %edi
callq 0x46fe3
testl %eax, %eax
je 0x6de54
movq 0x9a0(%r13), %rcx
movq 0x40028(%rcx,%r15,8), %rax
cmpq 0xad3dc(%rip), %rax     # 0x11b1d0
je 0x6de54
cmpq $0x0, 0x20028(%rcx,%r15,8)
jne 0x6de54
incl %ebp
movl $0x3, %edi
testq %rax, %rax
je 0x6de35
movq %r14, %rsi
movl %r15d, %edx
xorl %eax, %eax
callq 0x32ea6
movq 0x9a0(%r13), %rax
movq 0x40028(%rax,%r15,8), %r12
addq $0x20028, %rax          # imm = 0x20028
movq %r12, (%rax,%r15,8)
jmp 0x6de54
movq %rbx, %rsi
movl %r15d, %edx
xorl %eax, %eax
callq 0x32ea6
movq 0x9a0(%r13), %rax
cmpq $0x0, 0x40028(%rax,%r15,8)
je 0x6de66
incq %r15
cmpq $0x4000, %r15           # imm = 0x4000
jne 0x6ddd2
jmp 0x6de89
movq 0xad363(%rip), %r12     # 0x11b1d0
movq %r12, %rdi
movl %r15d, %esi
callq 0x6dccc
movq 0x9a0(%r13), %rax
movl $0x40028, %ecx          # imm = 0x40028
addq %rcx, %rax
jmp 0x6de2f
xorl %ebx, %ebx
testl %ebp, %ebp
je 0x6dea0
movl $0x1, %edi
callq 0x6992e
jmp 0x6dea0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq