// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterCron
void clusterCron(void) {
    dictIterator *di;
    dictEntry *de;
    int update_state = 0;
    int orphaned_masters; /* How many masters there are without ok slaves. */
    int max_slaves; /* Max number of ok slaves for a single master. */
    int this_slaves; /* Number of ok slaves for our master (if we are slave). */
    mstime_t min_pong = 0, now = mstime();
    clusterNode *min_pong_node = NULL;
    static unsigned long long iteration = 0;
    mstime_t handshake_timeout;

    iteration++; /* Number of times this function was called so far. */

    /* The handshake timeout is the time after which a handshake node that was
     * not turned into a normal node is removed from the nodes. Usually it is
     * just the NODE_TIMEOUT value, but when NODE_TIMEOUT is too small we use
     * the value of 1 second. */
    handshake_timeout = server.cluster_node_timeout;
    if (handshake_timeout < 1000) handshake_timeout = 1000;

    /* Check if we have disconnected nodes and re-establish the connection. */
    di = dictGetSafeIterator(server.cluster->nodes);
    while((de = dictNext(di)) != NULL) {
        clusterNode *node = dictGetVal(de);

        if (node->flags & (CLUSTER_NODE_MYSELF|CLUSTER_NODE_NOADDR)) continue;

        /* A Node in HANDSHAKE state has a limited lifespan equal to the
         * configured node timeout. */
        if (nodeInHandshake(node) && now - node->ctime > handshake_timeout) {
            clusterDelNode(node);
            continue;
        }

        if (node->link == NULL) {
            int fd;
            mstime_t old_ping_sent;
            clusterLink *link;

            fd = anetTcpNonBlockBindConnect(server.neterr, node->ip,
                node->port+CLUSTER_PORT_INCR, NET_FIRST_BIND_ADDR);
            if (fd == -1) {
                /* We got a synchronous error from connect before
                 * clusterSendPing() had a chance to be called.
                 * If node->ping_sent is zero, failure detection can't work,
                 * so we claim we actually sent a ping now (that will
                 * be really sent as soon as the link is obtained). */
                if (node->ping_sent == 0) node->ping_sent = mstime();
                serverLog(LL_DEBUG, "Unable to connect to "
                    "Cluster Node [%s]:%d -> %s", node->ip,
                    node->port+CLUSTER_PORT_INCR,
                    server.neterr);
                continue;
            }
            link = createClusterLink(node);
            link->fd = fd;
            node->link = link;
            aeCreateFileEvent(server.el,link->fd,AE_READABLE,
                    clusterReadHandler,link);
            /* Queue a PING in the new connection ASAP: this is crucial
             * to avoid false positives in failure detection.
             *
             * If the node is flagged as MEET, we send a MEET message instead
             * of a PING one, to force the receiver to add us in its node
             * table. */
            old_ping_sent = node->ping_sent;
            clusterSendPing(link, node->flags & CLUSTER_NODE_MEET ?
                    CLUSTERMSG_TYPE_MEET : CLUSTERMSG_TYPE_PING);
            if (old_ping_sent) {
                /* If there was an active ping before the link was
                 * disconnected, we want to restore the ping time, otherwise
                 * replaced by the clusterSendPing() call. */
                node->ping_sent = old_ping_sent;
            }
            /* We can clear the flag after the first packet is sent.
             * If we'll never receive a PONG, we'll never send new packets
             * to this node. Instead after the PONG is received and we
             * are no longer in meet/handshake status, we want to send
             * normal PING packets. */
            node->flags &= ~CLUSTER_NODE_MEET;

            serverLog(LL_DEBUG,"Connecting with Node %.40s at %s:%d",
                    node->name, node->ip, node->port+CLUSTER_PORT_INCR);
        }
    }
    dictReleaseIterator(di);

    /* Ping some random node 1 time every 10 iterations, so that we usually ping
     * one random node every second. */
    if (!(iteration % 10)) {
        int j;

        /* Check a few random nodes and ping the one with the oldest
         * pong_received time. */
        for (j = 0; j < 5; j++) {
            de = dictGetRandomKey(server.cluster->nodes);
            clusterNode *this = dictGetVal(de);

            /* Don't ping nodes disconnected or with a ping currently active. */
            if (this->link == NULL || this->ping_sent != 0) continue;
            if (this->flags & (CLUSTER_NODE_MYSELF|CLUSTER_NODE_HANDSHAKE))
                continue;
            if (min_pong_node == NULL || min_pong > this->pong_received) {
                min_pong_node = this;
                min_pong = this->pong_received;
            }
        }
        if (min_pong_node) {
            serverLog(LL_DEBUG,"Pinging node %.40s", min_pong_node->name);
            clusterSendPing(min_pong_node->link, CLUSTERMSG_TYPE_PING);
        }
    }

    /* Iterate nodes to check if we need to flag something as failing.
     * This loop is also responsible to:
     * 1) Check if there are orphaned masters (masters without non failing
     *    slaves).
     * 2) Count the max number of non failing slaves for a single master.
     * 3) Count the number of slaves for our master, if we are a slave. */
    orphaned_masters = 0;
    max_slaves = 0;
    this_slaves = 0;
    di = dictGetSafeIterator(server.cluster->nodes);
    while((de = dictNext(di)) != NULL) {
        clusterNode *node = dictGetVal(de);
        now = mstime(); /* Use an updated time at every iteration. */
        mstime_t delay;

        if (node->flags &
            (CLUSTER_NODE_MYSELF|CLUSTER_NODE_NOADDR|CLUSTER_NODE_HANDSHAKE))
                continue;

        /* Orphaned master check, useful only if the current instance
         * is a slave that may migrate to another master. */
        if (nodeIsSlave(myself) && nodeIsMaster(node) && !nodeFailed(node)) {
            int okslaves = clusterCountNonFailingSlaves(node);

            /* A master is orphaned if it is serving a non-zero number of
             * slots, have no working slaves, but used to have at least one
             * slave, or failed over a master that used to have slaves. */
            if (okslaves == 0 && node->numslots > 0 &&
                node->flags & CLUSTER_NODE_MIGRATE_TO)
            {
                orphaned_masters++;
            }
            if (okslaves > max_slaves) max_slaves = okslaves;
            if (nodeIsSlave(myself) && myself->slaveof == node)
                this_slaves = okslaves;
        }

        /* If we are waiting for the PONG more than half the cluster
         * timeout, reconnect the link: maybe there is a connection
         * issue even if the node is alive. */
        if (node->link && /* is connected */
            now - node->link->ctime >
            server.cluster_node_timeout && /* was not already reconnected */
            node->ping_sent && /* we already sent a ping */
            node->pong_received < node->ping_sent && /* still waiting pong */
            /* and we are waiting for the pong more than timeout/2 */
            now - node->ping_sent > server.cluster_node_timeout/2)
        {
            /* Disconnect the link, it will be reconnected automatically. */
            freeClusterLink(node->link);
        }

        /* If we have currently no active ping in this instance, and the
         * received PONG is older than half the cluster timeout, send
         * a new ping now, to ensure all the nodes are pinged without
         * a too big delay. */
        if (node->link &&
            node->ping_sent == 0 &&
            (now - node->pong_received) > server.cluster_node_timeout/2)
        {
            clusterSendPing(node->link, CLUSTERMSG_TYPE_PING);
            continue;
        }

        /* If we are a master and one of the slaves requested a manual
         * failover, ping it continuously. */
        if (server.cluster->mf_end &&
            nodeIsMaster(myself) &&
            server.cluster->mf_slave == node &&
            node->link)
        {
            clusterSendPing(node->link, CLUSTERMSG_TYPE_PING);
            continue;
        }

        /* Check only if we have an active ping for this instance. */
        if (node->ping_sent == 0) continue;

        /* Compute the delay of the PONG. Note that if we already received
         * the PONG, then node->ping_sent is zero, so can't reach this
         * code at all. */
        delay = now - node->ping_sent;

        if (delay > server.cluster_node_timeout) {
            /* Timeout reached. Set the node as possibly failing if it is
             * not already in this state. */
            if (!(node->flags & (CLUSTER_NODE_PFAIL|CLUSTER_NODE_FAIL))) {
                serverLog(LL_DEBUG,"*** NODE %.40s possibly failing",
                    node->name);
                node->flags |= CLUSTER_NODE_PFAIL;
                update_state = 1;
            }
        }
    }
    dictReleaseIterator(di);

    /* If we are a slave node but the replication is still turned off,
     * enable it if we know the address of our master and it appears to
     * be up. */
    if (nodeIsSlave(myself) &&
        server.masterhost == NULL &&
        myself->slaveof &&
        nodeHasAddr(myself->slaveof))
    {
        replicationSetMaster(myself->slaveof->ip, myself->slaveof->port);
    }

    /* Abourt a manual failover if the timeout is reached. */
    manualFailoverCheckTimeout();

    if (nodeIsSlave(myself)) {
        clusterHandleManualFailover();
        clusterHandleSlaveFailover();
        /* If there are orphaned slaves, and we are a slave among the masters
         * with the max number of non-failing slaves, consider migrating to
         * the orphaned masters. Note that it does not make sense to try
         * a migration if there is no master with at least *two* working
         * slaves. */
        if (orphaned_masters && max_slaves >= 2 && this_slaves == max_slaves)
            clusterHandleSlaveMigration(max_slaves);
    }

    if (update_state || server.cluster->state == CLUSTER_FAIL)
        clusterUpdateState();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movl $0x0, -0x14(%rbp)
movq $0x0, -0x28(%rbp)
callq 0x2ff70
movq %rax, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq 0x10a12e(%rip), %rax    # 0x18cb70
addq $0x1, %rax
movq %rax, 0x10a123(%rip)    # 0x18cb70
leaq 0xf5784(%rip), %rax     # 0x1781d8
movq 0x9a0(%rax), %rax
movq %rax, -0x40(%rbp)
cmpq $0x3e8, -0x40(%rbp)     # imm = 0x3E8
jge 0x82a71
movq $0x3e8, -0x40(%rbp)     # imm = 0x3E8
leaq 0xf5760(%rip), %rax     # 0x1781d8
movq 0x9b0(%rax), %rax
movq 0x18(%rax), %rdi
callq 0x2e470
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x2e4a0
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
je 0x82cc3
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movl 0x30(%rax), %eax
andl $0x50, %eax
cmpl $0x0, %eax
je 0x82ac0
jmp 0x82a8c
movq -0x48(%rbp), %rax
movl 0x30(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x82aeb
movq -0x30(%rbp), %rax
movq -0x48(%rbp), %rcx
subq (%rcx), %rax
cmpq -0x40(%rbp), %rax
jle 0x82aeb
movq -0x48(%rbp), %rdi
callq 0x7da10
jmp 0x82a8c
movq -0x48(%rbp), %rax
cmpq $0x0, 0x8c8(%rax)
jne 0x82cbe
movq -0x48(%rbp), %rax
addq $0x890, %rax            # imm = 0x890
movq %rax, -0x90(%rbp)
movq -0x48(%rbp), %rax
movl 0x8c0(%rax), %eax
addl $0x2710, %eax           # imm = 0x2710
movl %eax, -0x88(%rbp)
leaq 0xf56ae(%rip), %rax     # 0x1781d8
cmpl $0x0, 0x128(%rax)
je 0x82b4a
leaq 0xf569e(%rip), %rax     # 0x1781d8
movq 0xa8(%rax), %rax
movq %rax, -0x98(%rbp)
jmp 0x82b55
xorl %eax, %eax
movq %rax, -0x98(%rbp)
jmp 0x82b55
movl -0x88(%rbp), %edx
movq -0x90(%rbp), %rsi
movq -0x98(%rbp), %rcx
leaq 0xf5668(%rip), %rdi     # 0x1781d8
addq $0x208, %rdi            # imm = 0x208
callq 0x2c260
movl %eax, -0x4c(%rbp)
cmpl $-0x1, -0x4c(%rbp)
jne 0x82be4
movq -0x48(%rbp), %rax
cmpq $0x0, 0x858(%rax)
jne 0x82ba6
callq 0x2ff70
movq %rax, %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x858(%rax)
movq -0x48(%rbp), %rdx
addq $0x890, %rdx            # imm = 0x890
movq -0x48(%rbp), %rax
movl 0x8c0(%rax), %ecx
addl $0x2710, %ecx           # imm = 0x2710
xorl %edi, %edi
leaq 0xbf9df(%rip), %rsi     # 0x1425a9
leaq 0xf5607(%rip), %r8      # 0x1781d8
addq $0x208, %r8             # imm = 0x208
movb $0x0, %al
callq 0x2fc60
jmp 0x82a8c
movq -0x48(%rbp), %rdi
callq 0x7db80
movq %rax, -0x60(%rbp)
movl -0x4c(%rbp), %ecx
movq -0x60(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x60(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x8c8(%rax)
leaq 0xf55c7(%rip), %rax     # 0x1781d8
movq 0x40(%rax), %rdi
movq -0x60(%rbp), %rax
movl 0x8(%rax), %esi
movq -0x60(%rbp), %r8
movl $0x1, %edx
leaq -0x4f8c(%rip), %rcx     # 0x7dca0
callq 0x2a8f0
movq -0x48(%rbp), %rax
movq 0x858(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x60(%rbp), %rdi
movq -0x48(%rbp), %rax
movl 0x30(%rax), %ecx
andl $0x80, %ecx
xorl %esi, %esi
movl $0x2, %eax
cmpl $0x0, %ecx
cmovnel %eax, %esi
callq 0x80730
cmpq $0x0, -0x58(%rbp)
je 0x82c79
movq -0x58(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x858(%rax)
movq -0x48(%rbp), %rax
movl 0x30(%rax), %ecx
andl $0xffffff7f, %ecx       # imm = 0xFFFFFF7F
movl %ecx, 0x30(%rax)
movq -0x48(%rbp), %rdx
addq $0x8, %rdx
movq -0x48(%rbp), %rcx
addq $0x890, %rcx            # imm = 0x890
movq -0x48(%rbp), %rax
movl 0x8c0(%rax), %r8d
addl $0x2710, %r8d           # imm = 0x2710
xorl %edi, %edi
leaq 0xbf922(%rip), %rsi     # 0x1425d9
movb $0x0, %al
callq 0x2fc60
jmp 0x82a8c
movq -0x8(%rbp), %rdi
callq 0x2e600
movq 0x109e9d(%rip), %rax    # 0x18cb70
movl $0xa, %ecx
xorl %edx, %edx
divq %rcx
cmpq $0x0, %rdx
jne 0x82dc0
movl $0x0, -0x64(%rbp)
cmpl $0x5, -0x64(%rbp)
jge 0x82d8d
leaq 0xf54d9(%rip), %rax     # 0x1781d8
movq 0x9b0(%rax), %rax
movq 0x18(%rax), %rdi
callq 0x2e6a0
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpq $0x0, 0x8c8(%rax)
je 0x82d3b
movq -0x70(%rbp), %rax
cmpq $0x0, 0x858(%rax)
je 0x82d3d
jmp 0x82d7f
movq -0x70(%rbp), %rax
movl 0x30(%rax), %eax
andl $0x30, %eax
cmpl $0x0, %eax
je 0x82d4e
jmp 0x82d7f
cmpq $0x0, -0x38(%rbp)
je 0x82d66
movq -0x28(%rbp), %rax
movq -0x70(%rbp), %rcx
cmpq 0x860(%rcx), %rax
jle 0x82d7d
movq -0x70(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x70(%rbp), %rax
movq 0x860(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x82d7f
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x82cee
cmpq $0x0, -0x38(%rbp)
je 0x82dbe
movq -0x38(%rbp), %rdx
addq $0x8, %rdx
xorl %edi, %edi
leaq 0xbf858(%rip), %rsi     # 0x1425fd
movb $0x0, %al
callq 0x2fc60
movq -0x38(%rbp), %rax
movq 0x8c8(%rax), %rdi
xorl %esi, %esi
callq 0x80730
jmp 0x82dc0
movl $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
leaq 0xf53fc(%rip), %rax     # 0x1781d8
movq 0x9b0(%rax), %rax
movq 0x18(%rax), %rdi
callq 0x2e470
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x2e4a0
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
je 0x830ea
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x78(%rbp)
callq 0x2ff70
movq %rax, -0x30(%rbp)
movq -0x78(%rbp), %rax
movl 0x30(%rax), %eax
andl $0x70, %eax
cmpl $0x0, %eax
je 0x82e2d
jmp 0x82df0
movq 0x109d2c(%rip), %rax    # 0x18cb60
movl 0x30(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x82eed
movq -0x78(%rbp), %rax
movl 0x30(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x82eed
movq -0x78(%rbp), %rax
movl 0x30(%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
jne 0x82eed
movq -0x78(%rbp), %rdi
callq 0x7e340
movl %eax, -0x84(%rbp)
cmpl $0x0, -0x84(%rbp)
jne 0x82ea8
movq -0x78(%rbp), %rax
cmpl $0x0, 0x840(%rax)
jle 0x82ea8
movq -0x78(%rbp), %rax
movl 0x30(%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x82ea8
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
movl -0x84(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jle 0x82ebc
movl -0x84(%rbp), %eax
movl %eax, -0x1c(%rbp)
movq 0x109c9d(%rip), %rax    # 0x18cb60
movl 0x30(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x82eeb
movq 0x109c8b(%rip), %rax    # 0x18cb60
movq 0x850(%rax), %rax
cmpq -0x78(%rbp), %rax
jne 0x82eeb
movl -0x84(%rbp), %eax
movl %eax, -0x20(%rbp)
jmp 0x82eed
movq -0x78(%rbp), %rax
cmpq $0x0, 0x8c8(%rax)
je 0x82f94
movq -0x30(%rbp), %rax
movq -0x78(%rbp), %rcx
movq 0x8c8(%rcx), %rcx
subq (%rcx), %rax
leaq 0xf52c0(%rip), %rcx     # 0x1781d8
cmpq 0x9a0(%rcx), %rax
jle 0x82f94
movq -0x78(%rbp), %rax
cmpq $0x0, 0x858(%rax)
je 0x82f94
movq -0x78(%rbp), %rax
movq 0x860(%rax), %rax
movq -0x78(%rbp), %rcx
cmpq 0x858(%rcx), %rax
jge 0x82f94
movq -0x30(%rbp), %rax
movq -0x78(%rbp), %rcx
subq 0x858(%rcx), %rax
movq %rax, -0xa0(%rbp)
leaq 0xf5274(%rip), %rax     # 0x1781d8
movq 0x9a0(%rax), %rax
movl $0x2, %ecx
cqto
idivq %rcx
movq %rax, %rcx
movq -0xa0(%rbp), %rax
cmpq %rcx, %rax
jle 0x82f94
movq -0x78(%rbp), %rax
movq 0x8c8(%rax), %rdi
callq 0x7dbf0
movq -0x78(%rbp), %rax
cmpq $0x0, 0x8c8(%rax)
je 0x83004
movq -0x78(%rbp), %rax
cmpq $0x0, 0x858(%rax)
jne 0x83004
movq -0x30(%rbp), %rax
movq -0x78(%rbp), %rcx
subq 0x860(%rcx), %rax
movq %rax, -0xa8(%rbp)
leaq 0xf520b(%rip), %rax     # 0x1781d8
movq 0x9a0(%rax), %rax
movl $0x2, %ecx
cqto
idivq %rcx
movq %rax, %rcx
movq -0xa8(%rbp), %rax
cmpq %rcx, %rax
jle 0x83004
movq -0x78(%rbp), %rax
movq 0x8c8(%rax), %rdi
xorl %esi, %esi
callq 0x80730
jmp 0x82df0
leaq 0xf51cd(%rip), %rax     # 0x1781d8
movq 0x9b0(%rax), %rax
cmpq $0x0, 0x60058(%rax)
je 0x8306e
movq 0x109b3d(%rip), %rax    # 0x18cb60
movl 0x30(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x8306e
leaq 0xf51a3(%rip), %rax     # 0x1781d8
movq 0x9b0(%rax), %rax
movq 0x60060(%rax), %rax
cmpq -0x78(%rbp), %rax
jne 0x8306e
movq -0x78(%rbp), %rax
cmpq $0x0, 0x8c8(%rax)
je 0x8306e
movq -0x78(%rbp), %rax
movq 0x8c8(%rax), %rdi
xorl %esi, %esi
callq 0x80730
jmp 0x82df0
movq -0x78(%rbp), %rax
cmpq $0x0, 0x858(%rax)
jne 0x83081
jmp 0x82df0
movq -0x30(%rbp), %rax
movq -0x78(%rbp), %rcx
subq 0x858(%rcx), %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
leaq 0xf5139(%rip), %rcx     # 0x1781d8
cmpq 0x9a0(%rcx), %rax
jle 0x830e5
movq -0x78(%rbp), %rax
movl 0x30(%rax), %eax
andl $0xc, %eax
cmpl $0x0, %eax
jne 0x830e3
movq -0x78(%rbp), %rdx
addq $0x8, %rdx
xorl %edi, %edi
leaq 0xbf548(%rip), %rsi     # 0x142610
movb $0x0, %al
callq 0x2fc60
movq -0x78(%rbp), %rax
movl 0x30(%rax), %ecx
orl $0x4, %ecx
movl %ecx, 0x30(%rax)
movl $0x1, -0x14(%rbp)
jmp 0x830e5
jmp 0x82df0
movq -0x8(%rbp), %rdi
callq 0x2e600
movq 0x109a66(%rip), %rax    # 0x18cb60
movl 0x30(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x8316e
leaq 0xf50cc(%rip), %rax     # 0x1781d8
cmpq $0x0, 0x828(%rax)
jne 0x8316e
movq 0x109a43(%rip), %rax    # 0x18cb60
cmpq $0x0, 0x850(%rax)
je 0x8316e
movq 0x109a32(%rip), %rax    # 0x18cb60
movq 0x850(%rax), %rax
movl 0x30(%rax), %eax
andl $0x40, %eax
cmpl $0x0, %eax
jne 0x8316e
movq 0x109a19(%rip), %rax    # 0x18cb60
movq 0x850(%rax), %rdi
addq $0x890, %rdi            # imm = 0x890
movq 0x109a04(%rip), %rax    # 0x18cb60
movq 0x850(%rax), %rax
movl 0x8c0(%rax), %esi
callq 0x51790
callq 0x828e0
movq 0x1099e6(%rip), %rax    # 0x18cb60
movl 0x30(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x831ad
callq 0x82950
callq 0x81fe0
cmpl $0x0, -0x18(%rbp)
je 0x831ab
cmpl $0x2, -0x1c(%rbp)
jl 0x831ab
movl -0x20(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jne 0x831ab
movl -0x1c(%rbp), %edi
callq 0x82620
jmp 0x831ad
cmpl $0x0, -0x14(%rbp)
jne 0x831c7
leaq 0xf501e(%rip), %rax     # 0x1781d8
movq 0x9b0(%rax), %rax
cmpl $0x1, 0x10(%rax)
jne 0x831cc
callq 0x81d30
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)