// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/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;

        if (server.verbosity == LL_DEBUG) {
            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.
               Handle failure reports, only when the sender is a master. */
            if (sender && nodeIsMaster(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 of a node that
             * can talk with this other node, update the address, disconnect
             * the old link if any, so that we'll attempt to connect with the
             * new address. */
            if (node->flags & (CLUSTER_NODE_FAIL|CLUSTER_NODE_PFAIL) &&
                !(flags & CLUSTER_NODE_NOADDR) &&
                !(flags & (CLUSTER_NODE_FAIL|CLUSTER_NODE_PFAIL)) &&
                (strcasecmp(node->ip,g->ip) || node->port != ntohs(g->port)))
            {
                if (node->link) freeClusterLink(node->link);
                memcpy(node->ip,g->ip,NET_IP_STR_LEN);
                node->port = ntohs(g->port);
                node->flags &= ~CLUSTER_NODE_NOADDR;
            }
        } 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
subq $0x18, %rsp
movq %rdi, %rbx
movzwl 0xe(%rdi), %r12d
movq 0x20(%rsi), %r14
testq %r14, %r14
jne 0x5c938
leaq 0x28(%rbx), %rdi
callq 0x5b1bf
movq %rax, %r14
rolw $0x8, %r12w
addq $0x8a0, %rbx            # imm = 0x8A0
leaq 0x8(%r14), %rax
movq %rax, 0x8(%rsp)
movq %r14, 0x10(%rsp)
subw $0x1, %r12w
jb 0x5cb21
movzwl 0x60(%rbx), %r13d
rolw $0x8, %r13w
leaq 0x9cf3a(%rip), %rax     # 0xf98a8
cmpl $0x0, 0x5f8(%rax)
jne 0x5c9b9
callq 0x3114c
movzwl %r13w, %esi
movq %rax, %rdi
callq 0x5cb30
movq %rax, %r15
leaq 0x30(%rbx), %rcx
movzwl 0x5e(%rbx), %eax
rolw $0x8, %ax
movzwl %ax, %r8d
xorl %edi, %edi
leaq 0x5c280(%rip), %rsi     # 0xb8c24
movq %rbx, %rdx
movq %r15, %r9
xorl %eax, %eax
callq 0x2b699
movq %r15, %rdi
callq 0x311c8
movq %rbx, %rdi
callq 0x5b1bf
testq %rax, %rax
je 0x5ca23
movq %rax, %rbp
testq %r14, %r14
je 0x5ca82
testb $0x1, 0x30(%r14)
je 0x5ca82
cmpq 0xb184c(%rip), %rbp     # 0x10e230
je 0x5ca82
movq %rbp, %rdi
movq %r14, %rsi
testb $0xc, %r13b
je 0x5ca5f
callq 0x5c022
testl %eax, %eax
je 0x5ca19
leaq 0x8(%rbp), %rcx
pushq $0x1
popq %rdi
leaq 0x5c22d(%rip), %rsi     # 0xb8c3a
movq 0x8(%rsp), %rdx
xorl %eax, %eax
callq 0x2b699
movq %rbp, %rdi
callq 0x5c5ab
jmp 0x5ca82
testq %r14, %r14
je 0x5cb13
andl $0x40, %r13d
jne 0x5cb13
movq %rbx, %rdi
callq 0x5c564
testl %eax, %eax
jne 0x5cb13
leaq 0x30(%rbx), %rdi
movzwl 0x5e(%rbx), %eax
rolw $0x8, %ax
movzwl %ax, %esi
callq 0x5c807
jmp 0x5cb13
callq 0x5c10e
testl %eax, %eax
je 0x5ca82
leaq 0x8(%rbp), %rcx
pushq $0x1
popq %rdi
leaq 0x5c1f5(%rip), %rsi     # 0xb8c6b
movq 0x8(%rsp), %rdx
xorl %eax, %eax
callq 0x2b699
movl 0x30(%rbp), %r14d
testb $0xc, %r14b
sete %al
testb $0x4c, %r13b
setne %cl
orb %al, %cl
jne 0x5cb13
movq %rbp, %r13
addq $0x890, %r13            # imm = 0x890
leaq 0x30(%rbx), %r15
movq %r13, %rdi
movq %r15, %rsi
callq 0x262f0
testl %eax, %eax
jne 0x5cac8
movzwl 0x5e(%rbx), %eax
rolw $0x8, %ax
movzwl %ax, %eax
cmpl %eax, 0x8c0(%rbp)
je 0x5cb13
movq 0x8c8(%rbp), %rdi
testq %rdi, %rdi
je 0x5cadd
callq 0x5bdf1
movl 0x30(%rbp), %r14d
movups (%r15), %xmm0
movups 0x10(%r15), %xmm1
movups 0x1e(%r15), %xmm2
movups %xmm2, 0x1e(%r13)
movups %xmm1, 0x10(%r13)
movups %xmm0, (%r13)
movzwl 0x5e(%rbx), %eax
rolw $0x8, %ax
movzwl %ax, %eax
movl %eax, 0x8c0(%rbp)
andl $-0x41, %r14d
movl %r14d, 0x30(%rbp)
addq $0x68, %rbx
movq 0x10(%rsp), %r14
jmp 0x5c952
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq