// File: /workspace/github_c_makefile_star2_O0/erikdubbelboer[P]discnt/src/cluster.c
// Function: clusterInit
void clusterInit(void) {
    int saveconf = 0;

    server.cluster = zmalloc(sizeof(clusterState));
    server.cluster->myself = NULL;
    server.cluster->state = CLUSTER_OK;
    server.cluster->size = 1;
    server.cluster->todo_before_sleep = 0;
    server.cluster->nodes = dictCreate(&clusterNodesDictType,NULL);
    server.cluster->deleted_nodes = dictCreate(&clusterNodesDictType,NULL);
    server.cluster->nodes_black_list =
        dictCreate(&clusterNodesBlackListDictType,NULL);
    server.cluster->stats_bus_messages_sent = 0;
    server.cluster->stats_bus_messages_received = 0;
    server.cluster->reachable_nodes = NULL;
    server.cluster->reachable_nodes_count = 0;

    /* 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);
        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, "Discnt port number too high. "
                   "Cluster communication port is 10,000 port "
                   "numbers higher than your Discnt node port. "
                   "Your Discnt node 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 Discnt Cluster "
                                "Bus file event.");
        }
    }

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

    /* Update state and list of reachable nodes. */
    clusterUpdateState();
    clusterUpdateReachableNodes();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x0, -0x4(%rbp)
movl $0x50, %edi
callq 0x20a00
movq %rax, %rcx
leaq 0x8cda5(%rip), %rax     # 0xbf0e8
movq %rcx, 0x668(%rax)
leaq 0x8cd97(%rip), %rax     # 0xbf0e8
movq 0x668(%rax), %rax
movq $0x0, (%rax)
leaq 0x8cd82(%rip), %rax     # 0xbf0e8
movq 0x668(%rax), %rax
movl $0x0, 0x8(%rax)
leaq 0x8cd6d(%rip), %rax     # 0xbf0e8
movq 0x668(%rax), %rax
movl $0x1, 0xc(%rax)
leaq 0x8cd58(%rip), %rax     # 0xbf0e8
movq 0x668(%rax), %rax
movl $0x0, 0x28(%rax)
leaq 0x8c99b(%rip), %rdi     # 0xbed40
xorl %eax, %eax
movl %eax, %esi
callq 0x16120
movq %rax, %rcx
leaq 0x8cd30(%rip), %rax     # 0xbf0e8
movq 0x668(%rax), %rax
movq %rcx, 0x10(%rax)
leaq 0x8c976(%rip), %rdi     # 0xbed40
xorl %eax, %eax
movl %eax, %esi
callq 0x16120
movq %rax, %rcx
leaq 0x8cd0b(%rip), %rax     # 0xbf0e8
movq 0x668(%rax), %rax
movq %rcx, 0x18(%rax)
leaq 0x8c981(%rip), %rdi     # 0xbed70
xorl %eax, %eax
movl %eax, %esi
callq 0x16120
movq %rax, %rcx
leaq 0x8cce6(%rip), %rax     # 0xbf0e8
movq 0x668(%rax), %rax
movq %rcx, 0x20(%rax)
leaq 0x8ccd4(%rip), %rax     # 0xbf0e8
movq 0x668(%rax), %rax
movq $0x0, 0x40(%rax)
leaq 0x8ccbe(%rip), %rax     # 0xbf0e8
movq 0x668(%rax), %rax
movq $0x0, 0x48(%rax)
leaq 0x8cca8(%rip), %rax     # 0xbf0e8
movq 0x668(%rax), %rax
movq $0x0, 0x30(%rax)
leaq 0x8cc92(%rip), %rax     # 0xbf0e8
movq 0x668(%rax), %rax
movl $0x0, 0x38(%rax)
leaq 0x8cc7d(%rip), %rax     # 0xbf0e8
movq 0x660(%rax), %rdi
callq 0x32230
cmpl $-0x1, %eax
jne 0x32486
movl $0x1, %edi
callq 0x12870
leaq 0x8cc5b(%rip), %rax     # 0xbf0e8
movq 0x660(%rax), %rdi
callq 0x31750
cmpl $-0x1, %eax
jne 0x324f1
xorl %eax, %eax
movl %eax, %edi
movl $0x4, %esi
callq 0x31d90
leaq 0x8cc35(%rip), %rcx     # 0xbf0e8
movq 0x668(%rcx), %rcx
movq %rax, (%rcx)
movq %rax, 0xa113c(%rip)     # 0xd3600
movq 0xa1135(%rip), %rdx     # 0xd3600
movl $0x2, %edi
leaq 0x74fb0(%rip), %rsi     # 0xa7487
movb $0x0, %al
callq 0x18b10
movq 0xa111b(%rip), %rdi     # 0xd3600
callq 0x31e80
movl $0x1, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
je 0x32501
movl $0x1, %edi
callq 0x321f0
leaq 0x8cbe0(%rip), %rax     # 0xbf0e8
movl $0x0, 0x1dc(%rax)
leaq 0x8cbcf(%rip), %rax     # 0xbf0e8
cmpl $0xd8ef, 0xb4(%rax)     # imm = 0xD8EF
jle 0x32542
movl $0x3, %edi
leaq 0x74f80(%rip), %rsi     # 0xa74b1
movb $0x0, %al
callq 0x18b10
movl $0x1, %edi
callq 0x12870
leaq 0x8cb9f(%rip), %rax     # 0xbf0e8
movl 0xb4(%rax), %edi
addl $0x2710, %edi           # imm = 0x2710
leaq 0x8cb8c(%rip), %rdx     # 0xbf0e8
movq %rdx, %rsi
addq $0x19c, %rsi            # imm = 0x19C
addq $0x1dc, %rdx            # imm = 0x1DC
callq 0x1ad70
cmpl $-0x1, %eax
jne 0x32581
movl $0x1, %edi
callq 0x12870
movl $0x0, -0x8(%rbp)
movl -0x8(%rbp), %eax
leaq 0x8cb56(%rip), %rcx     # 0xbf0e8
cmpl 0x1dc(%rcx), %eax
jge 0x32601
leaq 0x8cb47(%rip), %rax     # 0xbf0e8
movq 0x38(%rax), %rdi
movslq -0x8(%rbp), %rcx
leaq 0x8cb38(%rip), %rax     # 0xbf0e8
movl 0x19c(%rax,%rcx,4), %esi
movl $0x1, %edx
leaq 0x6d(%rip), %rcx        # 0x32630
xorl %eax, %eax
movl %eax, %r8d
callq 0x137d0
cmpl $-0x1, %eax
jne 0x325f4
leaq 0x74f81(%rip), %rdi     # 0xa755a
leaq 0x74cdd(%rip), %rsi     # 0xa72bd
movl $0x180, %edx            # imm = 0x180
callq 0x304a0
movl $0x1, %edi
callq 0x12100
jmp 0x325f6
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x32588
jmp 0x32603
leaq 0x8cade(%rip), %rax     # 0xbf0e8
movl 0xb4(%rax), %ecx
movq 0xa0fe9(%rip), %rax     # 0xd3600
movl %ecx, 0x80(%rax)
callq 0x32740
callq 0x327f0
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)