LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterSendUpdate
void clusterSendUpdate(clusterLink *link, clusterNode *node) {
    unsigned char buf[sizeof(clusterMsg)];
    clusterMsg *hdr = (clusterMsg*) buf;

    if (link == NULL) return;
    clusterBuildMessageHdr(hdr,CLUSTERMSG_TYPE_UPDATE);
    memcpy(hdr->data.update.nodecfg.nodename,node->name,CLUSTER_NAMELEN);
    hdr->data.update.nodecfg.configEpoch = htonu64(node->configEpoch);
    memcpy(hdr->data.update.nodecfg.slots,node->slots,sizeof(node->slots));
    clusterSendMessage(link,buf,ntohl(hdr->totlen));
}

// Assembly:
testq %rdi, %rdi
je 0x5dc9c
pushq %r15
pushq %r14
pushq %rbx
subq $0x10d0, %rsp           # imm = 0x10D0
movq %rsi, %r15
movq %rdi, %rbx
movq %rsp, %r14
pushq $0x7
popq %rsi
movq %r14, %rdi
callq 0x5e068
movq 0x28(%r15), %rax
movq %rax, 0x8c8(%r14)
movups 0x8(%r15), %xmm0
movups 0x18(%r15), %xmm1
movups %xmm1, 0x8b8(%r14)
movups %xmm0, 0x8a8(%r14)
movq 0x38(%r15), %rdi
callq 0x61f7b
movq %rax, 0x8a0(%r14)
leaq 0x8d0(%rsp), %rdi
addq $0x40, %r15
movl $0x800, %edx            # imm = 0x800
movq %r15, %rsi
callq 0x26c50
movl 0x4(%r14), %edx
bswapl %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5df88
addq $0x10d0, %rsp           # imm = 0x10D0
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterWriteHandler
void clusterWriteHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
    clusterLink *link = (clusterLink*) privdata;
    ssize_t nwritten;
    UNUSED(el);
    UNUSED(mask);

    nwritten = write(fd, link->sndbuf, sdslen(link->sndbuf));
    if (nwritten <= 0) {
        serverLog(LL_DEBUG,"I/O error writing to node link: %s",
            strerror(errno));
        handleLinkIOError(link);
        return;
    }
    sdsrange(link->sndbuf,nwritten,-1);
    if (sdslen(link->sndbuf) == 0)
        aeDeleteFileEvent(server.el, link->fd, AE_WRITABLE);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movl %esi, %ebp
movq 0x10(%rdx), %r14
movq %r14, %rdi
callq 0x5b5fd
movl %ebp, %edi
movq %r14, %rsi
movq %rax, %rdx
callq 0x26bb0
testq %rax, %rax
jle 0x5df43
movq 0x10(%rbx), %rdi
pushq $-0x1
popq %rdx
movl %eax, %esi
callq 0x31e8e
movq 0x10(%rbx), %rdi
callq 0x5b5fd
testq %rax, %rax
je 0x5df6e
popq %rbx
popq %r14
popq %rbp
retq
callq 0x26880
movl (%rax), %edi
callq 0x26680
leaq 0x5b06a(%rip), %rsi     # 0xb8fc0
xorl %edi, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0x2b699
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x5bdf1
leaq 0x9b933(%rip), %rax     # 0xf98a8
movq 0x40(%rax), %rdi
movl 0x8(%rbx), %esi
pushq $0x2
popq %rdx
popq %rbx
popq %r14
popq %rbp
jmp 0x28ba8
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterSendMessage
void clusterSendMessage(clusterLink *link, unsigned char *msg, size_t msglen) {
    if (sdslen(link->sndbuf) == 0 && msglen != 0)
        aeCreateFileEvent(server.el,link->fd,AE_WRITABLE,
                    clusterWriteHandler,link);

    link->sndbuf = sdscatlen(link->sndbuf, msg, msglen);
    server.cluster->stats_bus_messages_sent++;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq 0x10(%rdi), %r12
movq %r12, %rdi
callq 0x5b5fd
testq %r14, %r14
je 0x5dfd3
testq %rax, %rax
jne 0x5dfd3
leaq 0x9b8f2(%rip), %rax     # 0xf98a8
movq 0x40(%rax), %rdi
movl 0x8(%rbx), %esi
leaq -0xc9(%rip), %rcx       # 0x5defb
pushq $0x2
popq %rdx
movq %rbx, %r8
callq 0x28ae8
movq 0x10(%rbx), %r12
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x31758
movq %rax, 0x10(%rbx)
leaq 0x9b8bc(%rip), %rax     # 0xf98a8
movq 0x9b0(%rax), %rax
incq 0x60088(%rax)
addq $0x8, %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: clusterBroadcastMessage
void clusterBroadcastMessage(void *buf, size_t len) {
    dictIterator *di;
    dictEntry *de;

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

        if (!node->link) continue;
        if (node->flags & (CLUSTER_NODE_MYSELF|CLUSTER_NODE_HANDSHAKE))
            continue;
        clusterSendMessage(node->link,buf,len);
    }
    dictReleaseIterator(di);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x9b890(%rip), %rax     # 0xf98a8
movq 0x9b0(%rax), %rax
movq 0x18(%rax), %rdi
callq 0x2a9c4
movq %rax, %r15
movq %r15, %rdi
callq 0x2a9d3
testq %rax, %rax
je 0x5e05b
movq 0x8(%rax), %rax
movq 0x8c8(%rax), %rdi
testq %rdi, %rdi
je 0x5e02b
testb $0x30, 0x30(%rax)
jne 0x5e02b
movq %r14, %rsi
movq %rbx, %rdx
callq 0x5df88
jmp 0x5e02b
movq %r15, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x2aa94
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterBroadcastPong
void clusterBroadcastPong(int target) {
    dictIterator *di;
    dictEntry *de;

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

        if (!node->link) continue;
        if (node == myself || nodeInHandshake(node)) continue;
        if (target == CLUSTER_BROADCAST_LOCAL_SLAVES) {
            int local_slave =
                nodeIsSlave(node) && node->slaveof &&
                (node->slaveof == myself || node->slaveof == myself->slaveof);
            if (!local_slave) continue;
        }
        clusterSendPing(node->link,CLUSTERMSG_TYPE_PONG);
    }
    dictReleaseIterator(di);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edi, %ebx
leaq 0x9b6aa(%rip), %rax     # 0xf98a8
movq 0x9b0(%rax), %rax
movq 0x18(%rax), %rdi
callq 0x2a9c4
movq %rax, %r14
pushq $0x1
popq %rbp
movq %r14, %rdi
callq 0x2a9d3
testq %rax, %rax
je 0x5e272
movq 0x8(%rax), %rcx
movq 0x8c8(%rcx), %rdi
testq %rdi, %rdi
je 0x5e214
movq 0xafff8(%rip), %rax     # 0x10e230
cmpq %rax, %rcx
je 0x5e214
movl 0x30(%rcx), %edx
testb $0x20, %dl
jne 0x5e214
cmpl $0x1, %ebx
jne 0x5e269
testb $0x2, %dl
je 0x5e214
movq 0x850(%rcx), %rcx
testq %rcx, %rcx
je 0x5e214
cmpq %rax, %rcx
je 0x5e269
cmpq 0x850(%rax), %rcx
jne 0x5e214
movl %ebp, %esi
callq 0x5d948
jmp 0x5e214
movq %r14, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x2aa94
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterSendPublish
void clusterSendPublish(clusterLink *link, robj *channel, robj *message) {
    unsigned char buf[sizeof(clusterMsg)], *payload;
    clusterMsg *hdr = (clusterMsg*) buf;
    uint32_t totlen;
    uint32_t channel_len, message_len;

    channel = getDecodedObject(channel);
    message = getDecodedObject(message);
    channel_len = sdslen(channel->ptr);
    message_len = sdslen(message->ptr);

    clusterBuildMessageHdr(hdr,CLUSTERMSG_TYPE_PUBLISH);
    totlen = sizeof(clusterMsg)-sizeof(union clusterMsgData);
    totlen += sizeof(clusterMsgDataPublish) - 8 + channel_len + message_len;

    hdr->data.publish.msg.channel_len = htonl(channel_len);
    hdr->data.publish.msg.message_len = htonl(message_len);
    hdr->totlen = htonl(totlen);

    /* Try to use the local buffer if possible */
    if (totlen < sizeof(buf)) {
        payload = buf;
    } else {
        payload = zmalloc(totlen);
        memcpy(payload,hdr,sizeof(*hdr));
        hdr = (clusterMsg*) payload;
    }
    memcpy(hdr->data.publish.msg.bulk_data,channel->ptr,sdslen(channel->ptr));
    memcpy(hdr->data.publish.msg.bulk_data+sdslen(channel->ptr),
        message->ptr,sdslen(message->ptr));

    if (link)
        clusterSendMessage(link,payload,totlen);
    else
        clusterBroadcastMessage(payload,totlen);

    decrRefCount(channel);
    decrRefCount(message);
    if (payload != buf) zfree(payload);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10e8, %rsp           # imm = 0x10E8
movq %rdx, %r14
movq %rdi, 0x8(%rsp)
movq %rsi, %rdi
callq 0x3a57d
movq %rax, %rbx
movq %r14, %rdi
callq 0x3a57d
movq %rax, %r14
movq 0x8(%rbx), %rdi
callq 0x5b5fd
movq %rax, %rbp
movq 0x8(%r14), %rdi
callq 0x5b5fd
movq %rax, %r15
leaq 0x10(%rsp), %r12
pushq $0x4
popq %rsi
movq %r12, %rdi
callq 0x5e068
leal (%r15,%rbp), %r13d
addl $0x8a8, %r13d           # imm = 0x8A8
bswapl %ebp
movl %ebp, 0x8a0(%r12)
bswapl %r15d
movl %r15d, 0x8a4(%r12)
movl %r13d, %eax
bswapl %eax
movl %eax, 0x4(%r12)
cmpl $0x10d0, %r13d          # imm = 0x10D0
jb 0x5e325
movq %r13, %rdi
callq 0x327b9
movq %rax, %r12
leaq 0x10(%rsp), %rsi
movl $0x10d0, %edx           # imm = 0x10D0
movq %rax, %rdi
callq 0x26c50
leaq 0x8a8(%r12), %r15
movq 0x8(%rbx), %rbp
movq %rbp, %rdi
callq 0x5b5fd
movq %r15, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x26c50
movq 0x8(%rbx), %rdi
callq 0x5b5fd
leaq (%r12,%rax), %r15
addq $0x8a8, %r15            # imm = 0x8A8
movq 0x8(%r14), %rbp
movq %rbp, %rdi
callq 0x5b5fd
movq %r15, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x26c50
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x5e38c
movq %r12, %rsi
movq %r13, %rdx
callq 0x5df88
jmp 0x5e397
movq %r12, %rdi
movq %r13, %rsi
callq 0x5e006
movq %rbx, %rdi
callq 0x3a265
movq %r14, %rdi
callq 0x3a265
leaq 0x10(%rsp), %rax
cmpq %rax, %r12
je 0x5e3b9
movq %r12, %rdi
callq 0x328f9
addq $0x10e8, %rsp           # imm = 0x10E8
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: clusterRequestFailoverAuth
void clusterRequestFailoverAuth(void) {
    unsigned char buf[sizeof(clusterMsg)];
    clusterMsg *hdr = (clusterMsg*) buf;
    uint32_t totlen;

    clusterBuildMessageHdr(hdr,CLUSTERMSG_TYPE_FAILOVER_AUTH_REQUEST);
    /* If this is a manual failover, set the CLUSTERMSG_FLAG0_FORCEACK bit
     * in the header to communicate the nodes receiving the message that
     * they should authorized the failover even if the master is working. */
    if (server.cluster->mf_end) hdr->mflags[0] |= CLUSTERMSG_FLAG0_FORCEACK;
    totlen = sizeof(clusterMsg)-sizeof(union clusterMsgData);
    hdr->totlen = htonl(totlen);
    clusterBroadcastMessage(buf,totlen);
}

// Assembly:
subq $0x10d8, %rsp           # imm = 0x10D8
movq %rsp, %rdi
pushq $0x5
popq %rsi
callq 0x5e068
leaq 0x9b4b7(%rip), %rax     # 0xf98a8
movq 0x9b0(%rax), %rax
cmpq $0x0, 0x60058(%rax)
je 0x5e40a
orb $0x2, 0x89d(%rsp)
movq %rsp, %rdi
movl $0xa0080000, 0x4(%rdi)  # imm = 0xA0080000
movl $0x8a0, %esi            # imm = 0x8A0
callq 0x5e006
addq $0x10d8, %rsp           # imm = 0x10D8
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterSendFailoverAuth
void clusterSendFailoverAuth(clusterNode *node) {
    unsigned char buf[sizeof(clusterMsg)];
    clusterMsg *hdr = (clusterMsg*) buf;
    uint32_t totlen;

    if (!node->link) return;
    clusterBuildMessageHdr(hdr,CLUSTERMSG_TYPE_FAILOVER_AUTH_ACK);
    totlen = sizeof(clusterMsg)-sizeof(union clusterMsgData);
    hdr->totlen = htonl(totlen);
    clusterSendMessage(node->link,buf,totlen);
}

// Assembly:
cmpq $0x0, 0x8c8(%rdi)
je 0x5e471
pushq %r14
pushq %rbx
subq $0x10d8, %rsp           # imm = 0x10D8
movq %rdi, %rbx
movq %rsp, %r14
pushq $0x6
popq %rsi
movq %r14, %rdi
callq 0x5e068
movl $0xa0080000, 0x4(%r14)  # imm = 0xA0080000
movq 0x8c8(%rbx), %rdi
movl $0x8a0, %edx            # imm = 0x8A0
movq %r14, %rsi
callq 0x5df88
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: clusterSendMFStart
void clusterSendMFStart(clusterNode *node) {
    unsigned char buf[sizeof(clusterMsg)];
    clusterMsg *hdr = (clusterMsg*) buf;
    uint32_t totlen;

    if (!node->link) return;
    clusterBuildMessageHdr(hdr,CLUSTERMSG_TYPE_MFSTART);
    totlen = sizeof(clusterMsg)-sizeof(union clusterMsgData);
    hdr->totlen = htonl(totlen);
    clusterSendMessage(node->link,buf,totlen);
}

// Assembly:
cmpq $0x0, 0x8c8(%rdi)
je 0x5e4bd
pushq %r14
pushq %rbx
subq $0x10d8, %rsp           # imm = 0x10D8
movq %rdi, %rbx
movq %rsp, %r14
pushq $0x8
popq %rsi
movq %r14, %rdi
callq 0x5e068
movl $0xa0080000, 0x4(%r14)  # imm = 0xA0080000
movq 0x8c8(%rbx), %rdi
movl $0x8a0, %edx            # imm = 0x8A0
movq %r14, %rsi
callq 0x5df88
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: clusterGetSlaveRank
int clusterGetSlaveRank(void) {
    long long myoffset;
    int j, rank = 0;
    clusterNode *master;

    serverAssert(nodeIsSlave(myself));
    master = myself->slaveof;
    if (master == NULL) return 0; /* Never called by slaves without master. */

    myoffset = replicationGetSlaveOffset();
    for (j = 0; j < master->numslaves; j++)
        if (master->slaves[j] != myself &&
            master->slaves[j]->repl_offset > myoffset) rank++;
    return rank;
}

// Assembly:
pushq %rbx
movq 0xafd6a(%rip), %rax     # 0x10e230
testb $0x2, 0x30(%rax)
je 0x5e524
movq 0x850(%rax), %rbx
testq %rbx, %rbx
je 0x5e51e
callq 0x3fee6
movl 0x844(%rbx), %edx
movq 0xafd46(%rip), %rsi     # 0x10e230
xorl %edi, %edi
testl %edx, %edx
cmovlel %edi, %edx
xorl %ecx, %ecx
cmpq %rdi, %rdx
je 0x5e520
movq 0x848(%rbx), %r8
movq (%r8,%rdi,8), %r8
cmpq %rsi, %r8
je 0x5e519
xorl %r9d, %r9d
cmpq %rax, 0x888(%r8)
setg %r9b
addl %r9d, %ecx
incq %rdi
jmp 0x5e4f3
xorl %ecx, %ecx
movl %ecx, %eax
popq %rbx
retq
leaq 0x5ad0e(%rip), %rdi     # 0xb9239
leaq 0x5a1cb(%rip), %rsi     # 0xb86fd
movl $0xa1a, %edx            # imm = 0xA1A
callq 0x57ac8
pushq $0x1
popq %rdi
callq 0x263c0
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterLogCantFailover
void clusterLogCantFailover(int reason) {
    char *msg;
    static time_t lastlog_time = 0;
    mstime_t nolog_fail_time = server.cluster_node_timeout + 5000;

    /* Don't log if we have the same reason for some time. */
    if (reason == server.cluster->cant_failover_reason &&
        time(NULL)-lastlog_time < CLUSTER_CANT_FAILOVER_RELOG_PERIOD)
        return;

    server.cluster->cant_failover_reason = reason;

    /* We also don't emit any log if the master failed no long ago, the
     * goal of this function is to log slaves in a stalled condition for
     * a long time. */
    if (myself->slaveof &&
        nodeFailed(myself->slaveof) &&
        (mstime() - myself->slaveof->fail_time) < nolog_fail_time) return;

    switch(reason) {
    case CLUSTER_CANT_FAILOVER_DATA_AGE:
        msg = "Disconnected from master for longer than allowed. "
              "Please check the 'cluster-slave-validity-factor' configuration "
              "option.";
        break;
    case CLUSTER_CANT_FAILOVER_WAITING_DELAY:
        msg = "Waiting the delay before I can start a new failover.";
        break;
    case CLUSTER_CANT_FAILOVER_EXPIRED:
        msg = "Failover attempt expired.";
        break;
    case CLUSTER_CANT_FAILOVER_WAITING_VOTES:
        msg = "Waiting for votes, but majority still not reached.";
        break;
    default:
        msg = "Unknown reason code.";
        break;
    }
    lastlog_time = time(NULL);
    serverLog(LL_WARNING,"Currently unable to failover: %s", msg);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
leaq 0x9b358(%rip), %r15     # 0xf98a8
movl $0x1388, %r14d          # imm = 0x1388
addq 0x9a0(%r15), %r14
movl %edi, %ebx
movq 0x9b0(%r15), %rax
cmpl %edi, 0x60050(%rax)
jne 0x5e58b
xorl %edi, %edi
callq 0x26cd0
subq 0xafcbc(%rip), %rax     # 0x10e238
cmpq $0x12c, %rax            # imm = 0x12C
jl 0x5e5c9
movq 0x9b0(%r15), %rax
movl %ebx, 0x60050(%rax)
movq 0xafc98(%rip), %rax     # 0x10e230
movq 0x850(%rax), %rax
testq %rax, %rax
je 0x5e5cf
testb $0x8, 0x30(%rax)
je 0x5e5cf
callq 0x2b8ae
movq 0xafc7a(%rip), %rcx     # 0x10e230
movq 0x850(%rcx), %rcx
subq 0x868(%rcx), %rax
cmpq %r14, %rax
jge 0x5e5cf
popq %rbx
popq %r14
popq %r15
retq
decl %ebx
cmpl $0x3, %ebx
ja 0x5e5e8
movl %ebx, %eax
leaq 0x5a075(%rip), %rcx     # 0xb8654
movslq (%rcx,%rax,4), %rbx
addq %rcx, %rbx
jmp 0x5e5ef
leaq 0x5ad59(%rip), %rbx     # 0xb9348
xorl %edi, %edi
callq 0x26cd0
movq %rax, 0xafc3b(%rip)     # 0x10e238
leaq 0x5ad59(%rip), %rsi     # 0xb935d
pushq $0x3
popq %rdi
movq %rbx, %rdx
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
jmp 0x2b699
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterFailoverReplaceYourMaster
void clusterFailoverReplaceYourMaster(void) {
    int j;
    clusterNode *oldmaster = myself->slaveof;

    if (nodeIsMaster(myself) || oldmaster == NULL) return;

    /* 1) Turn this node into a master. */
    clusterSetNodeAsMaster(myself);
    replicationUnsetMaster();

    /* 2) Claim all the slots assigned to our master. */
    for (j = 0; j < CLUSTER_SLOTS; j++) {
        if (clusterNodeGetSlotBit(oldmaster,j)) {
            clusterDelSlot(j);
            clusterAddSlot(myself,j);
        }
    }

    /* 3) Update state and save config. */
    clusterUpdateState();
    clusterSaveConfigOrDie(1);

    /* 4) Pong all the other nodes so that they can update the state
     *    accordingly and detect that we switched to master role. */
    clusterBroadcastPong(CLUSTER_BROADCAST_ALL);

    /* 5) If there was a manual failover in progress, clear the state. */
    resetManualFailover();
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0xafc0f(%rip), %rdi     # 0x10e230
movq 0x850(%rdi), %r14
testq %r14, %r14
sete %al
orb 0x30(%rdi), %al
testb $0x1, %al
je 0x5e63d
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x5bc2e
callq 0x3f6ed
xorl %ebx, %ebx
cmpl $0x4000, %ebx           # imm = 0x4000
je 0x5e67f
movl %ebx, %eax
shrl $0x3, %eax
movzbl 0x40(%r14,%rax), %eax
movl %ebx, %ecx
andl $0x7, %ecx
btl %ecx, %eax
jae 0x5e67b
movl %ebx, %edi
callq 0x5bc88
movq 0xafbbc(%rip), %rdi     # 0x10e230
movl %ebx, %esi
callq 0x5b377
incl %ebx
jmp 0x5e649
callq 0x5e6ba
pushq $0x1
popq %rdi
callq 0x5b635
xorl %edi, %edi
callq 0x5e1f1
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x5ba74
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterHandleManualFailover
void clusterHandleManualFailover(void) {
    /* Return ASAP if no manual failover is in progress. */
    if (server.cluster->mf_end == 0) return;

    /* If mf_can_start is non-zero, the failover was already triggered so the
     * next steps are performed by clusterHandleSlaveFailover(). */
    if (server.cluster->mf_can_start) return;

    if (server.cluster->mf_master_offset == 0) return; /* Wait for offset... */

    if (server.cluster->mf_master_offset == replicationGetSlaveOffset()) {
        /* Our replication offset matches the master replication offset
         * announced after clients were paused. We can start the failover. */
        server.cluster->mf_can_start = 1;
        serverLog(LL_WARNING,
            "All master replication stream processed, "
            "manual failover can start.");
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0x9aae1(%rip), %rbx     # 0xf98a8
movq 0x9b0(%rbx), %rax
cmpq $0x0, 0x60058(%rax)
je 0x5ede1
cmpl $0x0, 0x60070(%rax)
je 0x5ede9
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq 0x60068(%rax), %r14
testq %r14, %r14
je 0x5ede1
callq 0x3fee6
cmpq %rax, %r14
jne 0x5ede1
movq 0x9b0(%rbx), %rax
movl $0x1, 0x60070(%rax)
leaq 0x5a6b5(%rip), %rsi     # 0xb94cc
pushq $0x3
popq %rdi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2b699
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterBeforeSleep
void clusterBeforeSleep(void) {
    /* Handle failover, this is needed when it is likely that there is already
     * the quorum from masters in order to react fast. */
    if (server.cluster->todo_before_sleep & CLUSTER_TODO_HANDLE_FAILOVER)
        clusterHandleSlaveFailover();

    /* Update the cluster state. */
    if (server.cluster->todo_before_sleep & CLUSTER_TODO_UPDATE_STATE)
        clusterUpdateState();

    /* Save the config, possibly using fsync. */
    if (server.cluster->todo_before_sleep & CLUSTER_TODO_SAVE_CONFIG) {
        int fsync = server.cluster->todo_before_sleep &
                    CLUSTER_TODO_FSYNC_CONFIG;
        clusterSaveConfigOrDie(fsync);
    }

    /* Reset our flags (not strictly needed since every single function
     * called for flags set should be able to clear its flag). */
    server.cluster->todo_before_sleep = 0;
}

// Assembly:
pushq %rbx
leaq 0x9a561(%rip), %rbx     # 0xf98a8
movq 0x9b0(%rbx), %rax
movl 0x60080(%rax), %edi
testb $0x1, %dil
je 0x5f36c
callq 0x5e860
movq 0x9b0(%rbx), %rax
movl 0x60080(%rax), %edi
testb $0x2, %dil
je 0x5f384
callq 0x5e6ba
movq 0x9b0(%rbx), %rax
movl 0x60080(%rax), %edi
testb $0x4, %dil
je 0x5f399
andl $0x8, %edi
callq 0x5b635
movq 0x9b0(%rbx), %rax
andl $0x0, 0x60080(%rax)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterMastersHaveSlaves
int clusterMastersHaveSlaves(void) {
    dictIterator *di = dictGetSafeIterator(server.cluster->nodes);
    dictEntry *de;
    int slaves = 0;
    while((de = dictNext(di)) != NULL) {
        clusterNode *node = dictGetVal(de);

        if (nodeIsSlave(node)) continue;
        slaves += node->numslaves;
    }
    dictReleaseIterator(di);
    return slaves != 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
leaq 0x9a4ca(%rip), %rax     # 0xf98a8
movq 0x9b0(%rax), %rax
movq 0x18(%rax), %rdi
callq 0x2a9c4
movq %rax, %rbx
xorl %ebp, %ebp
movq %rbx, %rdi
callq 0x2a9d3
testq %rax, %rax
je 0x5f412
movq 0x8(%rax), %rax
testb $0x2, 0x30(%rax)
jne 0x5f3f3
addl 0x844(%rax), %ebp
jmp 0x5f3f3
movq %rbx, %rdi
callq 0x2aa94
xorl %eax, %eax
testl %ebp, %ebp
setne %al
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterNodeSetSlotBit
int clusterNodeSetSlotBit(clusterNode *n, int slot) {
    int old = bitmapTestBit(n->slots,slot);
    bitmapSetBit(n->slots,slot);
    if (!old) {
        n->numslots++;
        /* When a master gets its first slot, even if it has no slaves,
         * it gets flagged with MIGRATE_TO, that is, the master is a valid
         * target for replicas migration, if and only if at least one of
         * the other masters has slaves right now.
         *
         * Normally masters are valid targerts of replica migration if:
         * 1. The used to have slaves (but no longer have).
         * 2. They are slaves failing over a master that used to have slaves.
         *
         * However new masters with slots assigned are considered valid
         * migration tagets if the rest of the cluster is not a slave-less.
         *
         * See https://github.com/antirez/redis/issues/3043 for more info. */
        if (n->numslots == 1 && clusterMastersHaveSlaves())
            n->flags |= CLUSTER_NODE_MIGRATE_TO;
    }
    return old;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
pushq $0x8
popq %rcx
movl %esi, %eax
cltd
idivl %ecx
cltq
movzbl 0x40(%rdi,%rax), %ecx
andb $0x7, %sil
movl %ecx, %edx
btsl %esi, %edx
movzbl %sil, %esi
xorl %ebp, %ebp
btl %esi, %ecx
setb %bpl
movb %dl, 0x40(%rdi,%rax)
jb 0x5f479
movq %rdi, %rbx
movl 0x840(%rdi), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0x840(%rdi)
testl %eax, %eax
jne 0x5f479
callq 0x5f3d4
testl %eax, %eax
je 0x5f479
orb $0x1, 0x31(%rbx)
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: clusterNodeClearSlotBit
int clusterNodeClearSlotBit(clusterNode *n, int slot) {
    int old = bitmapTestBit(n->slots,slot);
    bitmapClearBit(n->slots,slot);
    if (old) n->numslots--;
    return old;
}

// Assembly:
movl %esi, %ecx
pushq $0x8
popq %rsi
movl %ecx, %eax
cltd
idivl %esi
movslq %eax, %rdx
movzbl 0x40(%rdi,%rdx), %esi
andb $0x7, %cl
movl %esi, %eax
shrl %cl, %eax
pushq $0x1
popq %r8
shll %cl, %r8d
notb %r8b
andb %sil, %r8b
movb %r8b, 0x40(%rdi,%rdx)
andl $0x1, %eax
je 0x5f4b8
decl 0x840(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: createDumpPayload
void createDumpPayload(rio *payload, robj *o) {
    unsigned char buf[2];
    uint64_t crc;

    /* Serialize the object in a RDB-like format. It consist of an object type
     * byte followed by the serialized object. This is understood by RESTORE. */
    rioInitWithBuffer(payload,sdsempty());
    serverAssert(rdbSaveObjectType(payload,o));
    serverAssert(rdbSaveObject(payload,o));

    /* Write the footer, this is how it looks like:
     * ----------------+---------------------+---------------+
     * ... RDB payload | 2 bytes RDB version | 8 bytes CRC64 |
     * ----------------+---------------------+---------------+
     * RDB version and CRC are both in little endian.
     */

    /* RDB version */
    buf[0] = RDB_VERSION & 0xff;
    buf[1] = (RDB_VERSION >> 8) & 0xff;
    payload->io.buffer.ptr = sdscatlen(payload->io.buffer.ptr,buf,2);

    /* CRC64 */
    crc = crc64(0,(unsigned char*)payload->io.buffer.ptr,
                sdslen(payload->io.buffer.ptr));
    memrev64ifbe(&crc);
    payload->io.buffer.ptr = sdscatlen(payload->io.buffer.ptr,&crc,8);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
callq 0x3114c
movq %rbx, %rdi
movq %rax, %rsi
callq 0x66a98
movq %rbx, %rdi
movq %r14, %rsi
callq 0x40f1b
testl %eax, %eax
je 0x60a3a
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4102b
testq %rax, %rax
je 0x60a4f
leaq 0xe(%rsp), %rsi
movw $0x7, (%rsi)
movq 0x40(%rbx), %rdi
pushq $0x2
popq %rdx
callq 0x31758
movq %rax, %r14
movq %rax, 0x40(%rbx)
movq %rax, %rdi
callq 0x5b5fd
xorl %edi, %edi
movq %r14, %rsi
movq %rax, %rdx
callq 0x67b24
leaq 0x10(%rsp), %rsi
movq %rax, (%rsi)
movq 0x40(%rbx), %rdi
pushq $0x8
popq %rdx
callq 0x31758
movq %rax, 0x40(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r14
retq
leaq 0x594e3(%rip), %rdi     # 0xb9f24
leaq 0x57cb5(%rip), %rsi     # 0xb86fd
movl $0x1135, %edx           # imm = 0x1135
jmp 0x60a62
leaq 0x594eb(%rip), %rdi     # 0xb9f41
leaq 0x57ca0(%rip), %rsi     # 0xb86fd
movl $0x1136, %edx           # imm = 0x1136
callq 0x57ac8
pushq $0x1
popq %rdi
callq 0x263c0
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: verifyDumpPayload
int verifyDumpPayload(unsigned char *p, size_t len) {
    unsigned char *footer;
    uint16_t rdbver;
    uint64_t crc;

    /* At least 2 bytes of RDB version and 8 of CRC64 should be present. */
    if (len < 10) return C_ERR;
    footer = p+(len-10);

    /* Verify RDB version */
    rdbver = (footer[1] << 8) | footer[0];
    if (rdbver > RDB_VERSION) return C_ERR;

    /* Verify CRC64 */
    crc = crc64(0,p,len-8);
    memrev64ifbe(&crc);
    return (memcmp(&crc,footer+2,8) == 0) ? C_OK : C_ERR;
}

// Assembly:
movq %rsi, %rdx
pushq $-0x1
popq %rax
cmpq $0xa, %rsi
jb 0x60ab2
movq %rdi, %rsi
cmpw $0x7, -0xa(%rdi,%rdx)
ja 0x60ab2
pushq %rbx
subq $0x10, %rsp
leaq (%rsi,%rdx), %rbx
addq $-0x8, %rdx
xorl %edi, %edi
callq 0x67b24
movq %rax, %rcx
movq %rax, 0x8(%rsp)
xorl %eax, %eax
cmpq -0x8(%rbx), %rcx
setne %al
negl %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: dumpCommand
void dumpCommand(client *c) {
    robj *o, *dumpobj;
    rio payload;

    /* Check if the key is here. */
    if ((o = lookupKeyRead(c->db,c->argv[1])) == NULL) {
        addReply(c,shared.nullbulk);
        return;
    }

    /* Create the DUMP encoded representation. */
    createDumpPayload(&payload,o);

    /* Transfer to the client */
    dumpobj = createObject(OBJ_STRING,payload.io.buffer.ptr);
    addReplyBulk(c,dumpobj);
    decrRefCount(dumpobj);
    return;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rsi
callq 0x3aebb
testq %rax, %rax
je 0x60b0a
movq %rsp, %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x609ac
movq 0x40(%r14), %rsi
xorl %edi, %edi
callq 0x39d58
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
callq 0x36fd9
movq %r14, %rdi
callq 0x3a265
addq $0x68, %rsp
popq %rbx
popq %r14
retq
leaq 0x997ff(%rip), %rax     # 0xfa310
movq 0x50(%rax), %rsi
movq %rbx, %rdi
addq $0x68, %rsp
popq %rbx
popq %r14
jmp 0x36987
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: migrateCloseSocket
void migrateCloseSocket(robj *host, robj *port) {
    sds name = sdsempty();
    migrateCachedSocket *cs;

    name = sdscatlen(name,host->ptr,sdslen(host->ptr));
    name = sdscatlen(name,":",1);
    name = sdscatlen(name,port->ptr,sdslen(port->ptr));
    cs = dictFetchValue(server.migrate_cached_sockets,name);
    if (!cs) {
        sdsfree(name);
        return;
    }

    close(cs->fd);
    zfree(cs);
    dictDelete(server.migrate_cached_sockets,name);
    sdsfree(name);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
callq 0x3114c
movq %rax, %r15
movq 0x8(%r14), %r14
movq %r14, %rdi
callq 0x5b5fd
movq %r15, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x31758
leaq 0x6152c(%rip), %rsi     # 0xc2438
pushq $0x1
popq %rdx
movq %rax, %rdi
callq 0x31758
movq %rax, %r14
movq 0x8(%rbx), %rbx
movq %rbx, %rdi
callq 0x5b5fd
movq %r14, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x31758
movq %rax, %rbx
leaq 0x9896a(%rip), %r15     # 0xf98a8
movq 0x308(%r15), %rdi
movq %rax, %rsi
callq 0x2a900
testq %rax, %rax
je 0x60f73
movq %rax, %r14
movl (%rax), %edi
callq 0x26180
movq %r14, %rdi
callq 0x328f9
movq 0x308(%r15), %rdi
movq %rbx, %rsi
callq 0x2a6dc
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x311c8
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: migrateCloseTimedoutSockets
void migrateCloseTimedoutSockets(void) {
    dictIterator *di = dictGetSafeIterator(server.migrate_cached_sockets);
    dictEntry *de;

    while((de = dictNext(di)) != NULL) {
        migrateCachedSocket *cs = dictGetVal(de);

        if ((server.unixtime - cs->last_use_time) > MIGRATE_SOCKET_CACHE_TTL) {
            close(cs->fd);
            zfree(cs);
            dictDelete(server.migrate_cached_sockets,dictGetKey(de));
        }
    }
    dictReleaseIterator(di);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
leaq 0x98919(%rip), %r12     # 0xf98a8
movq 0x308(%r12), %rdi
callq 0x2a9c4
movq %rax, %rbx
movq %rbx, %rdi
callq 0x2a9d3
testq %rax, %rax
je 0x60fe7
movq %rax, %r14
movq 0x8(%rax), %r15
movq 0x978(%r12), %rax
subq 0x10(%r15), %rax
cmpq $0xb, %rax
jl 0x60f9f
movl (%r15), %edi
callq 0x26180
movq %r15, %rdi
callq 0x328f9
movq 0x308(%r12), %rdi
movq (%r14), %rsi
callq 0x2a6dc
jmp 0x60f9f
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x2aa94
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: askingCommand
void askingCommand(client *c) {
    if (server.cluster_enabled == 0) {
        addReplyError(c,"This instance has cluster support disabled");
        return;
    }
    c->flags |= CLIENT_ASKING;
    addReply(c,shared.ok);
}

// Assembly:
leaq 0x97f5f(%rip), %rax     # 0xf98a8
cmpl $0x0, 0x99c(%rax)
je 0x61969
orb $0x2, 0x99(%rdi)
leaq 0x989b0(%rip), %rax     # 0xfa310
movq 0x8(%rax), %rsi
jmp 0x36987
leaq 0x57dad(%rip), %rsi     # 0xb971d
jmp 0x36b6f
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: readonlyCommand
void readonlyCommand(client *c) {
    if (server.cluster_enabled == 0) {
        addReplyError(c,"This instance has cluster support disabled");
        return;
    }
    c->flags |= CLIENT_READONLY;
    addReply(c,shared.ok);
}

// Assembly:
leaq 0x97f2c(%rip), %rax     # 0xf98a8
cmpl $0x0, 0x99c(%rax)
je 0x6199c
orb $0x2, 0x9a(%rdi)
leaq 0x9897d(%rip), %rax     # 0xfa310
movq 0x8(%rax), %rsi
jmp 0x36987
leaq 0x57d7a(%rip), %rsi     # 0xb971d
jmp 0x36b6f
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterRedirectClient
void clusterRedirectClient(client *c, clusterNode *n, int hashslot, int error_code) {
    if (error_code == CLUSTER_REDIR_CROSS_SLOT) {
        addReplySds(c,sdsnew("-CROSSSLOT Keys in request don't hash to the same slot\r\n"));
    } else if (error_code == CLUSTER_REDIR_UNSTABLE) {
        /* The request spawns mutliple keys in the same slot,
         * but the slot is not "stable" currently as there is
         * a migration or import in progress. */
        addReplySds(c,sdsnew("-TRYAGAIN Multiple keys request during rehashing of slot\r\n"));
    } else if (error_code == CLUSTER_REDIR_DOWN_STATE) {
        addReplySds(c,sdsnew("-CLUSTERDOWN The cluster is down\r\n"));
    } else if (error_code == CLUSTER_REDIR_DOWN_UNBOUND) {
        addReplySds(c,sdsnew("-CLUSTERDOWN Hash slot not served\r\n"));
    } else if (error_code == CLUSTER_REDIR_MOVED ||
               error_code == CLUSTER_REDIR_ASK)
    {
        addReplySds(c,sdscatprintf(sdsempty(),
            "-%s %d %s:%d\r\n",
            (error_code == CLUSTER_REDIR_ASK) ? "ASK" : "MOVED",
            hashslot,n->ip,n->port));
    } else {
        serverPanic("getNodeByQuery() unknown error.");
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %ecx, %r15d
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
leal -0x1(%r15), %eax
cmpl $0x5, %eax
ja 0x61da5
leaq 0x568a4(%rip), %rcx     # 0xb8604
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x5854f(%rip), %rdi     # 0xba2bf
jmp 0x61d8b
leaq 0x585ba(%rip), %rdi     # 0xba333
jmp 0x61d8b
leaq 0x58576(%rip), %rdi     # 0xba2f8
jmp 0x61d8b
leaq 0x585cb(%rip), %rdi     # 0xba356
callq 0x3115a
movq %rax, %rsi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x36a9d
leal -0x3(%r15), %eax
cmpl $0x1, %eax
ja 0x61def
callq 0x3114c
cmpl $0x3, %r15d
leaq 0x585cb(%rip), %rcx     # 0xba389
leaq 0x585c8(%rip), %rdx     # 0xba38d
cmoveq %rcx, %rdx
movl 0x8c0(%r14), %r9d
addq $0x890, %r14            # imm = 0x890
leaq 0x5859c(%rip), %rsi     # 0xba37a
movq %rax, %rdi
movl %ebp, %ecx
movq %r14, %r8
xorl %eax, %eax
callq 0x31a38
jmp 0x61d90
leaq 0x5859d(%rip), %rdi     # 0xba393
leaq 0x56900(%rip), %rsi     # 0xb86fd
movl $0x143f, %edx           # imm = 0x143F
callq 0x57b45
pushq $0x1
popq %rdi
callq 0x263c0
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterRedirectBlockedClientIfNeeded
int clusterRedirectBlockedClientIfNeeded(client *c) {
    if (c->flags & CLIENT_BLOCKED && c->btype == BLOCKED_LIST) {
        dictEntry *de;
        dictIterator *di;

        /* If the cluster is down, unblock the client with the right error. */
        if (server.cluster->state == CLUSTER_FAIL) {
            clusterRedirectClient(c,NULL,0,CLUSTER_REDIR_DOWN_STATE);
            return 1;
        }

        /* All keys must belong to the same slot, so check first key only. */
        di = dictGetIterator(c->bpop.keys);
        if ((de = dictNext(di)) != NULL) {
            robj *key = dictGetKey(de);
            int slot = keyHashSlot((char*)key->ptr, sdslen(key->ptr));
            clusterNode *node = server.cluster->slots[slot];

            /* We send an error and unblock the client if:
             * 1) The slot is unassigned, emitting a cluster down error.
             * 2) The slot is not handled by this node, nor being imported. */
            if (node != myself &&
                server.cluster->importing_slots_from[slot] == NULL)
            {
                if (node == NULL) {
                    clusterRedirectClient(c,NULL,0,
                        CLUSTER_REDIR_DOWN_UNBOUND);
                } else {
                    clusterRedirectClient(c,node,slot,
                        CLUSTER_REDIR_MOVED);
                }
                dictReleaseIterator(di);
                return 1;
            }
        }
        dictReleaseIterator(di);
    }
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
xorl %ebx, %ebx
testb $0x10, 0x98(%rdi)
je 0x61ec1
movq %rdi, %r14
cmpl $0x1, 0x168(%rdi)
jne 0x61ec1
leaq 0x97a6a(%rip), %r13     # 0xf98a8
movq 0x9b0(%r13), %rax
cmpl $0x1, 0x10(%rax)
jne 0x61e5f
pushq $0x5
popq %rcx
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x61d3e
pushq $0x1
popq %rbx
jmp 0x61ec1
movq 0x178(%r14), %rdi
callq 0x2a99f
movq %rax, %r15
movq %rax, %rdi
callq 0x2a9d3
testq %rax, %rax
je 0x61eb9
movq (%rax), %rax
movq 0x8(%rax), %r12
movq %r12, %rdi
callq 0x5b5fd
movq %r12, %rdi
movl %eax, %esi
callq 0x5bfa3
movq 0x9b0(%r13), %rcx
movl %eax, %edx
movq 0x40028(%rcx,%rdx,8), %rsi
cmpq 0xac384(%rip), %rsi     # 0x10e230
je 0x61eb9
cmpq $0x0, 0x20028(%rcx,%rdx,8)
je 0x61ecd
movq %r15, %rdi
callq 0x2aa94
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
testq %rsi, %rsi
je 0x61eda
pushq $0x4
popq %rcx
movq %r14, %rdi
jmp 0x61ee4
pushq $0x6
popq %rcx
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x61d3e
movq %r15, %rdi
callq 0x2aa94
jmp 0x61e5a
nop
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/crc16.c
// Function: crc16
uint16_t crc16(const char *buf, int len) {
    int counter;
    uint16_t crc = 0;
    for (counter = 0; counter < len; counter++)
            crc = (crc<<8) ^ crc16tab[((crc>>8) ^ *buf++)&0x00FF];
    return crc;
}

// Assembly:
xorl %ecx, %ecx
testl %esi, %esi
cmovlel %ecx, %esi
leaq 0x584ea(%rip), %rdx     # 0xba3f0
xorl %eax, %eax
cmpl %ecx, %esi
je 0x61f29
movzwl %ax, %r8d
shll $0x8, %eax
shrl $0x8, %r8d
movzbl (%rdi,%rcx), %r9d
xorl %r8d, %r9d
xorw (%rdx,%r9,2), %ax
incq %rcx
jmp 0x61f08
retq
nop
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/slowlog.c
// Function: slowlogFreeEntry
void slowlogFreeEntry(void *septr) {
    slowlogEntry *se = septr;
    int j;

    for (j = 0; j < se->argc; j++)
        decrRefCount(se->argv[j]);
    zfree(se->argv);
    zfree(se);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
movslq 0x8(%rbx), %rax
movq (%rbx), %rdi
cmpq %rax, %r14
jge 0x6216d
movq (%rdi,%r14,8), %rdi
callq 0x3a265
incq %r14
jmp 0x62153
callq 0x328f9
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x328f9
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/slowlog.c
// Function: slowlogPushEntryIfNeeded
void slowlogPushEntryIfNeeded(robj **argv, int argc, long long duration) {
    if (server.slowlog_log_slower_than < 0) return; /* Slowlog disabled */
    if (duration >= server.slowlog_log_slower_than)
        listAddNodeHead(server.slowlog,slowlogCreateEntry(argv,argc,duration));

    /* Remove old entries if needed. */
    while (listLength(server.slowlog) > server.slowlog_max_len)
        listDelNode(server.slowlog,listLast(server.slowlog));
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0x976f3(%rip), %r14     # 0xf98a8
movq 0x408(%r14), %rax
testq %rax, %rax
js 0x621fc
cmpq %rdx, %rax
jg 0x621e8
movq 0x3f8(%r14), %rbx
callq 0x61f84
movq %rbx, %rdi
movq %rax, %rsi
callq 0x26e75
jmp 0x621e8
movq 0x8(%rdi), %rsi
callq 0x26fa8
movq 0x3f8(%r14), %rdi
movq 0x28(%rdi), %rax
cmpq 0x410(%r14), %rax
ja 0x621df
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/scripting.c
// Function: sha1hex
void sha1hex(char *digest, char *script, size_t len) {
    SHA1_CTX ctx;
    unsigned char hash[20];
    char *cset = "0123456789abcdef";
    int j;

    SHA1Init(&ctx);
    SHA1Update(&ctx,(unsigned char*)script,len);
    SHA1Final(hash,&ctx);

    for (j = 0; j < 20; j++) {
        digest[j*2] = cset[((hash[j]&0xF0)>>4)];
        digest[j*2+1] = cset[(hash[j]&0xF)];
    }
    digest[40] = '\0';
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x1c(%rsp), %r12
movq %r12, %rdi
callq 0x34e69
movq %r12, %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0x34e81
movq %rsp, %rdi
movq %r12, %rsi
callq 0x34f29
xorl %eax, %eax
leaq 0x4ffa4(%rip), %rcx     # 0xb23e3
cmpq $0x14, %rax
je 0x62465
movzbl (%rsp,%rax), %edx
movl %edx, %esi
shrl $0x4, %esi
movb (%rsi,%rcx), %sil
movb %sil, (%rbx,%rax,2)
andl $0xf, %edx
movb (%rdx,%rcx), %dl
movb %dl, 0x1(%rbx,%rax,2)
incq %rax
jmp 0x6243f
movb $0x0, 0x28(%rbx)
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/scripting.c
// Function: redisProtocolToLuaType
char *redisProtocolToLuaType(lua_State *lua, char* reply) {
    char *p = reply;

    switch(*p) {
    case ':': p = redisProtocolToLuaType_Int(lua,reply); break;
    case '$': p = redisProtocolToLuaType_Bulk(lua,reply); break;
    case '+': p = redisProtocolToLuaType_Status(lua,reply); break;
    case '-': p = redisProtocolToLuaType_Error(lua,reply); break;
    case '*': p = redisProtocolToLuaType_MultiBulk(lua,reply); break;
    }
    return p;
}

// Assembly:
movzbl (%rsi), %ecx
leal -0x24(%rcx), %eax
cmpl $0x9, %eax
ja 0x62495
leaq 0x581f1(%rip), %rcx     # 0xba678
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
jmp 0x62513
cmpl $0x3a, %ecx
jne 0x6249f
jmp 0x624b2
movq %rsi, %rax
retq
jmp 0x62590
jmp 0x625fd
jmp 0x6266a
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/scripting.c
// Function: redisProtocolToLuaType_Int
char *redisProtocolToLuaType_Int(lua_State *lua, char *reply) {
    char *p = strchr(reply+1,'\r');
    long long value;

    string2ll(reply+1,p-reply-1,&value);
    lua_pushnumber(lua,(lua_Number)value);
    return p+2;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x1(%rsi), %r15
pushq $0xd
popq %rsi
movq %r15, %rdi
callq 0x267f0
movq %rax, %r12
notq %rbx
addq %rax, %rbx
leaq 0x8(%rsp), %r13
movq %r15, %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x39865
cvtsi2sdq (%r13), %xmm0
movq %r14, %rdi
callq 0x78a66
addq $0x2, %r12
movq %r12, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/scripting.c
// Function: redisProtocolToLuaType_Bulk
char *redisProtocolToLuaType_Bulk(lua_State *lua, char *reply) {
    char *p = strchr(reply+1,'\r');
    long long bulklen;

    string2ll(reply+1,p-reply-1,&bulklen);
    if (bulklen == -1) {
        lua_pushboolean(lua,0);
        return p+2;
    } else {
        lua_pushlstring(lua,p+2,bulklen);
        return p+2+bulklen+2;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r15
movq %rdi, %r14
leaq 0x1(%rsi), %r12
pushq $0xd
popq %rsi
movq %r12, %rdi
callq 0x267f0
movq %rax, %rbx
notq %r15
addq %rax, %r15
leaq 0x8(%rsp), %r13
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x39865
movq (%r13), %rdx
cmpq $-0x1, %rdx
je 0x62571
addq $0x2, %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x78a95
addq 0x8(%rsp), %rbx
jmp 0x6257b
movq %r14, %rdi
xorl %esi, %esi
callq 0x78cb0
addq $0x2, %rbx
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/scripting.c
// Function: redisProtocolToLuaType_Status
char *redisProtocolToLuaType_Status(lua_State *lua, char *reply) {
    char *p = strchr(reply+1,'\r');

    lua_newtable(lua);
    lua_pushstring(lua,"ok");
    lua_pushlstring(lua,reply+1,p-reply-1);
    lua_settable(lua,-3);
    return p+2;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x1(%rsi), %r12
pushq $0xd
popq %rsi
movq %r12, %rdi
callq 0x267f0
movq %rax, %r14
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x78ddb
leaq 0x5f6d4(%rip), %rsi     # 0xc1c97
movq %rbx, %rdi
callq 0x78aec
notq %r15
addq %r14, %r15
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x78a95
pushq $-0x3
popq %rsi
movq %rbx, %rdi
callq 0x78ed3
addq $0x2, %r14
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/scripting.c
// Function: redisProtocolToLuaType_Error
char *redisProtocolToLuaType_Error(lua_State *lua, char *reply) {
    char *p = strchr(reply+1,'\r');

    lua_newtable(lua);
    lua_pushstring(lua,"err");
    lua_pushlstring(lua,reply+1,p-reply-1);
    lua_settable(lua,-3);
    return p+2;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x1(%rsi), %r12
pushq $0xd
popq %rsi
movq %r12, %rdi
callq 0x267f0
movq %rax, %r14
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x78ddb
leaq 0x4d758(%rip), %rsi     # 0xafd88
movq %rbx, %rdi
callq 0x78aec
notq %r15
addq %r14, %r15
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x78a95
pushq $-0x3
popq %rsi
movq %rbx, %rdi
callq 0x78ed3
addq $0x2, %r14
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/scripting.c
// Function: redisProtocolToLuaType_MultiBulk
char *redisProtocolToLuaType_MultiBulk(lua_State *lua, char *reply) {
    char *p = strchr(reply+1,'\r');
    long long mbulklen;
    int j = 0;

    string2ll(reply+1,p-reply-1,&mbulklen);
    p += 2;
    if (mbulklen == -1) {
        lua_pushboolean(lua,0);
        return p;
    }
    lua_newtable(lua);
    for (j = 0; j < mbulklen; j++) {
        lua_pushnumber(lua,j+1);
        p = redisProtocolToLuaType(lua,p);
        lua_settable(lua,-3);
    }
    return p;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x1(%rsi), %r12
pushq $0xd
popq %rsi
movq %r12, %rdi
callq 0x267f0
movq %rax, %r14
notq %r15
addq %rax, %r15
movq %rsp, %r13
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x39865
addq $0x2, %r14
cmpq $-0x1, (%r13)
je 0x626f1
xorl %r15d, %r15d
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x78ddb
pushq $-0x3
popq %rbp
cmpq %r15, (%rsp)
jle 0x626fb
incq %r15
cvtsi2sd %r15d, %xmm0
movq %rbx, %rdi
callq 0x78a66
movq %rbx, %rdi
movq %r14, %rsi
callq 0x62475
movq %rax, %r14
movq %rbx, %rdi
movl %ebp, %esi
callq 0x78ed3
jmp 0x626c1
movq %rbx, %rdi
xorl %esi, %esi
callq 0x78cb0
movq %r14, %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/scripting.c
// Function: luaPushError
void luaPushError(lua_State *lua, char *error) {
    lua_Debug dbg;

    /* If debugging is active and in step mode, log errors resulting from
     * Redis commands. */
    if (ldb.active && ldb.step) {
        ldbLog(sdscatprintf(sdsempty(),"<error> %s",error));
    }

    lua_newtable(lua);
    lua_pushstring(lua,"err");

    /* Attempt to figure out where this function was called, if possible */
    if(lua_getstack(lua, 1, &dbg) && lua_getinfo(lua, "nSl", &dbg)) {
        sds msg = sdscatprintf(sdsempty(), "%s: %d: %s",
            dbg.source, dbg.currentline, error);
        lua_pushstring(lua, msg);
        sdsfree(msg);
    } else {
        lua_pushstring(lua, error);
    }
    lua_settable(lua,-3);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x78, %rsp
movq %rsi, %r14
movq %rdi, %rbx
cmpl $0x0, 0xabb43(%rip)     # 0x10e264
je 0x6274d
cmpl $0x0, 0xabc62(%rip)     # 0x10e38c
je 0x6274d
callq 0x3114c
leaq 0x58038(%rip), %rsi     # 0xba770
movq %rax, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x31a38
movq %rax, %rdi
callq 0x627e8
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x78ddb
leaq 0x4d628(%rip), %rsi     # 0xafd88
movq %rbx, %rdi
callq 0x78aec
pushq $0x1
popq %rsi
movq %rsp, %rdx
movq %rbx, %rdi
callq 0x7967b
testl %eax, %eax
je 0x627ca
leaq 0x57ffa(%rip), %rsi     # 0xba77b
movq %rsp, %rdx
movq %rbx, %rdi
callq 0x797e8
testl %eax, %eax
je 0x627ca
callq 0x3114c
movq 0x20(%rsp), %rdx
movl 0x28(%rsp), %ecx
leaq 0x57fda(%rip), %rsi     # 0xba77f
movq %rax, %rdi
movq %r14, %r8
xorl %eax, %eax
callq 0x31a38
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
callq 0x78aec
movq %r14, %rdi
callq 0x311c8
jmp 0x627d5
movq %rbx, %rdi
movq %r14, %rsi
callq 0x78aec
pushq $-0x3
popq %rsi
movq %rbx, %rdi
callq 0x78ed3
addq $0x78, %rsp
popq %rbx
popq %r14
retq