LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_hash.c
// Function: hsetCommand
void hsetCommand(redisClient *c) {
    int update;
    robj *o;

    // 取出或新创建哈希对象
    if ((o = hashTypeLookupWriteOrCreate(c,c->argv[1])) == NULL) return;

    // 如果需要的话，转换哈希对象的编码
    hashTypeTryConversion(o,c->argv,2,3);

    // 编码 field 和 value 对象以节约空间
    hashTypeTryObjectEncoding(o,&c->argv[2], &c->argv[3]);

    // 设置 field 和 value 到 hash
    update = hashTypeSet(o,c->argv[2],c->argv[3]);

    // 返回状态：显示 field-value 对是新添加还是更新
    addReply(c, update ? shared.czero : shared.cone);

    // 发送键修改信号
    signalModifiedKey(c->db,c->argv[1]);

    // 发送事件通知
    notifyKeyspaceEvent(REDIS_NOTIFY_HASH,"hset",c->argv[1],c->db->id);

    // 将服务器设为脏
    server.dirty++;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x38(%rdi), %rax
movq 0x8(%rax), %rsi
callq 0x42b94
testq %rax, %rax
je 0x42de1
movq %rax, %r14
movq 0x38(%rbx), %rsi
movq %rax, %rdi
movl $0x2, %edx
movl $0x3, %ecx
callq 0x42238
movq 0x38(%rbx), %rdx
leaq 0x10(%rdx), %rsi
addq $0x18, %rdx
movq %r14, %rdi
callq 0x422eb
movq 0x38(%rbx), %rax
movq 0x10(%rax), %rsi
movq 0x18(%rax), %rdx
movq %r14, %rdi
callq 0x425b0
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
leaq 0x87a6b(%rip), %rax     # 0xca800
movq 0x20(%rax,%rcx,8), %rsi
movq %rbx, %rdi
callq 0x2d6f0
movq 0x8(%rbx), %rdi
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rsi
callq 0x316b7
movq 0x8(%rbx), %rax
movq 0x38(%rbx), %rcx
movq 0x8(%rcx), %rdx
movl 0x30(%rax), %ecx
leaq 0x51691(%rip), %rsi     # 0x9445a
movl $0x40, %edi
callq 0x608b5
leaq 0x871ce(%rip), %rax     # 0xc9fa8
incq 0x560(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_hash.c
// Function: hsetnxCommand
void hsetnxCommand(redisClient *c) {
    robj *o;

    // 取出或新创建哈希对象
    if ((o = hashTypeLookupWriteOrCreate(c,c->argv[1])) == NULL) return;

    // 如果需要的话，转换哈希对象的编码
    hashTypeTryConversion(o,c->argv,2,3);

    // 如果 field-value 对已经存在
    // 那么回复 0 
    if (hashTypeExists(o, c->argv[2])) {
        addReply(c, shared.czero);

    // 否则，设置 field-value 对
    } else {
        // 对 field 和 value 对象编码，以节省空间
        hashTypeTryObjectEncoding(o,&c->argv[2], &c->argv[3]);
        // 设置
        hashTypeSet(o,c->argv[2],c->argv[3]);

        // 回复 1 ，表示设置成功
        addReply(c, shared.cone);

        // 发送键修改信号
        signalModifiedKey(c->db,c->argv[1]);

        // 发送事件通知
        notifyKeyspaceEvent(REDIS_NOTIFY_HASH,"hset",c->argv[1],c->db->id);

        // 将数据库设为脏
        server.dirty++;
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x38(%rdi), %rax
movq 0x8(%rax), %rsi
callq 0x42b94
testq %rax, %rax
je 0x42ec7
movq %rax, %r14
movq 0x38(%rbx), %rsi
movq %rax, %rdi
movl $0x2, %edx
movl $0x3, %ecx
callq 0x42238
movq 0x38(%rbx), %rax
movq 0x10(%rax), %rsi
movq %r14, %rdi
callq 0x42530
testl %eax, %eax
je 0x42e4d
leaq 0x879c6(%rip), %rax     # 0xca800
movq 0x20(%rax), %rsi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2d6f0
movq 0x38(%rbx), %rdx
leaq 0x10(%rdx), %rsi
addq $0x18, %rdx
movq %r14, %rdi
callq 0x422eb
movq 0x38(%rbx), %rax
movq 0x10(%rax), %rsi
movq 0x18(%rax), %rdx
movq %r14, %rdi
callq 0x425b0
leaq 0x87984(%rip), %rax     # 0xca800
movq 0x28(%rax), %rsi
movq %rbx, %rdi
callq 0x2d6f0
movq 0x8(%rbx), %rdi
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rsi
callq 0x316b7
movq 0x8(%rbx), %rax
movq 0x38(%rbx), %rcx
movq 0x8(%rcx), %rdx
movl 0x30(%rax), %ecx
leaq 0x515ab(%rip), %rsi     # 0x9445a
movl $0x40, %edi
callq 0x608b5
leaq 0x870e8(%rip), %rax     # 0xc9fa8
incq 0x560(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_hash.c
// Function: hmsetCommand
void hmsetCommand(redisClient *c) {
    int i;
    robj *o;

    // field-value 参数必须成对出现
    if ((c->argc % 2) == 1) {
        addReplyError(c,"wrong number of arguments for HMSET");
        return;
    }

    // 取出或新创建哈希对象
    if ((o = hashTypeLookupWriteOrCreate(c,c->argv[1])) == NULL) return;

    // 如果需要的话，转换哈希对象的编码
    hashTypeTryConversion(o,c->argv,2,c->argc-1);

    // 遍历并设置所有 field-value 对
    for (i = 2; i < c->argc; i += 2) {
        // 编码 field-value 对，以节约空间
        hashTypeTryObjectEncoding(o,&c->argv[i], &c->argv[i+1]);
        // 设置
        hashTypeSet(o,c->argv[i],c->argv[i+1]);
    }

    // 向客户端发送回复
    addReply(c, shared.ok);

    // 发送键修改信号
    signalModifiedKey(c->db,c->argv[1]);

    // 发送事件通知
    notifyKeyspaceEvent(REDIS_NOTIFY_HASH,"hset",c->argv[1],c->db->id);

    // 将数据库设为脏
    server.dirty++;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x80000001, %eax       # imm = 0x80000001
andl 0x30(%rdi), %eax
cmpl $0x1, %eax
jne 0x42eff
leaq 0x5675e(%rip), %rsi     # 0x9964b
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2d9d7
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0x42b94
testq %rax, %rax
je 0x42fcc
movq %rax, %r14
movq 0x38(%rbx), %rsi
movl 0x30(%rbx), %ecx
decl %ecx
movl $0x2, %ebp
movq %rax, %rdi
movl $0x2, %edx
callq 0x42238
cmpl $0x3, 0x30(%rbx)
jl 0x42f7a
movl $0x18, %r15d
movq 0x38(%rbx), %rdx
leaq (%rdx,%r15), %rsi
addq $-0x8, %rsi
addq %r15, %rdx
movq %r14, %rdi
callq 0x422eb
movq 0x38(%rbx), %rax
movq -0x8(%rax,%r15), %rsi
movq (%rax,%r15), %rdx
movq %r14, %rdi
callq 0x425b0
addq $0x10, %r15
addl $0x2, %ebp
cmpl %ebp, 0x30(%rbx)
jg 0x42f42
leaq 0x8787f(%rip), %rax     # 0xca800
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0x2d6f0
movq 0x8(%rbx), %rdi
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rsi
callq 0x316b7
movq 0x8(%rbx), %rax
movq 0x38(%rbx), %rcx
movq 0x8(%rcx), %rdx
movl 0x30(%rax), %ecx
leaq 0x514a6(%rip), %rsi     # 0x9445a
movl $0x40, %edi
callq 0x608b5
leaq 0x86fe3(%rip), %rax     # 0xc9fa8
incq 0x560(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_hash.c
// Function: hgetCommand
void hgetCommand(redisClient *c) {
    robj *o;

    if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.nullbulk)) == NULL ||
        checkType(c,o,REDIS_HASH)) return;

    // 取出并返回域的值
    addHashFieldToReply(c, o, c->argv[2]);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x38(%rdi), %rax
movq 0x8(%rax), %rsi
leaq 0x8751e(%rip), %rax     # 0xca800
movq 0x50(%rax), %rdx
callq 0x31475
testq %rax, %rax
je 0x43307
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
movl $0x4, %edx
callq 0x308e7
testl %eax, %eax
je 0x4330f
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq 0x38(%rbx), %rax
movq 0x10(%rax), %rdx
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x43326
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_hash.c
// Function: addHashFieldToReply
static void addHashFieldToReply(redisClient *c, robj *o, robj *field) {
    int ret;

    // 对象不存在
    if (o == NULL) {
        addReply(c, shared.nullbulk);
        return;
    }

    // ziplist 编码
    if (o->encoding == REDIS_ENCODING_ZIPLIST) {
        unsigned char *vstr = NULL;
        unsigned int vlen = UINT_MAX;
        long long vll = LLONG_MAX;

        // 取出值
        ret = hashTypeGetFromZiplist(o, field, &vstr, &vlen, &vll);
        if (ret < 0) {
            addReply(c, shared.nullbulk);
        } else {
            if (vstr) {
                addReplyBulkCBuffer(c, vstr, vlen);
            } else {
                addReplyBulkLongLong(c, vll);
            }
        }

    // 字典
    } else if (o->encoding == REDIS_ENCODING_HT) {
        robj *value;

        // 取出值
        ret = hashTypeGetFromHashTable(o, field, &value);
        if (ret < 0) {
            addReply(c, shared.nullbulk);
        } else {
            addReplyBulk(c, value);
        }

    } else {
        redisPanic("Unknown hash encoding");
    }
}

// Assembly:
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
testq %rsi, %rsi
je 0x4339c
movl (%rsi), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x2, %eax
je 0x433b4
cmpl $0x5, %eax
jne 0x43402
leaq 0x8(%rsp), %rax
movq $0x0, (%rax)
leaq 0x14(%rsp), %rcx
movl $0xffffffff, (%rcx)     # imm = 0xFFFFFFFF
movabsq $0x7fffffffffffffff, %rdi # imm = 0x7FFFFFFFFFFFFFFF
leaq 0x18(%rsp), %r8
movq %rdi, (%r8)
movq %rsi, %rdi
movq %rdx, %rsi
movq %rax, %rdx
callq 0x42329
testl %eax, %eax
js 0x433da
movq 0x8(%rsp), %rsi
testq %rsi, %rsi
je 0x433ef
movl 0x14(%rsp), %edx
movq %rbx, %rdi
callq 0x2dfa7
jmp 0x433fc
leaq 0x8745d(%rip), %rax     # 0xca800
movq 0x50(%rax), %rsi
movq %rbx, %rdi
addq $0x20, %rsp
popq %rbx
jmp 0x2d6f0
leaq 0x8(%rsp), %rax
movq %rsi, %rdi
movq %rdx, %rsi
movq %rax, %rdx
callq 0x42427
testl %eax, %eax
js 0x433da
movq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x2df74
jmp 0x433fc
leaq 0x8741f(%rip), %rax     # 0xca800
movq 0x50(%rax), %rsi
movq %rbx, %rdi
callq 0x2d6f0
jmp 0x433fc
movq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x2dfe7
addq $0x20, %rsp
popq %rbx
retq
leaq 0x556aa(%rip), %rdi     # 0x98ab3
leaq 0x5616a(%rip), %rsi     # 0x9957a
movl $0x3c1, %edx            # imm = 0x3C1
callq 0x4d0e5
movl $0x1, %edi
callq 0x1f3b0
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_hash.c
// Function: hmgetCommand
void hmgetCommand(redisClient *c) {
    robj *o;
    int i;

    /* Don't abort when the key cannot be found. Non-existing keys are empty
     * hashes, where HMGET should respond with a series of null bulks. */
    // 取出哈希对象
    o = lookupKeyRead(c->db, c->argv[1]);

    // 对象存在，检查类型
    if (o != NULL && o->type != REDIS_HASH) {
        addReply(c, shared.wrongtypeerr);
        return;
    }

    // 获取多个 field 的值
    addReplyMultiBulkLen(c, c->argc-2);
    for (i = 2; i < c->argc; i++) {
        addHashFieldToReply(c, o, c->argv[i]);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rsi
callq 0x3136a
movq %rax, %r14
testq %rax, %rax
je 0x43450
movl (%r14), %eax
andl $0xf, %eax
cmpl $0x4, %eax
jne 0x43491
movslq 0x30(%rbx), %rsi
addq $-0x2, %rsi
movq %rbx, %rdi
callq 0x2ded8
cmpl $0x3, 0x30(%rbx)
jl 0x4348b
movl $0x2, %r15d
movq 0x38(%rbx), %rax
movq (%rax,%r15,8), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x43326
incq %r15
movslq 0x30(%rbx), %rax
cmpq %rax, %r15
jl 0x4346c
popq %rbx
popq %r14
popq %r15
retq
leaq 0x87368(%rip), %rax     # 0xca800
movq 0x70(%rax), %rsi
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x2d6f0
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_hash.c
// Function: hdelCommand
void hdelCommand(redisClient *c) {
    robj *o;
    int j, deleted = 0, keyremoved = 0;

    // 取出对象
    if ((o = lookupKeyWriteOrReply(c,c->argv[1],shared.czero)) == NULL ||
        checkType(c,o,REDIS_HASH)) return;

    // 删除指定域值对
    for (j = 2; j < c->argc; j++) {
        if (hashTypeDelete(o,c->argv[j])) {

            // 成功删除一个域值对时进行计数
            deleted++;

            // 如果哈希已经为空，那么删除这个对象
            if (hashTypeLength(o) == 0) {
                dbDelete(c->db,c->argv[1]);
                keyremoved = 1;
                break;
            }
        }
    }

    // 只要有至少一个域值对被修改了，那么执行以下代码
    if (deleted) {
        // 发送键修改信号
        signalModifiedKey(c->db,c->argv[1]);

        // 发送事件通知
        notifyKeyspaceEvent(REDIS_NOTIFY_HASH,"hdel",c->argv[1],c->db->id);

        // 发送事件通知
        if (keyremoved)
            notifyKeyspaceEvent(REDIS_NOTIFY_GENERIC,"del",c->argv[1],
                                c->db->id);

        // 将数据库设为脏
        server.dirty += deleted;
    }

    // 将成功删除的域值对数量作为结果返回给客户端
    addReplyLongLong(c,deleted);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq 0x38(%rdi), %rax
movq 0x8(%rax), %rsi
leaq 0x8733d(%rip), %rax     # 0xca800
movq 0x20(%rax), %rdx
callq 0x314a5
testq %rax, %rax
je 0x434e8
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
movl $0x4, %edx
callq 0x308e7
testl %eax, %eax
je 0x434f1
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
xorl %r15d, %r15d
cmpl $0x3, 0x30(%rbx)
setge %bpl
jl 0x4354e
xorl %r15d, %r15d
movl $0x2, %r12d
movq 0x38(%rbx), %rax
movq (%rax,%r12,8), %rsi
movq %r14, %rdi
callq 0x4279d
testl %eax, %eax
je 0x4352b
incl %r15d
movq %r14, %rdi
callq 0x4274d
testq %rax, %rax
je 0x4353d
incq %r12
movslq 0x30(%rbx), %rax
cmpq %rax, %r12
setl %bpl
jl 0x43507
jmp 0x4354e
movq 0x8(%rbx), %rdi
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rsi
callq 0x3174b
movslq %r15d, %r14
testl %r15d, %r15d
je 0x435bb
movq 0x8(%rbx), %rdi
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rsi
callq 0x316b7
movq 0x8(%rbx), %rax
movq 0x38(%rbx), %rcx
movq 0x8(%rcx), %rdx
movl 0x30(%rax), %ecx
leaq 0x50f0f(%rip), %rsi     # 0x9448c
movl $0x40, %edi
callq 0x608b5
testb $0x1, %bpl
je 0x435ad
movq 0x8(%rbx), %rax
movq 0x38(%rbx), %rcx
movq 0x8(%rcx), %rdx
movl 0x30(%rax), %ecx
leaq 0x50eea(%rip), %rsi     # 0x9448d
movl $0x4, %edi
callq 0x608b5
leaq 0x869f4(%rip), %rax     # 0xc9fa8
addq %r14, 0x560(%rax)
movq %rbx, %rdi
movq %r14, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x2dea3
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_hash.c
// Function: hlenCommand
void hlenCommand(redisClient *c) {
    robj *o;

    // 取出哈希对象
    if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL ||
        checkType(c,o,REDIS_HASH)) return;

    // 回复
    addReplyLongLong(c,hashTypeLength(o));
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x38(%rdi), %rax
movq 0x8(%rax), %rsi
leaq 0x8721c(%rip), %rax     # 0xca800
movq 0x20(%rax), %rdx
callq 0x31475
testq %rax, %rax
je 0x43609
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
movl $0x4, %edx
callq 0x308e7
testl %eax, %eax
je 0x43611
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %r14, %rdi
callq 0x4274d
movq %rbx, %rdi
movq %rax, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2dea3
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_hash.c
// Function: genericHgetallCommand
void genericHgetallCommand(redisClient *c, int flags) {
    robj *o;
    hashTypeIterator *hi;
    int multiplier = 0;
    int length, count = 0;

    // 取出哈希对象
    if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.emptymultibulk)) == NULL
        || checkType(c,o,REDIS_HASH)) return;

    // 计算要取出的元素数量
    if (flags & REDIS_HASH_KEY) multiplier++;
    if (flags & REDIS_HASH_VALUE) multiplier++;

    length = hashTypeLength(o) * multiplier;

    addReplyMultiBulkLen(c, length);

    // 迭代节点，并取出元素
    hi = hashTypeInitIterator(o);
    while (hashTypeNext(hi) != REDIS_ERR) {
        // 取出键
        if (flags & REDIS_HASH_KEY) {
            addHashIteratorCursorToReply(c, hi, REDIS_HASH_KEY);
            count++;
        }
        // 取出值
        if (flags & REDIS_HASH_VALUE) {
            addHashIteratorCursorToReply(c, hi, REDIS_HASH_VALUE);
            count++;
        }
    }

    // 释放迭代器
    hashTypeReleaseIterator(hi);
    redisAssert(count == length);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
movq 0x38(%rdi), %rax
movq 0x8(%rax), %rsi
leaq 0x871b6(%rip), %rax     # 0xca800
movq 0x68(%rax), %rdx
callq 0x31475
testq %rax, %rax
je 0x43702
movq %rax, %r12
movq %r14, %rdi
movq %rax, %rsi
movl $0x4, %edx
callq 0x308e7
testl %eax, %eax
jne 0x43702
movl %ebx, %ebp
andl $0x1, %ebp
andl $0x2, %ebx
movl %ebx, %r13d
shrl %r13d
addl %ebp, %r13d
movq %r12, %rdi
callq 0x4274d
movq %rax, %r15
imull %r13d, %r15d
movslq %r15d, %rsi
movq %r14, %rdi
callq 0x2ded8
movq %r12, %rdi
callq 0x4288e
movq %rax, %r12
movq %rax, %rdi
callq 0x4291a
xorl %r13d, %r13d
cmpl $-0x1, %eax
je 0x436f5
testl %ebp, %ebp
je 0x436d4
movq %r14, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x43733
incl %r13d
testl %ebx, %ebx
je 0x436eb
movq %r14, %rdi
movq %r12, %rsi
movl $0x2, %edx
callq 0x43733
incl %r13d
movq %r12, %rdi
callq 0x4291a
jmp 0x436b8
movq %r12, %rdi
callq 0x428fe
cmpl %r15d, %r13d
jne 0x43711
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x55f99(%rip), %rdi     # 0x996b1
leaq 0x55e5b(%rip), %rsi     # 0x9957a
movl $0x45e, %edx            # imm = 0x45E
callq 0x4d037
movl $0x1, %edi
callq 0x1f3b0
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_hash.c
// Function: addHashIteratorCursorToReply
static void addHashIteratorCursorToReply(redisClient *c, hashTypeIterator *hi, int what) {

    // 处理 ZIPLIST
    if (hi->encoding == REDIS_ENCODING_ZIPLIST) {
        unsigned char *vstr = NULL;
        unsigned int vlen = UINT_MAX;
        long long vll = LLONG_MAX;

        hashTypeCurrentFromZiplist(hi, what, &vstr, &vlen, &vll);
        if (vstr) {
            addReplyBulkCBuffer(c, vstr, vlen);
        } else {
            addReplyBulkLongLong(c, vll);
        }

    // 处理 HT
    } else if (hi->encoding == REDIS_ENCODING_HT) {
        robj *value;

        hashTypeCurrentFromHashTable(hi, what, &value);
        addReplyBulk(c, value);

    } else {
        redisPanic("Unknown hash encoding");
    }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movl 0x8(%rsi), %eax
cmpl $0x2, %eax
je 0x4379a
cmpl $0x5, %eax
jne 0x437ce
leaq 0x10(%rsp), %r14
movq $0x0, (%r14)
leaq 0x4(%rsp), %rcx
movl $0xffffffff, (%rcx)     # imm = 0xFFFFFFFF
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
leaq 0x8(%rsp), %r8
movq %rax, (%r8)
movq %rsi, %rdi
movl %edx, %esi
movq %r14, %rdx
callq 0x42a25
movq (%r14), %rsi
testq %rsi, %rsi
je 0x437b9
movl 0x4(%rsp), %edx
movq %rbx, %rdi
callq 0x2dfa7
jmp 0x437c6
leaq 0x10(%rsp), %r14
movq %rsi, %rdi
movl %edx, %esi
movq %r14, %rdx
callq 0x42aac
movq (%r14), %rsi
movq %rbx, %rdi
callq 0x2df74
jmp 0x437c6
movq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x2dfe7
addq $0x18, %rsp
popq %rbx
popq %r14
retq
leaq 0x552de(%rip), %rdi     # 0x98ab3
leaq 0x55d9e(%rip), %rsi     # 0x9957a
movl $0x437, %edx            # imm = 0x437
callq 0x4d0e5
movl $0x1, %edi
callq 0x1f3b0
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_hash.c
// Function: hexistsCommand
void hexistsCommand(redisClient *c) {
    robj *o;

    // 取出哈希对象
    if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL ||
        checkType(c,o,REDIS_HASH)) return;

    // 检查给定域是否存在
    addReply(c, hashTypeExists(o,c->argv[2]) ? shared.cone : shared.czero);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x38(%rdi), %rax
movq 0x8(%rax), %rsi
leaq 0x86fdb(%rip), %r15     # 0xca800
movq 0x20(%r15), %rdx
callq 0x31475
testq %rax, %rax
je 0x4384a
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
movl $0x4, %edx
callq 0x308e7
testl %eax, %eax
je 0x43850
popq %rbx
popq %r14
popq %r15
retq
movq 0x38(%rbx), %rax
movq 0x10(%rax), %rsi
movq %r14, %rdi
callq 0x42530
xorl %ecx, %ecx
testl %eax, %eax
setne %cl
movq 0x20(%r15,%rcx,8), %rsi
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x2d6f0
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_hash.c
// Function: hscanCommand
void hscanCommand(redisClient *c) {
    robj *o;
    unsigned long cursor;

    if (parseScanCursorOrReply(c,c->argv[2],&cursor) == REDIS_ERR) return;
    if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.emptyscan)) == NULL ||
        checkType(c,o,REDIS_HASH)) return;
    scanGenericCommand(c,o,cursor);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x38(%rdi), %rax
movq 0x10(%rax), %rsi
movq %rsp, %rdx
callq 0x31e19
cmpl $-0x1, %eax
je 0x438de
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rsi
leaq 0x86f5c(%rip), %rax     # 0xca800
movq 0x148(%rax), %rdx
movq %rbx, %rdi
callq 0x31475
testq %rax, %rax
je 0x438de
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
movl $0x4, %edx
callq 0x308e7
testl %eax, %eax
jne 0x438de
movq (%rsp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x31e96
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/config.c
// Function: loadServerConfig
void loadServerConfig(char *filename, char *options) {
    sds config = sdsempty();
    char buf[REDIS_CONFIGLINE_MAX+1];

    /* Load the file content */
    // 载入文件内容
    if (filename) {
        FILE *fp;

        if (filename[0] == '-' && filename[1] == '\0') {
            fp = stdin;
        } else {
            if ((fp = fopen(filename,"r")) == NULL) {
                redisLog(REDIS_WARNING,
                    "Fatal error, can't open config file '%s'", filename);
                exit(1);
            }
        }
        while(fgets(buf,REDIS_CONFIGLINE_MAX+1,fp) != NULL)
            config = sdscat(config,buf);
        if (fp != stdin) fclose(fp);
    }

    /* Append the additional options */
    // 追加 options 字符串到内容的末尾
    if (options) {
        config = sdscat(config,"\n");
        config = sdscat(config,options);
    }

    // 根据字符串内容，设置服务器配置
    loadServerConfigFromString(config);

    sdsfree(config);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movq %rsi, %rbx
movq %rdi, %r12
callq 0x281b2
movq %rax, %r14
testq %r12, %r12
je 0x4540e
cmpb $0x2d, (%r12)
jne 0x453a4
cmpb $0x0, 0x1(%r12)
je 0x4544f
leaq 0x5ccdf(%rip), %rsi     # 0xa208a
movq %r12, %rdi
callq 0x1fa60
movq %rax, %r15
testq %rax, %rax
je 0x4545e
movq %rsp, %rdi
movl $0x401, %esi            # imm = 0x401
movq %r15, %rdx
callq 0x1f430
testq %rax, %rax
je 0x453fa
movq %rsp, %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x283d7
movq %rax, %r14
movq %r12, %rdi
movl $0x401, %esi            # imm = 0x401
movq %r15, %rdx
callq 0x1f430
testq %rax, %rax
jne 0x453d7
movq 0x80b6f(%rip), %rax     # 0xc5f70
cmpq (%rax), %r15
je 0x4540e
movq %r15, %rdi
callq 0x1f9a0
testq %rbx, %rbx
je 0x45430
leaq 0x51327(%rip), %rsi     # 0x96741
movq %r14, %rdi
callq 0x283d7
movq %rax, %rdi
movq %rbx, %rsi
callq 0x283d7
movq %rax, %r14
movq %r14, %rdi
callq 0x4399d
movq %r14, %rdi
callq 0x28204
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0x80b1a(%rip), %rax     # 0xc5f70
movq (%rax), %r15
jmp 0x453bf
leaq 0x54cc8(%rip), %rsi     # 0x9a12d
movl $0x3, %edi
movq %r12, %rdx
xorl %eax, %eax
callq 0x23064
movl $0x1, %edi
callq 0x1f2b0
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/config.c
// Function: rewriteConfigStringOption
void rewriteConfigStringOption(struct rewriteConfigState *state, char *option, char *value, char *defvalue) {
    int force = 1;
    sds line;

    /* String options set to NULL need to be not present at all in the
     * configuration file to be set to NULL again at the next reboot. */
    if (value == NULL) {
        rewriteConfigMarkAsProcessed(state,option);
        return;
    }

    /* Compare the strings as sds strings to have a binary safe comparison. */
    if (defvalue && strcmp(value,defvalue) == 0) force = 0;

    line = sdsnew(option);
    line = sdscatlen(line, " ", 1);
    line = sdscatrepr(line, value, strlen(value));

    rewriteConfigRewriteLine(state,option,line,force);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
testq %rdx, %rdx
je 0x4820e
movq %rdx, %r15
testq %rcx, %rcx
je 0x48221
movq %r15, %rdi
movq %rcx, %rsi
callq 0x1f880
xorl %ebp, %ebp
testl %eax, %eax
setne %bpl
jmp 0x48226
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x47d46
movl $0x1, %ebp
movq %rbx, %rdi
callq 0x281da
leaq 0x52192(%rip), %rsi     # 0x9a3c7
movl $0x1, %edx
movq %rax, %rdi
callq 0x28380
movq %rax, %r12
movq %r15, %rdi
callq 0x1f4f0
movq %r12, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x28f45
movq %r14, %rdi
movq %rbx, %rsi
movq %rax, %rdx
movl %ebp, %ecx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x47f92
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/config.c
// Function: rewriteConfigEnumOption
void rewriteConfigEnumOption(struct rewriteConfigState *state, char *option, int value, ...) {
    va_list ap;
    char *enum_name, *matching_name = NULL;
    int enum_val, def_val, force;
    sds line;
    
    va_start(ap, value);
    while(1) {
        enum_name = va_arg(ap,char*);
        enum_val = va_arg(ap,int);
        if (enum_name == NULL) {
            def_val = enum_val;
            break;
        }
        if (value == enum_val) matching_name = enum_name;
    }
    va_end(ap);
    
    force = value != def_val;
    line = sdscatprintf(sdsempty(),"%s %s",option,matching_name);
    rewriteConfigRewriteLine(state,option,line,force);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0xd8, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x20(%rsp), %rsi
movq %rcx, 0x18(%rsi)
movq %r8, 0x20(%rsi)
movq %r9, 0x28(%rsi)
testb %al, %al
je 0x4836d
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movq %rsi, 0x10(%rsp)
leaq 0x100(%rsp), %rcx
movq %rcx, 0x8(%rsp)
movabsq $0x3000000018, %rax     # imm = 0x3000000018
movq %rax, (%rsp)
movl $0x18, %eax
xorl %r15d, %r15d
cmpl $0x28, %eax
ja 0x483aa
movq %rcx, %rdi
movl %eax, %ecx
addq %rsi, %rcx
addl $0x8, %eax
movl %eax, (%rsp)
jmp 0x483b3
leaq 0x8(%rcx), %rdi
movq %rdi, 0x8(%rsp)
movq (%rcx), %r8
cmpl $0x28, %eax
ja 0x483cb
movq %rdi, %rcx
movl %eax, %edi
addq %rsi, %rdi
addl $0x8, %eax
movl %eax, (%rsp)
jmp 0x483d4
leaq 0x8(%rdi), %rcx
movq %rcx, 0x8(%rsp)
movl (%rdi), %edi
testq %r8, %r8
je 0x483e3
cmpl %edx, %edi
cmoveq %r8, %r15
jmp 0x48395
xorl %ebp, %ebp
cmpl %edx, %edi
setne %bpl
callq 0x281b2
leaq 0x57801(%rip), %rsi     # 0x9fbf8
movq %rax, %rdi
movq %rbx, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x28760
movq %r14, %rdi
movq %rbx, %rsi
movq %rax, %rdx
movl %ebp, %ecx
callq 0x47f92
addq $0xd8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/config.c
// Function: rewriteConfigSyslogfacilityOption
void rewriteConfigSyslogfacilityOption(struct rewriteConfigState *state) {
    int value = server.syslog_facility, j;
    int force = value != LOG_LOCAL0;
    char *name = NULL, *option = "syslog-facility";
    sds line;

    for (j = 0; validSyslogFacilities[j].name; j++) {
        if (validSyslogFacilities[j].value == value) {
            name = (char*) validSyslogFacilities[j].name;
            break;
        }
    }
    line = sdscatprintf(sdsempty(),"%s %s",option,name);
    rewriteConfigRewriteLine(state,option,line,force);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x81b72(%rip), %rax     # 0xc9fa8
movl 0x5e8(%rax), %eax
cmpl $0x8, %eax
jne 0x4844a
leaq 0x520f4(%rip), %r14     # 0x9a53c
jmp 0x48473
movl $0x18, %edx
xorl %r14d, %r14d
leaq 0x7ae97(%rip), %rcx     # 0xc32f0
leaq 0x10(%rdx), %rsi
cmpq $0xa8, %rsi
je 0x48473
cmpl %eax, (%rdx,%rcx)
movq %rsi, %rdx
jne 0x48459
movq -0x18(%rsi,%rcx), %r14
xorl %ebp, %ebp
cmpl $0x80, %eax
setne %bpl
callq 0x281b2
leaq 0x5776e(%rip), %rsi     # 0x9fbf8
leaq 0x51415(%rip), %r15     # 0x998a6
movq %rax, %rdi
movq %r15, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x28760
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
movl %ebp, %ecx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x47f92
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/config.c
// Function: rewriteConfigSlaveofOption
void rewriteConfigSlaveofOption(struct rewriteConfigState *state) {
    char *option = "slaveof";
    sds line;

    /* If this is a master, we want all the slaveof config options
     * in the file to be removed. Note that if this is a cluster instance
     * we don't want a slaveof directive inside redis.conf. */
    if (server.cluster_enabled || server.masterhost == NULL) {
        rewriteConfigMarkAsProcessed(state,"slaveof");
        return;
    }
    line = sdscatprintf(sdsempty(),"%s %s %d", option,
        server.masterhost, server.masterport);
    rewriteConfigRewriteLine(state,option,line,1);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x819fe(%rip), %r14     # 0xc9fa8
cmpl $0x0, 0x7bc(%r14)
jne 0x48606
cmpq $0x0, 0x650(%r14)
je 0x48606
callq 0x281b2
movq 0x650(%r14), %rcx
movl 0x658(%r14), %r8d
leaq 0x56875(%rip), %rsi     # 0x9ee4d
leaq 0x4bfac(%rip), %r14     # 0x9458b
movq %rax, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x28760
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
movl $0x1, %ecx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x47f92
leaq 0x4bf7e(%rip), %rsi     # 0x9458b
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x47d46
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/config.c
// Function: rewriteConfigNotifykeyspaceeventsOption
void rewriteConfigNotifykeyspaceeventsOption(struct rewriteConfigState *state) {
    int force = server.notify_keyspace_events != 0;
    char *option = "notify-keyspace-events";
    sds line, flags;

    flags = keyspaceEventsFlagsToString(server.notify_keyspace_events);
    line = sdsnew(option);
    line = sdscatlen(line, " ", 1);
    line = sdscatrepr(line, flags, sdslen(flags));
    sdsfree(flags);
    rewriteConfigRewriteLine(state,option,line,force);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x8197a(%rip), %rax     # 0xc9fa8
movl 0x7b8(%rax), %edi
xorl %ebp, %ebp
testl %edi, %edi
setne %bpl
callq 0x60797
movq %rax, %r14
leaq 0x519bc(%rip), %r15     # 0x9a007
movq %r15, %rdi
callq 0x281da
leaq 0x51d6d(%rip), %rsi     # 0x9a3c7
movl $0x1, %edx
movq %rax, %rdi
callq 0x28380
movslq -0x8(%r14), %rdx
movq %rax, %rdi
movq %r14, %rsi
callq 0x28f45
movq %rax, %r12
movq %r14, %rdi
callq 0x28204
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
movl %ebp, %ecx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x47f92
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/config.c
// Function: rewriteConfigClientoutputbufferlimitOption
void rewriteConfigClientoutputbufferlimitOption(struct rewriteConfigState *state) {
    int j;
    char *option = "client-output-buffer-limit";

    for (j = 0; j < REDIS_CLIENT_LIMIT_NUM_CLASSES; j++) {
        int force = (server.client_obuf_limits[j].hard_limit_bytes !=
                    clientBufferLimitsDefaults[j].hard_limit_bytes) ||
                    (server.client_obuf_limits[j].soft_limit_bytes !=
                    clientBufferLimitsDefaults[j].soft_limit_bytes) ||
                    (server.client_obuf_limits[j].soft_limit_seconds !=
                    clientBufferLimitsDefaults[j].soft_limit_seconds);
        sds line;
        char hard[64], soft[64];

        rewriteConfigFormatMemory(hard,sizeof(hard),
                server.client_obuf_limits[j].hard_limit_bytes);
        rewriteConfigFormatMemory(soft,sizeof(soft),
                server.client_obuf_limits[j].soft_limit_bytes);

        line = sdscatprintf(sdsempty(),"%s %s %s %s %ld",
                option, getClientLimitClassName(j), hard, soft,
                (long) server.client_obuf_limits[j].soft_limit_seconds);
        rewriteConfigRewriteLine(state,option,line,force);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdi, 0x8(%rsp)
leaq 0x818f2(%rip), %rbx     # 0xc9fa8
leaq 0x81403(%rip), %rcx     # 0xc9ac0
xorl %r15d, %r15d
xorl %ebp, %ebp
movq 0x488(%rbx,%r15), %rdx
movl $0x1, %r12d
cmpq (%r15,%rcx), %rdx
jne 0x486f9
movq 0x490(%rbx,%r15), %rax
cmpq 0x8(%r15,%rcx), %rax
jne 0x486f9
movq 0x498(%rbx,%r15), %rax
xorl %r12d, %r12d
cmpq 0x10(%r15,%rcx), %rax
setne %r12b
movl $0x40, %esi
leaq 0x10(%rsp), %rdi
callq 0x480af
movq 0x490(%rbx,%r15), %rdx
movl $0x40, %esi
leaq 0x50(%rsp), %r13
movq %r13, %rdi
callq 0x480af
callq 0x281b2
movq %rax, %r14
movl %ebp, %edi
callq 0x2f7f6
movq 0x498(%rbx,%r15), %rcx
movq %rcx, (%rsp)
movq %r14, %rdi
leaq 0x51cd6(%rip), %rsi     # 0x9a41d
leaq 0x517ab(%rip), %r14     # 0x99ef9
movq %r14, %rdx
movq %rax, %rcx
leaq 0x10(%rsp), %r8
movq %r13, %r9
xorl %eax, %eax
callq 0x28760
movq 0x8(%rsp), %rdi
movq %r14, %rsi
movq %rax, %rdx
movl %r12d, %ecx
callq 0x47f92
leaq 0x81343(%rip), %rcx     # 0xc9ac0
incq %rbp
addq $0x18, %r15
cmpq $0x3, %rbp
jne 0x486c2
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/config.c
// Function: configCommand
void configCommand(redisClient *c) {
    if (!strcasecmp(c->argv[1]->ptr,"set")) {
        if (c->argc != 4) goto badarity;
        configSetCommand(c);
    } else if (!strcasecmp(c->argv[1]->ptr,"get")) {
        if (c->argc != 3) goto badarity;
        configGetCommand(c);
    } else if (!strcasecmp(c->argv[1]->ptr,"resetstat")) {
        if (c->argc != 2) goto badarity;
        resetServerStats();
        resetCommandTableStats();
        addReply(c,shared.ok);
    } else if (!strcasecmp(c->argv[1]->ptr,"rewrite")) {
        if (c->argc != 2) goto badarity;
        if (server.configfile == NULL) {
            addReplyError(c,"The server is running without a config file");
            return;
        }
        if (rewriteConfig(server.configfile) == -1) {
            redisLog(REDIS_WARNING,"CONFIG REWRITE failed: %s", strerror(errno));
            addReplyErrorFormat(c,"Rewriting config file: %s", strerror(errno));
        } else {
            redisLog(REDIS_WARNING,"CONFIG REWRITE executed with success.");
            addReply(c,shared.ok);
        }
    } else {
        addReplyError(c,
            "CONFIG subcommand must be one of GET, SET, RESETSTAT, REWRITE");
    }
    return;

badarity:
    addReplyErrorFormat(c,"Wrong number of arguments for CONFIG %s",
        (char*) c->argv[1]->ptr);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x38(%rdi), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %r14
leaq 0x4c2c5(%rip), %rsi     # 0x954de
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
je 0x49274
leaq 0x4b23b(%rip), %rsi     # 0x94467
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
je 0x4928d
leaq 0x51207(%rip), %rsi     # 0x9a446
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
je 0x492a2
leaq 0x50a04(%rip), %rsi     # 0x99c56
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
je 0x492cc
leaq 0x51271(%rip), %rsi     # 0x9a4d6
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2d9d7
cmpl $0x4, 0x30(%rbx)
jne 0x49300
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4547e
cmpl $0x3, 0x30(%rbx)
jne 0x49300
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x46873
cmpl $0x2, 0x30(%rbx)
jne 0x49300
callq 0x2523c
callq 0x25921
leaq 0x81547(%rip), %rax     # 0xca800
movq 0x8(%rax), %rsi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2d6f0
cmpl $0x2, 0x30(%rbx)
jne 0x49300
leaq 0x80ccf(%rip), %rax     # 0xc9fa8
movq (%rax), %rdi
testq %rdi, %rdi
je 0x4931b
callq 0x48a88
cmpl $-0x1, %eax
je 0x49327
leaq 0x511be(%rip), %rsi     # 0x9a4b0
movl $0x3, %edi
xorl %eax, %eax
callq 0x23064
jmp 0x492b2
leaq 0x5120d(%rip), %rsi     # 0x9a514
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2d9fe
leaq 0x5112e(%rip), %rsi     # 0x9a450
jmp 0x49265
callq 0x1f810
movq %rax, %r14
movl (%rax), %edi
callq 0x1f630
leaq 0x5113f(%rip), %rsi     # 0x9a47c
movl $0x3, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0x23064
movl (%r14), %edi
callq 0x1f630
leaq 0x5113b(%rip), %rsi     # 0x9a496
movq %rbx, %rdi
movq %rax, %rdx
jmp 0x4930d
nop
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/aof.c
// Function: aofRewriteBufferReset
void aofRewriteBufferReset(void) {

    // 释放旧有的缓存（链表）
    if (server.aof_rewrite_buf_blocks)
        listRelease(server.aof_rewrite_buf_blocks);

    // 初始化新的缓存（链表）
    server.aof_rewrite_buf_blocks = listCreate();
    listSetFreeMethod(server.aof_rewrite_buf_blocks,zfree);
}

// Assembly:
pushq %rbx
leaq 0x80c3c(%rip), %rbx     # 0xc9fa8
movq 0x508(%rbx), %rdi
testq %rdi, %rdi
je 0x4937d
callq 0x203b0
callq 0x2038c
movq %rax, 0x508(%rbx)
leaq -0x1fb45(%rip), %rcx    # 0x2984b
movq %rcx, 0x18(%rax)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/aof.c
// Function: aofRewriteBufferSize
unsigned long aofRewriteBufferSize(void) {

    // 取出链表中最后的缓存块
    listNode *ln = listLast(server.aof_rewrite_buf_blocks);
    aofrwblock *block = ln ? ln->value : NULL;

    // 没有缓存被使用
    if (block == NULL) return 0;

    // 总缓存大小 = （缓存块数量-1） * AOF_RW_BUF_BLOCK_SIZE + 最后一个缓存块的大小
    unsigned long size =
        (listLength(server.aof_rewrite_buf_blocks)-1) * AOF_RW_BUF_BLOCK_SIZE;
    size += block->used;

    return size;
}

// Assembly:
leaq 0x80c0b(%rip), %rax     # 0xc9fa8
movq 0x508(%rax), %rax
movq 0x8(%rax), %rcx
testq %rcx, %rcx
je 0x493b3
movq 0x10(%rcx), %rcx
jmp 0x493b5
xorl %ecx, %ecx
testq %rcx, %rcx
je 0x493d3
movq 0x28(%rax), %rax
leaq (%rax,%rax,4), %rax
shlq $0x15, %rax
movq (%rcx), %rcx
addq %rcx, %rax
addq $-0xa00000, %rax        # imm = 0xFF600000
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/aof.c
// Function: aofRewriteBufferWrite
ssize_t aofRewriteBufferWrite(int fd) {
    listNode *ln;
    listIter li;
    ssize_t count = 0;

    // 遍历所有缓存块
    listRewind(server.aof_rewrite_buf_blocks,&li);
    while((ln = listNext(&li))) {
        aofrwblock *block = listNodeValue(ln);
        ssize_t nwritten;

        if (block->used) {

            // 写入缓存块内容到 fd
            nwritten = write(fd,block->buf,block->used);
            if (nwritten != block->used) {
                if (nwritten == 0) errno = EIO;
                return -1;
            }

            // 积累写入字节
            count += nwritten;
        }
    }

    return count;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %edi, %ebx
leaq 0x80a79(%rip), %rax     # 0xc9fa8
movq 0x508(%rax), %rdi
movq %rsp, %r15
movq %r15, %rsi
callq 0x205d2
xorl %r14d, %r14d
movq %r15, %rdi
callq 0x205ef
testq %rax, %rax
je 0x49596
movq 0x10(%rax), %r12
movq (%r12), %rdx
movb $0x1, %bpl
testq %rdx, %rdx
je 0x4958a
leaq 0x10(%r12), %rsi
movl %ebx, %edi
callq 0x1fb30
cmpq (%r12), %rax
jne 0x49578
addq %rax, %r14
jmp 0x4958a
testq %rax, %rax
jne 0x49588
callq 0x1f810
movl $0x5, (%rax)
xorl %ebp, %ebp
testb %bpl, %bpl
jne 0x49544
movq $-0x1, %r14
movq %r14, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/aof.c
// Function: stopAppendOnly
void stopAppendOnly(void) {

    // AOF 必须正在启用，才能调用这个函数
    redisAssert(server.aof_state != REDIS_AOF_OFF);

    // 将 AOF 缓存的内容写入并冲洗到 AOF 文件中
    // 参数 1 表示强制模式
    flushAppendOnlyFile(1);

    // 冲洗 AOF 文件
    aof_fsync(server.aof_fd);

    // 关闭 AOF 文件
    close(server.aof_fd);

    // 清空 AOF 状态
    server.aof_fd = -1;
    server.aof_selected_db = -1;
    server.aof_state = REDIS_AOF_OFF;

    /* rewrite operation in progress? kill it, wait child exit 
    *
    * 如果 BGREWRITEAOF 正在执行，那么杀死它
    * 并等待子进程退出
    */
    if (server.aof_child_pid != -1) {
        int statloc;

        redisLog(REDIS_NOTICE,"Killing running AOF rewrite child: %ld",
            (long) server.aof_child_pid);

        // 杀死子进程
        if (kill(server.aof_child_pid,SIGUSR1) != -1)
            wait3(&statloc,0,NULL);

        /* reset the buffer accumulating changes while the child saves 
         * 清理未完成的 AOF 重写留下来的缓存和临时文件
         */
        aofRewriteBufferReset();
        aofRemoveTempFile(server.aof_child_pid);
        server.aof_child_pid = -1;
        server.aof_rewrite_time_start = -1;
    }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
leaq 0x809e0(%rip), %r14     # 0xc9fa8
cmpl $0x0, 0x4d0(%r14)
je 0x496a2
movl $0x1, %edi
callq 0x496c4
movl 0x518(%r14), %edi
callq 0x1f560
movl 0x518(%r14), %edi
callq 0x1f170
movq $-0x1, 0x518(%r14)
movl $0x0, 0x4d0(%r14)
movslq 0x504(%r14), %rdx
cmpq $-0x1, %rdx
je 0x49697
leaq 0x50fed(%rip), %rsi     # 0x9a60f
movl $0x2, %edi
xorl %eax, %eax
callq 0x23064
movl 0x504(%r14), %edi
movl $0xa, %esi
callq 0x1f620
cmpl $-0x1, %eax
je 0x49652
leaq 0xc(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x1f800
callq 0x49364
movl 0x504(%r14), %ecx
leaq 0x5160f(%rip), %rdx     # 0x9ac74
leaq 0x10(%rsp), %rbx
movl $0x100, %esi            # imm = 0x100
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1f120
movq %rbx, %rdi
callq 0x1f3a0
movl $0xffffffff, 0x504(%r14) # imm = 0xFFFFFFFF
movq $-0x1, 0x538(%r14)
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r14
retq
leaq 0x50f3e(%rip), %rdi     # 0x9a5e7
leaq 0x50f59(%rip), %rsi     # 0x9a609
movl $0xed, %edx
callq 0x4d037
movl $0x1, %edi
callq 0x1f3b0
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/aof.c
// Function: startAppendOnly
int startAppendOnly(void) {

    // 将开始时间设为 AOF 最后一次 fsync 时间 
    server.aof_last_fsync = server.unixtime;

    // 打开 AOF 文件
    server.aof_fd = open(server.aof_filename,O_WRONLY|O_APPEND|O_CREAT,0644);

    redisAssert(server.aof_state == REDIS_AOF_OFF);

    // 文件打开失败
    if (server.aof_fd == -1) {
        redisLog(REDIS_WARNING,"Redis needs to enable the AOF but can't open the append only file: %s",strerror(errno));
        return REDIS_ERR;
    }

    if (rewriteAppendOnlyFileBackground() == REDIS_ERR) {
        // AOF 后台重写失败，关闭 AOF 文件
        close(server.aof_fd);
        redisLog(REDIS_WARNING,"Redis needs to enable the AOF but can't trigger a background AOF rewrite operation. Check the above logs for more info about the error.");
        return REDIS_ERR;
    }

    /* We correctly switched on AOF, now wait for the rerwite to be complete
     * in order to append data on disk. 
     *
     * 等待重写执行完毕
     */
    server.aof_state = REDIS_AOF_WAIT_REWRITE;

    return REDIS_OK;
}

// Assembly:
pushq %rbx
leaq 0x80584(%rip), %rbx     # 0xc9fa8
movq 0x798(%rbx), %rax
movq %rax, 0x528(%rbx)
movq 0x4d8(%rbx), %rdi
movl $0x441, %esi            # imm = 0x441
movl $0x1a4, %edx            # imm = 0x1A4
xorl %eax, %eax
callq 0x1f640
movl %eax, 0x518(%rbx)
cmpl $0x0, 0x4d0(%rbx)
jne 0x49abf
cmpl $-0x1, %eax
je 0x49a76
callq 0x49ae1
cmpl $-0x1, %eax
je 0x49a9a
movl $0x2, 0x4d0(%rbx)
xorl %eax, %eax
jmp 0x49abd
callq 0x1f810
movl (%rax), %edi
callq 0x1f630
leaq 0x50bcf(%rip), %rsi     # 0x9a658
movl $0x3, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0x23064
jmp 0x49ab8
movl 0x518(%rbx), %edi
callq 0x1f170
leaq 0x50bf2(%rip), %rsi     # 0x9a69e
movl $0x3, %edi
xorl %eax, %eax
callq 0x23064
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
retq
leaq 0x50b70(%rip), %rdi     # 0x9a636
leaq 0x50b3c(%rip), %rsi     # 0x9a609
movl $0x125, %edx            # imm = 0x125
callq 0x4d037
movl $0x1, %edi
callq 0x1f3b0
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/aof.c
// Function: catAppendOnlyGenericCommand
sds catAppendOnlyGenericCommand(sds dst, int argc, robj **argv) {
    char buf[32];
    int len, j;
    robj *o;

    // 重建命令的个数，格式为 *<count>\r\n
    // 例如 *3\r\n
    buf[0] = '*';
    len = 1+ll2string(buf+1,sizeof(buf)-1,argc);
    buf[len++] = '\r';
    buf[len++] = '\n';
    dst = sdscatlen(dst,buf,len);

    // 重建命令和命令参数，格式为 $<length>\r\n<content>\r\n
    // 例如 $3\r\nSET\r\n$3\r\nKEY\r\n$5\r\nVALUE\r\n
    for (j = 0; j < argc; j++) {
        o = getDecodedObject(argv[j]);

        // 组合 $<length>\r\n
        buf[0] = '$';
        len = 1+ll2string(buf+1,sizeof(buf)-1,sdslen(o->ptr));
        buf[len++] = '\r';
        buf[len++] = '\n';
        dst = sdscatlen(dst,buf,len);

        // 组合 <content>\r\n
        dst = sdscatlen(dst,o->ptr,sdslen(o->ptr));
        dst = sdscatlen(dst,"\r\n",2);

        decrRefCount(o);
    }

    // 返回重建后的协议内容
    return dst;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r13
leaq 0x1(%rsp), %rdi
movb $0x2a, -0x1(%rdi)
movslq %esi, %r12
movl $0x1f, %esi
movq %r12, %rdx
callq 0x2fe12
cltq
movq %rsp, %r15
movw $0xa0d, 0x1(%rax,%r15)  # imm = 0xA0D
addl $0x3, %eax
movslq %eax, %rdx
movq %r13, %rdi
movq %r15, %rsi
callq 0x28380
movq %rax, %r13
testl %r12d, %r12d
jle 0x49d07
movl %ebp, %r14d
xorl %r12d, %r12d
movq (%rbx,%r12,8), %rdi
callq 0x30ac3
movq %rax, %rbp
movb $0x24, (%rsp)
movq 0x8(%rax), %rax
movslq -0x8(%rax), %rdx
movl $0x1f, %esi
leaq 0x1(%rsp), %rdi
callq 0x2fe12
cltq
movw $0xa0d, 0x1(%rax,%r15)  # imm = 0xA0D
addl $0x3, %eax
movslq %eax, %rdx
movq %r13, %rdi
movq %r15, %rsi
callq 0x28380
movq 0x8(%rbp), %rsi
movslq -0x8(%rsi), %rdx
movq %rax, %rdi
callq 0x28380
movl $0x2, %edx
movq %rax, %rdi
leaq 0x4f9d8(%rip), %rsi     # 0x996c7
callq 0x28380
movq %rax, %r13
movq %rbp, %rdi
callq 0x30834
incq %r12
cmpq %r12, %r14
jne 0x49c8e
movq %r13, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/aof.c
// Function: catAppendOnlyExpireAtCommand
sds catAppendOnlyExpireAtCommand(sds buf, struct redisCommand *cmd, robj *key, robj *seconds) {
    long long when;
    robj *argv[3];

    /* Make sure we can use strtol 
     *
     * 取出过期值
     */
    seconds = getDecodedObject(seconds);
    when = strtoll(seconds->ptr,NULL,10);

    /* Convert argument into milliseconds for EXPIRE, SETEX, EXPIREAT 
     *
     * 如果过期值的格式为秒，那么将它转换为毫秒
     */
    if (cmd->proc == expireCommand || cmd->proc == setexCommand ||
        cmd->proc == expireatCommand)
    {
        when *= 1000;
    }

    /* Convert into absolute time for EXPIRE, PEXPIRE, SETEX, PSETEX 
     *
     * 如果过期值的格式为相对值，那么将它转换为绝对值
     */
    if (cmd->proc == expireCommand || cmd->proc == pexpireCommand ||
        cmd->proc == setexCommand || cmd->proc == psetexCommand)
    {
        when += mstime();
    }

    decrRefCount(seconds);

    // 构建 PEXPIREAT 命令
    argv[0] = createStringObject("PEXPIREAT",9);
    argv[1] = key;
    argv[2] = createStringObjectFromLongLong(when);

    // 追加到 AOF 缓存中
    buf = catAppendOnlyGenericCommand(buf, 3, argv);

    decrRefCount(argv[0]);
    decrRefCount(argv[2]);

    return buf;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdx, %r14
movq %rsi, %r13
movq %rdi, %rbx
movq %rcx, %rdi
callq 0x30ac3
movq %rax, %r12
movq 0x8(%rax), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x1fa70
movq %rax, %r15
movq 0x8(%r13), %rax
imulq $0x3e8, %r15, %rcx      # imm = 0x3E8
cmpq 0x7c279(%rip), %rax     # 0xc5fd8
leaq -0x1123a(%rip), %rdx    # 0x38b2c
cmoveq %rcx, %r15
cmpq %rdx, %rax
cmoveq %rcx, %r15
cmpq 0x7c190(%rip), %rax     # 0xc5f08
cmoveq %rcx, %r15
cmpq %rdx, %rax
je 0x49d9c
cmpq 0x7c180(%rip), %rax     # 0xc5f08
je 0x49d9c
cmpq 0x7c21f(%rip), %rax     # 0xc5fb0
je 0x49d9c
cmpq 0x7c1e6(%rip), %rax     # 0xc5f80
jne 0x49da4
callq 0x232a3
addq %rax, %r15
movq %r12, %rdi
callq 0x30834
leaq 0x50b7e(%rip), %rdi     # 0x9a931
movl $0x9, %esi
callq 0x303b7
movq %rax, %r12
movq %rsp, %r13
movq %rax, (%r13)
movq %r14, 0x8(%r13)
movq %r15, %rdi
callq 0x303c6
movq %rax, %r14
movq %rax, 0x10(%r13)
movq %rbx, %rdi
movl $0x3, %esi
movq %r13, %rdx
callq 0x49c33
movq %rax, %rbx
movq %r12, %rdi
callq 0x30834
movq %r14, %rdi
callq 0x30834
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq