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

    server.cluster = zmalloc(sizeof(clusterState));
    server.cluster->myself = NULL;
    server.cluster->currentEpoch = 0;
    server.cluster->state = CLUSTER_FAIL;
    server.cluster->size = 1;
    server.cluster->todo_before_sleep = 0;
    server.cluster->nodes = dictCreate(&clusterNodesDictType,NULL);
    server.cluster->nodes_black_list =
        dictCreate(&clusterNodesBlackListDictType,NULL);
    server.cluster->failover_auth_time = 0;
    server.cluster->failover_auth_count = 0;
    server.cluster->failover_auth_rank = 0;
    server.cluster->failover_auth_epoch = 0;
    server.cluster->cant_failover_reason = CLUSTER_CANT_FAILOVER_NONE;
    server.cluster->lastVoteEpoch = 0;
    server.cluster->stats_bus_messages_sent = 0;
    server.cluster->stats_bus_messages_received = 0;
    memset(server.cluster->slots,0, sizeof(server.cluster->slots));
    clusterCloseAllSlots();

    /* Lock the cluster config file to make sure every node uses
     * its own nodes.conf. */
    if (clusterLockConfig(server.cluster_configfile) == C_ERR)
        exit(1);

    /* Load or create a new nodes configuration. */
    if (clusterLoadConfig(server.cluster_configfile) == C_ERR) {
        /* No configuration found. We will just use the random name provided
         * by the createClusterNode() function. */
        myself = server.cluster->myself =
            createClusterNode(NULL,CLUSTER_NODE_MYSELF|CLUSTER_NODE_MASTER);
        serverLog(LL_NOTICE,"No cluster configuration found, I'm %.40s",
            myself->name);
        clusterAddNode(myself);
        saveconf = 1;
    }
    if (saveconf) clusterSaveConfigOrDie(1);

    /* We need a listening TCP port for our cluster messaging needs. */
    server.cfd_count = 0;

    /* Port sanity check II
     * The other handshake port check is triggered too late to stop
     * us from trying to use a too-high cluster port number. */
    if (server.port > (65535-CLUSTER_PORT_INCR)) {
        serverLog(LL_WARNING, "Redis port number too high. "
                   "Cluster communication port is 10,000 port "
                   "numbers higher than your Redis port. "
                   "Your Redis port number must be "
                   "lower than 55535.");
        exit(1);
    }

    if (listenToPort(server.port+CLUSTER_PORT_INCR,
        server.cfd,&server.cfd_count) == C_ERR)
    {
        exit(1);
    } else {
        int j;

        for (j = 0; j < server.cfd_count; j++) {
            if (aeCreateFileEvent(server.el, server.cfd[j], AE_READABLE,
                clusterAcceptHandler, NULL) == AE_ERR)
                    serverPanic("Unrecoverable error creating Redis Cluster "
                                "file event.");
        }
    }

    /* The slots -> keys map is a sorted set. Init it. */
    server.cluster->slots_to_keys = zslCreate();

    /* Set myself->port to my listening port, we'll just need to discover
     * the IP address via MEET messages. */
    myself->port = server.port;

    server.cluster->mf_end = 0;
    resetManualFailover();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl $0x60098, %edi          # imm = 0x60098
callq 0x327b9
leaq 0x9e190(%rip), %r14     # 0xf98a8
movq %rax, 0x9b0(%r14)
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, 0x10(%rax)
andl $0x0, 0x60080(%rax)
leaq 0x9d7ef(%rip), %rdi     # 0xf8f30
xorl %esi, %esi
callq 0x2a155
movq 0x9b0(%r14), %rcx
movq %rax, 0x18(%rcx)
leaq 0x9d806(%rip), %rdi     # 0xf8f60
xorl %esi, %esi
callq 0x2a155
movq 0x9b0(%r14), %rbx
movq %rax, 0x20(%rbx)
andq $0x0, 0x60030(%rbx)
andl $0x0, 0x60038(%rbx)
andl $0x0, 0x60040(%rbx)
andq $0x0, 0x60048(%rbx)
andl $0x0, 0x60050(%rbx)
andq $0x0, 0x60078(%rbx)
leaq 0x40028(%rbx), %rdi
movl $0x20000, %edx          # imm = 0x20000
xorl %esi, %esi
callq 0x26110
leaq 0x28(%rbx), %rdi
movl $0x20000, %edx          # imm = 0x20000
xorl %esi, %esi
callq 0x26110
xorps %xmm0, %xmm0
movups %xmm0, 0x60088(%rbx)
movl $0x20028, %edi          # imm = 0x20028
addq 0x9b0(%r14), %rdi
movl $0x20000, %edx          # imm = 0x20000
xorl %esi, %esi
callq 0x26110
movq 0x9a8(%r14), %rdi
callq 0x5b65b
cmpl $-0x1, %eax
je 0x5b92e
movq 0x9a8(%r14), %rdi
callq 0x5abb8
cmpl $-0x1, %eax
jne 0x5b848
pushq $0x11
popq %rsi
xorl %edi, %edi
callq 0x5b208
movq 0x9b0(%r14), %rcx
movq %rax, (%rcx)
movq %rax, 0xb2a11(%rip)     # 0x10e230
leaq 0x8(%rax), %rdx
leaq 0x5d0c4(%rip), %rsi     # 0xb88ee
pushq $0x2
popq %rdi
xorl %eax, %eax
callq 0x2b699
movq 0xb29f5(%rip), %rdi     # 0x10e230
callq 0x5b2c3
pushq $0x1
popq %rdi
callq 0x5b635
andl $0x0, 0x1c4(%r14)
movl 0xa0(%r14), %edi
cmpl $0xd8f0, %edi           # imm = 0xD8F0
jge 0x5b91d
addl $0x2710, %edi           # imm = 0x2710
leaq 0x184(%r14), %rsi
leaq 0x1c4(%r14), %rdx
callq 0x2d7ff
cmpl $-0x1, %eax
je 0x5b92e
xorl %r15d, %r15d
leaq 0xdf(%rip), %rbx        # 0x5b96e
pushq $0x1
popq %rbp
movslq 0x1c4(%r14), %rax
cmpq %rax, %r15
jge 0x5b8df
movq 0x40(%r14), %rdi
movl 0x184(%r14,%r15,4), %esi
movl %ebp, %edx
movq %rbx, %rcx
xorl %r8d, %r8d
callq 0x28ae8
incq %r15
cmpl $-0x1, %eax
jne 0x5b892
leaq 0x5d0ee(%rip), %rdi     # 0xb89b4
leaq 0x5ce30(%rip), %rsi     # 0xb86fd
movl $0x1d0, %edx            # imm = 0x1D0
callq 0x57b45
pushq $0x1
popq %rdi
callq 0x263c0
callq 0x478ee
movq 0x9b0(%r14), %rcx
movq %rax, 0x60028(%rcx)
movl 0xa0(%r14), %eax
movq 0xb2930(%rip), %rdx     # 0x10e230
movl %eax, 0x8c0(%rdx)
andq $0x0, 0x60058(%rcx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5ba74
leaq 0x5cff4(%rip), %rsi     # 0xb8918
pushq $0x3
popq %rdi
xorl %eax, %eax
callq 0x2b699
pushq $0x1
popq %rdi
callq 0x262c0