LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterSaveConfig
int clusterSaveConfig(int do_fsync) {
    sds ci;
    size_t content_size;
    struct stat sb;
    int fd;

    server.cluster->todo_before_sleep &= ~CLUSTER_TODO_SAVE_CONFIG;

    /* Get the nodes description and concatenate our "vars" directive to
     * save currentEpoch and lastVoteEpoch. */
    ci = clusterGenNodesDescription(CLUSTER_NODE_HANDSHAKE);
    ci = sdscatprintf(ci,"vars currentEpoch %llu lastVoteEpoch %llu\n",
        (unsigned long long) server.cluster->currentEpoch,
        (unsigned long long) server.cluster->lastVoteEpoch);
    content_size = sdslen(ci);

    if ((fd = open(server.cluster_configfile,O_WRONLY|O_CREAT,0644))
        == -1) goto err;

    /* Pad the new payload if the existing file length is greater. */
    if (fstat(fd,&sb) != -1) {
        if (sb.st_size > (off_t)content_size) {
            ci = sdsgrowzero(ci,sb.st_size);
            memset(ci+content_size,'\n',sb.st_size-content_size);
        }
    }
    if (write(fd,ci,sdslen(ci)) != (ssize_t)sdslen(ci)) goto err;
    if (do_fsync) {
        server.cluster->todo_before_sleep &= ~CLUSTER_TODO_FSYNC_CONFIG;
        fsync(fd);
    }

    /* Truncate the file if needed to remove the final \n padding that
     * is just garbage. */
    if (content_size != sdslen(ci) && ftruncate(fd,content_size) == -1) {
        /* ftruncate() failing is not a critical error. */
    }
    close(fd);
    sdsfree(ci);
    return 0;

err:
    if (fd != -1) close(fd);
    sdsfree(ci);
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movl %edi, %ebp
leaq 0x9e46f(%rip), %r13     # 0xf98a8
movq 0x9b0(%r13), %rax
andl $-0x5, 0x60080(%rax)
pushq $0x20
popq %rdi
callq 0x5b562
movq 0x9b0(%r13), %rcx
movq 0x8(%rcx), %rdx
movq 0x60078(%rcx), %rcx
leaq 0x5d33e(%rip), %rsi     # 0xb87a6
movq %rax, %rdi
xorl %eax, %eax
callq 0x31a38
movq %rax, %rbx
movq %rax, %rdi
callq 0x5b5fd
movq %rax, %r15
movq 0x9a8(%r13), %rdi
pushq $0x41
popq %rsi
movl $0x1a4, %edx            # imm = 0x1A4
xorl %eax, %eax
callq 0x26690
cmpl $-0x1, %eax
je 0x5b536
movl %eax, %r14d
leaq 0x8(%rsp), %rsi
movl %eax, %edi
callq 0x266e0
cmpl $-0x1, %eax
je 0x5b4da
movq 0x38(%rsp), %rsi
movq %rsi, %r12
subq %r15, %r12
jle 0x5b4da
movq %rbx, %rdi
callq 0x316f6
movq %rax, %rbx
leaq (%rax,%r15), %rdi
pushq $0xa
popq %rsi
movq %r12, %rdx
callq 0x26110
movq %rbx, %rdi
callq 0x5b5fd
movl %r14d, %edi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x26bb0
movq %rax, %r12
movq %rbx, %rdi
callq 0x5b5fd
cmpq %rax, %r12
jne 0x5b53b
testl %ebp, %ebp
je 0x5b51a
movq 0x9b0(%r13), %rax
andl $-0x9, 0x60080(%rax)
movl %r14d, %edi
callq 0x26600
movq %rbx, %rdi
callq 0x5b5fd
xorl %ebp, %ebp
cmpq %rax, %r15
je 0x5b53e
movl %r14d, %edi
movq %r15, %rsi
callq 0x26730
jmp 0x5b53e
pushq $-0x1
popq %rbp
jmp 0x5b546
pushq $-0x1
popq %rbp
movl %r14d, %edi
callq 0x26180
movq %rbx, %rdi
callq 0x311c8
movl %ebp, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterGenNodesDescription
sds clusterGenNodesDescription(int filter) {
    sds ci = sdsempty(), ni;
    dictIterator *di;
    dictEntry *de;

    di = dictGetSafeIterator(server.cluster->nodes);
    while((de = dictNext(di)) != NULL) {
        clusterNode *node = dictGetVal(de);

        if (node->flags & filter) continue;
        ni = clusterGenNodeDescription(node);
        ci = sdscatsds(ci,ni);
        sdsfree(ni);
        ci = sdscatlen(ci,"\n",1);
    }
    dictReleaseIterator(di);
    return ci;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %ebx
callq 0x3114c
movq %rax, %r15
leaq 0x9e32a(%rip), %rax     # 0xf98a8
movq 0x9b0(%rax), %rax
movq 0x18(%rax), %rdi
callq 0x2a9c4
movq %rax, %r14
leaq 0x55821(%rip), %r12     # 0xb0db9
pushq $0x1
popq %r13
movq %r14, %rdi
callq 0x2a9d3
testq %rax, %rax
je 0x5b5e3
movq 0x8(%rax), %rdi
testl %ebx, 0x30(%rdi)
jne 0x5b59c
callq 0x5f5db
movq %rax, %rbp
movq %r15, %rdi
movq %rax, %rsi
callq 0x317de
movq %rax, %r15
movq %rbp, %rdi
callq 0x311c8
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x31758
movq %rax, %r15
jmp 0x5b59c
movq %r14, %rdi
callq 0x2aa94
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterLockConfig
int clusterLockConfig(char *filename) {
/* flock() does not exist on Solaris
 * and a fcntl-based solution won't help, as we constantly re-open that file,
 * which will release _all_ locks anyway
 */
#if !defined(__sun)
    /* To lock it, we need to open the file in a way it is created if
     * it does not exist, otherwise there is a race condition with other
     * processes. */
    int fd = open(filename,O_WRONLY|O_CREAT,0644);
    if (fd == -1) {
        serverLog(LL_WARNING,
            "Can't open %s in order to acquire a lock: %s",
            filename, strerror(errno));
        return C_ERR;
    }

    if (flock(fd,LOCK_EX|LOCK_NB) == -1) {
        if (errno == EWOULDBLOCK) {
            serverLog(LL_WARNING,
                 "Sorry, the cluster configuration file %s is already used "
                 "by a different Redis Cluster node. Please make sure that "
                 "different nodes use different cluster configuration "
                 "files.", filename);
        } else {
            serverLog(LL_WARNING,
                "Impossible to lock %s: %s", filename, strerror(errno));
        }
        close(fd);
        return C_ERR;
    }
    /* Lock acquired: leak the 'fd' by not closing it, so that we'll retain the
     * lock to the file as long as the process exists. */
#endif /* __sun */

    return C_OK;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %r14d, %r14d
pushq $0x41
popq %rsi
movl $0x1a4, %edx            # imm = 0x1A4
xorl %eax, %eax
callq 0x26690
cmpl $-0x1, %eax
je 0x5b6ac
movl %eax, %ebp
pushq $0x6
popq %rsi
movl %eax, %edi
callq 0x26650
cmpl $-0x1, %eax
jne 0x5b6f8
callq 0x26880
movl (%rax), %edi
cmpl $0xb, %edi
jne 0x5b6d1
leaq 0x5d18a(%rip), %rsi     # 0xb8827
pushq $0x3
popq %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2b699
jmp 0x5b6ed
callq 0x26880
movl (%rax), %edi
callq 0x26680
leaq 0x5d13b(%rip), %rsi     # 0xb87fa
pushq $0x3
popq %rdi
movq %rbx, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x2b699
jmp 0x5b6f4
callq 0x26680
leaq 0x5d1f7(%rip), %rsi     # 0xb88d4
pushq $0x3
popq %rdi
movq %rbx, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x2b699
movl %ebp, %edi
callq 0x26180
pushq $-0x1
popq %r14
movl %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterAcceptHandler
void clusterAcceptHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
    int cport, cfd;
    int max = MAX_CLUSTER_ACCEPTS_PER_CALL;
    char cip[NET_IP_STR_LEN];
    clusterLink *link;
    UNUSED(el);
    UNUSED(mask);
    UNUSED(privdata);

    /* If the server is starting up, don't accept cluster connections:
     * UPDATE messages may interact with the database content. */
    if (server.masterhost == NULL && server.loading) return;

    while(max--) {
        cfd = anetTcpAccept(server.neterr, fd, cip, sizeof(cip), &cport);
        if (cfd == ANET_ERR) {
            if (errno != EWOULDBLOCK)
                serverLog(LL_VERBOSE,
                    "Error accepting cluster node: %s", server.neterr);
            return;
        }
        anetNonBlock(NULL,cfd);
        anetEnableTcpNoDelay(NULL,cfd);

        /* Use non-blocking I/O for cluster messages. */
        serverLog(LL_VERBOSE,"Accepted cluster node %s:%d", cip, cport);
        /* Create a link object we use to handle the connection.
         * It gets passed to the readable handler when data is available.
         * Initiallly the link->node pointer is set to NULL as we don't know
         * which node is, but the right node is references once we know the
         * node identity. */
        link = createClusterLink(NULL);
        link->fd = cfd;
        aeCreateFileEvent(server.el,cfd,AE_READABLE,clusterReadHandler,link);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %esi, %ebx
leaq 0x9df23(%rip), %rax     # 0xf98a8
cmpq $0x0, 0x828(%rax)
jne 0x5b9ae
leaq 0x9df12(%rip), %rax     # 0xf98a8
cmpl $0x0, 0x31c(%rax)
je 0x5b9ae
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xfffffc18, %ebp       # imm = 0xFFFFFC18
movl $0x208, %r14d           # imm = 0x208
addq 0x995f8(%rip), %r14     # 0xf4fb8
leaq 0x10(%rsp), %r15
pushq $0x1
popq %r12
testl %ebp, %ebp
je 0x5b99f
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
pushq $0x2e
popq %rcx
leaq 0xc(%rsp), %r8
callq 0x29cc1
cmpl $-0x1, %eax
je 0x5ba44
movl %eax, %r13d
xorl %edi, %edi
movl %eax, %esi
callq 0x2929c
xorl %edi, %edi
movl %r13d, %esi
callq 0x2939b
movl 0xc(%rsp), %ecx
movl %r12d, %edi
leaq 0x5d051(%rip), %rsi     # 0xb8a5c
movq %r15, %rdx
xorl %eax, %eax
callq 0x2b699
xorl %edi, %edi
callq 0x5bdb1
movl %r13d, 0x8(%rax)
leaq 0x9de81(%rip), %rcx     # 0xf98a8
movq 0x40(%rcx), %rdi
movl %r13d, %esi
movl %r12d, %edx
leaq 0x424(%rip), %rcx       # 0x5be5c
movq %rax, %r8
callq 0x28ae8
incl %ebp
jmp 0x5b9c9
callq 0x26880
cmpl $0xb, (%rax)
je 0x5b99f
movl $0x208, %edx            # imm = 0x208
addq 0x9955a(%rip), %rdx     # 0xf4fb8
leaq 0x5cfd6(%rip), %rsi     # 0xb8a3b
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x2b699
jmp 0x5b99f
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: resetManualFailover
void resetManualFailover(void) {
    if (server.cluster->mf_end && clientsArePaused()) {
        server.clients_pause_end_time = 0;
        clientsArePaused(); /* Just use the side effect of the function. */
    }
    server.cluster->mf_end = 0; /* No manual failover in progress. */
    server.cluster->mf_can_start = 0;
    server.cluster->mf_slave = NULL;
    server.cluster->mf_master_offset = 0;
}

// Assembly:
pushq %rbx
leaq 0x9de2c(%rip), %rbx     # 0xf98a8
movq 0x9b0(%rbx), %rax
cmpq $0x0, 0x60058(%rax)
je 0x5baa3
callq 0x38320
testl %eax, %eax
je 0x5baa3
andq $0x0, 0x200(%rbx)
callq 0x38320
movq 0x9b0(%rbx), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x60064(%rax)
movups %xmm0, 0x60058(%rax)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterSetNodeAsMaster
void clusterSetNodeAsMaster(clusterNode *n) {
    if (nodeIsMaster(n)) return;

    if (n->slaveof) {
        clusterNodeRemoveSlave(n->slaveof,n);
        if (n != myself) n->flags |= CLUSTER_NODE_MIGRATE_TO;
    }
    n->flags &= ~CLUSTER_NODE_SLAVE;
    n->flags |= CLUSTER_NODE_MASTER;
    n->slaveof = NULL;

    /* Update config and state. */
    clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG|
                         CLUSTER_TODO_UPDATE_STATE);
}

// Assembly:
movl 0x30(%rdi), %eax
testb $0x1, %al
jne 0x5bc87
pushq %rbx
movq %rdi, %rbx
movq 0x850(%rdi), %rdi
testq %rdi, %rdi
je 0x5bc61
movq %rbx, %rsi
callq 0x5c187
movl 0x30(%rbx), %ecx
movl %ecx, %eax
orl $0x100, %eax            # imm = 0x100
cmpq %rbx, 0xb25d2(%rip)     # 0x10e230
cmovel %ecx, %eax
andl $-0x4, %eax
incl %eax
movl %eax, 0x30(%rbx)
andq $0x0, 0x850(%rbx)
leaq 0x9dc30(%rip), %rax     # 0xf98a8
movq 0x9b0(%rax), %rax
orl $0x6, 0x60080(%rax)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterDelSlot
int clusterDelSlot(int slot) {
    clusterNode *n = server.cluster->slots[slot];

    if (!n) return C_ERR;
    serverAssert(clusterNodeClearSlotBit(n,slot) == 1);
    server.cluster->slots[slot] = NULL;
    return C_OK;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %esi
leaq 0x9dc13(%rip), %rbx     # 0xf98a8
movq 0x9b0(%rbx), %rax
movslq %edi, %r14
movq 0x40028(%rax,%r14,8), %rdi
testq %rdi, %rdi
je 0x5bcc9
callq 0x5f482
testl %eax, %eax
je 0x5bcd4
movq 0x9b0(%rbx), %rax
andq $0x0, 0x40028(%rax,%r14,8)
xorl %eax, %eax
jmp 0x5bccc
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x5d8bc(%rip), %rdi     # 0xb9597
leaq 0x5ca1b(%rip), %rsi     # 0xb86fd
movl $0xd69, %edx            # imm = 0xD69
callq 0x57ac8
pushq $0x1
popq %rdi
callq 0x263c0
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterDelNode
void clusterDelNode(clusterNode *delnode) {
    int j;
    dictIterator *di;
    dictEntry *de;

    /* 1) Mark slots as unassigned. */
    for (j = 0; j < CLUSTER_SLOTS; j++) {
        if (server.cluster->importing_slots_from[j] == delnode)
            server.cluster->importing_slots_from[j] = NULL;
        if (server.cluster->migrating_slots_to[j] == delnode)
            server.cluster->migrating_slots_to[j] = NULL;
        if (server.cluster->slots[j] == delnode)
            clusterDelSlot(j);
    }

    /* 2) Remove failure reports. */
    di = dictGetSafeIterator(server.cluster->nodes);
    while((de = dictNext(di)) != NULL) {
        clusterNode *node = dictGetVal(de);

        if (node == delnode) continue;
        clusterNodeDelFailureReport(node,delnode);
    }
    dictReleaseIterator(di);

    /* 3) Free the node, unlinking it from the cluster. */
    freeClusterNode(delnode);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %r14d, %r14d
leaq 0x9dba2(%rip), %r15     # 0xf98a8
movq 0x9b0(%r15), %rax
cmpq $0x4000, %r14           # imm = 0x4000
je 0x5bd5b
cmpq %rbx, 0x20028(%rax,%r14,8)
jne 0x5bd30
andq $0x0, 0x20028(%rax,%r14,8)
movq 0x9b0(%r15), %rax
cmpq %rbx, 0x28(%rax,%r14,8)
jne 0x5bd44
andq $0x0, 0x28(%rax,%r14,8)
movq 0x9b0(%r15), %rax
cmpq %rbx, 0x40028(%rax,%r14,8)
jne 0x5bd56
movl %r14d, %edi
callq 0x5bc88
incq %r14
jmp 0x5bd06
movq 0x18(%rax), %rdi
callq 0x2a9c4
movq %rax, %r14
movq %r14, %rdi
callq 0x2a9d3
testq %rax, %rax
je 0x5bd87
movq 0x8(%rax), %rdi
cmpq %rbx, %rdi
je 0x5bd67
movq %rbx, %rsi
callq 0x5c10e
jmp 0x5bd67
movq %r14, %rdi
callq 0x2aa94
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x5c228
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: createClusterLink
clusterLink *createClusterLink(clusterNode *node) {
    clusterLink *link = zmalloc(sizeof(*link));
    link->ctime = mstime();
    link->sndbuf = sdsempty();
    link->rcvbuf = sdsempty();
    link->node = node;
    link->fd = -1;
    return link;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
pushq $0x28
popq %rdi
callq 0x327b9
movq %rax, %r14
callq 0x2b8ae
movq %rax, (%r14)
callq 0x3114c
movq %rax, 0x10(%r14)
callq 0x3114c
movq %rax, 0x18(%r14)
movq %rbx, 0x20(%r14)
orl $-0x1, 0x8(%r14)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: freeClusterLink
void freeClusterLink(clusterLink *link) {
    if (link->fd != -1) {
        aeDeleteFileEvent(server.el, link->fd, AE_WRITABLE);
        aeDeleteFileEvent(server.el, link->fd, AE_READABLE);
    }
    sdsfree(link->sndbuf);
    sdsfree(link->rcvbuf);
    if (link->node)
        link->node->link = NULL;
    close(link->fd);
    zfree(link);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x8(%rdi), %esi
cmpl $-0x1, %esi
je 0x5be22
leaq 0x9daa1(%rip), %r14     # 0xf98a8
movq 0x40(%r14), %rdi
pushq $0x2
popq %rdx
callq 0x28ba8
movq 0x40(%r14), %rdi
movl 0x8(%rbx), %esi
pushq $0x1
popq %rdx
callq 0x28ba8
movq 0x10(%rbx), %rdi
callq 0x311c8
movq 0x18(%rbx), %rdi
callq 0x311c8
movq 0x20(%rbx), %rax
testq %rax, %rax
je 0x5be45
andq $0x0, 0x8c8(%rax)
movl 0x8(%rbx), %edi
callq 0x26180
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x328f9
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: keyHashSlot
unsigned int keyHashSlot(char *key, int keylen) {
    int s, e; /* start-end indexes of { and } */

    for (s = 0; s < keylen; s++)
        if (key[s] == '{') break;

    /* No '{' ? Hash the whole key. This is the base case. */
    if (s == keylen) return crc16(key,keylen) & 0x3FFF;

    /* '{' found? Check if we have the corresponding '}'. */
    for (e = s+1; e < keylen; e++)
        if (key[e] == '}') break;

    /* No '}' or nothing betweeen {} ? Hash the whole key. */
    if (e == keylen || e == s+1) return crc16(key,keylen) & 0x3FFF;

    /* If we are here there is both a { and a } on its right. Hash
     * what is in the middle between { and }. */
    return crc16(key+s+1,e-s-1) & 0x3FFF;
}

// Assembly:
pushq %rax
xorl %eax, %eax
testl %esi, %esi
movl $0x0, %ecx
cmovgl %esi, %ecx
cmpq %rax, %rcx
je 0x5bfc2
cmpb $0x7b, (%rdi,%rax)
je 0x5bfc0
incq %rax
jmp 0x5bfb0
movl %eax, %ecx
cmpl %esi, %ecx
je 0x5c016
leal 0x1(%rcx), %r8d
movl %ecx, %edx
cmpl %r8d, %esi
movl %r8d, %r9d
cmovgl %esi, %r9d
leaq (%rdx,%rdi), %r10
incq %r10
movl %ecx, %eax
incl %eax
cmpl %esi, %eax
jge 0x5bff1
cmpb $0x7d, (%r10)
leaq 0x1(%r10), %r10
jne 0x5bfdf
jmp 0x5bff4
movl %r9d, %eax
cmpl %esi, %eax
sete %r9b
cmpl %r8d, %eax
sete %r8b
orb %r9b, %r8b
cmpb $0x1, %r8b
je 0x5c016
addq %rdx, %rdi
incq %rdi
notl %ecx
addl %ecx, %eax
movl %eax, %esi
callq 0x61ef8
andl $0x3fff, %eax           # imm = 0x3FFF
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterNodeAddFailureReport
int clusterNodeAddFailureReport(clusterNode *failing, clusterNode *sender) {
    list *l = failing->fail_reports;
    listNode *ln;
    listIter li;
    clusterNodeFailReport *fr;

    /* If a failure report from the same sender already exists, just update
     * the timestamp. */
    listRewind(l,&li);
    while ((ln = listNext(&li)) != NULL) {
        fr = ln->value;
        if (fr->node == sender) {
            fr->time = mstime();
            return 0;
        }
    }

    /* Otherwise create a new report. */
    fr = zmalloc(sizeof(*fr));
    fr->node = sender;
    fr->time = mstime();
    listAddNodeTail(l,fr);
    return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq 0x8d0(%rdi), %rbx
leaq 0x8(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2702c
movq %r15, %rdi
callq 0x27046
testq %rax, %rax
je 0x5c06c
movq 0x10(%rax), %r12
cmpq %r14, (%r12)
jne 0x5c047
callq 0x2b8ae
movq %rax, 0x8(%r12)
xorl %eax, %eax
jmp 0x5c091
pushq $0x10
popq %rdi
callq 0x327b9
movq %rax, %r15
movq %r14, (%rax)
callq 0x2b8ae
movq %rax, 0x8(%r15)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x26ecc
pushq $0x1
popq %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterNodeCleanupFailureReports
void clusterNodeCleanupFailureReports(clusterNode *node) {
    list *l = node->fail_reports;
    listNode *ln;
    listIter li;
    clusterNodeFailReport *fr;
    mstime_t maxtime = server.cluster_node_timeout *
                     CLUSTER_FAIL_REPORT_VALIDITY_MULT;
    mstime_t now = mstime();

    listRewind(l,&li);
    while ((ln = listNext(&li)) != NULL) {
        fr = ln->value;
        if (now - fr->time > maxtime) listDelNode(l,ln);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq 0x8d0(%rdi), %rbx
leaq 0x9d7f2(%rip), %rax     # 0xf98a8
movq 0x9a0(%rax), %r12
addq %r12, %r12
callq 0x2b8ae
movq %rax, %r14
leaq 0x8(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2702c
movq %r15, %rdi
callq 0x27046
testq %rax, %rax
je 0x5c102
movq 0x10(%rax), %rcx
movq %r14, %rdx
subq 0x8(%rcx), %rdx
cmpq %r12, %rdx
jle 0x5c0d8
movq %rbx, %rdi
movq %rax, %rsi
callq 0x26fa8
jmp 0x5c0d8
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterNodeDelFailureReport
int clusterNodeDelFailureReport(clusterNode *node, clusterNode *sender) {
    list *l = node->fail_reports;
    listNode *ln;
    listIter li;
    clusterNodeFailReport *fr;

    /* Search for a failure report from this sender. */
    listRewind(l,&li);
    while ((ln = listNext(&li)) != NULL) {
        fr = ln->value;
        if (fr->node == sender) break;
    }
    if (!ln) return 0; /* No failure report from this sender. */

    /* Remove the failure report. */
    listDelNode(l,ln);
    clusterNodeCleanupFailureReports(node);
    return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r15
movq %rdi, %rbx
movq 0x8d0(%rdi), %r14
leaq 0x8(%rsp), %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x2702c
movq %r12, %rdi
callq 0x27046
testq %rax, %rax
je 0x5c164
movq 0x10(%rax), %rcx
cmpq %r15, (%rcx)
jne 0x5c136
movq %r14, %rdi
movq %rax, %rsi
callq 0x26fa8
movq %rbx, %rdi
callq 0x5c09d
pushq $0x1
popq %rax
jmp 0x5c166
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterNodeRemoveSlave
int clusterNodeRemoveSlave(clusterNode *master, clusterNode *slave) {
    int j;

    for (j = 0; j < master->numslaves; j++) {
        if (master->slaves[j] == slave) {
            if ((j+1) < master->numslaves) {
                int remaining_slaves = (master->numslaves - j) - 1;
                memmove(master->slaves+j,master->slaves+(j+1),
                        (sizeof(*master->slaves) * remaining_slaves));
            }
            master->numslaves--;
            if (master->numslaves == 0)
                master->flags &= ~CLUSTER_NODE_MIGRATE_TO;
            return C_OK;
        }
    }
    return C_ERR;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl 0x844(%rdi), %ecx
xorl %edi, %edi
testl %ecx, %ecx
cmovgl %ecx, %edi
negq %rdi
pushq $0x1
popq %rdx
pushq $-0x1
popq %rax
leaq (%rdi,%rdx), %r8
cmpq $0x1, %r8
je 0x5c1f2
movq 0x848(%rbx), %r8
cmpq %rsi, -0x8(%r8,%rdx,8)
je 0x5c1be
incq %rdx
jmp 0x5c1a1
cmpl %ecx, %edx
jge 0x5c1e2
leaq (%r8,%rdx,8), %rsi
leaq (%r8,%rdx,8), %rdi
addq $-0x8, %rdi
subl %edx, %ecx
movslq %ecx, %rdx
shlq $0x3, %rdx
callq 0x267e0
movl 0x844(%rbx), %ecx
xorl %eax, %eax
decl %ecx
movl %ecx, 0x844(%rbx)
jne 0x5c1f2
andb $-0x2, 0x31(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterCountNonFailingSlaves
int clusterCountNonFailingSlaves(clusterNode *n) {
    int j, okslaves = 0;

    for (j = 0; j < n->numslaves; j++)
        if (!nodeFailed(n->slaves[j])) okslaves++;
    return okslaves;
}

// Assembly:
movl 0x844(%rdi), %ecx
xorl %edx, %edx
testl %ecx, %ecx
cmovlel %edx, %ecx
xorl %eax, %eax
cmpq %rdx, %rcx
je 0x5c227
movq 0x848(%rdi), %rsi
movq (%rsi,%rdx,8), %rsi
movb 0x30(%rsi), %sil
andb $0x8, %sil
cmpb $0x1, %sil
adcl $0x0, %eax
incq %rdx
jmp 0x5c203
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: freeClusterNode
void freeClusterNode(clusterNode *n) {
    sds nodename;
    int j;

    /* If the node has associated slaves, we have to set
     * all the slaves->slaveof fields to NULL (unknown). */
    for (j = 0; j < n->numslaves; j++)
        n->slaves[j]->slaveof = NULL;

    /* Remove this node from the list of slaves of its master. */
    if (nodeIsSlave(n) && n->slaveof) clusterNodeRemoveSlave(n->slaveof,n);

    /* Unlink from the set of nodes. */
    nodename = sdsnewlen(n->name, CLUSTER_NAMELEN);
    serverAssert(dictDelete(server.cluster->nodes,nodename) == DICT_OK);
    sdsfree(nodename);

    /* Release link and associated data structures. */
    if (n->link) freeClusterLink(n->link);
    listRelease(n->fail_reports);
    zfree(n->slaves);
    zfree(n);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movslq 0x844(%rdi), %rax
xorl %ecx, %ecx
cmpq %rax, %rcx
jge 0x5c255
movq 0x848(%rbx), %rdx
movq (%rdx,%rcx,8), %rdx
andq $0x0, 0x850(%rdx)
incq %rcx
jmp 0x5c238
testb $0x2, 0x30(%rbx)
je 0x5c26f
movq 0x850(%rbx), %rdi
testq %rdi, %rdi
je 0x5c26f
movq %rbx, %rsi
callq 0x5c187
leaq 0x8(%rbx), %rdi
pushq $0x28
popq %rsi
callq 0x31018
movq %rax, %r14
leaq 0x9d623(%rip), %rax     # 0xf98a8
movq 0x9b0(%rax), %rax
movq 0x18(%rax), %rdi
movq %r14, %rsi
callq 0x2a6dc
testl %eax, %eax
jne 0x5c2dc
movq %r14, %rdi
callq 0x311c8
movq 0x8c8(%rbx), %rdi
testq %rdi, %rdi
je 0x5c2b5
callq 0x5bdf1
movq 0x8d0(%rbx), %rdi
callq 0x26e2a
movq 0x848(%rbx), %rdi
callq 0x328f9
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x328f9
leaq 0x5c795(%rip), %rdi     # 0xb8a78
leaq 0x5c413(%rip), %rsi     # 0xb86fd
movl $0x340, %edx            # imm = 0x340
callq 0x57ac8
pushq $0x1
popq %rdi
callq 0x263c0
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterRenameNode
void clusterRenameNode(clusterNode *node, char *newname) {
    int retval;
    sds s = sdsnewlen(node->name, CLUSTER_NAMELEN);

    serverLog(LL_DEBUG,"Renaming node %.40s into %.40s",
        node->name, newname);
    retval = dictDelete(server.cluster->nodes, s);
    sdsfree(s);
    serverAssert(retval == DICT_OK);
    memcpy(node->name, newname, CLUSTER_NAMELEN);
    clusterAddNode(node);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x8(%rdi), %r14
pushq $0x28
popq %rsi
movq %r14, %rdi
callq 0x31018
movq %rax, %r12
leaq 0x5c78b(%rip), %rsi     # 0xb8aae
xorl %edi, %edi
movq %r14, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x2b699
leaq 0x9d56f(%rip), %rax     # 0xf98a8
movq 0x9b0(%rax), %rax
movq 0x18(%rax), %rdi
movq %r12, %rsi
callq 0x2a6dc
movl %eax, %ebp
movq %r12, %rdi
callq 0x311c8
testl %ebp, %ebp
jne 0x5c384
movq 0x20(%r15), %rax
movq %rax, 0x20(%r14)
movups (%r15), %xmm0
movups 0x10(%r15), %xmm1
movups %xmm1, 0x10(%r14)
movups %xmm0, (%r14)
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x5b2c3
leaq 0x563a1(%rip), %rdi     # 0xb272c
leaq 0x5c36b(%rip), %rsi     # 0xb86fd
movl $0x392, %edx            # imm = 0x392
callq 0x57ac8
pushq $0x1
popq %rdi
callq 0x263c0
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterBumpConfigEpochWithoutConsensus
int clusterBumpConfigEpochWithoutConsensus(void) {
    uint64_t maxEpoch = clusterGetMaxEpoch();

    if (myself->configEpoch == 0 ||
        myself->configEpoch != maxEpoch)
    {
        server.cluster->currentEpoch++;
        myself->configEpoch = server.cluster->currentEpoch;
        clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG|
                             CLUSTER_TODO_FSYNC_CONFIG);
        serverLog(LL_WARNING,
            "New configEpoch set to %llu",
            (unsigned long long) myself->configEpoch);
        return C_OK;
    } else {
        return C_ERR;
    }
}

// Assembly:
pushq %rbx
callq 0x5b3bf
movq 0xb1e7f(%rip), %rcx     # 0x10e230
movq 0x38(%rcx), %rdx
testq %rdx, %rdx
setne %sil
cmpq %rax, %rdx
sete %al
testb %al, %sil
je 0x5c3cc
pushq $-0x1
popq %rbx
jmp 0x5c403
leaq 0x9d4d5(%rip), %rax     # 0xf98a8
movq 0x9b0(%rax), %rax
movq 0x8(%rax), %rdx
incq %rdx
movq %rdx, 0x8(%rax)
movq %rdx, 0x38(%rcx)
orb $0xc, 0x60080(%rax)
leaq 0x5c6d6(%rip), %rsi     # 0xb8acd
xorl %ebx, %ebx
pushq $0x3
popq %rdi
xorl %eax, %eax
callq 0x2b699
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterHandleConfigEpochCollision
void clusterHandleConfigEpochCollision(clusterNode *sender) {
    /* Prerequisites: nodes have the same configEpoch and are both masters. */
    if (sender->configEpoch != myself->configEpoch ||
        !nodeIsMaster(sender) || !nodeIsMaster(myself)) return;
    /* Don't act if the colliding node has a smaller Node ID. */
    if (memcmp(sender->name,myself->name,CLUSTER_NAMELEN) <= 0) return;
    /* Get the next ID available at the best of this node knowledge. */
    server.cluster->currentEpoch++;
    myself->configEpoch = server.cluster->currentEpoch;
    clusterSaveConfigOrDie(1);
    serverLog(LL_VERBOSE,
        "WARNING: configEpoch collision with node %.40s."
        " configEpoch set to %llu",
        sender->name,
        (unsigned long long) myself->configEpoch);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq 0x38(%rdi), %rax
movq 0xb1e1a(%rip), %r14     # 0x10e230
cmpq 0x38(%r14), %rax
jne 0x5c443
movq %rdi, %rbx
testb $0x1, 0x30(%rdi)
je 0x5c443
testb $0x1, 0x30(%r14)
je 0x5c443
addq $0x8, %rbx
leaq 0x8(%r14), %rsi
pushq $0x28
popq %rdx
movq %rbx, %rdi
callq 0x269b0
testl %eax, %eax
jg 0x5c448
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x9d459(%rip), %rax     # 0xf98a8
movq 0x9b0(%rax), %rax
movq 0x8(%rax), %rcx
incq %rcx
movq %rcx, 0x8(%rax)
movq %rcx, 0x38(%r14)
pushq $0x1
popq %rbp
movl %ebp, %edi
callq 0x5b635
movq 0xb1dba(%rip), %rax     # 0x10e230
movq 0x38(%rax), %rcx
leaq 0x5c668(%rip), %rsi     # 0xb8ae9
movl %ebp, %edi
movq %rbx, %rdx
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x2b699
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterBlacklistCleanup
void clusterBlacklistCleanup(void) {
    dictIterator *di;
    dictEntry *de;

    di = dictGetSafeIterator(server.cluster->nodes_black_list);
    while((de = dictNext(di)) != NULL) {
        int64_t expire = dictGetUnsignedIntegerVal(de);

        if (expire < server.unixtime)
            dictDelete(server.cluster->nodes_black_list,dictGetKey(de));
    }
    dictReleaseIterator(di);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0x9d40c(%rip), %r14     # 0xf98a8
movq 0x9b0(%r14), %rax
movq 0x20(%rax), %rdi
callq 0x2a9c4
movq %rax, %rbx
movq %rbx, %rdi
callq 0x2a9d3
testq %rax, %rax
je 0x5c4de
movq 0x8(%rax), %rcx
cmpq 0x978(%r14), %rcx
jge 0x5c4af
movq 0x9b0(%r14), %rcx
movq 0x20(%rcx), %rdi
movq (%rax), %rsi
callq 0x2a6dc
jmp 0x5c4af
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2aa94
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterBlacklistAddNode
void clusterBlacklistAddNode(clusterNode *node) {
    dictEntry *de;
    sds id = sdsnewlen(node->name,CLUSTER_NAMELEN);

    clusterBlacklistCleanup();
    if (dictAdd(server.cluster->nodes_black_list,id,NULL) == DICT_OK) {
        /* If the key was added, duplicate the sds string representation of
         * the key for the next lookup. We'll free it at the end. */
        id = sdsdup(id);
    }
    de = dictFind(server.cluster->nodes_black_list,id);
    dictSetUnsignedIntegerVal(de,time(NULL)+CLUSTER_BLACKLIST_TTL);
    sdsfree(id);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
addq $0x8, %rdi
pushq $0x28
popq %rsi
callq 0x31018
movq %rax, %rbx
callq 0x5c491
leaq 0x9d39c(%rip), %r14     # 0xf98a8
movq 0x9b0(%r14), %rax
movq 0x20(%rax), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x2a3ed
testl %eax, %eax
jne 0x5c530
movq %rbx, %rdi
callq 0x3117b
movq %rax, %rbx
movq 0x9b0(%r14), %rax
movq 0x20(%rax), %rdi
movq %rbx, %rsi
callq 0x2a5f9
movq %rax, %r14
xorl %edi, %edi
callq 0x26cd0
addq $0x3c, %rax
movq %rax, 0x8(%r14)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x311c8
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterBlacklistExists
int clusterBlacklistExists(char *nodeid) {
    sds id = sdsnewlen(nodeid,CLUSTER_NAMELEN);
    int retval;

    clusterBlacklistCleanup();
    retval = dictFind(server.cluster->nodes_black_list,id) != NULL;
    sdsfree(id);
    return retval;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
pushq $0x28
popq %rsi
callq 0x31018
movq %rax, %rbx
callq 0x5c491
leaq 0x9d32a(%rip), %rax     # 0xf98a8
movq 0x9b0(%rax), %rax
movq 0x20(%rax), %rdi
movq %rbx, %rsi
callq 0x2a5f9
xorl %ebp, %ebp
testq %rax, %rax
setne %bpl
movq %rbx, %rdi
callq 0x311c8
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: markNodeAsFailingIfNeeded
void markNodeAsFailingIfNeeded(clusterNode *node) {
    int failures;
    int needed_quorum = (server.cluster->size / 2) + 1;

    if (!nodeTimedOut(node)) return; /* We can reach it. */
    if (nodeFailed(node)) return; /* Already FAILing. */

    failures = clusterNodeFailureReportsCount(node);
    /* Also count myself as a voter if I'm a master. */
    if (nodeIsMaster(myself)) failures++;
    if (failures < needed_quorum) return; /* No weak agreement from masters. */

    serverLog(LL_NOTICE,
        "Marking node %.40s as failing (quorum reached).", node->name);

    /* Mark the node as failing. */
    node->flags &= ~CLUSTER_NODE_PFAIL;
    node->flags |= CLUSTER_NODE_FAIL;
    node->fail_time = mstime();

    /* Broadcast the failing node name to everybody, forcing all the other
     * reachable nodes to flag the node as FAIL. */
    if (nodeIsMaster(myself)) clusterSendFail(node->name);
    clusterDoBeforeSleep(CLUSTER_TODO_UPDATE_STATE|CLUSTER_TODO_SAVE_CONFIG);
}

// Assembly:
movl 0x30(%rdi), %eax
andl $0xc, %eax
cmpl $0x4, %eax
jne 0x5c652
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x9d2dd(%rip), %r15     # 0xf98a8
movq 0x9b0(%r15), %rax
movl 0x14(%rax), %eax
pushq $0x2
popq %rcx
cltd
idivl %ecx
movl %eax, %ebp
callq 0x5c172
movq 0xb1c47(%rip), %rcx     # 0x10e230
movl 0x30(%rcx), %ecx
andl $0x1, %ecx
addl %eax, %ecx
cmpl %ebp, %ecx
jle 0x5c648
leaq 0x8(%rbx), %r14
leaq 0x5c531(%rip), %rsi     # 0xb8b31
pushq $0x2
popq %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2b699
movl 0x30(%rbx), %eax
andl $-0xd, %eax
orl $0x8, %eax
movl %eax, 0x30(%rbx)
callq 0x2b8ae
movq %rax, 0x868(%rbx)
movq 0xb1c04(%rip), %rax     # 0x10e230
testb $0x1, 0x30(%rax)
je 0x5c63a
movq %r14, %rdi
callq 0x5c653
movq 0x9b0(%r15), %rax
orl $0x6, 0x60080(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterSendFail
void clusterSendFail(char *nodename) {
    unsigned char buf[sizeof(clusterMsg)];
    clusterMsg *hdr = (clusterMsg*) buf;

    clusterBuildMessageHdr(hdr,CLUSTERMSG_TYPE_FAIL);
    memcpy(hdr->data.fail.about.nodename,nodename,CLUSTER_NAMELEN);
    clusterBroadcastMessage(buf,ntohl(hdr->totlen));
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x10d8, %rsp           # imm = 0x10D8
movq %rdi, %rbx
movq %rsp, %r14
pushq $0x3
popq %rsi
movq %r14, %rdi
callq 0x5e068
movq 0x20(%rbx), %rax
movq %rax, 0x8c0(%r14)
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movaps %xmm1, 0x8b0(%r14)
movaps %xmm0, 0x8a0(%r14)
movl 0x4(%r14), %esi
bswapl %esi
movq %r14, %rdi
callq 0x5e006
addq $0x10d8, %rsp           # imm = 0x10D8
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clearNodeFailureIfNeeded
void clearNodeFailureIfNeeded(clusterNode *node) {
    mstime_t now = mstime();

    serverAssert(nodeFailed(node));

    /* For slaves we always clear the FAIL flag if we can contact the
     * node again. */
    if (nodeIsSlave(node) || node->numslots == 0) {
        serverLog(LL_NOTICE,
            "Clear FAIL state for node %.40s: %s is reachable again.",
                node->name,
                nodeIsSlave(node) ? "slave" : "master without slots");
        node->flags &= ~CLUSTER_NODE_FAIL;
        clusterDoBeforeSleep(CLUSTER_TODO_UPDATE_STATE|CLUSTER_TODO_SAVE_CONFIG);
    }

    /* If it is a master and...
     * 1) The FAIL state is old enough.
     * 2) It is yet serving slots from our point of view (not failed over).
     * Apparently no one is going to fix these slots, clear the FAIL flag. */
    if (nodeIsMaster(node) && node->numslots > 0 &&
        (now - node->fail_time) >
        (server.cluster_node_timeout * CLUSTER_FAIL_UNDO_TIME_MULT))
    {
        serverLog(LL_NOTICE,
            "Clear FAIL state for node %.40s: is reachable again and nobody is serving its slots after some time.",
                node->name);
        node->flags &= ~CLUSTER_NODE_FAIL;
        clusterDoBeforeSleep(CLUSTER_TODO_UPDATE_STATE|CLUSTER_TODO_SAVE_CONFIG);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x2b8ae
movq %rax, %r14
movl 0x30(%rbx), %eax
testb $0x8, %al
je 0x5c76b
testb $0x2, %al
jne 0x5c6da
cmpl $0x0, 0x840(%rbx)
jne 0x5c714
leaq 0x5c4d2(%rip), %rcx     # 0xb8baa
jmp 0x5c6e1
leaq 0x5d5fc(%rip), %rcx     # 0xb9cdd
leaq 0x8(%rbx), %rdx
leaq 0x5c486(%rip), %rsi     # 0xb8b72
pushq $0x2
popq %rdi
xorl %eax, %eax
callq 0x2b699
movl 0x30(%rbx), %eax
andl $-0x9, %eax
movl %eax, 0x30(%rbx)
leaq 0x9d1a2(%rip), %rcx     # 0xf98a8
movq 0x9b0(%rcx), %rcx
orl $0x6, 0x60080(%rcx)
testb $0x1, %al
je 0x5c765
cmpl $0x0, 0x840(%rbx)
jle 0x5c765
subq 0x868(%rbx), %r14
leaq 0x9d179(%rip), %r15     # 0xf98a8
movq 0x9a0(%r15), %rax
addq %rax, %rax
cmpq %rax, %r14
jle 0x5c765
leaq 0x8(%rbx), %rdx
leaq 0x5c476(%rip), %rsi     # 0xb8bbf
pushq $0x2
popq %rdi
xorl %eax, %eax
callq 0x2b699
andb $-0x9, 0x30(%rbx)
movq 0x9b0(%r15), %rax
orl $0x6, 0x60080(%rax)
popq %rbx
popq %r14
popq %r15
retq
leaq 0x5c3ef(%rip), %rdi     # 0xb8b61
leaq 0x5bf84(%rip), %rsi     # 0xb86fd
movl $0x49e, %edx            # imm = 0x49E
callq 0x57ac8
pushq $0x1
popq %rdi
callq 0x263c0
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterHandshakeInProgress
int clusterHandshakeInProgress(char *ip, int port) {
    dictIterator *di;
    dictEntry *de;

    di = dictGetSafeIterator(server.cluster->nodes);
    while((de = dictNext(di)) != NULL) {
        clusterNode *node = dictGetVal(de);

        if (!nodeInHandshake(node)) continue;
        if (!strcasecmp(node->ip,ip) && node->port == port) break;
    }
    dictReleaseIterator(di);
    return de != NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
leaq 0x9d108(%rip), %rax     # 0xf98a8
movq 0x9b0(%rax), %rax
movq 0x18(%rax), %rdi
callq 0x2a9c4
movq %rax, %r15
movq %r15, %rdi
callq 0x2a9d3
movq %rax, %r12
testq %rax, %rax
je 0x5c7eb
movq 0x8(%r12), %r13
testb $0x20, 0x30(%r13)
je 0x5c7b3
leaq 0x890(%r13), %rdi
movq %r14, %rsi
callq 0x262f0
testl %eax, %eax
jne 0x5c7b3
cmpl %ebx, 0x8c0(%r13)
jne 0x5c7b3
xorl %ebx, %ebx
testq %r12, %r12
setne %bl
movq %r15, %rdi
callq 0x2aa94
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterStartHandshake
int clusterStartHandshake(char *ip, int port) {
    clusterNode *n;
    char norm_ip[NET_IP_STR_LEN];
    struct sockaddr_storage sa;

    /* IP sanity check */
    if (inet_pton(AF_INET,ip,
            &(((struct sockaddr_in *)&sa)->sin_addr)))
    {
        sa.ss_family = AF_INET;
    } else if (inet_pton(AF_INET6,ip,
            &(((struct sockaddr_in6 *)&sa)->sin6_addr)))
    {
        sa.ss_family = AF_INET6;
    } else {
        errno = EINVAL;
        return 0;
    }

    /* Port sanity check */
    if (port <= 0 || port > (65535-CLUSTER_PORT_INCR)) {
        errno = EINVAL;
        return 0;
    }

    /* Set norm_ip as the normalized string representation of the node
     * IP address. */
    memset(norm_ip,0,NET_IP_STR_LEN);
    if (sa.ss_family == AF_INET)
        inet_ntop(AF_INET,
            (void*)&(((struct sockaddr_in *)&sa)->sin_addr),
            norm_ip,NET_IP_STR_LEN);
    else
        inet_ntop(AF_INET6,
            (void*)&(((struct sockaddr_in6 *)&sa)->sin6_addr),
            norm_ip,NET_IP_STR_LEN);

    if (clusterHandshakeInProgress(norm_ip,port)) {
        errno = EAGAIN;
        return 0;
    }

    /* Add the node with a random address (NULL as first argument to
     * createClusterNode()). Everything will be fixed during the
     * handshake. */
    n = createClusterNode(NULL,CLUSTER_NODE_HANDSHAKE|CLUSTER_NODE_MEET);
    memcpy(n->ip,norm_ip,sizeof(n->ip));
    n->port = port;
    clusterAddNode(n);
    return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0xb8, %rsp
movl %esi, %ebx
movq %rdi, %r15
leaq 0x3c(%rsp), %r14
pushq $0x2
popq %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x26160
movl %eax, %ebp
movw $0x2, %cx
testl %eax, %eax
jne 0x5c84e
leaq 0x40(%rsp), %rdx
pushq $0xa
popq %rdi
movq %r15, %rsi
callq 0x26160
movw $0xa, %cx
testl %eax, %eax
je 0x5c85f
movw %cx, 0x38(%rsp)
movl $0xffff2710, %eax       # imm = 0xFFFF2710
leal (%rbx,%rax), %ecx
cmpl %eax, %ecx
ja 0x5c86c
callq 0x26880
movl $0x16, (%rax)
jmp 0x5c8bb
xorps %xmm0, %xmm0
movups %xmm0, 0x1e(%rsp)
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, (%rsp)
testl %ebp, %ebp
je 0x5c88f
pushq $0x2
popq %rdi
movq %rsp, %rdx
pushq $0x2e
popq %rcx
movq %r14, %rsi
jmp 0x5c89d
leaq 0x40(%rsp), %rsi
pushq $0xa
popq %rdi
movq %rsp, %rdx
pushq $0x2e
popq %rcx
callq 0x26c40
movq %rsp, %rdi
movl %ebx, %esi
callq 0x5c78b
testl %eax, %eax
je 0x5c8cb
callq 0x26880
movl $0xb, (%rax)
xorl %eax, %eax
addq $0xb8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
xorl %edi, %edi
movl $0xa0, %esi
callq 0x5b208
movaps (%rsp), %xmm0
movaps 0x10(%rsp), %xmm1
movups %xmm0, 0x890(%rax)
movups %xmm1, 0x8a0(%rax)
movups 0x1e(%rsp), %xmm0
movups %xmm0, 0x8ae(%rax)
movl %ebx, 0x8c0(%rax)
movq %rax, %rdi
callq 0x5b2c3
pushq $0x1
popq %rax
jmp 0x5c8bd
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: representClusterNodeFlags
sds representClusterNodeFlags(sds ci, uint16_t flags) {
    size_t orig_len = sdslen(ci);
    int i, size = sizeof(redisNodeFlagsTable)/sizeof(struct redisNodeFlags);
    for (i = 0; i < size; i++) {
        struct redisNodeFlags *nodeflag = redisNodeFlagsTable + i;
        if (flags & nodeflag->flag) ci = sdscat(ci, nodeflag->name);
    }
    /* If no flag was added, add the "noflags" special flag. */
    if (sdslen(ci) == orig_len) ci = sdscat(ci,"noflags,");
    sdsIncrLen(ci,-1); /* Remove trailing comma. */
    return ci;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
callq 0x5b5fd
movq %rax, %r14
pushq $0x8
popq %r15
leaq 0x951f0(%rip), %r12     # 0xf1d40
cmpq $0x78, %r15
je 0x5cb73
testw %bp, -0x8(%r15,%r12)
je 0x5cb6d
movq (%r15,%r12), %rsi
movq %rbx, %rdi
callq 0x317b7
movq %rax, %rbx
addq $0x10, %r15
jmp 0x5cb50
movq %rbx, %rdi
callq 0x5b5fd
cmpq %r14, %rax
jne 0x5cb92
leaq 0x5cb15(%rip), %rsi     # 0xb969c
movq %rbx, %rdi
callq 0x317b7
movq %rax, %rbx
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0x31514
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: nodeUpdateAddressIfNeeded
int nodeUpdateAddressIfNeeded(clusterNode *node, clusterLink *link, int port) {
    char ip[NET_IP_STR_LEN] = {0};

    /* We don't proceed if the link is the same as the sender link, as this
     * function is designed to see if the node link is consistent with the
     * symmetric link that is used to receive PINGs from the node.
     *
     * As a side effect this function never frees the passed 'link', so
     * it is safe to call during packet processing. */
    if (link == node->link) return 0;

    nodeIp2String(ip,link);
    if (node->port == port && strcmp(ip,node->ip) == 0) return 0;

    /* IP / port is different, update it. */
    memcpy(node->ip,ip,sizeof(ip));
    node->port = port;
    if (node->link) freeClusterLink(node->link);
    node->flags &= ~CLUSTER_NODE_NOADDR;
    serverLog(LL_WARNING,"Address updated for node %.40s, now %s:%d",
        node->name, node->ip, node->port);

    /* Check if this is our master and we have to change the
     * replication target as well. */
    if (nodeIsSlave(myself) && myself->slaveof == node)
        replicationSetMaster(node->ip, node->port);
    return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x38, %rsp
xorps %xmm0, %xmm0
movups %xmm0, 0x1e(%rsp)
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, (%rsp)
xorl %r14d, %r14d
cmpq %rsi, 0x8c8(%rdi)
je 0x5cca1
movl %edx, %ebp
movq %rdi, %rbx
movq %rsp, %rdi
callq 0x5cba9
cmpl %ebp, 0x8c0(%rbx)
jne 0x5cc13
leaq 0x890(%rbx), %rsi
movq %rsp, %rdi
callq 0x268f0
testl %eax, %eax
je 0x5cca1
leaq 0x890(%rbx), %r15
movups 0x1e(%rsp), %xmm0
movups %xmm0, 0x8ae(%rbx)
movaps (%rsp), %xmm0
movaps 0x10(%rsp), %xmm1
movups %xmm1, 0x8a0(%rbx)
movups %xmm0, 0x890(%rbx)
movl %ebp, 0x8c0(%rbx)
movq 0x8c8(%rbx), %rdi
testq %rdi, %rdi
je 0x5cc5a
callq 0x5bdf1
movl 0x8c0(%rbx), %ebp
andb $-0x41, 0x30(%rbx)
leaq 0x8(%rbx), %rdx
leaq 0x5c031(%rip), %rsi     # 0xb8c9a
pushq $0x3
popq %rdi
movq %r15, %rcx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x2b699
movq 0xb15b0(%rip), %rax     # 0x10e230
pushq $0x1
popq %r14
testb $0x2, 0x30(%rax)
je 0x5cca1
cmpq %rbx, 0x850(%rax)
jne 0x5cca1
movl 0x8c0(%rbx), %esi
movq %r15, %rdi
callq 0x3f66f
movl %r14d, %eax
addq $0x38, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterSetMaster
void clusterSetMaster(clusterNode *n) {
    serverAssert(n != myself);
    serverAssert(myself->numslots == 0);

    if (nodeIsMaster(myself)) {
        myself->flags &= ~(CLUSTER_NODE_MASTER|CLUSTER_NODE_MIGRATE_TO);
        myself->flags |= CLUSTER_NODE_SLAVE;
        clusterCloseAllSlots();
    } else {
        if (myself->slaveof)
            clusterNodeRemoveSlave(myself->slaveof,myself);
    }
    myself->slaveof = n;
    clusterNodeAddSlave(n,myself);
    replicationSetMaster(n->ip, n->port);
    resetManualFailover();
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq 0xb13b7(%rip), %r14     # 0x10e230
cmpq %rdi, %r14
je 0x5cf2b
cmpl $0x0, 0x840(%r14)
jne 0x5cf40
movq %rdi, %rbx
movl 0x30(%r14), %eax
testb $0x1, %al
jne 0x5ceb8
movq 0x850(%r14), %rdi
testq %rdi, %rdi
je 0x5cefa
movq %r14, %rsi
callq 0x5c187
movq 0xb137a(%rip), %r14     # 0x10e230
jmp 0x5cefa
andl $0xfffffefc, %eax       # imm = 0xFFFFFEFC
orl $0x2, %eax
movl %eax, 0x30(%r14)
leaq 0x9c9dd(%rip), %r15     # 0xf98a8
movq 0x9b0(%r15), %rdi
addq $0x28, %rdi
movl $0x20000, %edx          # imm = 0x20000
xorl %esi, %esi
callq 0x26110
movl $0x20028, %edi          # imm = 0x20028
addq 0x9b0(%r15), %rdi
movl $0x20000, %edx          # imm = 0x20000
xorl %esi, %esi
callq 0x26110
movq %rbx, 0x850(%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5b306
movl 0x8c0(%rbx), %esi
addq $0x890, %rbx            # imm = 0x890
movq %rbx, %rdi
callq 0x3f66f
popq %rbx
popq %r14
popq %r15
jmp 0x5ba74
leaq 0x5c748(%rip), %rdi     # 0xb967a
leaq 0x5b7c4(%rip), %rsi     # 0xb86fd
movl $0xe3a, %edx            # imm = 0xE3A
jmp 0x5cf53
leaq 0x5c73f(%rip), %rdi     # 0xb9686
leaq 0x5b7af(%rip), %rsi     # 0xb86fd
movl $0xe3b, %edx            # imm = 0xE3B
callq 0x57ac8
pushq $0x1
popq %rdi
callq 0x263c0
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterDelNodeSlots
int clusterDelNodeSlots(clusterNode *node) {
    int deleted = 0, j;

    for (j = 0; j < CLUSTER_SLOTS; j++) {
        if (clusterNodeGetSlotBit(node,j)) {
            clusterDelSlot(j);
            deleted++;
        }
    }
    return deleted;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %r14
xorl %ebx, %ebx
xorl %ebp, %ebp
cmpl $0x4000, %ebp           # imm = 0x4000
je 0x5dc01
movl %ebp, %eax
shrl $0x3, %eax
movzbl 0x40(%r14,%rax), %eax
movl %ebp, %ecx
andl $0x7, %ecx
btl %ecx, %eax
jae 0x5dbfd
movl %ebp, %edi
callq 0x5bc88
incl %ebx
incl %ebp
jmp 0x5dbd7
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq