// File: /workspace/github_c_makefile_star2_O3/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), %r15d
movq 0x20(%rsi), %r14
testq %r14, %r14
jne 0x2cc39
leaq 0x10(%rbx), %rsi
leaq 0x4246d(%rip), %rax     # 0x6f088
movq 0x668(%rax), %rax
movq 0x10(%rax), %rdi
callq 0x18d3e
testq %rax, %rax
je 0x2cc36
movq 0x8(%rax), %r14
jmp 0x2cc39
xorl %r14d, %r14d
testw %r15w, %r15w
je 0x2cd71
rolw $0x8, %r15w
addq $0x60, %rbx
leaq 0x42435(%rip), %r12     # 0x6f088
movzwl 0x60(%rbx), %ebp
rolw $0x8, %bp
movq 0x668(%r12), %rax
movq 0x10(%rax), %rdi
movq %rbx, %rsi
callq 0x18d3e
testq %rax, %rax
je 0x2cccb
movq 0x8(%rax), %r13
testq %r13, %r13
je 0x2cccb
testq %r14, %r14
je 0x2cd1c
cmpq 0x56913(%rip), %r13     # 0x835a0
je 0x2cd1c
movq %r13, %rdi
movq %r14, %rsi
testb $0x3, %bpl
je 0x2ccfa
callq 0x2c4d1
testl %eax, %eax
je 0x2ccc1
movl $0x1, %edi
leaq 0x2a1bf(%rip), %rsi     # 0x56e73
movq %r14, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x19c06
movq %r13, %rdi
callq 0x2c8b7
jmp 0x2cd1c
testq %r14, %r14
je 0x2cd60
andl $0x10, %ebp
jne 0x2cd60
movq %rbx, %rdi
callq 0x2c86e
testl %eax, %eax
jne 0x2cd60
leaq 0x30(%rbx), %rdi
movzwl 0x5e(%rbx), %eax
rolw $0x8, %ax
movzwl %ax, %esi
jmp 0x2cd5b
callq 0x2c5d1
testl %eax, %eax
je 0x2cd1c
movl $0x1, %edi
leaq 0x2a195(%rip), %rsi     # 0x56ea4
movq %r14, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x19c06
testb $0x3, 0x30(%r13)
je 0x2cd60
leaq 0x50(%r13), %rdi
leaq 0x30(%rbx), %rbp
movq %rbp, %rsi
callq 0x12090
testl %eax, %eax
je 0x2cd44
movzwl 0x5e(%rbx), %eax
rolw $0x8, %ax
movzwl %ax, %esi
jmp 0x2cd58
movzwl 0x5e(%rbx), %eax
rolw $0x8, %ax
movzwl %ax, %esi
cmpl %esi, 0x80(%r13)
je 0x2cd60
movq %rbp, %rdi
callq 0x2caca
decl %r15d
addq $0x68, %rbx
testw %r15w, %r15w
jne 0x2cc53
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq