LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/nilyang[P]redis-tdd-annotation/src/t_list.c
// Function: listTypeInsert
void listTypeInsert(listTypeEntry *entry, robj *value, int where) {

    robj *subject = entry->li->subject;

    // 插入到 ZIPLIST
    if (entry->li->encoding == REDIS_ENCODING_ZIPLIST) {

        // 返回对象未编码的值
        value = getDecodedObject(value);

        if (where == REDIS_TAIL) {
            unsigned char *next = ziplistNext(subject->ptr,entry->zi);

            /* When we insert after the current element, but the current element
             * is the tail of the list, we need to do a push. */
            if (next == NULL) {
                // next 是表尾节点，push 新节点到表尾
                subject->ptr = ziplistPush(subject->ptr,value->ptr,sdslen(value->ptr),REDIS_TAIL);
            } else {
                // 插入到到节点之后
                subject->ptr = ziplistInsert(subject->ptr,next,value->ptr,sdslen(value->ptr));
            }
        } else {
            subject->ptr = ziplistInsert(subject->ptr,entry->zi,value->ptr,sdslen(value->ptr));
        }
        decrRefCount(value);

    // 插入到双端链表
    } else if (entry->li->encoding == REDIS_ENCODING_LINKEDLIST) {

        if (where == REDIS_TAIL) {
            listInsertNode(subject->ptr,entry->ln,value,AL_START_TAIL);
        } else {
            listInsertNode(subject->ptr,entry->ln,value,AL_START_HEAD);
        }

        incrRefCount(value);

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %rax
movq (%rax), %r15
movzbl 0x8(%rax), %eax
cmpl $0x4, %eax
je 0x39c3a
cmpl $0x5, %eax
jne 0x39c97
movq %rbx, %rdi
callq 0x30d93
movq %rax, %rbx
movq 0x8(%r15), %rdi
movq 0x8(%r14), %rsi
cmpl $0x1, %ebp
jne 0x39c64
callq 0x2c558
movq 0x8(%r15), %rdi
movq 0x8(%rbx), %rdx
movl -0x8(%rdx), %ecx
testq %rax, %rax
je 0x39c86
movq %rax, %rsi
jmp 0x39c6b
xorl %ecx, %ecx
cmpl $0x1, %ebp
sete %cl
movq 0x8(%r15), %rdi
movq 0x10(%r14), %rsi
movq %rbx, %rdx
callq 0x20531
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x306f3
movq 0x8(%rbx), %rdx
movl -0x8(%rdx), %ecx
callq 0x2c70e
movq %rax, 0x8(%r15)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x30b0c
movq %rdx, %rsi
movl %ecx, %edx
movl $0x1, %ecx
callq 0x2be64
jmp 0x39c70
leaq 0x5ee42(%rip), %rdi     # 0x98ae0
leaq 0x5f309(%rip), %rsi     # 0x98fae
movl $0x179, %edx            # imm = 0x179
callq 0x4cae0
movl $0x1, %edi
callq 0x1f3b0
// File: /workspace/github_c_makefile_star2_O3/nilyang[P]redis-tdd-annotation/src/t_list.c
// Function: listTypeEqual
int listTypeEqual(listTypeEntry *entry, robj *o) {

    listTypeIterator *li = entry->li;

    if (li->encoding == REDIS_ENCODING_ZIPLIST) {
        redisAssertWithInfo(NULL,o,sdsEncodedObject(o));
        return ziplistCompare(entry->zi,o->ptr,sdslen(o->ptr));

    } else if (li->encoding == REDIS_ENCODING_LINKEDLIST) {
        return equalStringObjects(o,listNodeValue(entry->ln));

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

// Assembly:
pushq %rax
movq (%rdi), %rax
movzbl 0x8(%rax), %eax
cmpl $0x4, %eax
je 0x39ce5
cmpl $0x5, %eax
jne 0x39cf9
movl (%rsi), %eax
shrl $0x4, %eax
testb $0x7, %al
jne 0x39d13
movq 0x8(%rdi), %rdi
movq 0x8(%rsi), %rsi
movl -0x8(%rsi), %edx
popq %rax
jmp 0x2c8fd
movq 0x10(%rdi), %rax
movq 0x10(%rax), %rax
movq %rsi, %rdi
movq %rax, %rsi
popq %rax
jmp 0x30f08
leaq 0x5ede0(%rip), %rdi     # 0x98ae0
leaq 0x5f2a7(%rip), %rsi     # 0x98fae
movl $0x18f, %edx            # imm = 0x18F
callq 0x4cae0
jmp 0x39d2e
leaq 0x5f2e7(%rip), %rdx     # 0x99001
leaq 0x5f28d(%rip), %rcx     # 0x98fae
xorl %edi, %edi
movl $0x188, %r8d            # imm = 0x188
callq 0x4d277
movl $0x1, %edi
callq 0x1f3b0
// File: /workspace/github_c_makefile_star2_O3/nilyang[P]redis-tdd-annotation/src/t_list.c
// Function: listTypeDelete
void listTypeDelete(listTypeEntry *entry) {

    listTypeIterator *li = entry->li;

    // ZIPLIST
    if (li->encoding == REDIS_ENCODING_ZIPLIST) {

        unsigned char *p = entry->zi;

        li->subject->ptr = ziplistDelete(li->subject->ptr,&p);

        /* Update position of the iterator depending on the direction */
        // 删除节点之后，更新迭代器的指针
        if (li->direction == REDIS_TAIL)
            li->zi = p;
        else
            li->zi = ziplistPrev(li->subject->ptr,p);

    // 双端链表
    } else if (entry->li->encoding == REDIS_ENCODING_LINKEDLIST) {

        // 记录后置节点
        listNode *next;

        if (li->direction == REDIS_TAIL)
            next = entry->ln->next;
        else
            next = entry->ln->prev;

        // 删除当前节点
        listDelNode(li->subject->ptr,entry->ln);

        // 删除节点之后，更新迭代器的指针
        li->ln = next;

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

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq (%rdi), %r14
movzbl 0x8(%r14), %eax
cmpl $0x4, %eax
je 0x39d89
cmpl $0x5, %eax
jne 0x39db3
movq 0x8(%rdi), %rax
movq %rsp, %rbx
movq %rax, (%rbx)
movq (%r14), %rax
movq 0x8(%rax), %rdi
movq %rbx, %rsi
callq 0x2c713
movq %rax, %rdi
movq (%r14), %rax
movq %rdi, 0x8(%rax)
cmpb $0x1, 0x9(%r14)
movq (%rbx), %rax
je 0x39d83
movq %rax, %rsi
callq 0x2c57e
movq %rax, 0x10(%r14)
jmp 0x39dab
xorl %eax, %eax
cmpb $0x1, 0x9(%r14)
sete %al
movq 0x10(%rdi), %rsi
movq (%rsi,%rax,8), %rbx
movq (%r14), %rax
movq 0x8(%rax), %rdi
callq 0x205b1
movq %rbx, 0x18(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x5ed26(%rip), %rdi     # 0x98ae0
leaq 0x5f1ed(%rip), %rsi     # 0x98fae
movl $0x1bb, %edx            # imm = 0x1BB
callq 0x4cae0
movl $0x1, %edi
callq 0x1f3b0
// File: /workspace/github_c_makefile_star2_O3/nilyang[P]redis-tdd-annotation/src/t_list.c
// Function: pushGenericCommand
void pushGenericCommand(redisClient *c, int where) {

    int j, waiting = 0, pushed = 0;

    // 取出列表对象
    robj *lobj = lookupKeyWrite(c->db,c->argv[1]);

    // 如果列表对象不存在，那么可能有客户端在等待这个键的出现
    int may_have_waiting_clients = (lobj == NULL);

    if (lobj && lobj->type != REDIS_LIST) {
        addReply(c,shared.wrongtypeerr);
        return;
    }

    // 将列表状态设置为就绪
    if (may_have_waiting_clients) signalListAsReady(c,c->argv[1]);

    // 遍历所有输入值，并将它们添加到列表中
    for (j = 2; j < c->argc; j++) {

        // 编码值
        c->argv[j] = tryObjectEncoding(c->argv[j]);

        // 如果列表对象不存在，那么创建一个，并关联到数据库
        if (!lobj) {
            lobj = createZiplistObject();
            dbAdd(c->db,c->argv[1],lobj);
        }

        // 将值推入到列表
        listTypePush(lobj,c->argv[j],where);

        pushed++;
    }

    // 返回添加的节点数量
    addReplyLongLong(c, waiting + (lobj ? listTypeLength(lobj) : 0));

    // 如果至少有一个元素被成功推入，那么执行以下代码
    if (pushed) {
        char *event = (where == REDIS_HEAD) ? "lpush" : "rpush";

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

        // 发送事件通知
        notifyKeyspaceEvent(REDIS_NOTIFY_LIST,event,c->argv[1],c->db->id);
    }

    server.dirty += pushed;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rsi
callq 0x31724
movq %rax, %r14
testq %rax, %rax
je 0x39e22
movl (%r14), %eax
andl $0xf, %eax
cmpl $0x1, %eax
je 0x39e32
leaq 0x909f4(%rip), %rax     # 0xca800
movq 0x70(%rax), %rsi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2d97c
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0x39f17
xorl %r15d, %r15d
cmpl $0x3, 0x30(%rbx)
jl 0x39e99
movl $0x2, %r15d
movq 0x38(%rbx), %rax
movq (%rax,%r15,8), %rdi
callq 0x30c49
movq 0x38(%rbx), %rcx
movq %rax, (%rcx,%r15,8)
testq %r14, %r14
jne 0x39e77
callq 0x30869
movq %rax, %r14
movq 0x8(%rbx), %rdi
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rsi
movq %r14, %rdx
callq 0x317f0
movq 0x38(%rbx), %rax
movq (%rax,%r15,8), %rsi
movq %r14, %rdi
movl %ebp, %edx
callq 0x397a9
incq %r15
movslq 0x30(%rbx), %rax
cmpq %rax, %r15
jl 0x39e41
addl $-0x2, %r15d
testq %r14, %r14
je 0x39eab
movq %r14, %rdi
callq 0x39979
movq %rax, %rsi
jmp 0x39ead
xorl %esi, %esi
movq %rbx, %rdi
callq 0x2e133
testl %r15d, %r15d
je 0x39efb
testl %ebp, %ebp
leaq 0x5a464(%rip), %rax     # 0x94327
leaq 0x5a433(%rip), %r14     # 0x942fd
cmoveq %rax, %r14
movq 0x8(%rbx), %rdi
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rsi
callq 0x319b8
movq 0x8(%rbx), %rax
movq 0x38(%rbx), %rcx
movq 0x8(%rcx), %rdx
movl 0x30(%rax), %ecx
movl $0x10, %edi
movq %r14, %rsi
callq 0x60371
movl %r15d, %eax
leaq 0x900a3(%rip), %rcx     # 0xc9fa8
addq %rax, 0x560(%rcx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/nilyang[P]redis-tdd-annotation/src/t_list.c
// Function: signalListAsReady
void signalListAsReady(redisClient *c, robj *key) {
    readyList *rl;

    /* No clients blocking for this key? No need to queue it. */
    // 没有客户端被这个键阻塞，直接返回
    if (dictFind(c->db->blocking_keys,key) == NULL) return;

    /* Key was already signaled? No need to queue it again. */
    // 这个键已经被添加到 ready_keys 中了，直接返回
    if (dictFind(c->db->ready_keys,key) != NULL) return;

    /* Ok, we need to queue this key into server.ready_keys. */
    // 创建一个 readyList 结构，保存键和数据库
    // 然后将 readyList 添加到 server.ready_keys 中
    rl = zmalloc(sizeof(*rl));
    rl->key = key;
    rl->db = c->db;
    incrRefCount(key);
    listAddNodeTail(server.ready_keys,rl);

    /* We also add the key in the db->ready_keys dictionary in order
     * to avoid adding it multiple times into a list with a simple O(1)
     * check. 
     *
     * 将 key 添加到 c->db->ready_keys 集合中，防止重复添加
     */
    incrRefCount(key);
    redisAssert(dictAdd(c->db->ready_keys,key,NULL) == DICT_OK);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq 0x8(%rdi), %rax
movq 0x10(%rax), %rdi
callq 0x226ac
testq %rax, %rax
je 0x39f9d
movq 0x8(%r14), %rax
movq 0x18(%rax), %rdi
movq %rbx, %rsi
callq 0x226ac
testq %rax, %rax
jne 0x39f9d
movl $0x10, %edi
callq 0x299b5
movq %rax, %r15
movq %rbx, 0x8(%rax)
movq 0x8(%r14), %rax
movq %rax, (%r15)
movq %rbx, %rdi
callq 0x306f3
leaq 0x90038(%rip), %rax     # 0xc9fa8
movq 0x740(%rax), %rdi
movq %r15, %rsi
callq 0x204cb
movq %rbx, %rdi
callq 0x306f3
movq 0x8(%r14), %rax
movq 0x18(%rax), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x2249c
testl %eax, %eax
jne 0x39fa3
popq %rbx
popq %r14
popq %r15
retq
leaq 0x5f107(%rip), %rdi     # 0x990b1
leaq 0x5effd(%rip), %rsi     # 0x98fae
movl $0x4f5, %edx            # imm = 0x4F5
callq 0x4ca32
movl $0x1, %edi
callq 0x1f3b0
// File: /workspace/github_c_makefile_star2_O3/nilyang[P]redis-tdd-annotation/src/t_list.c
// Function: linsertCommand
void linsertCommand(redisClient *c) {

    // 编码 refval 对象
    c->argv[4] = tryObjectEncoding(c->argv[4]);

    if (strcasecmp(c->argv[2]->ptr,"after") == 0) {
        pushxGenericCommand(c,c->argv[3],c->argv[4],REDIS_TAIL);

    } else if (strcasecmp(c->argv[2]->ptr,"before") == 0) {
        pushxGenericCommand(c,c->argv[3],c->argv[4],REDIS_HEAD);

    } else {
        addReply(c,shared.syntaxerr);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x38(%rdi), %rax
movq 0x20(%rax), %rdi
callq 0x30c49
movq 0x38(%rbx), %rcx
movq %rax, 0x20(%rcx)
movq 0x38(%rbx), %r15
movq 0x10(%r15), %rax
movq 0x8(%rax), %r14
leaq 0x5ee40(%rip), %rsi     # 0x9904f
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
je 0x3a249
leaq 0x5ee33(%rip), %rsi     # 0x99055
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
je 0x3a25b
leaq 0x905cb(%rip), %rax     # 0xca800
movq 0x80(%rax), %rsi
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x2d97c
movq 0x18(%r15), %rsi
movq 0x20(%r15), %rdx
movq %rbx, %rdi
movl $0x1, %ecx
jmp 0x3a268
movq 0x18(%r15), %rsi
movq 0x20(%r15), %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
popq %rbx
popq %r14
popq %r15
jmp 0x39fd6
// File: /workspace/github_c_makefile_star2_O3/nilyang[P]redis-tdd-annotation/src/t_list.c
// Function: lindexCommand
void lindexCommand(redisClient *c) {

    robj *o = lookupKeyReadOrReply(c,c->argv[1],shared.nullbulk);

    if (o == NULL || checkType(c,o,REDIS_LIST)) return;
    long index;
    robj *value = NULL;

    // 取出整数值对象 index
    if ((getLongFromObjectOrReply(c, c->argv[2], &index, NULL) != REDIS_OK))
        return;

    // 根据索引，遍历 ziplist ，直到指定位置
    if (o->encoding == REDIS_ENCODING_ZIPLIST) {
        unsigned char *p;
        unsigned char *vstr;
        unsigned int vlen;
        long long vlong;

        p = ziplistIndex(o->ptr,index);

        if (ziplistGet(p,&vstr,&vlen,&vlong)) {
            if (vstr) {
                value = createStringObject((char*)vstr,vlen);
            } else {
                value = createStringObjectFromLongLong(vlong);
            }
            addReplyBulk(c,value);
            decrRefCount(value);
        } else {
            addReply(c,shared.nullbulk);
        }

    // 根据索引，遍历双端链表，直到指定位置
    } else if (o->encoding == REDIS_ENCODING_LINKEDLIST) {

        listNode *ln = listIndex(o->ptr,index);

        if (ln != NULL) {
            value = listNodeValue(ln);
            addReplyBulk(c,value);
        } else {
            addReply(c,shared.nullbulk);
        }
    } else {
        redisPanic("Unknown list encoding");
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
movq 0x38(%rdi), %rax
movq 0x8(%rax), %rsi
leaq 0x90516(%rip), %r15     # 0xca800
movq 0x50(%r15), %rdx
callq 0x31745
testq %rax, %rax
je 0x3a32a
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
movl $0x1, %edx
callq 0x30bbf
testl %eax, %eax
jne 0x3a32a
movq 0x38(%rbx), %rax
movq 0x10(%rax), %rsi
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x313b2
testl %eax, %eax
je 0x3a334
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
movl (%r14), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x4, %eax
je 0x3a388
cmpl $0x5, %eax
jne 0x3a3df
movq 0x8(%r14), %rdi
movl 0x8(%rsp), %esi
callq 0x2c28b
leaq 0x18(%rsp), %rsi
leaq 0x4(%rsp), %rdx
leaq 0x10(%rsp), %rcx
movq %rax, %rdi
callq 0x2c5f6
testl %eax, %eax
je 0x3a3a9
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x3a3ba
movl 0x4(%rsp), %esi
callq 0x3068f
jmp 0x3a3c4
movq 0x8(%r14), %rdi
movq 0x8(%rsp), %rsi
callq 0x207b0
testq %rax, %rax
je 0x3a3a9
movq 0x10(%rax), %rsi
movq %rbx, %rdi
callq 0x2e204
jmp 0x3a32a
movq 0x50(%r15), %rsi
movq %rbx, %rdi
callq 0x2d97c
jmp 0x3a32a
movq 0x10(%rsp), %rdi
callq 0x3069e
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2e204
movq %r14, %rdi
callq 0x30b0c
jmp 0x3a32a
leaq 0x5e6fa(%rip), %rdi     # 0x98ae0
leaq 0x5ebc1(%rip), %rsi     # 0x98fae
movl $0x2ba, %edx            # imm = 0x2BA
callq 0x4cae0
movl $0x1, %edi
callq 0x1f3b0
// File: /workspace/github_c_makefile_star2_O3/nilyang[P]redis-tdd-annotation/src/t_list.c
// Function: popGenericCommand
void popGenericCommand(redisClient *c, int where) {

    // 取出列表对象
    robj *o = lookupKeyWriteOrReply(c,c->argv[1],shared.nullbulk);

    if (o == NULL || checkType(c,o,REDIS_LIST)) return;

    // 弹出列表元素
    robj *value = listTypePop(o,where);

    // 根据弹出元素是否为空，决定后续动作
    if (value == NULL) {
        addReply(c,shared.nullbulk);
    } else {
        char *event = (where == REDIS_HEAD) ? "lpop" : "rpop";

        addReplyBulk(c,value);
        decrRefCount(value);
        notifyKeyspaceEvent(REDIS_NOTIFY_LIST,event,c->argv[1],c->db->id);
        if (listTypeLength(o) == 0) {
            notifyKeyspaceEvent(REDIS_NOTIFY_GENERIC,"del",
                                c->argv[1],c->db->id);
            dbDelete(c->db,c->argv[1]);
        }
        signalModifiedKey(c->db,c->argv[1]);
        server.dirty++;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
movq 0x38(%rdi), %rax
movq 0x8(%rax), %rsi
leaq 0x9022e(%rip), %r12     # 0xca800
movq 0x50(%r12), %rdx
callq 0x317a6
testq %rax, %rax
je 0x3a6b6
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
movl $0x1, %edx
callq 0x30bbf
testl %eax, %eax
jne 0x3a6b6
movq %r14, %rdi
movl %ebp, %esi
callq 0x3988d
testq %rax, %rax
je 0x3a6bf
movq %rax, %r15
testl %ebp, %ebp
leaq 0x59d13(%rip), %rax     # 0x94332
leaq 0x59cf4(%rip), %r12     # 0x9431a
cmoveq %rax, %r12
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2e204
movq %r15, %rdi
callq 0x30b0c
movq 0x8(%rbx), %rax
movq 0x38(%rbx), %rcx
movq 0x8(%rcx), %rdx
movl 0x30(%rax), %ecx
movl $0x10, %edi
movq %r12, %rsi
callq 0x60371
movq %r14, %rdi
callq 0x39979
testq %rax, %rax
jne 0x3a697
movq 0x8(%rbx), %rax
movq 0x38(%rbx), %rcx
movq 0x8(%rcx), %rdx
movl 0x30(%rax), %ecx
leaq 0x59e61(%rip), %rsi     # 0x944dd
movl $0x4, %edi
callq 0x60371
movq 0x8(%rbx), %rdi
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rsi
callq 0x31a36
movq 0x8(%rbx), %rdi
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rsi
callq 0x319b8
leaq 0x8f8f9(%rip), %rax     # 0xc9fa8
incq 0x560(%rax)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x50(%r12), %rsi
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x2d97c
// File: /workspace/github_c_makefile_star2_O3/nilyang[P]redis-tdd-annotation/src/t_list.c
// Function: rpoplpushHandlePush
void rpoplpushHandlePush(redisClient *c, robj *dstkey, robj *dstobj, robj *value) {
    /* Create the list if the key does not exist */
    // 如果目标列表不存在，那么创建一个
    if (!dstobj) {
        dstobj = createZiplistObject();
        dbAdd(c->db,dstkey,dstobj);
        signalListAsReady(c,dstkey);
    }

    signalModifiedKey(c->db,dstkey);

    // 将值推入目标列表中
    listTypePush(dstobj,value,REDIS_HEAD);

    notifyKeyspaceEvent(REDIS_NOTIFY_LIST,"lpush",dstkey,c->db->id);
    /* Always send the pushed value to the client. */
    addReplyBulk(c,value);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %r14
testq %rdx, %rdx
jne 0x3acd7
callq 0x30869
movq %rax, %r12
movq 0x8(%r14), %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x317f0
movq %r14, %rdi
movq %r15, %rsi
callq 0x39f17
movq 0x8(%r14), %rdi
movq %r15, %rsi
callq 0x319b8
movq %r12, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x397a9
movq 0x8(%r14), %rax
movl 0x30(%rax), %ecx
leaq 0x59629(%rip), %rsi     # 0x94327
movl $0x10, %edi
movq %r15, %rdx
callq 0x60371
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x2e204
// File: /workspace/github_c_makefile_star2_O3/nilyang[P]redis-tdd-annotation/src/t_list.c
// Function: blockForKeys
void blockForKeys(redisClient *c, robj **keys, int numkeys, mstime_t timeout, robj *target) {
    dictEntry *de;
    list *l;
    int j;

    // 设置阻塞状态的超时和目标选项
    c->bpop.timeout = timeout;

    // target 在执行 RPOPLPUSH 命令时使用
    c->bpop.target = target;

    if (target != NULL) incrRefCount(target);

    // 关联阻塞客户端和键的相关信息
    for (j = 0; j < numkeys; j++) {

        /* If the key already exists in the dict ignore it. */
        // c->bpop.keys 是一个集合（值为 NULL 的字典）
        // 它记录所有造成客户端阻塞的键
        // 以下语句在键不存在于集合的时候，将它添加到集合
        if (dictAdd(c->bpop.keys,keys[j],NULL) != DICT_OK) continue;

        incrRefCount(keys[j]);

        /* And in the other "side", to map keys -> clients */
        // c->db->blocking_keys 字典的键为造成客户端阻塞的键
        // 而值则是一个链表，链表中包含了所有被阻塞的客户端
        // 以下程序将阻塞键和被阻塞客户端关联起来
        de = dictFind(c->db->blocking_keys,keys[j]);
        if (de == NULL) {
            // 链表不存在，新创建一个，并将它关联到字典中
            int retval;

            /* For every key we take a list of clients blocked for it */
            l = listCreate();
            retval = dictAdd(c->db->blocking_keys,keys[j],l);
            incrRefCount(keys[j]);
            redisAssertWithInfo(c,keys[j],retval == DICT_OK);
        } else {
            l = dictGetVal(de);
        }
        // 将客户端填接到被阻塞客户端的链表中
        listAddNodeTail(l,c);
    }
    blockClient(c,REDIS_BLOCKED_LIST);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movq %rcx, 0x120(%rdi)
movq %r8, 0x130(%rdi)
testq %r8, %r8
je 0x3aea0
movq %r8, %rdi
callq 0x306f3
testl %ebp, %ebp
jle 0x3af23
movl %ebp, %r12d
xorl %r13d, %r13d
movq 0x128(%rbx), %rdi
movq (%r14,%r13,8), %rsi
xorl %edx, %edx
callq 0x2249c
testl %eax, %eax
jne 0x3af1b
movq (%r14,%r13,8), %rdi
callq 0x306f3
movq 0x8(%rbx), %rax
movq 0x10(%rax), %rdi
movq (%r14,%r13,8), %rsi
callq 0x226ac
testq %rax, %rax
je 0x3aee5
movq 0x8(%rax), %r15
jmp 0x3af10
callq 0x203fc
movq %rax, %r15
movq 0x8(%rbx), %rax
movq 0x10(%rax), %rdi
movq (%r14,%r13,8), %rsi
movq %r15, %rdx
callq 0x2249c
movl %eax, %ebp
movq (%r14,%r13,8), %rdi
callq 0x306f3
testl %ebp, %ebp
jne 0x3af3e
movq %r15, %rdi
movq %rbx, %rsi
callq 0x204cb
incq %r13
cmpq %r13, %r12
jne 0x3aeaa
movq %rbx, %rdi
movl $0x1, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x608cc
movq (%r14,%r13,8), %rsi
leaq 0x5d90d(%rip), %rdx     # 0x98856
leaq 0x5e05e(%rip), %rcx     # 0x98fae
movq %rbx, %rdi
movl $0x498, %r8d            # imm = 0x498
callq 0x4d277
movl $0x1, %edi
callq 0x1f3b0
// File: /workspace/github_c_makefile_star2_O3/nilyang[P]redis-tdd-annotation/src/t_list.c
// Function: unblockClientWaitingData
void unblockClientWaitingData(redisClient *c) {
    dictEntry *de;
    dictIterator *di;
    list *l;

    redisAssertWithInfo(c,NULL,dictSize(c->bpop.keys) != 0);

    // 遍历所有 key ，将它们从客户端 db->blocking_keys 的链表中移除
    di = dictGetIterator(c->bpop.keys);
    /* The client may wait for multiple keys, so unblock it for every key. */
    while((de = dictNext(di)) != NULL) {
        robj *key = dictGetKey(de);

        /* Remove this client from the list of clients waiting for this key. */
        // 获取所有因为 key 而被阻塞的客户端的链表
        l = dictFetchValue(c->db->blocking_keys,key);

        redisAssertWithInfo(c,key,l != NULL);

        // 将指定客户端从链表中删除
        listDelNode(l,listSearchKey(l,c));

        /* If the list is empty we need to remove it to avoid wasting memory */
        // 如果已经没有其他客户端阻塞在这个 key 上，那么删除这个链表
        if (listLength(l) == 0)
            dictDelete(c->db->blocking_keys,key);
    }
    dictReleaseIterator(di);

    /* Cleanup the client structure */
    // 清空 bpop.keys 集合（字典）
    dictEmpty(c->bpop.keys,NULL);
    if (c->bpop.target) {
        decrRefCount(c->bpop.target);
        c->bpop.target = NULL;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x128(%rdi), %rdi
movq 0x28(%rdi), %rax
addq 0x48(%rdi), %rax
je 0x3b052
callq 0x22a71
movq %rax, %r14
movq %rax, %rdi
callq 0x22acf
testq %rax, %rax
je 0x3afeb
movq (%rax), %r15
movq 0x8(%rbx), %rax
movq 0x10(%rax), %rdi
movq %r15, %rsi
callq 0x229cf
testq %rax, %rax
je 0x3b029
movq %rax, %r12
movq %rax, %rdi
movq %rbx, %rsi
callq 0x20729
movq %r12, %rdi
movq %rax, %rsi
callq 0x205b1
cmpq $0x0, 0x28(%r12)
jne 0x3afe6
movq 0x8(%rbx), %rax
movq 0x10(%rax), %rdi
movq %r15, %rsi
callq 0x22796
movq %r14, %rdi
jmp 0x3af93
movq %r14, %rdi
callq 0x22b86
movq 0x128(%rbx), %rdi
xorl %esi, %esi
callq 0x22f17
movq 0x130(%rbx), %rdi
testq %rdi, %rdi
je 0x3b01d
callq 0x30b0c
movq $0x0, 0x130(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x5e077(%rip), %rdx     # 0x990a7
leaq 0x5df77(%rip), %rcx     # 0x98fae
movq %rbx, %rdi
movq %r15, %rsi
movl $0x4b5, %r8d            # imm = 0x4B5
callq 0x4d277
movl $0x1, %edi
callq 0x1f3b0
leaq 0x5e032(%rip), %rdx     # 0x9908b
leaq 0x5df4e(%rip), %rcx     # 0x98fae
movq %rbx, %rdi
xorl %esi, %esi
movl $0x4a9, %r8d            # imm = 0x4A9
jmp 0x3b043
// File: /workspace/github_c_makefile_star2_O3/nilyang[P]redis-tdd-annotation/src/t_list.c
// Function: brpoplpushCommand
void brpoplpushCommand(redisClient *c) {
    mstime_t timeout;

    // 取出 timeout 参数
    if (getTimeoutFromObjectOrReply(c,c->argv[3],&timeout,UNIT_SECONDS)
        != REDIS_OK) return;

    // 取出列表键
    robj *key = lookupKeyWrite(c->db, c->argv[1]);

    // 键为空，阻塞
    if (key == NULL) {
        if (c->flags & REDIS_MULTI) {
            /* Blocking against an empty list in a multi state
             * returns immediately. */
            addReply(c, shared.nullbulk);
        } else {
            /* The list is empty and the client blocks. */
            blockForKeys(c, c->argv + 1, 1, timeout, c->argv[2]);
        }

    // 键非空，执行 RPOPLPUSH
    } else {
        if (key->type != REDIS_LIST) {
            addReply(c, shared.wrongtypeerr);
        } else {
            /* The list exists and has elements, so
             * the regular rpoplpushCommand is executed. */
            redisAssertWithInfo(c,key,listTypeLength(key) > 0);

            rpoplpushCommand(c);
        }
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x38(%rdi), %rax
movq 0x18(%rax), %rsi
movq %rsp, %rdx
xorl %ecx, %ecx
callq 0x60858
testl %eax, %eax
jne 0x3b696
movq 0x8(%rbx), %rdi
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rsi
callq 0x31724
testq %rax, %rax
je 0x3b64e
movq %rax, %r14
movl (%rax), %eax
andl $0xf, %eax
cmpl $0x1, %eax
jne 0x3b676
movq %r14, %rdi
callq 0x39979
testq %rax, %rax
je 0x3b69e
movq %rbx, %rdi
callq 0x3ad21
jmp 0x3b696
testb $0x8, 0x90(%rbx)
jne 0x3b683
movq 0x38(%rbx), %rsi
movq (%rsp), %rcx
movq 0x10(%rsi), %r8
addq $0x8, %rsi
movq %rbx, %rdi
movl $0x1, %edx
callq 0x3ae72
jmp 0x3b696
leaq 0x8f183(%rip), %rax     # 0xca800
movq 0x70(%rax), %rsi
jmp 0x3b68e
leaq 0x8f176(%rip), %rax     # 0xca800
movq 0x50(%rax), %rsi
movq %rbx, %rdi
callq 0x2d97c
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x5da49(%rip), %rdx     # 0x990ee
leaq 0x5d902(%rip), %rcx     # 0x98fae
movq %rbx, %rdi
movq %r14, %rsi
movl $0x64e, %r8d            # imm = 0x64E
callq 0x4d277
movl $0x1, %edi
callq 0x1f3b0
nop
// File: /workspace/github_c_makefile_star2_O3/nilyang[P]redis-tdd-annotation/src/t_set.c
// Function: setTypeAdd
int setTypeAdd(robj *subject, robj *value) {
    long long llval;

    // 字典
    if (subject->encoding == REDIS_ENCODING_HT) {
        // 将 value 作为键， NULL 作为值，将元素添加到字典中
        if (dictAdd(subject->ptr,value,NULL) == DICT_OK) {
            incrRefCount(value);
            return 1;
        }

    // intset
    } else if (subject->encoding == REDIS_ENCODING_INTSET) {
        
        // 如果对象的值可以编码为整数的话，那么将对象的值添加到 intset 中
        if (isObjectRepresentableAsLongLong(value,&llval) == REDIS_OK) {
            uint8_t success = 0;
            subject->ptr = intsetAdd(subject->ptr,llval,&success);
            if (success) {
                /* Convert to regular set when the intset contains
                 * too many entries. */
                // 添加成功
                // 检查集合在添加新元素之后是否需要转换为字典
                if (intsetLen(subject->ptr) > server.set_max_intset_entries)
                    setTypeConvert(subject,REDIS_ENCODING_HT);
                return 1;
            }

        // 如果对象的值不能编码为整数，那么将集合从 intset 编码转换为 HT 编码
        // 然后再执行添加操作
        } else {
            /* Failed to get integer from object, convert to regular set. */
            setTypeConvert(subject,REDIS_ENCODING_HT);

            /* The set *was* an intset and this value is not integer
             * encodable, so dictAdd should always work. */
            redisAssertWithInfo(NULL,value,dictAdd(subject->ptr,value,NULL) == DICT_OK);
            incrRefCount(value);
            return 1;
        }

    // 未知编码
    } else {
        redisPanic("Unknown set encoding");
    }

    // 添加失败，元素已经存在
    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movl (%rdi), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x6, %eax
je 0x3b71a
cmpl $0x2, %eax
jne 0x3b7b7
movq 0x8(%r14), %rdi
xorl %r14d, %r14d
movq %rbx, %rsi
xorl %edx, %edx
callq 0x2249c
testl %eax, %eax
jne 0x3b75c
jmp 0x3b74e
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x30be5
testl %eax, %eax
je 0x3b767
movq %r14, %rdi
movl $0x2, %esi
callq 0x3b7f9
movq 0x8(%r14), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x2249c
testl %eax, %eax
jne 0x3b7d1
movq %rbx, %rdi
callq 0x306f3
movl $0x1, %r14d
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
leaq 0xf(%rsp), %rbx
movb $0x0, (%rbx)
movq 0x8(%r14), %rdi
movq 0x10(%rsp), %rsi
movq %rbx, %rdx
callq 0x4f07c
movq %rax, 0x8(%r14)
cmpb $0x0, (%rbx)
je 0x3b7b2
movq %rax, %rdi
callq 0x4f4bf
movl %eax, %eax
leaq 0x8e80e(%rip), %rcx     # 0xc9fa8
cmpq %rax, 0x778(%rcx)
jae 0x3b756
movq %r14, %rdi
movl $0x2, %esi
callq 0x3b7f9
jmp 0x3b756
xorl %r14d, %r14d
jmp 0x3b75c
leaq 0x5d33a(%rip), %rdi     # 0x98af8
leaq 0x5d96d(%rip), %rsi     # 0x99132
movl $0x68, %edx
callq 0x4cae0
jmp 0x3b7ef
leaq 0x5d92e(%rip), %rdx     # 0x99106
leaq 0x5d953(%rip), %rcx     # 0x99132
xorl %edi, %edi
movq %rbx, %rsi
movl $0x61, %r8d
callq 0x4d277
movl $0x1, %edi
callq 0x1f3b0
// File: /workspace/github_c_makefile_star2_O3/nilyang[P]redis-tdd-annotation/src/t_set.c
// Function: setTypeConvert
void setTypeConvert(robj *setobj, int enc) {

    setTypeIterator *si;

    // 确认类型和编码正确
    redisAssertWithInfo(NULL,setobj,setobj->type == REDIS_SET &&
                             setobj->encoding == REDIS_ENCODING_INTSET);

    if (enc == REDIS_ENCODING_HT) {
        int64_t intele;
        // 创建新字典
        dict *d = dictCreate(&setDictType,NULL);
        robj *element;

        /* Presize the dict to avoid rehashing */
        // 预先扩展空间
        dictExpand(d,intsetLen(setobj->ptr));

        /* To add the elements we extract integers and create redis objects */
        // 遍历集合，并将元素添加到字典中
        si = setTypeInitIterator(setobj);
        while (setTypeNext(si,NULL,&intele) != -1) {
            element = createStringObjectFromLongLong(intele);
            redisAssertWithInfo(NULL,element,dictAdd(d,element,NULL) == DICT_OK);
        }
        setTypeReleaseIterator(si);

        // 更新集合的编码
        setobj->encoding = REDIS_ENCODING_HT;
        zfree(setobj->ptr);
        // 更新集合的值对象
        setobj->ptr = d;
    } else {
        redisPanic("Unsupported set conversion");
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
cmpb $0x62, (%rdi)
jne 0x3b8d6
cmpl $0x2, %esi
jne 0x3b8f1
leaq 0x8e04e(%rip), %rdi     # 0xc9870
xorl %esi, %esi
callq 0x2217b
movq %rax, %r14
movq 0x8(%rbx), %rdi
callq 0x4f4bf
movl %eax, %esi
movq %r14, %rdi
callq 0x221e2
movq %rbx, %rdi
callq 0x3ba3a
movq %rax, %r15
leaq 0x8(%rsp), %r12
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x3bac6
cmpl $-0x1, %eax
je 0x3b8a7
movq 0x8(%rsp), %rdi
callq 0x3069e
movq %rax, %r13
movq %r14, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x2249c
testl %eax, %eax
je 0x3b84f
leaq 0x5d912(%rip), %rdx     # 0x99198
leaq 0x5d8a5(%rip), %rcx     # 0x99132
xorl %edi, %edi
movq %r13, %rsi
movl $0x18e, %r8d            # imm = 0x18E
callq 0x4d277
movl $0x1, %edi
callq 0x1f3b0
movq %r15, %rdi
callq 0x3baaa
movl $0xffffff0f, %eax       # imm = 0xFFFFFF0F
andl (%rbx), %eax
orl $0x20, %eax
movl %eax, (%rbx)
movq 0x8(%rbx), %rdi
callq 0x29af7
movq %r14, 0x8(%rbx)
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x5d874(%rip), %rdx     # 0x99151
leaq 0x5d84e(%rip), %rcx     # 0x99132
xorl %edi, %edi
movq %rbx, %rsi
movl $0x17d, %r8d            # imm = 0x17D
jmp 0x3b898
leaq 0x5d8c3(%rip), %rdi     # 0x991bb
leaq 0x5d833(%rip), %rsi     # 0x99132
movl $0x198, %edx            # imm = 0x198
callq 0x4cae0
jmp 0x3b89d
// File: /workspace/github_c_makefile_star2_O3/nilyang[P]redis-tdd-annotation/src/t_set.c
// Function: setTypeRemove
int setTypeRemove(robj *setobj, robj *value) {
    long long llval;

    // HT
    if (setobj->encoding == REDIS_ENCODING_HT) {
        // 从字典中删除键（集合元素）
        if (dictDelete(setobj->ptr,value) == DICT_OK) {
            // 看是否有必要在删除之后缩小字典的大小
            if (htNeedsResize(setobj->ptr)) dictResize(setobj->ptr);
            return 1;
        }

    // INTSET
    } else if (setobj->encoding == REDIS_ENCODING_INTSET) {
        // 如果对象的值可以编码为整数的话，那么尝试从 intset 中移除元素
        if (isObjectRepresentableAsLongLong(value,&llval) == REDIS_OK) {
            int success;
            setobj->ptr = intsetRemove(setobj->ptr,llval,&success);
            if (success) return 1;
        }

    // 未知编码
    } else {
        redisPanic("Unknown set encoding");
    }

    // 删除失败
    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl (%rdi), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x6, %eax
je 0x3b952
cmpl $0x2, %eax
jne 0x3b997
movq 0x8(%rbx), %rdi
callq 0x22796
testl %eax, %eax
jne 0x3b964
movq 0x8(%rbx), %rdi
callq 0x2363c
movl $0x1, %ebp
testl %eax, %eax
je 0x3b966
movq 0x8(%rbx), %rdi
callq 0x221ba
jmp 0x3b966
movq %rsp, %rax
movq %rsi, %rdi
movq %rax, %rsi
callq 0x30be5
testl %eax, %eax
je 0x3b971
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq 0x8(%rbx), %rdi
movq (%rsp), %rsi
leaq 0xc(%rsp), %r14
movq %r14, %rdx
callq 0x4f333
movq %rax, 0x8(%rbx)
cmpl $0x0, (%r14)
movl $0x1, %ebp
jne 0x3b966
jmp 0x3b964
leaq 0x5d15a(%rip), %rdi     # 0x98af8
leaq 0x5d78d(%rip), %rsi     # 0x99132
movl $0x8b, %edx
callq 0x4cae0
movl $0x1, %edi
callq 0x1f3b0
// File: /workspace/github_c_makefile_star2_O3/nilyang[P]redis-tdd-annotation/src/t_set.c
// Function: setTypeIsMember
int setTypeIsMember(robj *subject, robj *value) {
    long long llval;

    // HT
    if (subject->encoding == REDIS_ENCODING_HT) {
        return dictFind((dict*)subject->ptr,value) != NULL;

    // INTSET
    } else if (subject->encoding == REDIS_ENCODING_INTSET) {
        if (isObjectRepresentableAsLongLong(value,&llval) == REDIS_OK) {
            return intsetFind((intset*)subject->ptr,llval);
        }

    // 未知编码
    } else {
        redisPanic("Unknown set encoding");
    }

    // 查找失败
    return 0;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl (%rdi), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x6, %eax
je 0x3b9e9
cmpl $0x2, %eax
jne 0x3ba18
movq 0x8(%rbx), %rdi
callq 0x226ac
movq %rax, %rcx
xorl %eax, %eax
testq %rcx, %rcx
setne %al
jmp 0x3ba12
leaq 0x8(%rsp), %rax
movq %rsi, %rdi
movq %rax, %rsi
callq 0x30be5
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
jne 0x3ba12
movq 0x8(%rbx), %rdi
movq 0x8(%rsp), %rsi
callq 0x4f42d
movzbl %al, %eax
addq $0x10, %rsp
popq %rbx
retq
leaq 0x5d0d9(%rip), %rdi     # 0x98af8
leaq 0x5d70c(%rip), %rsi     # 0x99132
movl $0xa4, %edx
callq 0x4cae0
movl $0x1, %edi
callq 0x1f3b0
// File: /workspace/github_c_makefile_star2_O3/nilyang[P]redis-tdd-annotation/src/t_set.c
// Function: setTypeInitIterator
setTypeIterator *setTypeInitIterator(robj *subject) {

    setTypeIterator *si = zmalloc(sizeof(setTypeIterator));
    
    // 指向被迭代的对象
    si->subject = subject;

    // 记录对象的编码
    si->encoding = subject->encoding;

    // HT
    if (si->encoding == REDIS_ENCODING_HT) {
        // 字典迭代器
        si->di = dictGetIterator(subject->ptr);

    // INTSET
    } else if (si->encoding == REDIS_ENCODING_INTSET) {
        // 索引
        si->ii = 0;

    // 未知编码
    } else {
        redisPanic("Unknown set encoding");
    }

    // 返回迭代器
    return si;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movl $0x18, %edi
callq 0x299b5
movq %rax, %rbx
movq %r14, (%rax)
movl (%r14), %eax
shrl $0x4, %eax
andl $0xf, %eax
movl %eax, 0x8(%rbx)
cmpl $0x6, %eax
je 0x3ba76
cmpl $0x2, %eax
jne 0x3ba88
movq 0x8(%r14), %rdi
callq 0x22a71
movq %rax, 0x10(%rbx)
jmp 0x3ba7d
movl $0x0, 0xc(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x5d069(%rip), %rdi     # 0x98af8
leaq 0x5d69c(%rip), %rsi     # 0x99132
movl $0xc6, %edx
callq 0x4cae0
movl $0x1, %edi
callq 0x1f3b0
// File: /workspace/github_c_makefile_star2_O3/nilyang[P]redis-tdd-annotation/src/t_set.c
// Function: setTypeNext
int setTypeNext(setTypeIterator *si, robj **objele, int64_t *llele) {

    // 从字典中取出对象
    if (si->encoding == REDIS_ENCODING_HT) {

        // 更新迭代器
        dictEntry *de = dictNext(si->di);

        // 字典已迭代完
        if (de == NULL) return -1;

        // 返回节点的键（集合的元素）
        *objele = dictGetKey(de);

    // 从 intset 中取出元素
    } else if (si->encoding == REDIS_ENCODING_INTSET) {
        if (!intsetGet(si->subject->ptr,si->ii++,llele))
            return -1;
    }

    // 返回编码
    return si->encoding;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x8(%rdi), %eax
cmpl $0x6, %eax
je 0x3baf3
cmpl $0x2, %eax
jne 0x3bb0c
movq %rsi, %r14
movq 0x10(%rbx), %rdi
callq 0x22acf
testq %rax, %rax
je 0x3bb11
movq (%rax), %rax
movq %rax, (%r14)
jmp 0x3bb0c
movq (%rbx), %rax
movq 0x8(%rax), %rdi
movl 0xc(%rbx), %esi
leal 0x1(%rsi), %eax
movl %eax, 0xc(%rbx)
callq 0x4f48d
testb %al, %al
je 0x3bb11
movl 0x8(%rbx), %eax
jmp 0x3bb16
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/nilyang[P]redis-tdd-annotation/src/t_set.c
// Function: setTypeNextObject
robj *setTypeNextObject(setTypeIterator *si) {
    int64_t intele;
    robj *objele;
    int encoding;

    // 取出元素
    encoding = setTypeNext(si,&objele,&intele);
    // 总是为元素创建对象
    switch(encoding) {
        // 已为空
        case -1:    return NULL;
        // INTSET 返回一个整数值，需要为这个值创建对象
        case REDIS_ENCODING_INTSET:
            return createStringObjectFromLongLong(intele);
        // HT 本身已经返回对象了，只需执行 incrRefCount()
        case REDIS_ENCODING_HT:
            incrRefCount(objele);
            return objele;
        default:
            redisPanic("Unsupported encoding");
    }

    return NULL; /* just to suppress warnings */
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rsp, %rsi
leaq 0x8(%rsp), %rdx
callq 0x3bac6
cmpl $-0x1, %eax
je 0x3bb5c
cmpl $0x2, %eax
je 0x3bb4e
cmpl $0x6, %eax
jne 0x3bb67
movq 0x8(%rsp), %rdi
callq 0x3069e
movq %rax, %rbx
jmp 0x3bb5e
movq (%rsp), %rbx
movq %rbx, %rdi
callq 0x306f3
jmp 0x3bb5e
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
retq
leaq 0x5d5cc(%rip), %rdi     # 0x9913a
leaq 0x5d5bd(%rip), %rsi     # 0x99132
movl $0x12f, %edx            # imm = 0x12F
callq 0x4cae0
movl $0x1, %edi
callq 0x1f3b0
// File: /workspace/github_c_makefile_star2_O3/nilyang[P]redis-tdd-annotation/src/t_set.c
// Function: setTypeRandomElement
int setTypeRandomElement(robj *setobj, robj **objele, int64_t *llele) {

    if (setobj->encoding == REDIS_ENCODING_HT) {
        dictEntry *de = dictGetRandomKey(setobj->ptr);
        *objele = dictGetKey(de);

    } else if (setobj->encoding == REDIS_ENCODING_INTSET) {
        *llele = intsetRandom(setobj->ptr);

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

    return setobj->encoding;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl (%rdi), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x6, %eax
je 0x3bbb7
cmpl $0x2, %eax
jne 0x3bbd4
movq %rsi, %r14
movq 0x8(%rbx), %rdi
callq 0x22be9
movq (%rax), %rax
movq %rax, (%r14)
jmp 0x3bbc6
movq %rdx, %r15
movq 0x8(%rbx), %rdi
callq 0x4f459
movq %rax, (%r15)
movl (%rbx), %eax
shrl $0x4, %eax
andl $0xf, %eax
popq %rbx
popq %r14
popq %r15
retq
leaq 0x5cf1d(%rip), %rdi     # 0x98af8
leaq 0x5d550(%rip), %rsi     # 0x99132
movl $0x158, %edx            # imm = 0x158
callq 0x4cae0
movl $0x1, %edi
callq 0x1f3b0
// File: /workspace/github_c_makefile_star2_O3/nilyang[P]redis-tdd-annotation/src/t_set.c
// Function: setTypeSize
unsigned long setTypeSize(robj *subject) {

    if (subject->encoding == REDIS_ENCODING_HT) {
        return dictSize((dict*)subject->ptr);

    } else if (subject->encoding == REDIS_ENCODING_INTSET) {
        return intsetLen((intset*)subject->ptr);

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

// Assembly:
pushq %rax
movl (%rdi), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x6, %eax
je 0x3bc17
cmpl $0x2, %eax
jne 0x3bc24
movq 0x8(%rdi), %rcx
movq 0x48(%rcx), %rax
addq 0x28(%rcx), %rax
jmp 0x3bc22
movq 0x8(%rdi), %rdi
callq 0x4f4bf
movl %eax, %eax
popq %rcx
retq
leaq 0x5cecd(%rip), %rdi     # 0x98af8
leaq 0x5d500(%rip), %rsi     # 0x99132
movl $0x16a, %edx            # imm = 0x16A
callq 0x4cae0
movl $0x1, %edi
callq 0x1f3b0
// File: /workspace/github_c_makefile_star2_O3/nilyang[P]redis-tdd-annotation/src/t_set.c
// Function: saddCommand
void saddCommand(redisClient *c) {
    robj *set;
    int j, added = 0;

    // 取出集合对象
    set = lookupKeyWrite(c->db,c->argv[1]);

    // 对象不存在，创建一个新的，并将它关联到数据库
    if (set == NULL) {
        set = setTypeCreate(c->argv[2]);
        dbAdd(c->db,c->argv[1],set);

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

    // 将所有输入元素添加到集合中
    for (j = 2; j < c->argc; j++) {
        c->argv[j] = tryObjectEncoding(c->argv[j]);
        // 只有元素未存在于集合时，才算一次成功添加
        if (setTypeAdd(set,c->argv[j])) added++;
    }

    // 如果有至少一个元素被成功添加，那么执行以下程序
    if (added) {
        // 发送键修改信号
        signalModifiedKey(c->db,c->argv[1]);
        // 发送事件通知
        notifyKeyspaceEvent(REDIS_NOTIFY_SET,"sadd",c->argv[1],c->db->id);
    }

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

    // 返回添加元素的数量
    addReplyLongLong(c,added);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rsi
callq 0x31724
testq %rax, %rax
je 0x3bc92
movq %rax, %r15
movl (%rax), %eax
andl $0xf, %eax
cmpl $0x2, %eax
je 0x3bcb6
leaq 0x8eb85(%rip), %rax     # 0xca800
movq 0x70(%rax), %rsi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x2d97c
movq 0x38(%rbx), %rax
movq 0x10(%rax), %rdi
callq 0x3b6c8
movq %rax, %r15
movq 0x8(%rbx), %rdi
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rsi
movq %r15, %rdx
callq 0x317f0
xorl %r14d, %r14d
cmpl $0x3, 0x30(%rbx)
jl 0x3bd37
movl $0x2, %r12d
movq 0x38(%rbx), %rax
movq (%rax,%r12,8), %rdi
callq 0x30c49
movq 0x38(%rbx), %rcx
movq %rax, (%rcx,%r12,8)
movq 0x38(%rbx), %rax
movq (%rax,%r12,8), %rsi
movq %r15, %rdi
callq 0x3b6e0
addl %eax, %r14d
incq %r12
movslq 0x30(%rbx), %rax
cmpq %rax, %r12
jl 0x3bcc5
testl %r14d, %r14d
je 0x3bd34
movq 0x8(%rbx), %rdi
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rsi
callq 0x319b8
movq 0x8(%rbx), %rax
movq 0x38(%rbx), %rcx
movq 0x8(%rcx), %rdx
movl 0x30(%rax), %ecx
leaq 0x58635(%rip), %rsi     # 0x9435a
movl $0x20, %edi
callq 0x60371
movl %r14d, %r14d
jmp 0x3bd37
xorl %r14d, %r14d
leaq 0x8e26a(%rip), %rax     # 0xc9fa8
addq %r14, 0x560(%rax)
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x2e133
// File: /workspace/github_c_makefile_star2_O3/nilyang[P]redis-tdd-annotation/src/t_set.c
// Function: sremCommand
void sremCommand(redisClient *c) {
    robj *set;
    int j, deleted = 0, keyremoved = 0;

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

    // 删除输入的所有元素
    for (j = 2; j < c->argc; j++) {
        
        // 只有元素在集合中时，才算一次成功删除
        if (setTypeRemove(set,c->argv[j])) {
            deleted++;
            // 如果集合已经为空，那么删除集合对象
            if (setTypeSize(set) == 0) {
                dbDelete(c->db,c->argv[1]);
                keyremoved = 1;
                break;
            }
        }
    }

    // 如果有至少一个元素被成功删除，那么执行以下程序
    if (deleted) {
        // 发送键修改信号
        signalModifiedKey(c->db,c->argv[1]);
        // 发送事件通知
        notifyKeyspaceEvent(REDIS_NOTIFY_SET,"srem",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 0x8ea8b(%rip), %rax     # 0xca800
movq 0x20(%rax), %rdx
callq 0x317a6
testq %rax, %rax
je 0x3bd9a
movq %rax, %r15
movq %rbx, %rdi
movq %rax, %rsi
movl $0x2, %edx
callq 0x30bbf
testl %eax, %eax
je 0x3bda3
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
xorl %r14d, %r14d
cmpl $0x3, 0x30(%rbx)
jl 0x3be6f
movl $0x2, %r12d
movq 0x38(%rbx), %rax
movq (%rax,%r12,8), %rsi
movq %r15, %rdi
callq 0x3b90b
testl %eax, %eax
je 0x3bdda
incl %r14d
movq %r15, %rdi
callq 0x3bbf6
testq %rax, %rax
je 0x3bdea
incq %r12
movslq 0x30(%rbx), %rax
cmpq %rax, %r12
jl 0x3bdb6
xorl %ebp, %ebp
jmp 0x3bdfe
movq 0x8(%rbx), %rdi
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rsi
callq 0x31a36
movb $0x1, %bpl
testl %r14d, %r14d
je 0x3be6c
movq 0x8(%rbx), %rdi
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rsi
callq 0x319b8
movq 0x8(%rbx), %rax
movq 0x38(%rbx), %rcx
movq 0x8(%rcx), %rdx
movl 0x30(%rax), %ecx
leaq 0x58535(%rip), %rsi     # 0x9435f
movl $0x20, %edi
callq 0x60371
testb %bpl, %bpl
je 0x3be59
movq 0x8(%rbx), %rax
movq 0x38(%rbx), %rcx
movq 0x8(%rcx), %rdx
movl 0x30(%rax), %ecx
leaq 0x5868e(%rip), %rsi     # 0x944dd
movl $0x4, %edi
callq 0x60371
movslq %r14d, %r14
leaq 0x8e145(%rip), %rax     # 0xc9fa8
addq %r14, 0x560(%rax)
jmp 0x3be6f
xorl %r14d, %r14d
movq %rbx, %rdi
movq %r14, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x2e133
// File: /workspace/github_c_makefile_star2_O3/nilyang[P]redis-tdd-annotation/src/t_set.c
// Function: sismemberCommand
void sismemberCommand(redisClient *c) {
    robj *set;

    // 取出集合对象
    if ((set = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL ||
        checkType(c,set,REDIS_SET)) return;

    // 编码输入元素
    c->argv[2] = tryObjectEncoding(c->argv[2]);

    // 检查是否存在
    if (setTypeIsMember(set,c->argv[2]))
        addReply(c,shared.cone);
    else
        addReply(c,shared.czero);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x38(%rdi), %rax
movq 0x8(%rax), %rsi
leaq 0x8e7a2(%rip), %r15     # 0xca800
movq 0x20(%r15), %rdx
callq 0x31745
testq %rax, %rax
je 0x3c083
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
movl $0x2, %edx
callq 0x30bbf
testl %eax, %eax
je 0x3c089
popq %rbx
popq %r14
popq %r15
retq
movq 0x38(%rbx), %rax
movq 0x10(%rax), %rdi
callq 0x30c49
movq 0x38(%rbx), %rcx
movq %rax, 0x10(%rcx)
movq 0x38(%rbx), %rax
movq 0x10(%rax), %rsi
movq %r14, %rdi
callq 0x3b9b9
xorl %ecx, %ecx
testl %eax, %eax
setne %cl
movq 0x20(%r15,%rcx,8), %rsi
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x2d97c
// File: /workspace/github_c_makefile_star2_O3/nilyang[P]redis-tdd-annotation/src/t_set.c
// Function: scardCommand
void scardCommand(redisClient *c) {
    robj *o;

    // 取出集合
    if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL ||
        checkType(c,o,REDIS_SET)) return;

    // 返回集合的基数
    addReplyLongLong(c,setTypeSize(o));
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x38(%rdi), %rax
movq 0x8(%rax), %rsi
leaq 0x8e723(%rip), %rax     # 0xca800
movq 0x20(%rax), %rdx
callq 0x31745
testq %rax, %rax
je 0x3c102
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
movl $0x2, %edx
callq 0x30bbf
testl %eax, %eax
je 0x3c10a
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %r14, %rdi
callq 0x3bbf6
movq %rbx, %rdi
movq %rax, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2e133