// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x0, -0x4(%rbp)
movl $0x60098, %edi          # imm = 0x60098
callq 0x3acd0
movq %rax, %rcx
leaq 0xfb095(%rip), %rax     # 0x1781d8
movq %rcx, 0x9b0(%rax)
leaq 0xfb087(%rip), %rax     # 0x1781d8
movq 0x9b0(%rax), %rax
movq $0x0, (%rax)
leaq 0xfb072(%rip), %rax     # 0x1781d8
movq 0x9b0(%rax), %rax
movq $0x0, 0x8(%rax)
leaq 0xfb05c(%rip), %rax     # 0x1781d8
movq 0x9b0(%rax), %rax
movl $0x1, 0x10(%rax)
leaq 0xfb047(%rip), %rax     # 0x1781d8
movq 0x9b0(%rax), %rax
movl $0x1, 0x14(%rax)
leaq 0xfb032(%rip), %rax     # 0x1781d8
movq 0x9b0(%rax), %rax
movl $0x0, 0x60080(%rax)
leaq 0xf9d72(%rip), %rdi     # 0x176f30
xorl %eax, %eax
movl %eax, %esi
callq 0x2d330
movq %rax, %rcx
leaq 0xfb007(%rip), %rax     # 0x1781d8
movq 0x9b0(%rax), %rax
movq %rcx, 0x18(%rax)
leaq 0xf9d7d(%rip), %rdi     # 0x176f60
xorl %eax, %eax
movl %eax, %esi
callq 0x2d330
movq %rax, %rcx
leaq 0xfafe2(%rip), %rax     # 0x1781d8
movq 0x9b0(%rax), %rax
movq %rcx, 0x20(%rax)
leaq 0xfafd0(%rip), %rax     # 0x1781d8
movq 0x9b0(%rax), %rax
movq $0x0, 0x60030(%rax)
leaq 0xfafb7(%rip), %rax     # 0x1781d8
movq 0x9b0(%rax), %rax
movl $0x0, 0x60038(%rax)
leaq 0xfaf9f(%rip), %rax     # 0x1781d8
movq 0x9b0(%rax), %rax
movl $0x0, 0x60040(%rax)
leaq 0xfaf87(%rip), %rax     # 0x1781d8
movq 0x9b0(%rax), %rax
movq $0x0, 0x60048(%rax)
leaq 0xfaf6e(%rip), %rax     # 0x1781d8
movq 0x9b0(%rax), %rax
movl $0x0, 0x60050(%rax)
leaq 0xfaf56(%rip), %rax     # 0x1781d8
movq 0x9b0(%rax), %rax
movq $0x0, 0x60078(%rax)
leaq 0xfaf3d(%rip), %rax     # 0x1781d8
movq 0x9b0(%rax), %rax
movq $0x0, 0x60088(%rax)
leaq 0xfaf24(%rip), %rax     # 0x1781d8
movq 0x9b0(%rax), %rax
movq $0x0, 0x60090(%rax)
leaq 0xfaf0b(%rip), %rax     # 0x1781d8
movq 0x9b0(%rax), %rdi
addq $0x40028, %rdi          # imm = 0x40028
xorl %esi, %esi
movl $0x20000, %edx          # imm = 0x20000
callq 0x26110
callq 0x7d4f0
leaq 0xfaee5(%rip), %rax     # 0x1781d8
movq 0x9a8(%rax), %rdi
callq 0x7d030
cmpl $-0x1, %eax
jne 0x7d30e
movl $0x1, %edi
callq 0x262d0
leaq 0xfaec3(%rip), %rax     # 0x1781d8
movq 0x9a8(%rax), %rdi
callq 0x7be20
cmpl $-0x1, %eax
jne 0x7d37d
xorl %eax, %eax
movl %eax, %edi
movl $0x11, %esi
callq 0x7c890
leaq 0xfae9d(%rip), %rcx     # 0x1781d8
movq 0x9b0(%rcx), %rcx
movq %rax, (%rcx)
movq %rax, 0x10f814(%rip)    # 0x18cb60
movq 0x10f80d(%rip), %rdx    # 0x18cb60
addq $0x8, %rdx
movl $0x2, %edi
leaq 0xc4624(%rip), %rsi     # 0x141987
movb $0x0, %al
callq 0x2fc60
movq 0x10f7ef(%rip), %rdi    # 0x18cb60
callq 0x7ca30
movl $0x1, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
je 0x7d38d
movl $0x1, %edi
callq 0x7cff0
leaq 0xfae44(%rip), %rax     # 0x1781d8
movl $0x0, 0x1c4(%rax)
leaq 0xfae33(%rip), %rax     # 0x1781d8
cmpl $0xd8ef, 0xa0(%rax)     # imm = 0xD8EF
jle 0x7d3ce
movl $0x3, %edi
leaq 0xc45f4(%rip), %rsi     # 0x1419b1
movb $0x0, %al
callq 0x2fc60
movl $0x1, %edi
callq 0x262d0
leaq 0xfae03(%rip), %rax     # 0x1781d8
movl 0xa0(%rax), %edi
addl $0x2710, %edi           # imm = 0x2710
leaq 0xfadf0(%rip), %rdx     # 0x1781d8
movq %rdx, %rsi
addq $0x184, %rsi            # imm = 0x184
addq $0x1c4, %rdx            # imm = 0x1C4
callq 0x32d10
cmpl $-0x1, %eax
jne 0x7d40d
movl $0x1, %edi
callq 0x262d0
movl $0x0, -0x8(%rbp)
movl -0x8(%rbp), %eax
leaq 0xfadba(%rip), %rcx     # 0x1781d8
cmpl 0x1c4(%rcx), %eax
jge 0x7d48d
leaq 0xfadab(%rip), %rax     # 0x1781d8
movq 0x40(%rax), %rdi
movslq -0x8(%rbp), %rcx
leaq 0xfad9c(%rip), %rax     # 0x1781d8
movl 0x184(%rax,%rcx,4), %esi
movl $0x1, %edx
leaq 0xf1(%rip), %rcx        # 0x7d540
xorl %eax, %eax
movl %eax, %r8d
callq 0x2a8f0
cmpl $-0x1, %eax
jne 0x7d480
leaq 0xc45e8(%rip), %rdi     # 0x141a4d
leaq 0xc432a(%rip), %rsi     # 0x141796
movl $0x1d0, %edx            # imm = 0x1D0
callq 0x76d80
movl $0x1, %edi
callq 0x263c0
jmp 0x7d482
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x7d414
jmp 0x7d48f
callq 0x5dfb0
movq %rax, %rcx
leaq 0xfad3a(%rip), %rax     # 0x1781d8
movq 0x9b0(%rax), %rax
movq %rcx, 0x60028(%rax)
leaq 0xfad25(%rip), %rax     # 0x1781d8
movl 0xa0(%rax), %ecx
movq 0x10f6a0(%rip), %rax    # 0x18cb60
movl %ecx, 0x8c0(%rax)
leaq 0xfad0b(%rip), %rax     # 0x1781d8
movq 0x9b0(%rax), %rax
movq $0x0, 0x60058(%rax)
callq 0x7d670
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)