// File: /workspace/github_c_makefile_star2_O1/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 0x2d213
leaq 0x10(%rbx), %rsi
leaq 0x41e93(%rip), %rax     # 0x6f088
movq 0x668(%rax), %rax
movq 0x10(%rax), %rdi
callq 0x190de
testq %rax, %rax
je 0x2d210
movq 0x8(%rax), %r14
jmp 0x2d213
xorl %r14d, %r14d
testw %r15w, %r15w
je 0x2d333
rolw $0x8, %r15w
addq $0x60, %rbx
leaq 0x41e5b(%rip), %r12     # 0x6f088
movzwl 0x60(%rbx), %ebp
movq 0x668(%r12), %rax
movq 0x10(%rax), %rdi
movq %rbx, %rsi
callq 0x190de
testq %rax, %rax
je 0x2d250
movq 0x8(%rax), %r13
jmp 0x2d253
xorl %r13d, %r13d
rolw $0x8, %bp
testq %r13, %r13
je 0x2d2a2
testq %r14, %r14
je 0x2d2e0
cmpq 0x56338(%rip), %r13     # 0x835a0
je 0x2d2e0
movq %r13, %rdi
movq %r14, %rsi
testb $0x3, %bpl
je 0x2d2be
callq 0x2cac0
testl %eax, %eax
je 0x2d298
movl $0x1, %edi
leaq 0x29bfc(%rip), %rsi     # 0x56e87
movq %r14, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x19fb1
movq %r13, %rdi
callq 0x2cea6
jmp 0x2d2e0
testq %r14, %r14
je 0x2d322
andl $0x10, %ebp
jne 0x2d322
movq %rbx, %rdi
callq 0x2ce5d
testl %eax, %eax
jne 0x2d322
leaq 0x30(%rbx), %rbp
jmp 0x2d30f
callq 0x2cbc0
testl %eax, %eax
je 0x2d2e0
movl $0x1, %edi
leaq 0x29be5(%rip), %rsi     # 0x56eb8
movq %r14, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x19fb1
testb $0x3, 0x30(%r13)
je 0x2d322
leaq 0x50(%r13), %rdi
leaq 0x30(%rbx), %rbp
movq %rbp, %rsi
callq 0x12090
testl %eax, %eax
jne 0x2d30f
movzwl 0x5e(%rbx), %eax
rolw $0x8, %ax
movzwl %ax, %eax
cmpl %eax, 0x80(%r13)
je 0x2d322
movzwl 0x5e(%rbx), %eax
rolw $0x8, %ax
movzwl %ax, %esi
movq %rbp, %rdi
callq 0x2d0b3
decl %r15d
addq $0x68, %rbx
testw %r15w, %r15w
jne 0x2d22d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq