// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movzwl 0xe(%rax), %edi
callq 0x12660
movw %ax, -0x12(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x337d6
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0x337e7
movq -0x8(%rbp), %rdi
addq $0x10, %rdi
callq 0x31d30
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x28(%rbp)
movw -0x12(%rbp), %ax
movw %ax, %cx
addw $-0x1, %cx
movw %cx, -0x12(%rbp)
cmpw $0x0, %ax
je 0x3398e
movq -0x20(%rbp), %rax
movzwl 0x60(%rax), %edi
callq 0x12660
movw %ax, -0x2a(%rbp)
movq -0x20(%rbp), %rdi
callq 0x31d30
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x33935
cmpq $0x0, -0x28(%rbp)
je 0x338be
movq -0x38(%rbp), %rax
cmpq 0x9fdb9(%rip), %rax     # 0xd3600
je 0x338be
movzwl -0x2a(%rbp), %eax
andl $0x3, %eax
cmpl $0x0, %eax
je 0x3388d
movq -0x38(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x32e50
cmpl $0x0, %eax
je 0x33882
movq -0x28(%rbp), %rdx
movq -0x38(%rbp), %rcx
movl $0x1, %edi
leaq 0x73e24(%rip), %rsi     # 0xa769f
movb $0x0, %al
callq 0x18b10
movq -0x38(%rbp), %rdi
callq 0x33380
jmp 0x338bc
movq -0x38(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x32fa0
cmpl $0x0, %eax
je 0x338ba
movq -0x28(%rbp), %rdx
movq -0x38(%rbp), %rcx
movl $0x1, %edi
leaq 0x73e1d(%rip), %rsi     # 0xa76d0
movb $0x0, %al
callq 0x18b10
jmp 0x338bc
jmp 0x338be
movq -0x38(%rbp), %rax
movl 0x30(%rax), %eax
andl $0x3, %eax
cmpl $0x0, %eax
je 0x33933
movq -0x38(%rbp), %rdi
addq $0x50, %rdi
movq -0x20(%rbp), %rsi
addq $0x30, %rsi
callq 0x12070
cmpl $0x0, %eax
jne 0x3390e
movq -0x38(%rbp), %rax
movl 0x80(%rax), %eax
movl %eax, -0x44(%rbp)
movq -0x20(%rbp), %rax
movzwl 0x5e(%rax), %edi
callq 0x12660
movw %ax, %cx
movl -0x44(%rbp), %eax
movzwl %cx, %ecx
cmpl %ecx, %eax
je 0x33933
movq -0x20(%rbp), %rax
addq $0x30, %rax
movq %rax, -0x50(%rbp)
movq -0x20(%rbp), %rax
movzwl 0x5e(%rax), %edi
callq 0x12660
movq -0x50(%rbp), %rdi
movzwl %ax, %esi
callq 0x33610
jmp 0x3397d
cmpq $0x0, -0x28(%rbp)
je 0x3397b
movzwl -0x2a(%rbp), %eax
andl $0x10, %eax
cmpl $0x0, %eax
jne 0x3397b
movq -0x20(%rbp), %rdi
callq 0x33320
cmpl $0x0, %eax
jne 0x3397b
movq -0x20(%rbp), %rax
addq $0x30, %rax
movq %rax, -0x58(%rbp)
movq -0x20(%rbp), %rax
movzwl 0x5e(%rax), %edi
callq 0x12660
movq -0x58(%rbp), %rdi
movzwl %ax, %esi
callq 0x33610
jmp 0x3397d
movq -0x20(%rbp), %rax
addq $0x68, %rax
movq %rax, -0x20(%rbp)
jmp 0x337ef
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)