// File: /workspace/github_c_makefile_star2_O2/erikdubbelboer[P]discnt/src/cluster.c
// Function: clusterProcessGossipSection
void clusterProcessGossipSection(clusterMsg *hdr, clusterLink *link) {
    uint16_t count = ntohs(hdr->count);
    clusterMsgDataGossip *g = (clusterMsgDataGossip*) hdr->data.ping.gossip;
    clusterNode *sender = link->node ? link->node : clusterLookupNode(hdr->sender);

    while(count--) {
        uint16_t flags = ntohs(g->flags);
        clusterNode *node;
        /*sds ci;

        ci = representClusterNodeFlags(sdsempty(), flags);
        serverLog(LL_DEBUG,"GOSSIP %.40s %s:%d %s",
            g->nodename,
            g->ip,
            ntohs(g->port),
            ci);
        sdsfree(ci);*/

        /* Update our state accordingly to the gossip sections */
        node = clusterLookupNode(g->nodename);
        if (node) {
            /* We already know this node. */
            if (sender && node != myself) {
                if (flags & (CLUSTER_NODE_FAIL|CLUSTER_NODE_PFAIL)) {
                    if (clusterNodeAddFailureReport(node,sender)) {
                        serverLog(LL_VERBOSE,
                            "Node %.40s reported node %.40s as not reachable.",
                            sender->name, node->name);
                    }
                    markNodeAsFailingIfNeeded(node);
                } else {
                    if (clusterNodeDelFailureReport(node,sender)) {
                        serverLog(LL_VERBOSE,
                            "Node %.40s reported node %.40s is back online.",
                            sender->name, node->name);
                    }
                }
            }

            /* If we already know this node, but it is not reachable, and
             * we see a different address in the gossip section, start an
             * handshake with the (possibly) new address: this will result
             * into a node address update if the handshake will be
             * successful. */
            if (node->flags & (CLUSTER_NODE_FAIL|CLUSTER_NODE_PFAIL) &&
                (strcasecmp(node->ip,g->ip) || node->port != ntohs(g->port)))
            {
                clusterStartHandshake(g->ip,ntohs(g->port));
            }
        } else {
            /* If it's not in NOADDR state and we don't have it, we
             * start a handshake process against this IP/PORT pairs.
             *
             * Note that we require that the sender of this gossip message
             * is a well known node in our cluster, otherwise we risk
             * joining another cluster. */
            if (sender &&
                !(flags & CLUSTER_NODE_NOADDR) &&
                !clusterBlacklistExists(g->nodename))
            {
                clusterStartHandshake(g->ip,ntohs(g->port));
            }
        }

        /* Next node */
        g++;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movzwl 0xe(%rdi), %r12d
movq 0x20(%rsi), %r14
testq %r14, %r14
jne 0x26354
leaq 0x10(%rbx), %rdi
callq 0x25290
movq %rax, %r14
rolw $0x8, %r12w
addq $0x60, %rbx
pushq $0x1
popq %rbp
subw $0x1, %r12w
jb 0x2646f
movzwl 0x60(%rbx), %r15d
rolw $0x8, %r15w
movq %rbx, %rdi
callq 0x25290
testq %rax, %rax
je 0x263d0
movq %rax, %r13
testq %r14, %r14
je 0x2641f
cmpq 0x5820b(%rip), %r13     # 0x7e5a0
je 0x2641f
movq %r13, %rdi
movq %r14, %rsi
testb $0x3, %r15b
je 0x26400
callq 0x25cd7
testl %eax, %eax
je 0x263c6
movl %ebp, %edi
leaq 0x2a1a2(%rip), %rsi     # 0x5055b
movq %r14, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x15b9e
movq %r13, %rdi
callq 0x2608b
jmp 0x2641f
testq %r14, %r14
je 0x26466
andl $0x10, %r15d
jne 0x26466
movq %rbx, %rdi
callq 0x26044
testl %eax, %eax
jne 0x26466
leaq 0x30(%rbx), %rdi
movzwl 0x5e(%rbx), %eax
rolw $0x8, %ax
movzwl %ax, %esi
jmp 0x26461
callq 0x25dc3
testl %eax, %eax
je 0x2641f
movl %ebp, %edi
leaq 0x2a17a(%rip), %rsi     # 0x5058c
movq %r14, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x15b9e
testb $0x3, 0x30(%r13)
je 0x26466
movq %r13, %rdi
addq $0x50, %rdi
leaq 0x30(%rbx), %r15
movq %r15, %rsi
callq 0x12090
testl %eax, %eax
je 0x2644a
movzwl 0x5e(%rbx), %eax
rolw $0x8, %ax
movzwl %ax, %esi
jmp 0x2645e
movzwl 0x5e(%rbx), %eax
rolw $0x8, %ax
movzwl %ax, %esi
cmpl %esi, 0x80(%r13)
je 0x26466
movq %r15, %rdi
callq 0x26231
addq $0x68, %rbx
jmp 0x26360
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq