LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/cluster.c
// Function: clusterHandleConfigEpochCollision
void clusterHandleConfigEpochCollision(clusterNode *sender) {
    /* Prerequisites: nodes have the same configEpoch and are both masters. */
    if (sender->configEpoch != myself->configEpoch ||
        !nodeIsMaster(sender) || !nodeIsMaster(myself)) return;
    /* Don't act if the colliding node has a smaller Node ID. */
    if (memcmp(sender->name,myself->name,REDIS_CLUSTER_NAMELEN) <= 0) return;
    /* Get the next ID available at the best of this node knowledge. */
    server.cluster->currentEpoch++;
    myself->configEpoch = server.cluster->currentEpoch;
    clusterSaveConfigOrDie(1);
    redisLog(REDIS_VERBOSE,
        "WARNING: configEpoch collision with node %.40s."
        " Updating my configEpoch to %llu",
        sender->name,
        (unsigned long long) myself->configEpoch);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movq 0xbcadd(%rip), %rcx     # 0x127f78
cmpq 0x38(%rcx), %rax
jne 0x6b4c2
movq -0x8(%rbp), %rax
movl 0x30(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x6b4c2
movq 0xbcac1(%rip), %rax     # 0x127f78
movl 0x30(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x6b4c7
jmp 0x6b552
movq -0x8(%rbp), %rdi
addq $0x8, %rdi
movq 0xbcaa2(%rip), %rsi     # 0x127f78
addq $0x8, %rsi
movl $0x28, %edx
callq 0x1f950
cmpl $0x0, %eax
jg 0x6b4eb
jmp 0x6b552
leaq 0xa8406(%rip), %rax     # 0x1138f8
movq 0x7d0(%rax), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
leaq 0xa83ec(%rip), %rax     # 0x1138f8
movq 0x7d0(%rax), %rax
movq 0x8(%rax), %rcx
movq 0xbca5a(%rip), %rax     # 0x127f78
movq %rcx, 0x38(%rax)
movl $0x1, %edi
callq 0x69020
movq -0x8(%rbp), %rdx
addq $0x8, %rdx
movq 0xbca3d(%rip), %rax     # 0x127f78
movq 0x38(%rax), %rcx
movl $0x1, %edi
leaq 0x7ad47(%rip), %rsi     # 0xe6292
movb $0x0, %al
callq 0x24fb0
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/cluster.c
// Function: clusterDelNodeSlots
int clusterDelNodeSlots(clusterNode *node) {
    int deleted = 0, j;

    for (j = 0; j < REDIS_CLUSTER_SLOTS; j++) {
        // 如果这个槽由该节点负责，那么删除它
        if (clusterNodeGetSlotBit(node,j)) clusterDelSlot(j);
        deleted++;
    }
    return deleted;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movl $0x0, -0x10(%rbp)
cmpl $0x4000, -0x10(%rbp)    # imm = 0x4000
jge 0x6c7f0
movq -0x8(%rbp), %rdi
movl -0x10(%rbp), %esi
callq 0x6dc60
cmpl $0x0, %eax
je 0x6c7dc
movl -0x10(%rbp), %edi
callq 0x698f0
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x6c7ba
movl -0xc(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/cluster.c
// Function: clusterWriteHandler
void clusterWriteHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
    clusterLink *link = (clusterLink*) privdata;
    ssize_t nwritten;
    REDIS_NOTUSED(el);
    REDIS_NOTUSED(mask);

    // 写入信息
    nwritten = write(fd, link->sndbuf, sdslen(link->sndbuf));

    // 写入错误
    if (nwritten <= 0) {
        redisLog(REDIS_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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x67ee0
movl -0x3c(%rbp), %edi
movq -0x38(%rbp), %rsi
movq %rax, %rdx
callq 0x1fb50
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jg 0x6cb91
callq 0x1f820
movl (%rax), %edi
callq 0x1f630
movq %rax, %rdx
xorl %edi, %edi
leaq 0x79998(%rip), %rsi     # 0xe6517
movb $0x0, %al
callq 0x24fb0
movq -0x28(%rbp), %rdi
callq 0x6caf0
jmp 0x6cbd8
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x30(%rbp), %rax
movl %eax, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2d2e0
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x67ee0
cmpq $0x0, %rax
jne 0x6cbd8
leaq 0xa6d35(%rip), %rax     # 0x1138f8
movq 0x28(%rax), %rdi
movq -0x28(%rbp), %rax
movl 0x8(%rax), %esi
movl $0x2, %edx
callq 0x20c60
addq $0x40, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/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;

        // 不向节点自身或者 HANDSHAKE 状态的节点发送信息
        if (node->flags & (REDIS_NODE_MYSELF|REDIS_NODE_HANDSHAKE))
            continue;

        // 发送信息
        clusterSendMessage(node->link,buf,len);
    }
    dictReleaseIterator(di);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq 0xa6c61(%rip), %rax     # 0x1138f8
movq 0x7d0(%rax), %rax
movq 0x18(%rax), %rdi
callq 0x24240
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x24270
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
je 0x6cd05
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq $0x0, 0x8c0(%rax)
jne 0x6ccda
jmp 0x6ccab
movq -0x28(%rbp), %rax
movl 0x30(%rax), %eax
andl $0x30, %eax
cmpl $0x0, %eax
je 0x6cceb
jmp 0x6ccab
movq -0x28(%rbp), %rax
movq 0x8c0(%rax), %rdi
movq -0x8(%rbp), %rsi
movq -0x10(%rbp), %rdx
callq 0x6cbe0
jmp 0x6ccab
movq -0x18(%rbp), %rdi
callq 0x243d0
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/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 alrady 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;
        redisLog(REDIS_WARNING,
            "All master replication stream processed, "
            "manual failover can start.");
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
leaq 0xa5739(%rip), %rax     # 0x1138f8
movq 0x7d0(%rax), %rax
cmpq $0x0, 0x60050(%rax)
jne 0x6e1d5
jmp 0x6e25d
leaq 0xa571c(%rip), %rax     # 0x1138f8
movq 0x7d0(%rax), %rax
cmpl $0x0, 0x60068(%rax)
je 0x6e1ee
jmp 0x6e25d
leaq 0xa5703(%rip), %rax     # 0x1138f8
movq 0x7d0(%rax), %rax
cmpq $0x0, 0x60060(%rax)
jne 0x6e208
jmp 0x6e25d
leaq 0xa56e9(%rip), %rax     # 0x1138f8
movq 0x7d0(%rax), %rax
movq 0x60060(%rax), %rax
movq %rax, -0x8(%rbp)
callq 0x42960
movq %rax, %rcx
movq -0x8(%rbp), %rax
cmpq %rcx, %rax
jne 0x6e25d
leaq 0xa56bf(%rip), %rax     # 0x1138f8
movq 0x7d0(%rax), %rax
movl $0x1, 0x60068(%rax)
movl $0x3, %edi
leaq 0x7848b(%rip), %rsi     # 0xe66e1
movb $0x0, %al
callq 0x24fb0
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/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. */
    // 保存 nodes.conf 配置文件
    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 %rbp
movq %rsp, %rbp
subq $0x10, %rsp
leaq 0xa4ee9(%rip), %rax     # 0x1138f8
movq 0x7d0(%rax), %rax
movl 0x60078(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x6ea29
callq 0x6d640
leaq 0xa4ec8(%rip), %rax     # 0x1138f8
movq 0x7d0(%rax), %rax
movl 0x60078(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x6ea4a
callq 0x6dc90
leaq 0xa4ea7(%rip), %rax     # 0x1138f8
movq 0x7d0(%rax), %rax
movl 0x60078(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x6ea88
leaq 0xa4e8b(%rip), %rax     # 0x1138f8
movq 0x7d0(%rax), %rax
movl 0x60078(%rax), %eax
andl $0x8, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %edi
callq 0x69020
leaq 0xa4e69(%rip), %rax     # 0x1138f8
movq 0x7d0(%rax), %rax
movl $0x0, 0x60078(%rax)
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/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++;
    return old;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rdi
addq $0x40, %rdi
movl -0xc(%rbp), %esi
callq 0x6b310
movl %eax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
addq $0x40, %rdi
movl -0xc(%rbp), %esi
callq 0x6eab0
cmpl $0x0, -0x10(%rbp)
jne 0x6eb9b
movq -0x8(%rbp), %rax
movl 0x840(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x840(%rax)
movl -0x10(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/cluster.c
// Function: getSlotOrReply
int getSlotOrReply(redisClient *c, robj *o) {
    long long slot;

    if (getLongLongFromObject(o,&slot) != REDIS_OK ||
        slot < 0 || slot >= REDIS_CLUSTER_SLOTS)
    {
        addReplyError(c,"Invalid or out of range slot");
        return -1;
    }
    return (int) slot;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x3b780
cmpl $0x0, %eax
jne 0x6f253
cmpq $0x0, -0x20(%rbp)
jl 0x6f253
cmpq $0x4000, -0x20(%rbp)    # imm = 0x4000
jl 0x6f26c
movq -0x10(%rbp), %rdi
leaq 0x776b7(%rip), %rsi     # 0xe6915
callq 0x35d40
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6f273
movq -0x20(%rbp), %rax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/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. */
    // 将对象序列化为一个 RDB 格式对象
    // 序列化对象以对象类型为首，后跟序列化后的对象
    // 如图
    //
    // |<-- RDB payload  -->|
    //      序列化数据
    // +-------------+------+
    // | 1 byte type | obj  |
    // +-------------+------+
    rioInitWithBuffer(payload,sdsempty());
    redisAssert(rdbSaveObjectType(payload,o));
    redisAssert(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 */
    // 写入 RDB 版本
    buf[0] = REDIS_RDB_VERSION & 0xff;
    buf[1] = (REDIS_RDB_VERSION >> 8) & 0xff;
    payload->io.buffer.ptr = sdscatlen(payload->io.buffer.ptr,buf,2);

    /* CRC64 */
    // 写入 CRC 校验和
    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);

    // 整个数据的结构:
    //
    // | <--- 序列化数据 -->|
    // +-------------+------+---------------------+---------------+
    // | 1 byte type | obj  | 2 bytes RDB version | 8 bytes CRC64 |
    // +-------------+------+---------------------+---------------+

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
callq 0x2c0c0
movq -0x28(%rbp), %rdi
movq %rax, %rsi
callq 0x75dc0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x43f30
cmpl $0x0, %eax
je 0x70a1d
jmp 0x70a3f
leaq 0x765d7(%rip), %rdi     # 0xe6ffb
leaq 0x7527a(%rip), %rsi     # 0xe5ca5
movl $0x13ab, %edx           # imm = 0x13AB
callq 0x63ca0
movl $0x1, %edi
callq 0x1f3b0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x441d0
cmpl $0x0, %eax
je 0x70a53
jmp 0x70a75
leaq 0x765be(%rip), %rdi     # 0xe7018
leaq 0x75244(%rip), %rsi     # 0xe5ca5
movl $0x13ac, %edx           # imm = 0x13AC
callq 0x63ca0
movl $0x1, %edi
callq 0x1f3b0
movb $0x6, -0x12(%rbp)
movb $0x0, -0x11(%rbp)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdi
leaq -0x12(%rbp), %rsi
movl $0x2, %edx
callq 0x2c500
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x67ee0
movq -0x30(%rbp), %rsi
movq %rax, %rdx
xorl %eax, %eax
movl %eax, %edi
callq 0x77030
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdi
leaq -0x20(%rbp), %rsi
movl $0x8, %edx
callq 0x2c500
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x38(%rax)
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/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. */
    // 因为序列化数据至少包含 2 个字节的 RDB 版本
    // 以及 8 个字节的 CRC64 校验和
    // 所以序列化数据不可能少于 10 个字节
    if (len < 10) return REDIS_ERR;

    // 指向数据的最后 10 个字节
    footer = p+(len-10);

    /* Verify RDB version */
    // 检查序列化数据的版本号，看是否和当前实例使用的版本号一致
    rdbver = (footer[1] << 8) | footer[0];
    if (rdbver != REDIS_RDB_VERSION) return REDIS_ERR;

    /* Verify CRC64 */
    // 检查数据的 CRC64 校验和是否正确
    crc = crc64(0,p,len-8);
    memrev64ifbe(&crc);
    return (memcmp(&crc,footer+2,8) == 0) ? REDIS_OK : REDIS_ERR;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0xa, -0x18(%rbp)
jae 0x70b20
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x70b9e
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
subq $0xa, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movzbl 0x1(%rax), %eax
shll $0x8, %eax
movq -0x20(%rbp), %rcx
movzbl (%rcx), %ecx
orl %ecx, %eax
movw %ax, -0x22(%rbp)
movzwl -0x22(%rbp), %eax
cmpl $0x6, %eax
je 0x70b5d
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x70b9e
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
subq $0x8, %rdx
xorl %eax, %eax
movl %eax, %edi
callq 0x77030
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
addq $0x2, %rax
movq (%rax), %rcx
movq -0x30(%rbp), %rax
subq %rcx, %rax
setne %al
movzbl %al, %edx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
cmpl $0x0, %edx
cmovel %ecx, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/cluster.c
// Function: dumpCommand
void dumpCommand(redisClient *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. */
    // 创建给定值的一个 DUMP 编码表示
    createDumpPayload(&payload,o);

    /* Transfer to the client */
    // 将编码后的键值对数据返回给客户端
    dumpobj = createObject(REDIS_STRING,payload.io.buffer.ptr);
    addReplyBulk(c,dumpobj);
    decrRefCount(dumpobj);

    return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x8(%rax), %rsi
callq 0x3bed0
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
jne 0x70bf5
movq -0x8(%rbp), %rdi
leaq 0xa3566(%rip), %rax     # 0x114150
movq 0x50(%rax), %rsi
callq 0x35a70
jmp 0x70c27
movq -0x10(%rbp), %rsi
leaq -0x68(%rbp), %rdi
callq 0x709e0
movq -0x30(%rbp), %rsi
xorl %edi, %edi
callq 0x3a0d0
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x36620
movq -0x18(%rbp), %rdi
callq 0x3aaa0
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/cluster.c
// Function: askingCommand
void askingCommand(redisClient *c) {

    if (server.cluster_enabled == 0) {
        addReplyError(c,"This instance has cluster support disabled");
        return;
    }

    // 打开客户端的标识
    c->flags |= REDIS_ASKING;

    addReply(c,shared.ok);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
leaq 0xa1c95(%rip), %rax     # 0x1138f8
cmpl $0x0, 0x7bc(%rax)
jne 0x71c7e
movq -0x8(%rbp), %rdi
leaq 0x74cbb(%rip), %rsi     # 0xe6932
callq 0x35d40
jmp 0x71ca8
movq -0x8(%rbp), %rax
movl 0x90(%rax), %ecx
orl $0x200, %ecx            # imm = 0x200
movl %ecx, 0x90(%rax)
movq -0x8(%rbp), %rdi
leaq 0xa24b1(%rip), %rax     # 0x114150
movq 0x8(%rax), %rsi
callq 0x35a70
addq $0x10, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/cluster.c
// Function: readonlyCommand
void readonlyCommand(redisClient *c) {
    if (server.cluster_enabled == 0) {
        addReplyError(c,"This instance has cluster support disabled");
        return;
    }
    c->flags |= REDIS_READONLY;
    addReply(c,shared.ok);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
leaq 0xa1c35(%rip), %rax     # 0x1138f8
cmpl $0x0, 0x7bc(%rax)
jne 0x71cde
movq -0x8(%rbp), %rdi
leaq 0x74c5b(%rip), %rsi     # 0xe6932
callq 0x35d40
jmp 0x71d08
movq -0x8(%rbp), %rax
movl 0x90(%rax), %ecx
orl $0x20000, %ecx          # imm = 0x20000
movl %ecx, 0x90(%rax)
movq -0x8(%rbp), %rdi
leaq 0xa2451(%rip), %rax     # 0x114150
movq 0x8(%rax), %rsi
callq 0x35a70
addq $0x10, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/slowlog.c
// Function: slowlogInit
void slowlogInit(void) {

    // 保存日志的链表，FIFO 顺序
    server.slowlog = listCreate();

    // 日志数量计数器
    server.slowlog_entry_id = 0;

    // 日志链表的释构函数
    listSetFreeMethod(server.slowlog,slowlogFreeEntry);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
callq 0x1fdb0
movq %rax, %rcx
leaq 0xa1135(%rip), %rax     # 0x1138f8
movq %rcx, 0x3a8(%rax)
leaq 0xa1127(%rip), %rax     # 0x1138f8
movq $0x0, 0x3b0(%rax)
leaq 0xa1115(%rip), %rax     # 0x1138f8
movq 0x3a8(%rax), %rax
leaq -0xb1(%rip), %rcx       # 0x72740
movq %rcx, 0x18(%rax)
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/scripting.c
// Function: luaPushError
void luaPushError(lua_State *lua, char *error) {
    lua_Debug dbg;

    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 %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x8cb60
movq -0x8(%rbp), %rdi
leaq 0x6ca0a(%rip), %rsi     # 0xdf995
callq 0x8c590
movq -0x8(%rbp), %rdi
movl $0x1, %esi
leaq -0x88(%rbp), %rdx
callq 0x8ddc0
cmpl $0x0, %eax
je 0x7300c
movq -0x8(%rbp), %rdi
leaq 0x746db(%rip), %rsi     # 0xe7690
leaq -0x88(%rbp), %rdx
callq 0x8e0c0
cmpl $0x0, %eax
je 0x7300c
callq 0x2c0c0
movq %rax, %rdi
movq -0x68(%rbp), %rdx
movl -0x60(%rbp), %ecx
movq -0x10(%rbp), %r8
leaq 0x746b4(%rip), %rsi     # 0xe7694
movb $0x0, %al
callq 0x2cad0
movq %rax, -0x90(%rbp)
movq -0x8(%rbp), %rdi
movq -0x90(%rbp), %rsi
callq 0x8c590
movq -0x90(%rbp), %rdi
callq 0x2c160
jmp 0x73019
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x8c590
movq -0x8(%rbp), %rdi
movl $0xfffffffd, %esi       # imm = 0xFFFFFFFD
callq 0x8cdc0
addq $0x90, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/scripting.c
// Function: luaLogCommand
int luaLogCommand(lua_State *lua) {
    int j, argc = lua_gettop(lua);
    int level;
    sds log;

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

    /* 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);
        }
    }
    redisLogRaw(level,log);
    sdsfree(log);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x8b6c0
movl %eax, -0x18(%rbp)
cmpl $0x2, -0x18(%rbp)
jge 0x73b5a
movq -0x10(%rbp), %rdi
leaq 0x73cd3(%rip), %rsi     # 0xe781c
callq 0x72f60
movl $0x1, -0x4(%rbp)
jmp 0x73c5d
movq -0x10(%rbp), %rdi
xorl %esi, %esi
subl -0x18(%rbp), %esi
callq 0x8bd00
cmpl $0x0, %eax
jne 0x73b89
movq -0x10(%rbp), %rdi
leaq 0x73cd0(%rip), %rsi     # 0xe7848
callq 0x72f60
movl $0x1, -0x4(%rbp)
jmp 0x73c5d
jmp 0x73b8b
movq -0x10(%rbp), %rdi
xorl %esi, %esi
subl -0x18(%rbp), %esi
callq 0x8bf90
cvttsd2si %xmm0, %eax
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jl 0x73bac
cmpl $0x3, -0x1c(%rbp)
jle 0x73bc8
movq -0x10(%rbp), %rdi
leaq 0x73cbe(%rip), %rsi     # 0xe7875
callq 0x72f60
movl $0x1, -0x4(%rbp)
jmp 0x73c5d
callq 0x2c0c0
movq %rax, -0x28(%rbp)
movl $0x1, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x73c41
movq -0x10(%rbp), %rdi
xorl %esi, %esi
subl -0x18(%rbp), %esi
addl -0x14(%rbp), %esi
leaq -0x30(%rbp), %rdx
callq 0x8c0e0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x73c34
cmpl $0x1, -0x14(%rbp)
je 0x73c1f
movq -0x28(%rbp), %rdi
leaq 0x708cd(%rip), %rsi     # 0xe44de
movl $0x1, %edx
callq 0x2c500
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x2c500
movq %rax, -0x28(%rbp)
jmp 0x73c36
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x73bd8
movl -0x1c(%rbp), %edi
movq -0x28(%rbp), %rsi
callq 0x24dd0
movq -0x28(%rbp), %rdi
callq 0x2c160
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/scripting.c
// Function: luaMaskCountHook
void luaMaskCountHook(lua_State *lua, lua_Debug *ar) {
    long long elapsed;
    REDIS_NOTUSED(ar);
    REDIS_NOTUSED(lua);

    // 计算已执行时间
    elapsed = mstime() - server.lua_time_start;
    // 执行已超时
    if (elapsed >= server.lua_time_limit && server.lua_timedout == 0) {

        // 打印 LOG
        redisLog(REDIS_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. */
         // 当脚本运行超时时，将正在执行的客户端从读事件中移除
         // 并允许其他客户端执行 SCRIPT KILL 或者 SHUTDOWN NOSAVE
         aeDeleteFileEvent(server.el, server.lua_caller->fd, AE_READABLE);
    }

    // 在脚本上下文中，启动文件事件处理（等待 SCRIPT KILL 或 SHUTDOWN NOSAVE）
    if (server.lua_timedout) processEventsWhileBlocked();
    // 如果接到 SCRIPT KILL ，那么杀死脚本
    if (server.lua_kill) {
        redisLog(REDIS_WARNING,"Lua script killed by user with SCRIPT KILL.");
        lua_pushstring(lua,"Script killed by user with SCRIPT KILL...");
        lua_error(lua);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
callq 0x252e0
leaq 0x9fc6c(%rip), %rcx     # 0x1138f8
subq 0x808(%rcx), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
leaq 0x9fc56(%rip), %rcx     # 0x1138f8
cmpq 0x800(%rcx), %rax
jl 0x73d08
leaq 0x9fc46(%rip), %rax     # 0x1138f8
cmpl $0x0, 0x818(%rax)
jne 0x73d08
movq -0x18(%rbp), %rdx
movl $0x3, %edi
leaq 0x73bbf(%rip), %rsi     # 0xe788a
movb $0x0, %al
callq 0x24fb0
leaq 0x9fc1f(%rip), %rax     # 0x1138f8
movl $0x1, 0x818(%rax)
leaq 0x9fc0e(%rip), %rax     # 0x1138f8
movq 0x28(%rax), %rdi
leaq 0x9fc03(%rip), %rax     # 0x1138f8
movq 0x7f0(%rax), %rax
movl (%rax), %esi
movl $0x1, %edx
callq 0x20c60
leaq 0x9fbe9(%rip), %rax     # 0x1138f8
cmpl $0x0, 0x818(%rax)
je 0x73d1d
callq 0x38ec0
leaq 0x9fbd4(%rip), %rax     # 0x1138f8
cmpl $0x0, 0x81c(%rax)
je 0x73d59
movl $0x3, %edi
leaq 0x73bd5(%rip), %rsi     # 0xe790e
movb $0x0, %al
callq 0x24fb0
movq -0x8(%rbp), %rdi
leaq 0x73bef(%rip), %rsi     # 0xe793a
callq 0x8c590
movq -0x8(%rbp), %rdi
callq 0x8d7f0
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/scripting.c
// Function: luaLoadLibraries
void luaLoadLibraries(lua_State *lua) {

    // 基础库
    luaLoadLib(lua, "", luaopen_base);

    // table 库
    luaLoadLib(lua, LUA_TABLIBNAME, luaopen_table);

    // 字符串库
    luaLoadLib(lua, LUA_STRLIBNAME, luaopen_string);

    // 数学库
    luaLoadLib(lua, LUA_MATHLIBNAME, luaopen_math);

    // debug 库
    luaLoadLib(lua, LUA_DBLIBNAME, luaopen_debug); 

    // cjson 库
    luaLoadLib(lua, "cjson", luaopen_cjson);

    // struct 库
    luaLoadLib(lua, "struct", luaopen_struct);

    // cmsgpack 库
    luaLoadLib(lua, "cmsgpack", luaopen_cmsgpack);

#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 %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x6d632(%rip), %rsi     # 0xe13f9
leaq 0x2ce92(%rip), %rdx     # 0xa0c60
callq 0x73d60
movq -0x8(%rbp), %rdi
leaq 0x77e67(%rip), %rsi     # 0xebc45
leaq 0x305db(%rip), %rdx     # 0xa43c0
callq 0x73d60
movq -0x8(%rbp), %rdi
leaq 0x77da3(%rip), %rsi     # 0xebb98
leaq 0x31164(%rip), %rdx     # 0xa4f60
callq 0x73d60
movq -0x8(%rbp), %rdi
leaq 0x73b58(%rip), %rsi     # 0xe7964
leaq 0x2fb2d(%rip), %rdx     # 0xa3940
callq 0x73d60
movq -0x8(%rbp), %rdi
leaq 0x79faa(%rip), %rsi     # 0xeddcd
leaq 0x2e936(%rip), %rdx     # 0xa2760
callq 0x73d60
movq -0x8(%rbp), %rdi
leaq 0x73b2f(%rip), %rsi     # 0xe7969
leaq 0x33ddf(%rip), %rdx     # 0xa7c20
callq 0x73d60
movq -0x8(%rbp), %rdi
leaq 0x73b1e(%rip), %rsi     # 0xe796f
leaq 0x360b8(%rip), %rdx     # 0xa9f10
callq 0x73d60
movq -0x8(%rbp), %rdi
leaq 0x73b0e(%rip), %rsi     # 0xe7976
leaq 0x37d21(%rip), %rdx     # 0xabb90
callq 0x73d60
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/scripting.c
// Function: evalShaCommand
void evalShaCommand(redisClient *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;
    }
    evalGenericCommand(c,1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
callq 0x72b70
cmpq $0x28, %rax
je 0x75490
movq -0x8(%rbp), %rdi
leaq 0x9ecce(%rip), %rax     # 0x114150
movq 0x98(%rax), %rsi
callq 0x35a70
jmp 0x7549e
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x74e50
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/bio.c
// Function: bioInit
void bioInit(void) {
    pthread_attr_t attr;
    pthread_t thread;
    size_t stacksize;
    int j;

    /* Initialization of state vars and objects 
     *
     * 初始化 job 队列，以及线程状态
     */
    for (j = 0; j < REDIS_BIO_NUM_OPS; j++) {
        pthread_mutex_init(&bio_mutex[j],NULL);
        pthread_cond_init(&bio_condvar[j],NULL);
        bio_jobs[j] = listCreate();
        bio_pending[j] = 0;
    }

    /* Set the stack size as by default it may be small in some system 
     *
     * 设置栈大小
     */
    pthread_attr_init(&attr);
    pthread_attr_getstacksize(&attr,&stacksize);
    if (!stacksize) stacksize = 1; /* The world is full of Solaris Fixes */
    while (stacksize < REDIS_THREAD_STACK_SIZE) stacksize *= 2;
    pthread_attr_setstacksize(&attr, stacksize);

    /* Ready to spawn our threads. We use the single argument the thread
     * function accepts in order to pass the job ID the thread is
     * responsible of. 
     *
     * 创建线程
     */
    for (j = 0; j < REDIS_BIO_NUM_OPS; j++) {
        void *arg = (void*)(unsigned long) j;
        if (pthread_create(&thread,&attr,bioProcessBackgroundJobs,arg) != 0) {
            redisLog(REDIS_WARNING,"Fatal: Can't initialize Background Jobs.");
            exit(1);
        }
        bio_threads[j] = thread;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movl $0x0, -0x4c(%rbp)
cmpl $0x2, -0x4c(%rbp)
jge 0x758b0
movslq -0x4c(%rbp), %rax
leaq 0xb28f0(%rip), %rdi     # 0x128140
imulq $0x28, %rax, %rax
addq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1f420
movslq -0x4c(%rbp), %rax
leaq 0xb2925(%rip), %rdi     # 0x128190
imulq $0x30, %rax, %rax
addq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1f4f0
callq 0x1fdb0
movq %rax, %rdx
movslq -0x4c(%rbp), %rcx
leaq 0xb2962(%rip), %rax     # 0x1281f0
movq %rdx, (%rax,%rcx,8)
movslq -0x4c(%rbp), %rcx
leaq 0xb2963(%rip), %rax     # 0x128200
movq $0x0, (%rax,%rcx,8)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x7583f
leaq -0x38(%rbp), %rdi
callq 0x1f9f0
leaq -0x38(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x1f880
cmpq $0x0, -0x48(%rbp)
jne 0x758d5
movq $0x1, -0x48(%rbp)
jmp 0x758d7
cmpq $0x400000, -0x48(%rbp)  # imm = 0x400000
jae 0x758ee
movq -0x48(%rbp), %rax
shlq %rax
movq %rax, -0x48(%rbp)
jmp 0x758d7
movq -0x48(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x1f760
movl $0x0, -0x4c(%rbp)
cmpl $0x2, -0x4c(%rbp)
jge 0x75968
movslq -0x4c(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rcx
leaq -0x40(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq 0x4d(%rip), %rdx        # 0x75970
callq 0x1f480
cmpl $0x0, %eax
je 0x7594a
movl $0x3, %edi
leaq 0x72699(%rip), %rsi     # 0xe7fd2
movb $0x0, %al
callq 0x24fb0
movl $0x1, %edi
callq 0x1f2c0
movq -0x40(%rbp), %rdx
movslq -0x4c(%rbp), %rcx
leaq 0xb28b7(%rip), %rax     # 0x128210
movq %rdx, (%rax,%rcx,8)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x75902
addq $0x60, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/bio.c
// Function: bioKillThreads
void bioKillThreads(void) {
    int err, j;

    for (j = 0; j < REDIS_BIO_NUM_OPS; j++) {
        if (pthread_cancel(bio_threads[j]) == 0) {
            if ((err = pthread_join(bio_threads[j],NULL)) != 0) {
                redisLog(REDIS_WARNING,
                    "Bio thread for job type #%d can be joined: %s",
                        j, strerror(err));
            } else {
                redisLog(REDIS_WARNING,
                    "Bio thread for job type #%d terminated",j);
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x0, -0x8(%rbp)
cmpl $0x2, -0x8(%rbp)
jge 0x75d23
movslq -0x8(%rbp), %rcx
leaq 0xb256c(%rip), %rax     # 0x128210
movq (%rax,%rcx,8), %rdi
callq 0x1f750
cmpl $0x0, %eax
jne 0x75d13
movslq -0x8(%rbp), %rcx
leaq 0xb2553(%rip), %rax     # 0x128210
movq (%rax,%rcx,8), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1f080
movl %eax, -0x4(%rbp)
cmpl $0x0, %eax
je 0x75cfb
movl -0x8(%rbp), %eax
movl %eax, -0xc(%rbp)
movl -0x4(%rbp), %edi
callq 0x1f630
movl -0xc(%rbp), %edx
movq %rax, %rcx
movl $0x3, %edi
leaq 0x7236f(%rip), %rsi     # 0xe8061
movb $0x0, %al
callq 0x24fb0
jmp 0x75d11
movl -0x8(%rbp), %edx
movl $0x3, %edi
leaq 0x72385(%rip), %rsi     # 0xe808f
movb $0x0, %al
callq 0x24fb0
jmp 0x75d13
jmp 0x75d15
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x75c8f
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/rio.c
// Function: rioWriteBulkString
size_t rioWriteBulkString(rio *r, const char *buf, size_t len) {
    size_t nwritten;

    // 写入 $<count>\r\n
    if ((nwritten = rioWriteBulkCount(r,'$',len)) == 0) return 0;

    // 写入 <payload>
    if (len > 0 && rioWrite(r,buf,len) == 0) return 0;

    // 写入 \r\n
    if (rioWrite(r,"\r\n",2) == 0) return 0;

    // 返回写入总量
    return nwritten+len+2;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movl %eax, %edx
movl $0x24, %esi
callq 0x75eb0
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
jne 0x7608c
movq $0x0, -0x8(%rbp)
jmp 0x760e9
cmpq $0x0, -0x20(%rbp)
jbe 0x760b4
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x75f70
cmpq $0x0, %rax
jne 0x760b4
movq $0x0, -0x8(%rbp)
jmp 0x760e9
movq -0x10(%rbp), %rdi
leaq 0x6d71f(%rip), %rsi     # 0xe37de
movl $0x2, %edx
callq 0x75f70
cmpq $0x0, %rax
jne 0x760d9
movq $0x0, -0x8(%rbp)
jmp 0x760e9
movq -0x28(%rbp), %rax
addq -0x20(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/rio.c
// Function: rioBufferRead
static size_t rioBufferRead(rio *r, void *buf, size_t len) {

    // r 中的内容的长度不足 len 
    if (sdslen(r->io.buffer.ptr)-r->io.buffer.pos < len)
        return 0; /* not enough buffer to return len bytes. */
    
    // 复制 r 中的内容到 buf
    memcpy(buf,r->io.buffer.ptr+r->io.buffer.pos,len);
    r->io.buffer.pos += len;

    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x75d30
movq -0x10(%rbp), %rcx
subq 0x40(%rcx), %rax
cmpq -0x20(%rbp), %rax
jae 0x762d9
movq $0x0, -0x8(%rbp)
jmp 0x7630e
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rsi
movq -0x10(%rbp), %rax
addq 0x40(%rax), %rsi
movq -0x20(%rbp), %rdx
callq 0x1fbf0
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
addq 0x40(%rax), %rcx
movq %rcx, 0x40(%rax)
movq $0x1, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/rio.c
// Function: rioBufferWrite
static size_t rioBufferWrite(rio *r, const void *buf, size_t len) {

    // 追加
    r->io.buffer.ptr = sdscatlen(r->io.buffer.ptr,(char*)buf,len);

    // 更新偏移量
    r->io.buffer.pos += len;

    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x2c500
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
addq 0x40(%rax), %rcx
movq %rcx, 0x40(%rax)
movl $0x1, %eax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/bitops.c
// Function: getBitOffsetFromArgument
static int getBitOffsetFromArgument(redisClient *c, robj *o, size_t *offset) {
    long long loffset;
    char *err = "bit offset is not an integer or out of range";

    if (getLongLongFromObjectOrReply(c,o,&loffset,err) != REDIS_OK)
        return REDIS_ERR;

    /* Limit offset to 512MB in bytes */
    if ((loffset < 0) || ((unsigned long long)loffset >> 3) >= (512*1024*1024))
    {
        addReplyError(c,err);
        return REDIS_ERR;
    }

    *offset = (size_t)loffset;
    return REDIS_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
leaq 0x715d0(%rip), %rax     # 0xe8d8b
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x30(%rbp), %rcx
leaq -0x28(%rbp), %rdx
callq 0x3b8e0
cmpl $0x0, %eax
je 0x777e2
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x77821
cmpq $0x0, -0x28(%rbp)
jl 0x777f9
movq -0x28(%rbp), %rax
shrq $0x3, %rax
cmpq $0x20000000, %rax       # imm = 0x20000000
jb 0x7780f
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x35d40
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x77821
movq -0x28(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/bitops.c
// Function: getbitCommand
void getbitCommand(redisClient *c) {
    robj *o;
    char llbuf[32];
    size_t bitoffset;
    size_t byte, bit;
    size_t bitval = 0;

    // 读取 offset 参数
    if (getBitOffsetFromArgument(c,c->argv[2],&bitoffset) != REDIS_OK)
        return;

    // 查找对象，并进行类型检查
    if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL ||
        checkType(c,o,REDIS_STRING)) return;

    // 计算出 offset 所指定的位所在的字节
    byte = bitoffset >> 3;
    // 计算出位所在的位置
    bit = 7 - (bitoffset & 0x7);

    // 取出位
    if (sdsEncodedObject(o)) {
        // 字符串编码，直接取值
        if (byte < sdslen(o->ptr))
            bitval = ((uint8_t*)o->ptr)[byte] & (1 << bit);
    } else {
        // 整数编码，先转换成字符串，再取值
        if (byte < (size_t)ll2string(llbuf,sizeof(llbuf),(long)o->ptr))
            bitval = llbuf[byte] & (1 << bit);
    }

    // 返回位
    addReply(c, bitval ? shared.cone : shared.czero);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x10(%rax), %rsi
leaq -0x38(%rbp), %rdx
callq 0x777a0
cmpl $0x0, %eax
je 0x77867
jmp 0x779bc
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x8(%rax), %rsi
leaq 0x9c8d2(%rip), %rax     # 0x114150
movq 0x20(%rax), %rdx
callq 0x3c0c0
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
je 0x778a5
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
xorl %edx, %edx
callq 0x3abb0
cmpl $0x0, %eax
je 0x778aa
jmp 0x779bc
movq -0x38(%rbp), %rax
shrq $0x3, %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rcx
andq $0x7, %rcx
movl $0x7, %eax
subq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x0, %eax
je 0x778ec
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x8, %eax
jne 0x77934
movq -0x40(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x770a0
movq %rax, %rcx
movq -0x58(%rbp), %rax
cmpq %rcx, %rax
jae 0x77932
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x40(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movq -0x48(%rbp), %rcx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
andl %ecx, %eax
cltq
movq %rax, -0x50(%rbp)
jmp 0x77980
movq -0x40(%rbp), %rax
movq %rax, -0x60(%rbp)
leaq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
movl $0x20, %esi
callq 0x39660
movl %eax, %ecx
movq -0x60(%rbp), %rax
movslq %ecx, %rcx
cmpq %rcx, %rax
jae 0x7797e
movq -0x40(%rbp), %rax
movsbl -0x30(%rbp,%rax), %eax
movq -0x48(%rbp), %rcx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
andl %ecx, %eax
cltq
movq %rax, -0x50(%rbp)
jmp 0x77980
movq -0x8(%rbp), %rax
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x50(%rbp)
je 0x779a0
leaq 0x9c7ba(%rip), %rax     # 0x114150
movq 0x28(%rax), %rax
movq %rax, -0x70(%rbp)
jmp 0x779af
leaq 0x9c7a9(%rip), %rax     # 0x114150
movq 0x20(%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x68(%rbp), %rdi
movq -0x70(%rbp), %rsi
callq 0x35a70
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/sentinel.c
// Function: releaseSentinelRedisInstance
void releaseSentinelRedisInstance(sentinelRedisInstance *ri) {

    /* Release all its slaves or sentinels if any. */
    // 释放（可能有的）sentinel 和 slave
    dictRelease(ri->sentinels);
    dictRelease(ri->slaves);

    /* Release hiredis connections. */
    // 释放连接
    if (ri->cc) sentinelKillLink(ri,ri->cc);
    if (ri->pc) sentinelKillLink(ri,ri->pc);

    /* Free other resources. */
    // 释放其他资源
    sdsfree(ri->name);
    sdsfree(ri->runid);
    sdsfree(ri->notification_script);
    sdsfree(ri->client_reconfig_script);
    sdsfree(ri->slave_master_host);
    sdsfree(ri->leader);
    sdsfree(ri->auth_pass);
    releaseSentinelAddr(ri->addr);

    /* Clear state into the master if needed. */
    // 清除故障转移带来的状态
    if ((ri->flags & SRI_SLAVE) && (ri->flags & SRI_PROMOTED) && ri->master)
        ri->master->promoted_slave = NULL;

    zfree(ri);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0xc0(%rax), %rdi
callq 0x24000
movq -0x8(%rbp), %rax
movq 0xc8(%rax), %rdi
callq 0x24000
movq -0x8(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x78968
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rsi
callq 0x7aee0
movq -0x8(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x78984
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rsi
callq 0x7aee0
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x2c160
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x2c160
movq -0x8(%rbp), %rax
movq 0x160(%rax), %rdi
callq 0x2c160
movq -0x8(%rbp), %rax
movq 0x168(%rax), %rdi
callq 0x2c160
movq -0x8(%rbp), %rax
movq 0x100(%rax), %rdi
callq 0x2c160
movq -0x8(%rbp), %rax
movq 0x118(%rax), %rdi
callq 0x2c160
movq -0x8(%rbp), %rax
movq 0xd8(%rax), %rdi
callq 0x2c160
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x79a80
movq -0x8(%rbp), %rax
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x78a3d
movq -0x8(%rbp), %rax
movl (%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x78a3d
movq -0x8(%rbp), %rax
cmpq $0x0, 0xf8(%rax)
je 0x78a3d
movq -0x8(%rbp), %rax
movq 0xf8(%rax), %rax
movq $0x0, 0x158(%rax)
movq -0x8(%rbp), %rdi
callq 0x2e3a0
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/sentinel.c
// Function: initSentinel
void initSentinel(void) {
    int j;

    /* Remove usual Redis commands from the command table, then just add
     * the SENTINEL command. */

    // 清空 Redis 服务器的命令表（该表用于普通模式）
    dictEmpty(server.commands,NULL);
    // 将 SENTINEL 模式所用的命令添加进命令表
    for (j = 0; j < sizeof(sentinelcmds)/sizeof(sentinelcmds[0]); j++) {
        int retval;
        struct redisCommand *cmd = sentinelcmds+j;

        retval = dictAdd(server.commands, sdsnew(cmd->name), cmd);
        redisAssert(retval == DICT_OK);
    }

    /* Initialize various data structures. */
    /* 初始化 Sentinel 的状态 */
    // 初始化纪元
    sentinel.current_epoch = 0;

    // 初始化保存主服务器信息的字典
    sentinel.masters = dictCreate(&instancesDictType,NULL);

    // 初始化 TILT 模式的相关选项
    sentinel.tilt = 0;
    sentinel.tilt_start_time = 0;
    sentinel.previous_time = mstime();

    // 初始化脚本相关选项
    sentinel.running_scripts = 0;
    sentinel.scripts_queue = listCreate();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
leaq 0x9a1a9(%rip), %rax     # 0x1138f8
movq 0x18(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x24a00
movl $0x0, -0x4(%rbp)
movslq -0x4(%rbp), %rax
cmpq $0x9, %rax
jae 0x797eb
movslq -0x4(%rbp), %rcx
leaq 0x99538(%rip), %rax     # 0x112cb0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
leaq 0x9a16e(%rip), %rax     # 0x1138f8
movq 0x18(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x2c0e0
movq -0x18(%rbp), %rdi
movq %rax, %rsi
movq -0x10(%rbp), %rdx
callq 0x236d0
movl %eax, -0x8(%rbp)
cmpl $0x0, -0x8(%rbp)
jne 0x797b9
jmp 0x797db
leaq 0x69162(%rip), %rdi     # 0xe2922
leaq 0x6f621(%rip), %rsi     # 0xe8de8
movl $0x28c, %edx            # imm = 0x28C
callq 0x63ca0
movl $0x1, %edi
callq 0x1f3b0
jmp 0x797dd
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x79763
movq $0x0, 0xaea42(%rip) # 0x128238
leaq 0x99453(%rip), %rdi     # 0x112c50
xorl %eax, %eax
movl %eax, %esi
callq 0x231a0
movq %rax, 0xaea33(%rip)     # 0x128240
movl $0x0, 0xaea31(%rip)     # 0x128248
movq $0x0, 0xaea2e(%rip) # 0x128250
callq 0x252e0
movq %rax, 0xaea2a(%rip)     # 0x128258
movl $0x0, 0xaea14(%rip)     # 0x12824c
callq 0x1fdb0
movq %rax, 0xaea1c(%rip)     # 0x128260
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/sentinel.c
// Function: sentinelIsRunning
void sentinelIsRunning(void) {
    redisLog(REDIS_WARNING,"Sentinel runid is %s", server.runid);

    // Sentinel 不能在没有配置文件的情况下执行
    if (server.configfile == NULL) {
        redisLog(REDIS_WARNING,
            "Sentinel started without a config file. Exiting...");
        exit(1);
    } else if (access(server.configfile,W_OK) == -1) {
        redisLog(REDIS_WARNING,
            "Sentinel config file %s is not writable: %s. Exiting...",
            server.configfile,strerror(errno));
        exit(1);
    }

    /* We want to generate a +monitor event for every configured master
     * at startup. */
    sentinelGenerateInitialMonitorEvents();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x3, %edi
leaq 0x6f58f(%rip), %rsi     # 0xe8df3
leaq 0x9a08d(%rip), %rdx     # 0x1138f8
addq $0x58, %rdx
movb $0x0, %al
callq 0x24fb0
leaq 0x9a07b(%rip), %rax     # 0x1138f8
cmpq $0x0, (%rax)
jne 0x798a0
movl $0x3, %edi
leaq 0x6f579(%rip), %rsi     # 0xe8e08
movb $0x0, %al
callq 0x24fb0
movl $0x1, %edi
callq 0x1f2c0
leaq 0x9a051(%rip), %rax     # 0x1138f8
movq (%rax), %rdi
movl $0x2, %esi
callq 0x1fa30
cmpl $-0x1, %eax
jne 0x798f7
leaq 0x9a038(%rip), %rax     # 0x1138f8
movq (%rax), %rax
movq %rax, -0x8(%rbp)
callq 0x1f820
movl (%rax), %edi
callq 0x1f630
movq -0x8(%rbp), %rdx
movq %rax, %rcx
movl $0x3, %edi
leaq 0x6f555(%rip), %rsi     # 0xe8e3b
movb $0x0, %al
callq 0x24fb0
movl $0x1, %edi
callq 0x1f2c0
jmp 0x798f9
callq 0x79910
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)