LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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 0x9a23d(%rip), %rax     # 0x106858
movq 0x9a0(%rax), %rax
movq 0x18(%rax), %rdi
callq 0x320e5
movq %rax, %r15
movq %rax, %rdi
callq 0x32116
testq %rax, %rax
je 0x6c661
movq 0x8(%rax), %rax
movq 0x8c8(%rax), %rdi
testq %rdi, %rdi
je 0x6c65c
testb $0x30, 0x30(%rax)
jne 0x6c65c
movq %r14, %rsi
movq %rbx, %rdx
callq 0x6c561
movq %r15, %rdi
jmp 0x6c631
movq %r15, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x321d3
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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
movl $0x5, %esi
callq 0x6c66e
leaq 0x99d3e(%rip), %rax     # 0x106858
movq 0x9a0(%rax), %rax
cmpq $0x0, 0x60058(%rax)
je 0x6cb33
orb $0x2, 0x89d(%rsp)
movq %rsp, %rdi
movl $0xa0080000, 0x4(%rdi)  # imm = 0xA0080000
movl $0x8a0, %esi            # imm = 0x8A0
callq 0x6c609
addq $0x10d8, %rsp           # imm = 0x10D8
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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 0x99bd1(%rip), %r15     # 0x106858
movl $0x1388, %r14d          # imm = 0x1388
addq 0x990(%r15), %r14
movl %edi, %ebx
movq 0x9a0(%r15), %rax
cmpl %edi, 0x60050(%rax)
jne 0x6ccbb
xorl %edi, %edi
callq 0x26ce0
subq 0xae525(%rip), %rax     # 0x11b1d8
cmpq $0x12c, %rax            # imm = 0x12C
jl 0x6cd00
movq 0x9a0(%r15), %rax
movl %ebx, 0x60050(%rax)
movq 0xae501(%rip), %rax     # 0x11b1d0
movq 0x850(%rax), %rax
testq %rax, %rax
je 0x6cd06
testb $0x8, 0x30(%rax)
je 0x6cd06
callq 0x330c8
movq 0xae4e3(%rip), %rcx     # 0x11b1d0
movq 0x850(%rcx), %rcx
subq 0x868(%rcx), %rax
cmpq %r14, %rax
jge 0x6cd06
popq %rbx
popq %r14
popq %r15
retq
decl %ebx
cmpl $0x3, %ebx
ja 0x6cd1f
movl %ebx, %eax
leaq 0x5d8ce(%rip), %rcx     # 0xca5e4
movslq (%rcx,%rax,4), %rbx
addq %rcx, %rbx
jmp 0x6cd26
leaq 0x5e5b2(%rip), %rbx     # 0xcb2d8
xorl %edi, %edi
callq 0x26ce0
movq %rax, 0xae4a4(%rip)     # 0x11b1d8
leaq 0x5e5b2(%rip), %rsi     # 0xcb2ed
movl $0x3, %edi
movq %rbx, %rdx
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
jmp 0x32ea6
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq 0xae472(%rip), %rdi     # 0x11b1d0
movq 0x850(%rdi), %r15
testq %r15, %r15
sete %al
orb 0x30(%rdi), %al
testb $0x1, %al
je 0x6cd7e
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
callq 0x69f8d
callq 0x49f71
xorl %ebx, %ebx
leaq 0x99ac7(%rip), %r12     # 0x106858
movl %ebx, %eax
shrl $0x3, %eax
movzbl 0x40(%r15,%rax), %eax
movl %ebx, %ecx
andl $0x7, %ecx
btl %ecx, %eax
jae 0x6cde1
movl %ebx, %edi
callq 0x69fe5
movq 0x9a0(%r12), %rax
cmpq $0x0, 0x40028(%rax,%rbx,8)
jne 0x6cde1
movq 0xae409(%rip), %r14     # 0x11b1d0
movq %r14, %rdi
movl %ebx, %esi
callq 0x6dccc
movq 0x9a0(%r12), %rax
movq %r14, 0x40028(%rax,%rbx,8)
incq %rbx
cmpq $0x4000, %rbx           # imm = 0x4000
jne 0x6cd91
callq 0x6ce31
movl $0x1, %edi
callq 0x6992e
xorl %edi, %edi
callq 0x6c7fa
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x69da6
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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 0x99268(%rip), %rbx     # 0x106858
movq 0x9a0(%rbx), %rax
cmpq $0x0, 0x60058(%rax)
je 0x6d60a
cmpl $0x0, 0x60070(%rax)
je 0x6d612
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq 0x60068(%rax), %r14
testq %r14, %r14
je 0x6d60a
callq 0x4a7d1
cmpq %rax, %r14
jne 0x6d60a
movq 0x9a0(%rbx), %rax
movl $0x1, 0x60070(%rax)
leaq 0x5de1c(%rip), %rsi     # 0xcb45c
movl $0x3, %edi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x32ea6
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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 0x98c88(%rip), %rbx     # 0x106858
movq 0x9a0(%rbx), %rax
testb $0x1, 0x60080(%rax)
je 0x6dbe5
callq 0x6cff3
movq 0x9a0(%rbx), %rax
testb $0x2, 0x60080(%rax)
je 0x6dbfa
callq 0x6ce31
movq 0x9a0(%rbx), %rax
movl 0x60080(%rax), %edi
testb $0x4, %dil
je 0x6dc15
andl $0x8, %edi
callq 0x6992e
movq 0x9a0(%rbx), %rax
movl $0x0, 0x60080(%rax)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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 %r14
pushq %rbx
leaq 0x98be9(%rip), %rax     # 0x106858
movq 0x9a0(%rax), %rax
movq 0x18(%rax), %rdi
callq 0x320e5
movq %rax, %rbx
movq %rax, %rdi
callq 0x32116
testq %rax, %rax
je 0x6dcbb
xorl %r14d, %r14d
movq 0x8(%rax), %rax
testb $0x2, 0x30(%rax)
jne 0x6dca3
addl 0x844(%rax), %r14d
movq %rbx, %rdi
callq 0x32116
testq %rax, %rax
jne 0x6dc92
xorl %ebp, %ebp
testl %r14d, %r14d
setne %bpl
jmp 0x6dcbd
xorl %ebp, %ebp
movq %rbx, %rdi
callq 0x321d3
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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
leal 0x7(%rsi), %eax
testl %esi, %esi
cmovnsl %esi, %eax
sarl $0x3, %eax
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 0x6dd20
movq %rdi, %rbx
movl 0x840(%rdi), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0x840(%rdi)
testl %eax, %eax
jne 0x6dd20
callq 0x6dc64
testl %eax, %eax
je 0x6dd20
orb $0x1, 0x31(%rbx)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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 0x39222
movq %rbx, %rdi
movq %rax, %rsi
callq 0x76150
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4bedf
testl %eax, %eax
je 0x6f3e8
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4c039
testq %rax, %rax
je 0x6f3fd
leaq 0xe(%rsp), %rsi
movw $0x7, (%rsi)
movq 0x40(%rbx), %rdi
movl $0x2, %edx
callq 0x39a56
movq %rax, 0x40(%rbx)
movzbl -0x1(%rax), %edx
movl %edx, %ecx
andl $0x7, %ecx
cmpl $0x4, %ecx
ja 0x6f3ba
leaq 0x5b10f(%rip), %rsi     # 0xca4a4
movslq (%rsi,%rcx,4), %rcx
addq %rsi, %rcx
jmpq *%rcx
shrl $0x3, %edx
jmp 0x6f3bc
movq -0x11(%rax), %rdx
jmp 0x6f3bc
movzwl -0x5(%rax), %edx
jmp 0x6f3bc
movl -0x9(%rax), %edx
jmp 0x6f3bc
movzbl -0x3(%rax), %edx
jmp 0x6f3bc
xorl %edx, %edx
xorl %edi, %edi
movq %rax, %rsi
callq 0x772bc
leaq 0x10(%rsp), %rsi
movq %rax, (%rsi)
movq 0x40(%rbx), %rdi
movl $0x8, %edx
callq 0x39a56
movq %rax, 0x40(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r14
retq
leaq 0x5cac5(%rip), %rdi     # 0xcbeb4
leaq 0x5b297(%rip), %rsi     # 0xca68d
movl $0x1133, %edx           # imm = 0x1133
jmp 0x6f410
leaq 0x5cacd(%rip), %rdi     # 0xcbed1
leaq 0x5b282(%rip), %rsi     # 0xca68d
movl $0x1134, %edx           # imm = 0x1134
callq 0x654e1
movl $0x1, %edi
callq 0x263d0
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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:
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq $0xa, %rsi
jb 0x6f466
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movzwl -0xa(%rdi,%rsi), %ecx
cmpl $0x7, %ecx
ja 0x6f45f
leaq -0x8(%rbx), %rdx
xorl %edi, %edi
movq %r14, %rsi
callq 0x772bc
movq %rax, %rcx
movq %rax, (%rsp)
xorl %eax, %eax
cmpq -0x8(%r14,%rbx), %rcx
setne %al
negl %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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 0x44f5f
testq %rax, %rax
je 0x6f4be
movq %rsp, %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x6f320
movq 0x40(%r14), %rsi
xorl %edi, %edi
callq 0x43ab4
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
callq 0x40537
movq %r14, %rdi
callq 0x440f3
addq $0x68, %rsp
popq %rbx
popq %r14
retq
leaq 0x97deb(%rip), %rax     # 0x1072b0
movq 0x50(%rax), %rsi
movq %rbx, %rdi
addq $0x68, %rsp
popq %rbx
popq %r14
jmp 0x3fc19
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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 0x962e2(%rip), %rax     # 0x106858
cmpl $0x0, 0x98c(%rax)
je 0x70596
orb $0x2, 0x99(%rdi)
leaq 0x96d23(%rip), %rax     # 0x1072b0
movq 0x8(%rax), %rsi
jmp 0x3fc19
leaq 0x5b110(%rip), %rsi     # 0xcb6ad
jmp 0x3ffcb
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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 0x962af(%rip), %rax     # 0x106858
cmpl $0x0, 0x98c(%rax)
je 0x705c9
orb $0x2, 0x9a(%rdi)
leaq 0x96cf0(%rip), %rax     # 0x1072b0
movq 0x8(%rax), %rsi
jmp 0x3fc19
leaq 0x5b0dd(%rip), %rsi     # 0xcb6ad
jmp 0x3ffcb
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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 0x70a38
leaq 0x59b8d(%rip), %rcx     # 0xca580
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x5b84c(%rip), %rdi     # 0xcc24f
jmp 0x70a1e
leaq 0x5b8b7(%rip), %rdi     # 0xcc2c3
jmp 0x70a1e
leaq 0x5b873(%rip), %rdi     # 0xcc288
jmp 0x70a1e
leaq 0x5b8c8(%rip), %rdi     # 0xcc2e6
callq 0x39245
movq %rax, %rsi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x3fe4b
leal -0x3(%r15), %eax
cmpl $0x1, %eax
ja 0x70a82
callq 0x39222
cmpl $0x3, %r15d
leaq 0x5b8c8(%rip), %rcx     # 0xcc319
leaq 0x5b8c5(%rip), %rdx     # 0xcc31d
cmoveq %rcx, %rdx
movl 0x8c0(%r14), %r9d
addq $0x890, %r14            # imm = 0x890
leaq 0x5b899(%rip), %rsi     # 0xcc30a
movq %rax, %rdi
movl %ebp, %ecx
movq %r14, %r8
xorl %eax, %eax
callq 0x39eb7
jmp 0x70a23
leaq 0x5b89a(%rip), %rdi     # 0xcc323
leaq 0x59bfd(%rip), %rsi     # 0xca68d
movl $0x142c, %edx           # imm = 0x142C
callq 0x6558d
movl $0x1, %edi
callq 0x263d0
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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;
        }

        di = dictGetIterator(c->bpop.keys);
        while((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);
                }
                return 1;
            }
        }
        dictReleaseIterator(di);
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
xorl %ebp, %ebp
testb $0x10, 0x98(%rdi)
je 0x70b9e
movq %rdi, %rbx
cmpl $0x1, 0x168(%rdi)
jne 0x70b9e
leaq 0x95d86(%rip), %r15     # 0x106858
movq 0x9a0(%r15), %rax
cmpl $0x1, 0x10(%rax)
jne 0x70b00
leaq 0x5b7dd(%rip), %rdi     # 0xcc2c3
callq 0x39245
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3fe4b
movl $0x1, %ebp
jmp 0x70b9e
movq 0x178(%rbx), %rdi
callq 0x320bb
movq %rax, %r14
movq %rax, %rdi
callq 0x32116
testq %rax, %rax
je 0x70b96
leaq 0x59a75(%rip), %r12     # 0xca598
movq (%rax), %rax
movq 0x8(%rax), %rdi
movzbl -0x1(%rdi), %esi
movl %esi, %eax
andl $0x7, %eax
cmpl $0x4, %eax
ja 0x70b5d
movslq (%r12,%rax,4), %rax
addq %r12, %rax
jmpq *%rax
shrl $0x3, %esi
jmp 0x70b5f
movq -0x11(%rdi), %rsi
jmp 0x70b5f
movzwl -0x5(%rdi), %esi
jmp 0x70b5f
movl -0x9(%rdi), %esi
jmp 0x70b5f
movzbl -0x3(%rdi), %esi
jmp 0x70b5f
xorl %esi, %esi
callq 0x6a378
movq 0x9a0(%r15), %rcx
movl %eax, %edx
movq 0x40028(%rcx,%rdx,8), %rsi
cmpq 0xaa654(%rip), %rsi     # 0x11b1d0
je 0x70b89
cmpq $0x0, 0x20028(%rcx,%rdx,8)
je 0x70ba9
movq %r14, %rdi
callq 0x32116
testq %rax, %rax
jne 0x70b23
movq %r14, %rdi
callq 0x321d3
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
testq %rsi, %rsi
je 0x70bc0
movq %rbx, %rdi
movl $0x4, %ecx
callq 0x709d1
jmp 0x70af6
leaq 0x5b71f(%rip), %rdi     # 0xcc2e6
jmp 0x70ae6
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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 0x71183
leaq 0x5b4a7(%rip), %rcx     # 0xcc61c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
jmp 0x71203
cmpl $0x3a, %ecx
jne 0x7118d
jmp 0x711a0
movq %rsi, %rax
retq
jmp 0x71282
jmp 0x712f3
jmp 0x71364
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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, 0xa9dd8(%rip)     # 0x11b204
je 0x7145f
cmpl $0x0, 0xa9ef7(%rip)     # 0x11b32c
je 0x7145f
callq 0x39222
leaq 0x5b465(%rip), %rsi     # 0xcc8a8
movq %rax, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x39eb7
movq 0xa9db9(%rip), %rdi     # 0x11b210
movq %rax, %rsi
callq 0x2e40f
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x8a31b
leaq 0x4f9b4(%rip), %rsi     # 0xc0e26
movq %rbx, %rdi
callq 0x8a02b
movq %rsp, %rdx
movq %rbx, %rdi
movl $0x1, %esi
callq 0x8abb9
testl %eax, %eax
je 0x714de
leaq 0x5b41e(%rip), %rsi     # 0xcc8b3
movq %rsp, %rdx
movq %rbx, %rdi
callq 0x8ad39
testl %eax, %eax
je 0x714de
callq 0x39222
movq 0x20(%rsp), %rdx
movl 0x28(%rsp), %ecx
leaq 0x5b3fe(%rip), %rsi     # 0xcc8b7
movq %rax, %rdi
movq %r14, %r8
xorl %eax, %eax
callq 0x39eb7
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
callq 0x8a02b
movq %r14, %rdi
callq 0x392b6
jmp 0x714e9
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8a02b
movq %rbx, %rdi
movl $0xfffffffd, %esi       # imm = 0xFFFFFFFD
callq 0x8a417
addq $0x78, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/scripting.c
// Function: luaRedisReplicateCommandsCommand
int luaRedisReplicateCommandsCommand(lua_State *lua) {
    if (server.lua_write_dirty) {
        lua_pushboolean(lua,0);
    } else {
        server.lua_replicate_commands = 1;
        /* When we switch to single commands replication, we can provide
         * different math.random() sequences at every call, which is what
         * the user normally expects. */
        redisSrand48(rand());
        lua_pushboolean(lua,1);
    }
    return 1;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x945a9(%rip), %rax     # 0x106858
xorl %esi, %esi
cmpl $0x0, 0x9e8(%rax)
jne 0x722d5
movl $0x1, 0x9f0(%rax)
callq 0x26b80
movl %eax, %edi
callq 0x768ab
movl $0x1, %esi
movq %rbx, %rdi
callq 0x8a1f0
movl $0x1, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/scripting.c
// Function: luaRedisDebugCommand
int luaRedisDebugCommand(lua_State *lua) {
    if (!ldb.active) return 0;
    int argc = lua_gettop(lua);
    sds log = sdscatprintf(sdsempty(),"<debug> line %d: ", ldb.currentline);
    while(argc--) {
        log = ldbCatStackValue(log,lua,-1 - argc);
        if (argc != 0) log = sdscatlen(log,", ",2);
    }
    ldbLog(log);
    return 0;
}

// Assembly:
cmpl $0x0, 0xa8ef0(%rip)     # 0x11b204
je 0x72388
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x89969
movl %eax, %ebp
callq 0x39222
movl 0xa9015(%rip), %edx     # 0x11b344
leaq 0x5a844(%rip), %rsi     # 0xccb7a
movq %rax, %rdi
xorl %eax, %eax
callq 0x39eb7
testl %ebp, %ebp
je 0x72375
negl %ebp
leaq 0x5a83f(%rip), %r14     # 0xccb8c
movq %rax, %rdi
movq %rbx, %rsi
movl %ebp, %edx
xorl %ecx, %ecx
callq 0x74720
cmpl $-0x1, %ebp
je 0x72371
movl $0x2, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x39a56
incl %ebp
jne 0x7234d
movq 0xa8e94(%rip), %rdi     # 0x11b210
movq %rax, %rsi
callq 0x2e40f
popq %rbx
popq %r14
popq %rbp
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/scripting.c
// Function: luaRedisSetReplCommand
int luaRedisSetReplCommand(lua_State *lua) {
    int argc = lua_gettop(lua);
    int flags;

    if (server.lua_replicate_commands == 0) {
        lua_pushstring(lua, "You can set the replication behavior only after turning on single commands replication with redis.replicate_commands().");
        return lua_error(lua);
    } else if (argc != 1) {
        lua_pushstring(lua, "redis.set_repl() requires two arguments.");
        return lua_error(lua);
    }

    flags = lua_tonumber(lua,-1);
    if ((flags & ~(PROPAGATE_AOF|PROPAGATE_REPL)) != 0) {
        lua_pushstring(lua, "Invalid replication flags. Use REPL_AOF, REPL_SLAVE, REPL_ALL or REPL_NONE.");
        return lua_error(lua);
    }
    server.lua_repl = flags;
    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x89969
leaq 0x944b3(%rip), %r14     # 0x106858
cmpl $0x0, 0x9f0(%r14)
je 0x723db
cmpl $0x1, %eax
jne 0x723e4
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x89d7e
cvttsd2si %xmm0, %eax
cmpl $0x4, %eax
jae 0x723ed
movl %eax, 0x9f8(%r14)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x5a7ad(%rip), %rsi     # 0xccb8f
jmp 0x723f4
leaq 0x5a81c(%rip), %rsi     # 0xccc07
jmp 0x723f4
leaq 0x5a83c(%rip), %rsi     # 0xccc30
movq %rbx, %rdi
callq 0x8a02b
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x8a922
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/scripting.c
// Function: luaLogCommand
int luaLogCommand(lua_State *lua) {
    int j, argc = lua_gettop(lua);
    int level;
    sds log;

    if (argc < 2) {
        lua_pushstring(lua, "redis.log() requires two arguments or more.");
        return lua_error(lua);
    } else if (!lua_isnumber(lua,-argc)) {
        lua_pushstring(lua, "First argument must be a number (log level).");
        return lua_error(lua);
    }
    level = lua_tonumber(lua,-argc);
    if (level < LL_DEBUG || level > LL_WARNING) {
        lua_pushstring(lua, "Invalid debug level.");
        return lua_error(lua);
    }

    /* Glue together all the arguments */
    log = sdsempty();
    for (j = 1; j < argc; j++) {
        size_t len;
        char *s;

        s = (char*)lua_tolstring(lua,(-argc)+j,&len);
        if (s) {
            if (j != 1) log = sdscatlen(log," ",1);
            log = sdscatlen(log,s,len);
        }
    }
    serverLogRaw(level,log);
    sdsfree(log);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
callq 0x89969
cmpl $0x1, %eax
jg 0x7242f
leaq 0x5a84f(%rip), %rsi     # 0xccc7c
jmp 0x72467
movl %eax, %r15d
movl %eax, %ebp
negl %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x89c1d
testl %eax, %eax
je 0x72460
movq %rbx, %rdi
movl %ebp, %esi
callq 0x89d7e
cvttsd2si %xmm0, %eax
cmpl $0x4, %eax
jb 0x72485
leaq 0x5a877(%rip), %rsi     # 0xcccd5
jmp 0x72467
leaq 0x5a841(%rip), %rsi     # 0xccca8
movq %rbx, %rdi
callq 0x8a02b
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x8a922
movl %eax, 0xc(%rsp)
callq 0x39222
movq %rax, %r14
movl $0x1, %ebp
subl %r15d, %ebp
xorl %r12d, %r12d
leaq 0x10(%rsp), %r15
leal (%r12,%rbp), %esi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x89e02
testq %rax, %rax
je 0x724e7
movq %rax, %r13
testl %r12d, %r12d
je 0x724d4
movl $0x1, %edx
movq %r14, %rdi
leaq 0x55765(%rip), %rsi     # 0xc7c31
callq 0x39a56
movq %rax, %r14
movq 0x10(%rsp), %rdx
movq %r14, %rdi
movq %r13, %rsi
callq 0x39a56
movq %rax, %r14
incl %r12d
movl %ebp, %eax
addl %r12d, %eax
jne 0x724a1
movl 0xc(%rsp), %edi
movq %r14, %rsi
callq 0x32d0c
movq %r14, %rdi
callq 0x392b6
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/scripting.c
// Function: luaLoadLibraries
void luaLoadLibraries(lua_State *lua) {
    luaLoadLib(lua, "", luaopen_base);
    luaLoadLib(lua, LUA_TABLIBNAME, luaopen_table);
    luaLoadLib(lua, LUA_STRLIBNAME, luaopen_string);
    luaLoadLib(lua, LUA_MATHLIBNAME, luaopen_math);
    luaLoadLib(lua, LUA_DBLIBNAME, luaopen_debug);
    luaLoadLib(lua, "cjson", luaopen_cjson);
    luaLoadLib(lua, "struct", luaopen_struct);
    luaLoadLib(lua, "cmsgpack", luaopen_cmsgpack);
    luaLoadLib(lua, "bit", luaopen_bit);

#if 0 /* Stuff that we don't load currently, for sandboxing concerns. */
    luaLoadLib(lua, LUA_LOADLIBNAME, luaopen_package);
    luaLoadLib(lua, LUA_OSLIBNAME, luaopen_os);
#endif
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x51517(%rip), %rsi     # 0xc3a6d
leaq 0x230ef(%rip), %rdx     # 0x9564c
callq 0x72516
leaq 0x4cddf(%rip), %rsi     # 0xbf348
leaq 0x25804(%rip), %rdx     # 0x97d74
movq %rbx, %rdi
callq 0x72516
leaq 0x61900(%rip), %rsi     # 0xd3e7f
leaq 0x261e6(%rip), %rdx     # 0x9876c
movq %rbx, %rdi
callq 0x72516
leaq 0x5a755(%rip), %rsi     # 0xcccea
leaq 0x250d4(%rip), %rdx     # 0x97670
movq %rbx, %rdi
callq 0x72516
leaq 0x64e2d(%rip), %rsi     # 0xd73d8
leaq 0x24426(%rip), %rdx     # 0x969d8
movq %rbx, %rdi
callq 0x72516
leaq 0x5a72e(%rip), %rsi     # 0xcccef
leaq 0x27db8(%rip), %rdx     # 0x9a380
movq %rbx, %rdi
callq 0x72516
leaq 0x5a71e(%rip), %rsi     # 0xcccf5
leaq 0x296b6(%rip), %rdx     # 0x9bc94
movq %rbx, %rdi
callq 0x72516
leaq 0x5a70f(%rip), %rsi     # 0xcccfc
leaq 0x2b459(%rip), %rdx     # 0x9da4d
movq %rbx, %rdi
callq 0x72516
leaq 0x62a0f(%rip), %rsi     # 0xd5012
leaq 0x2b506(%rip), %rdx     # 0x9db10
movq %rbx, %rdi
popq %rbx
jmp 0x72516
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/scripting.c
// Function: luaRemoveUnsupportedFunctions
void luaRemoveUnsupportedFunctions(lua_State *lua) {
    lua_pushnil(lua);
    lua_setglobal(lua,"loadfile");
    lua_pushnil(lua);
    lua_setglobal(lua,"dofile");
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x89f91
leaq 0x5a6e2(%rip), %rdx     # 0xccd05
movq %rbx, %rdi
movl $0xffffd8ee, %esi       # imm = 0xFFFFD8EE
callq 0x8a43e
movq %rbx, %rdi
callq 0x89f91
leaq 0x5a6cf(%rip), %rdx     # 0xccd0e
movq %rbx, %rdi
movl $0xffffd8ee, %esi       # imm = 0xFFFFD8EE
popq %rbx
jmp 0x8a43e
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/scripting.c
// Function: ldbInit
void ldbInit(void) {
    ldb.fd = -1;
    ldb.active = 0;
    ldb.logs = listCreate();
    listSetFreeMethod(ldb.logs,(void (*)(void*))sdsfree);
    ldb.children = listCreate();
    ldb.src = NULL;
    ldb.lines = 0;
    ldb.cbuf = sdsempty();
}

// Assembly:
pushq %rax
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, 0xa8542(%rip)     # 0x11b200
callq 0x2e33c
movq %rax, 0xa8546(%rip)     # 0x11b210
leaq -0x39a1b(%rip), %rcx    # 0x392b6
movq %rcx, 0x18(%rax)
callq 0x2e33c
movq %rax, 0xa853f(%rip)     # 0x11b220
movq $0x0, 0xa864c(%rip) # 0x11b338
movl $0x0, 0xa864a(%rip)     # 0x11b340
callq 0x39222
movq %rax, 0xa8646(%rip)     # 0x11b348
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/scripting.c
// Function: luaMaskCountHook
void luaMaskCountHook(lua_State *lua, lua_Debug *ar) {
    long long elapsed;
    UNUSED(ar);
    UNUSED(lua);

    elapsed = mstime() - server.lua_time_start;
    if (elapsed >= server.lua_time_limit && server.lua_timedout == 0) {
        serverLog(LL_WARNING,"Lua slow script detected: still in execution after %lld milliseconds. You can try killing the script using the SCRIPT KILL command.",elapsed);
        server.lua_timedout = 1;
        /* Once the script timeouts we reenter the event loop to permit others
         * to call SCRIPT KILL or SHUTDOWN NOSAVE if needed. For this reason
         * we need to mask the client executing the script from the event loop.
         * If we don't do that the client may disconnect and could no longer be
         * here when the EVAL command will return. */
         aeDeleteFileEvent(server.el, server.lua_caller->fd, AE_READABLE);
    }
    if (server.lua_timedout) processEventsWhileBlocked();
    if (server.lua_kill) {
        serverLog(LL_WARNING,"Lua script killed by user with SCRIPT KILL.");
        lua_pushstring(lua,"Script killed by user with SCRIPT KILL...");
        lua_error(lua);
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x330c8
leaq 0x936eb(%rip), %r14     # 0x106858
subq 0x9e0(%r14), %rax
cmpq 0x9d8(%r14), %rax
jl 0x731c0
cmpl $0x0, 0x9fc(%r14)
jne 0x731c0
leaq 0x5a075(%rip), %rsi     # 0xcd203
movl $0x3, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0x32ea6
movl $0x1, 0x9fc(%r14)
movq 0x40(%r14), %rdi
movq 0x9c8(%r14), %rax
movl 0x8(%rax), %esi
movl $0x1, %edx
callq 0x2ffb6
cmpl $0x0, 0x9fc(%r14)
je 0x731cf
callq 0x42e34
cmpl $0x0, 0xa00(%r14)
je 0x7320a
leaq 0x5a0a7(%rip), %rsi     # 0xcd287
movl $0x3, %edi
xorl %eax, %eax
callq 0x32ea6
leaq 0x5a0c0(%rip), %rsi     # 0xcd2b3
movq %rbx, %rdi
callq 0x8a02b
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x8a922
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/scripting.c
// Function: evalGenericCommandWithDebugging
void evalGenericCommandWithDebugging(client *c, int evalsha) {
    if (ldbStartSession(c)) {
        evalGenericCommand(c,evalsha);
        ldbEndSession(c);
    } else {
        ldbDisable(c);
    }
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
callq 0x73fde
testl %eax, %eax
je 0x73949
movq %rbx, %rdi
movl %ebp, %esi
callq 0x73212
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x74214
andb $-0x7, 0x9b(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/scripting.c
// Function: evalShaCommand
void evalShaCommand(client *c) {
    if (sdslen(c->argv[1]->ptr) != 40) {
        /* We know that a match is not possible if the provided SHA is
         * not the right length. So we return an error ASAP, this way
         * evalGenericCommand() can be implemented without string length
         * sanity check */
        addReply(c, shared.noscripterr);
        return;
    }
    if (!(c->flags & CLIENT_LUA_DEBUG))
        evalGenericCommand(c,1);
    else {
        addReplyError(c,"Please use EVAL instead of EVALSHA for debugging");
        return;
    }
}

// Assembly:
movq 0x40(%rdi), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rcx
movzbl -0x1(%rcx), %eax
movl %eax, %edx
andl $0x7, %edx
cmpl $0x4, %edx
ja 0x7399d
leaq 0x58d94(%rip), %rsi     # 0xcc70c
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
shrl $0x3, %eax
jmp 0x7399f
movq -0x11(%rcx), %rax
jmp 0x7399f
movzwl -0x5(%rcx), %eax
jmp 0x7399f
movl -0x9(%rcx), %eax
jmp 0x7399f
movzbl -0x3(%rcx), %eax
jmp 0x7399f
xorl %eax, %eax
cmpq $0x28, %rax
jne 0x739b8
testb $0x2, 0x9b(%rdi)
jne 0x739cb
movl $0x1, %esi
jmp 0x73212
leaq 0x938f1(%rip), %rax     # 0x1072b0
movq 0x98(%rax), %rsi
jmp 0x3fc19
leaq 0x599d3(%rip), %rsi     # 0xcd3a5
jmp 0x3ffcb
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/scripting.c
// Function: ldbEnable
void ldbEnable(client *c) {
    c->flags |= CLIENT_LUA_DEBUG;
    ldbFlushLog(ldb.logs);
    ldb.fd = c->fd;
    ldb.step = 1;
    ldb.bpcount = 0;
    ldb.luabp = 0;
    sdsfree(ldb.cbuf);
    ldb.cbuf = sdsempty();
    ldb.maxlen = LDB_MAX_LEN_DEFAULT;
    ldb.maxlen_hint_sent = 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
orb $0x2, 0x9b(%rdi)
movq 0xa7491(%rip), %r14     # 0x11b210
movq (%r14), %rsi
testq %rsi, %rsi
je 0x73d91
movq %r14, %rdi
callq 0x2e4f4
jmp 0x73d7f
movl 0x8(%rbx), %eax
movl %eax, 0xa7466(%rip)     # 0x11b200
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, 0xa757d(%rip)     # 0x11b328
xorl %ebx, %ebx
movl %ebx, 0xa757d(%rip)     # 0x11b330
movq 0xa758e(%rip), %rdi     # 0x11b348
callq 0x392b6
callq 0x39222
movq %rax, 0xa757d(%rip)     # 0x11b348
movq $0x100, 0xa757a(%rip) # imm = 0x100
movl %ebx, 0xa757c(%rip)     # 0x11b358
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/scripting.c
// Function: ldbLogWithMaxLen
void ldbLogWithMaxLen(sds entry) {
    int trimmed = 0;
    if (ldb.maxlen && sdslen(entry) > ldb.maxlen) {
        sdsrange(entry,0,ldb.maxlen-1);
        entry = sdscatlen(entry," ...",4);
        trimmed = 1;
    }
    ldbLog(entry);
    if (trimmed && ldb.maxlen_hint_sent == 0) {
        ldb.maxlen_hint_sent = 1;
        ldbLog(sdsnew(
        "<hint> The above reply was trimmed. Use 'maxlen 0' to disable trimming."));
    }
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0xa7541(%rip), %rdx     # 0x11b350
testq %rdx, %rdx
je 0x73e7d
movzbl -0x1(%rbx), %eax
movl %eax, %ecx
andl $0x7, %ecx
cmpl $0x4, %ecx
ja 0x73e4e
leaq 0x5890b(%rip), %rsi     # 0xcc734
movslq (%rsi,%rcx,4), %rcx
addq %rsi, %rcx
jmpq *%rcx
shrl $0x3, %eax
jmp 0x73e50
movq -0x11(%rbx), %rax
jmp 0x73e50
movzwl -0x5(%rbx), %eax
jmp 0x73e50
movl -0x9(%rbx), %eax
jmp 0x73e50
movzbl -0x3(%rbx), %eax
jmp 0x73e50
xorl %eax, %eax
cmpq %rdx, %rax
jbe 0x73e7d
decl %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3a73b
leaq 0x596df(%rip), %rsi     # 0xcd547
movl $0x4, %edx
movq %rbx, %rdi
callq 0x39a56
movq %rax, %rbx
movb $0x1, %bpl
jmp 0x73e7f
xorl %ebp, %ebp
movq 0xa738a(%rip), %rdi     # 0x11b210
movq %rbx, %rsi
callq 0x2e40f
testb %bpl, %bpl
je 0x73ec7
cmpl $0x0, 0xa74be(%rip)     # 0x11b358
jne 0x73ec7
movl $0x1, 0xa74b2(%rip)     # 0x11b358
leaq 0x5969f(%rip), %rdi     # 0xcd54c
callq 0x39245
movq 0xa7357(%rip), %rdi     # 0x11b210
movq %rax, %rsi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2e40f
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/scripting.c
// Function: ldbSendLogs
void ldbSendLogs(void) {
    sds proto = sdsempty();
    proto = sdscatfmt(proto,"*%i\r\n", (int)listLength(ldb.logs));
    while(listLength(ldb.logs)) {
        listNode *ln = listFirst(ldb.logs);
        proto = sdscatlen(proto,"+",1);
        sdsmapchars(ln->value,"\r\n","  ",2);
        proto = sdscatsds(proto,ln->value);
        proto = sdscatlen(proto,"\r\n",2);
        listDelNode(ldb.logs,ln);
    }
    if (write(ldb.fd,proto,sdslen(proto)) == -1) {
        /* Avoid warning. We don't check the return value of write()
         * since the next read() will catch the I/O error and will
         * close the debugging session. */
    }
    sdsfree(proto);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
callq 0x39222
movq 0xa732d(%rip), %rcx     # 0x11b210
movl 0x28(%rcx), %edx
leaq 0x596a7(%rip), %rsi     # 0xcd594
movq %rax, %rdi
xorl %eax, %eax
callq 0x39f3b
movq %rax, %rbx
movq 0xa730f(%rip), %rax     # 0x11b210
cmpq $0x0, 0x28(%rax)
je 0x73f83
leaq 0x4c091(%rip), %r14     # 0xbffa0
leaq 0x52e5a(%rip), %r15     # 0xc6d70
leaq 0x597a6(%rip), %r12     # 0xcd6c3
movq (%rax), %r13
movl $0x1, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x39a56
movq %rax, %rbx
movq 0x10(%r13), %rdi
movl $0x2, %ecx
movq %r15, %rsi
movq %r12, %rdx
callq 0x3b0f4
movq 0x10(%r13), %rsi
movq %rbx, %rdi
callq 0x39b4d
movl $0x2, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x39a56
movq %rax, %rbx
movq 0xa72a3(%rip), %rdi     # 0x11b210
movq %r13, %rsi
callq 0x2e4f4
movq 0xa7294(%rip), %rax     # 0x11b210
cmpq $0x0, 0x28(%rax)
jne 0x73f1d
movl 0xa7277(%rip), %edi     # 0x11b200
movzbl -0x1(%rbx), %edx
movl %edx, %eax
andl $0x7, %eax
cmpl $0x4, %eax
ja 0x73fc3
leaq 0x587aa(%rip), %rcx     # 0xcc748
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
shrl $0x3, %edx
jmp 0x73fc5
movq -0x11(%rbx), %rdx
jmp 0x73fc5
movzwl -0x5(%rbx), %edx
jmp 0x73fc5
movl -0x9(%rbx), %edx
jmp 0x73fc5
movzbl -0x3(%rbx), %edx
jmp 0x73fc5
xorl %edx, %edx
movq %rbx, %rsi
callq 0x26bc0
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x392b6
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/scripting.c
// Function: ldbEndSession
void ldbEndSession(client *c) {
    /* Emit the remaining logs and an <endsession> mark. */
    ldbLog(sdsnew("<endsession>"));
    ldbSendLogs();

    /* If it's a fork()ed session, we just exit. */
    if (ldb.forked) {
        writeToClient(c->fd, c, 0);
        serverLog(LL_WARNING,"Lua debugging session child exiting");
        exitFromChild(0);
    } else {
        serverLog(LL_WARNING,
            "Redis synchronous debugging eval session ended");
    }

    /* Otherwise let's restore client's state. */
    anetNonBlock(NULL,ldb.fd);
    anetSendTimeout(NULL,ldb.fd,0);

    /* Close the client connectin after sending the final EVAL reply
     * in order to signal the end of the debugging session. */
    c->flags |= CLIENT_CLOSE_AFTER_REPLY;

    /* Cleanup. */
    sdsfreesplitres(ldb.src,ldb.lines);
    ldb.lines = 0;
    ldb.active = 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x593fa(%rip), %rdi     # 0xcd61c
callq 0x39245
movq 0xa6fe2(%rip), %rdi     # 0x11b210
movq %rax, %rsi
callq 0x2e40f
callq 0x73ece
cmpl $0x0, 0xa6fc6(%rip)     # 0x11b208
je 0x7426d
movl 0x8(%rbx), %edi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x40f36
leaq 0x593d1(%rip), %rsi     # 0xcd629
movl $0x3, %edi
xorl %eax, %eax
callq 0x32ea6
xorl %edi, %edi
callq 0x33106
jmp 0x74280
leaq 0x593d9(%rip), %rsi     # 0xcd64d
movl $0x3, %edi
xorl %eax, %eax
callq 0x32ea6
movl 0xa6f7a(%rip), %esi     # 0x11b200
xorl %r14d, %r14d
xorl %edi, %edi
callq 0x30779
movl 0xa6f6a(%rip), %esi     # 0x11b200
xorl %edi, %edi
xorl %edx, %edx
callq 0x309c8
orb $0x40, 0x98(%rbx)
movq 0xa708b(%rip), %rdi     # 0x11b338
movl 0xa708d(%rip), %esi     # 0x11b340
callq 0x3ab7f
movl %r14d, 0xa7081(%rip)    # 0x11b340
movl %r14d, 0xa6f3e(%rip)    # 0x11b204
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/scripting.c
// Function: ldbRemoveChild
int ldbRemoveChild(pid_t pid) {
    listNode *ln = listSearchKey(ldb.children,(void*)(unsigned long)pid);
    if (ln) {
        listDelNode(ldb.children,ln);
        return 1;
    }
    return 0;
}

// Assembly:
pushq %rax
movq 0xa6f4a(%rip), %rax     # 0x11b220
movslq %edi, %rsi
movq %rax, %rdi
callq 0x2e653
testq %rax, %rax
je 0x742fc
movq 0xa6f33(%rip), %rdi     # 0x11b220
movq %rax, %rsi
callq 0x2e4f4
movl $0x1, %eax
jmp 0x742fe
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/scripting.c
// Function: ldbKillForkedSessions
void ldbKillForkedSessions(void) {
    listIter li;
    listNode *ln;

    listRewind(ldb.children,&li);
    while((ln = listNext(&li))) {
        pid_t pid = (unsigned long) ln->value;
        serverLog(LL_WARNING,"Killing debugging session %ld",(long)pid);
        kill(pid,SIGKILL);
    }
    listRelease(ldb.children);
    ldb.children = listCreate();
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq 0xa6f05(%rip), %rdi     # 0x11b220
movq %rsp, %rbx
movq %rbx, %rsi
callq 0x2e582
movq %rbx, %rdi
callq 0x2e59f
testq %rax, %rax
je 0x74370
leaq 0x59342(%rip), %rbx     # 0xcd67c
movq %rsp, %r14
movq 0x10(%rax), %rax
movslq %eax, %r15
movl $0x3, %edi
movq %rbx, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x32ea6
movl %r15d, %edi
movl $0x9, %esi
callq 0x26670
movq %r14, %rdi
callq 0x2e59f
testq %rax, %rax
jne 0x7433d
movq 0xa6ea9(%rip), %rdi     # 0x11b220
callq 0x2e360
callq 0x2e33c
movq %rax, 0xa6e98(%rip)     # 0x11b220
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/scripting.c
// Function: ldbIsBreakpoint
int ldbIsBreakpoint(int line) {
    int j;

    for (j = 0; j < ldb.bpcount; j++)
        if (ldb.bp[j] == line) return 1;
    return 0;
}

// Assembly:
movslq 0xa6f6d(%rip), %rax     # 0x11b328
testq %rax, %rax
jle 0x743d7
xorl %ecx, %ecx
leaq 0xa6e37(%rip), %rdx     # 0x11b200
cmpl %edi, 0x28(%rdx,%rcx,4)
je 0x743da
incq %rcx
cmpq %rcx, %rax
jne 0x743c9
xorl %eax, %eax
retq
movl $0x1, %eax
retq