LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_zset.c
// Function: zzlDeleteRangeByScore
unsigned char *zzlDeleteRangeByScore(unsigned char *zl, zrangespec *range, unsigned long *deleted) {
    unsigned char *eptr, *sptr;
    double score;
    unsigned long num = 0;

    if (deleted != NULL) *deleted = 0;

    // 指向 ziplist 中第一个符合范围的节点
    eptr = zzlFirstInRange(zl,range);
    if (eptr == NULL) return zl;

    /* When the tail of the ziplist is deleted, eptr will point to the sentinel
     * byte and ziplistNext will return NULL. */
    // 一直删除节点，直到遇到不在范围内的值为止
    // 节点中的值都是有序的
    while ((sptr = ziplistNext(zl,eptr)) != NULL) {
        score = zzlGetScore(sptr);
        if (zslValueLteMax(score,range)) {
            /* Delete both the element and the score. */
            zl = ziplistDelete(zl,&eptr);
            zl = ziplistDelete(zl,&eptr);
            num++;
        } else {
            /* No longer in range. */
            break;
        }
    }

    if (deleted != NULL) *deleted = num;
    return zl;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
testq %rdx, %rdx
je 0x3e8bf
movq $0x0, (%rbx)
movq %r14, %rdi
movq %r15, %rsi
callq 0x3e149
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x3e953
movq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x2c2b3
xorl %r13d, %r13d
testq %rax, %rax
je 0x3e94b
leaq 0x8(%rsp), %r12
movq %rax, %rdi
callq 0x3ddbd
cmpl $0x0, 0x14(%r15)
je 0x3e90c
movsd 0x8(%r15), %xmm1
ucomisd %xmm0, %xmm1
seta %al
jmp 0x3e919
movsd 0x8(%r15), %xmm1
ucomisd %xmm0, %xmm1
setae %al
testb %al, %al
je 0x3e94b
movq %r14, %rdi
movq %r12, %rsi
callq 0x2c46e
movq %rax, %rdi
movq %r12, %rsi
callq 0x2c46e
movq %rax, %r14
incq %r13
movq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x2c2b3
testq %rax, %rax
jne 0x3e8ee
testq %rbx, %rbx
je 0x3e953
movq %r13, (%rbx)
movq %r14, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_zset.c
// Function: zzlDeleteRangeByLex
unsigned char *zzlDeleteRangeByLex(unsigned char *zl, zlexrangespec *range, unsigned long *deleted) {
    unsigned char *eptr, *sptr;
    unsigned long num = 0;

    if (deleted != NULL) *deleted = 0;

    eptr = zzlFirstInLexRange(zl,range);
    if (eptr == NULL) return zl;

    /* When the tail of the ziplist is deleted, eptr will point to the sentinel
     * byte and ziplistNext will return NULL. */
    while ((sptr = ziplistNext(zl,eptr)) != NULL) {
        if (zzlLexValueLteMax(eptr,range)) {
            /* Delete both the element and the score. */
            zl = ziplistDelete(zl,&eptr);
            zl = ziplistDelete(zl,&eptr);
            num++;
        } else {
            /* No longer in range. */
            break;
        }
    }

    if (deleted != NULL) *deleted = num;

    return zl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
testq %rdx, %rdx
je 0x3e987
movq $0x0, (%rbx)
movq %r14, %rdi
movq %r15, %rsi
callq 0x3e403
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x3ea1b
movq %rbx, 0x10(%rsp)
movq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x2c2b3
xorl %ebx, %ebx
testq %rax, %rax
je 0x3ea0e
leaq 0x8(%rsp), %r12
movq 0x8(%rsp), %rdi
callq 0x3de5c
movq %rax, %r13
movq %rax, %rdi
movq %r15, %rsi
callq 0x3d886
movl %eax, %ebp
movq %r13, %rdi
callq 0x30834
testl %ebp, %ebp
je 0x3ea0e
movq %r14, %rdi
movq %r12, %rsi
callq 0x2c46e
movq %rax, %rdi
movq %r12, %rsi
callq 0x2c46e
movq %rax, %r14
incq %rbx
movq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x2c2b3
testq %rax, %rax
jne 0x3e9ba
movq 0x10(%rsp), %rax
testq %rax, %rax
je 0x3ea1b
movq %rbx, (%rax)
movq %r14, %rax
addq $0x18, %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/t_zset.c
// Function: zsetLength
unsigned int zsetLength(robj *zobj) {

    int length = -1;

    if (zobj->encoding == REDIS_ENCODING_ZIPLIST) {
        length = zzlLength(zobj->ptr);

    } else if (zobj->encoding == REDIS_ENCODING_SKIPLIST) {
        length = ((zset*)zobj->ptr)->zsl->length;

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

    return length;
}

// Assembly:
pushq %rax
movl (%rdi), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x7, %eax
je 0x3ea69
cmpl $0x5, %eax
jne 0x3ea76
movq 0x8(%rdi), %rdi
callq 0x2c9a8
shrl %eax
jmp 0x3ea74
movq 0x8(%rdi), %rax
movq 0x8(%rax), %rax
movl 0x10(%rax), %eax
popq %rcx
retq
leaq 0x588d6(%rip), %rdi     # 0x97353
leaq 0x5a732(%rip), %rsi     # 0x991b6
movl $0x632, %edx            # imm = 0x632
callq 0x4d0e5
movl $0x1, %edi
callq 0x1f3b0
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_zset.c
// Function: zslParseRange
static int zslParseRange(robj *min, robj *max, zrangespec *spec) {
    char *eptr;

    // 默认为闭区间
    spec->minex = spec->maxex = 0;

    /* Parse the min-max interval. If one of the values is prefixed
     * by the "(" character, it's considered "open". For instance
     * ZRANGEBYSCORE zset (1.5 (2.5 will match min < x < max
     * ZRANGEBYSCORE zset 1.5 2.5 will instead match min <= x <= max */
    if (min->encoding == REDIS_ENCODING_INT) {
        // min 的值为整数，开区间
        spec->min = (long)min->ptr;
    } else {
        // min 对象为字符串，分析 min 的值并决定区间
        if (((char*)min->ptr)[0] == '(') {
            // T = O(N)
            spec->min = strtod((char*)min->ptr+1,&eptr);
            if (eptr[0] != '\0' || isnan(spec->min)) return REDIS_ERR;
            spec->minex = 1;
        } else {
            // T = O(N)
            spec->min = strtod((char*)min->ptr,&eptr);
            if (eptr[0] != '\0' || isnan(spec->min)) return REDIS_ERR;
        }
    }

    if (max->encoding == REDIS_ENCODING_INT) {
        // max 的值为整数，开区间
        spec->max = (long)max->ptr;
    } else {
        // max 对象为字符串，分析 max 的值并决定区间
        if (((char*)max->ptr)[0] == '(') {
            // T = O(N)
            spec->max = strtod((char*)max->ptr+1,&eptr);
            if (eptr[0] != '\0' || isnan(spec->max)) return REDIS_ERR;
            spec->maxex = 1;
        } else {
            // T = O(N)
            spec->max = strtod((char*)max->ptr,&eptr);
            if (eptr[0] != '\0' || isnan(spec->max)) return REDIS_ERR;
        }
    }

    return REDIS_OK;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq $0x0, 0x10(%rdx)
movl $0xf0, %eax
andl (%rdi), %eax
movq 0x8(%rdi), %rdi
cmpl $0x10, %eax
jne 0x3f90b
cvtsi2sd %rdi, %xmm0
movsd %xmm0, (%rbx)
movl $0xf0, %eax
andl (%r14), %eax
movq 0x8(%r14), %rdi
cmpl $0x10, %eax
jne 0x3f940
xorps %xmm0, %xmm0
cvtsi2sd %rdi, %xmm0
movsd %xmm0, 0x8(%rbx)
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
cmpb $0x28, (%rdi)
jne 0x3f976
incq %rdi
leaq 0x8(%rsp), %r15
movq %r15, %rsi
callq 0x1fc40
movsd %xmm0, (%rbx)
movq (%r15), %rax
cmpb $0x0, (%rax)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jne 0x3f901
ucomisd %xmm0, %xmm0
jp 0x3f901
movl $0x1, 0x10(%rbx)
jmp 0x3f8e1
cmpb $0x28, (%rdi)
jne 0x3f9a7
incq %rdi
leaq 0x8(%rsp), %r14
movq %r14, %rsi
callq 0x1fc40
movsd %xmm0, 0x8(%rbx)
movq (%r14), %rax
cmpb $0x0, (%rax)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jne 0x3f901
ucomisd %xmm0, %xmm0
jp 0x3f901
movl $0x1, 0x14(%rbx)
jmp 0x3f8ff
leaq 0x8(%rsp), %r15
movq %r15, %rsi
callq 0x1fc40
movsd %xmm0, (%rbx)
movq (%r15), %rax
cmpb $0x0, (%rax)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jne 0x3f901
ucomisd %xmm0, %xmm0
jnp 0x3f8e1
jmp 0x3f901
leaq 0x8(%rsp), %r14
movq %r14, %rsi
callq 0x1fc40
movsd %xmm0, 0x8(%rbx)
movq (%r14), %rax
cmpb $0x0, (%rax)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jne 0x3f901
ucomisd %xmm0, %xmm0
jnp 0x3f8ff
jmp 0x3f901
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_zset.c
// Function: zslParseLexRange
static int zslParseLexRange(robj *min, robj *max, zlexrangespec *spec) {
    /* The range can't be valid if objects are integer encoded.
     * Every item must start with ( or [. */
    if (min->encoding == REDIS_ENCODING_INT ||
        max->encoding == REDIS_ENCODING_INT) return REDIS_ERR;

    spec->min = spec->max = NULL;
    if (zslParseLexRangeItem(min, &spec->min, &spec->minex) == REDIS_ERR ||
        zslParseLexRangeItem(max, &spec->max, &spec->maxex) == REDIS_ERR) {
        if (spec->min) decrRefCount(spec->min);
        if (spec->max) decrRefCount(spec->max);
        return REDIS_ERR;
    } else {
        return REDIS_OK;
    }
}

// Assembly:
movl $0xf0, %eax
movl (%rdi), %ecx
andl %eax, %ecx
cmpl $0x10, %ecx
jne 0x3f9ed
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r15
andl (%rsi), %eax
cmpl $0x10, %eax
je 0x3fa4c
movq %rdx, %rbx
leaq 0x8(%rdx), %r14
addq $0x10, %rdx
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq %rbx, %rsi
callq 0x3daa4
cmpl $-0x1, %eax
je 0x3fa32
leaq 0x14(%rbx), %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x3daa4
movl %eax, %ecx
xorl %eax, %eax
cmpl $-0x1, %ecx
jne 0x3fa51
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x3fa3f
callq 0x30834
movq (%r14), %rdi
testq %rdi, %rdi
je 0x3fa4c
callq 0x30834
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_zset.c
// Function: zuiInitIterator
void zuiInitIterator(zsetopsrc *op) {

    // 迭代对象为空，无动作
    if (op->subject == NULL)
        return;

    // 迭代集合
    if (op->type == REDIS_SET) {

        iterset *it = &op->iter.set;

        // 迭代 intset
        if (op->encoding == REDIS_ENCODING_INTSET) {
            it->is.is = op->subject->ptr;
            it->is.ii = 0;

        // 迭代字典
        } else if (op->encoding == REDIS_ENCODING_HT) {
            it->ht.dict = op->subject->ptr;
            it->ht.di = dictGetIterator(op->subject->ptr);
            it->ht.de = dictNext(it->ht.di);

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

    // 迭代有序集合
    } else if (op->type == REDIS_ZSET) {

        iterzset *it = &op->iter.zset;

        // 迭代 ziplist
        if (op->encoding == REDIS_ENCODING_ZIPLIST) {
            it->zl.zl = op->subject->ptr;
            it->zl.eptr = ziplistIndex(it->zl.zl,0);
            if (it->zl.eptr != NULL) {
                it->zl.sptr = ziplistNext(it->zl.zl,it->zl.eptr);
                redisAssert(it->zl.sptr != NULL);
            }

        // 迭代跳跃表
        } else if (op->encoding == REDIS_ENCODING_SKIPLIST) {
            it->sl.zs = op->subject->ptr;
            it->sl.node = it->sl.zs->zsl->header->level[0].forward;

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

    // 未知对象类型
    } else {
        redisPanic("Unsupported type");
    }
}

// Assembly:
pushq %rbx
movq (%rdi), %rax
testq %rax, %rax
je 0x3fb4e
movq %rdi, %rbx
movl 0x8(%rdi), %ecx
cmpl $0x3, %ecx
je 0x3fabc
cmpl $0x2, %ecx
jne 0x3fb50
movl 0xc(%rbx), %ecx
cmpl $0x2, %ecx
je 0x3fb2d
cmpl $0x6, %ecx
jne 0x3fb7a
movq 0x8(%rax), %rax
movq %rax, 0x18(%rbx)
movl $0x0, 0x20(%rbx)
jmp 0x3fb4e
movl 0xc(%rbx), %ecx
cmpl $0x7, %ecx
je 0x3fb14
cmpl $0x5, %ecx
jne 0x3fb65
movq 0x8(%rax), %rdi
movq %rdi, 0x18(%rbx)
xorl %esi, %esi
callq 0x2bff5
movq %rax, 0x20(%rbx)
testq %rax, %rax
je 0x3fb4e
movq 0x18(%rbx), %rdi
movq %rax, %rsi
callq 0x2c2b3
movq %rax, 0x28(%rbx)
testq %rax, %rax
jne 0x3fb4e
leaq 0x598e2(%rip), %rdi     # 0x993e3
leaq 0x596ae(%rip), %rsi     # 0x991b6
movl $0x8e1, %edx            # imm = 0x8E1
callq 0x4d037
jmp 0x3fb92
movq 0x8(%rax), %rax
movq %rax, 0x18(%rbx)
movq 0x8(%rax), %rax
movq (%rax), %rax
movq 0x18(%rax), %rax
movq %rax, 0x20(%rbx)
jmp 0x3fb4e
movq 0x8(%rax), %rcx
movq %rcx, 0x18(%rbx)
movq 0x8(%rax), %rdi
callq 0x228b5
movq %rax, 0x20(%rbx)
movq %rax, %rdi
callq 0x22913
movq %rax, 0x28(%rbx)
popq %rbx
retq
leaq 0x598a0(%rip), %rdi     # 0x993f7
leaq 0x59658(%rip), %rsi     # 0x991b6
movl $0x8ef, %edx            # imm = 0x8EF
jmp 0x3fb8d
leaq 0x577e7(%rip), %rdi     # 0x97353
leaq 0x59643(%rip), %rsi     # 0x991b6
movl $0x8ea, %edx            # imm = 0x8EA
jmp 0x3fb8d
leaq 0x58f1b(%rip), %rdi     # 0x98a9c
leaq 0x5962e(%rip), %rsi     # 0x991b6
movl $0x8d3, %edx            # imm = 0x8D3
callq 0x4d0e5
movl $0x1, %edi
callq 0x1f3b0
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_zset.c
// Function: zuiClearIterator
void zuiClearIterator(zsetopsrc *op) {

    if (op->subject == NULL)
        return;

    if (op->type == REDIS_SET) {

        iterset *it = &op->iter.set;

        if (op->encoding == REDIS_ENCODING_INTSET) {
            REDIS_NOTUSED(it); /* skip */

        } else if (op->encoding == REDIS_ENCODING_HT) {
            dictReleaseIterator(it->ht.di);

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

    } else if (op->type == REDIS_ZSET) {

        iterzset *it = &op->iter.zset;

        if (op->encoding == REDIS_ENCODING_ZIPLIST) {
            REDIS_NOTUSED(it); /* skip */

        } else if (op->encoding == REDIS_ENCODING_SKIPLIST) {
            REDIS_NOTUSED(it); /* skip */

        } else {
            redisPanic("Unknown sorted set encoding");
        }
    } else {
        redisPanic("Unsupported type");
    }
}

// Assembly:
pushq %rax
cmpq $0x0, (%rdi)
je 0x3fbd2
movl 0x8(%rdi), %eax
cmpl $0x3, %eax
je 0x3fbc7
cmpl $0x2, %eax
jne 0x3fbd4
movl 0xc(%rdi), %eax
cmpl $0x6, %eax
je 0x3fbd2
cmpl $0x2, %eax
jne 0x3fbe9
movq 0x20(%rdi), %rdi
popq %rax
jmp 0x229b9
movl 0xc(%rdi), %eax
orl $0x2, %eax
cmpl $0x7, %eax
jne 0x3fbfe
popq %rax
retq
leaq 0x5981c(%rip), %rdi     # 0x993f7
leaq 0x595d4(%rip), %rsi     # 0x991b6
movl $0x917, %edx            # imm = 0x917
jmp 0x3fc11
leaq 0x58eac(%rip), %rdi     # 0x98a9c
leaq 0x595bf(%rip), %rsi     # 0x991b6
movl $0x906, %edx            # imm = 0x906
jmp 0x3fc11
leaq 0x5774e(%rip), %rdi     # 0x97353
leaq 0x595aa(%rip), %rsi     # 0x991b6
movl $0x914, %edx            # imm = 0x914
callq 0x4d0e5
movl $0x1, %edi
callq 0x1f3b0
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_zset.c
// Function: zuiLength
int zuiLength(zsetopsrc *op) {

    if (op->subject == NULL)
        return 0;

    if (op->type == REDIS_SET) {
        if (op->encoding == REDIS_ENCODING_INTSET) {
            return intsetLen(op->subject->ptr);
        } else if (op->encoding == REDIS_ENCODING_HT) {
            dict *ht = op->subject->ptr;
            return dictSize(ht);
        } else {
            redisPanic("Unknown set encoding");
        }

    } else if (op->type == REDIS_ZSET) {

        if (op->encoding == REDIS_ENCODING_ZIPLIST) {
            return zzlLength(op->subject->ptr);
        } else if (op->encoding == REDIS_ENCODING_SKIPLIST) {
            zset *zs = op->subject->ptr;
            return zs->zsl->length;
        } else {
            redisPanic("Unknown sorted set encoding");
        }

    } else {
        redisPanic("Unsupported type");
    }
}

// Assembly:
pushq %rax
movq (%rdi), %rax
testq %rax, %rax
je 0x3fc4d
movl 0x8(%rdi), %ecx
cmpl $0x3, %ecx
je 0x3fc51
cmpl $0x2, %ecx
jne 0x3fc84
movl 0xc(%rdi), %ecx
cmpl $0x2, %ecx
je 0x3fc78
cmpl $0x6, %ecx
jne 0x3fcae
movq 0x8(%rax), %rdi
popq %rax
jmp 0x4fa0e
xorl %eax, %eax
jmp 0x3fc82
movl 0xc(%rdi), %ecx
cmpl $0x7, %ecx
je 0x3fc6b
cmpl $0x5, %ecx
jne 0x3fc99
movq 0x8(%rax), %rdi
callq 0x2c9a8
shrl %eax
jmp 0x3fc82
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
movl 0x10(%rax), %eax
jmp 0x3fc82
movq 0x8(%rax), %rcx
movl 0x48(%rcx), %eax
addl 0x28(%rcx), %eax
popq %rcx
retq
leaq 0x5976c(%rip), %rdi     # 0x993f7
leaq 0x59524(%rip), %rsi     # 0x991b6
movl $0x939, %edx            # imm = 0x939
jmp 0x3fcc1
leaq 0x576b3(%rip), %rdi     # 0x97353
leaq 0x5950f(%rip), %rsi     # 0x991b6
movl $0x935, %edx            # imm = 0x935
jmp 0x3fcc1
leaq 0x58de7(%rip), %rdi     # 0x98a9c
leaq 0x594fa(%rip), %rsi     # 0x991b6
movl $0x92a, %edx            # imm = 0x92A
callq 0x4d0e5
movl $0x1, %edi
callq 0x1f3b0
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_zset.c
// Function: zuiLongLongFromValue
int zuiLongLongFromValue(zsetopval *val) {

    if (!(val->flags & OPVAL_DIRTY_LL)) {

        // 打开标识 DIRTY LL
        val->flags |= OPVAL_DIRTY_LL;

        // 从对象中取值
        if (val->ele != NULL) {
            // 从 INT 编码的字符串中取出整数
            if (val->ele->encoding == REDIS_ENCODING_INT) {
                val->ell = (long)val->ele->ptr;
                val->flags |= OPVAL_VALID_LL;
            // 从未编码的字符串中转换整数
            } else if (sdsEncodedObject(val->ele)) {
                if (string2ll(val->ele->ptr,sdslen(val->ele->ptr),&val->ell))
                    val->flags |= OPVAL_VALID_LL;

            } else {
                redisPanic("Unsupported element encoding");
            }

        // 从 ziplist 节点中取值
        } else if (val->estr != NULL) {
            // 将节点值（一个字符串）转换为整数
            if (string2ll((char*)val->estr,val->elen,&val->ell))
                val->flags |= OPVAL_VALID_LL;

        } else {
            /* The long long was already set, flag as valid. */
            // 总是打开 VALID LL 标识
            val->flags |= OPVAL_VALID_LL;
        }
    }

    // 检查 VALID LL 标识是否已打开
    return val->flags & OPVAL_VALID_LL;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl (%rdi), %eax
testb $0x2, %al
jne 0x3ff18
movl %eax, %ecx
orl $0x2, %ecx
movl %ecx, (%rbx)
movq 0x28(%rbx), %rcx
testq %rcx, %rcx
je 0x3fef3
movl (%rcx), %edx
shrl $0x4, %edx
andl $0xf, %edx
je 0x3fee9
cmpl $0x8, %edx
je 0x3fee9
cmpl $0x1, %edx
jne 0x3ff1f
movq 0x8(%rcx), %rcx
movq %rcx, 0x40(%rbx)
jmp 0x3ff13
movq 0x8(%rcx), %rdi
movslq -0x8(%rdi), %rsi
jmp 0x3feff
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0x3ff13
movl 0x38(%rbx), %esi
leaq 0x40(%rbx), %rdx
callq 0x2fec4
testl %eax, %eax
je 0x3ff18
movl (%rbx), %eax
orl $0x4, %eax
jmp 0x3ff16
orl $0x6, %eax
movl %eax, (%rbx)
movl (%rbx), %eax
andl $0x4, %eax
popq %rbx
retq
leaq 0x5951c(%rip), %rdi     # 0x99442
leaq 0x59289(%rip), %rsi     # 0x991b6
movl $0x9b9, %edx            # imm = 0x9B9
callq 0x4d0e5
movl $0x1, %edi
callq 0x1f3b0
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_zset.c
// Function: zuiObjectFromValue
robj *zuiObjectFromValue(zsetopval *val) {

    if (val->ele == NULL) {

        // 从 long long 值中创建对象
        if (val->estr != NULL) {
            val->ele = createStringObject((char*)val->estr,val->elen);
        } else {
            val->ele = createStringObjectFromLongLong(val->ell);
        }

        // 打开 ROBJ 标识
        val->flags |= OPVAL_DIRTY_ROBJ;
    }

    // 返回值对象
    return val->ele;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpq $0x0, 0x28(%rdi)
jne 0x3ff6f
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0x3ff5f
movl 0x38(%rbx), %esi
callq 0x303b7
jmp 0x3ff68
movq 0x40(%rbx), %rdi
callq 0x303c6
movq %rax, 0x28(%rbx)
orb $0x1, (%rbx)
movq 0x28(%rbx), %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_zset.c
// Function: zuiBufferFromValue
int zuiBufferFromValue(zsetopval *val) {

    if (val->estr == NULL) {
        if (val->ele != NULL) {
            if (val->ele->encoding == REDIS_ENCODING_INT) {
                val->elen = ll2string((char*)val->_buf,sizeof(val->_buf),(long)val->ele->ptr);
                val->estr = val->_buf;
            } else if (sdsEncodedObject(val->ele)) {
                val->elen = sdslen(val->ele->ptr);
                val->estr = val->ele->ptr;
            } else {
                redisPanic("Unsupported element encoding");
            }
        } else {
            val->elen = ll2string((char*)val->_buf,sizeof(val->_buf),val->ell);
            val->estr = val->_buf;
        }
    }

    return 1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpq $0x0, 0x30(%rdi)
jne 0x3ffd0
movq %rdi, %rbx
movq 0x28(%rdi), %rax
testq %rax, %rax
je 0x3ffb4
movl (%rax), %ecx
shrl $0x4, %ecx
andl $0xf, %ecx
je 0x3ffaa
cmpl $0x8, %ecx
je 0x3ffaa
cmpl $0x1, %ecx
jne 0x3ffdd
leaq 0x4(%rbx), %r14
movq 0x8(%rax), %rdx
jmp 0x3ffbc
movq 0x8(%rax), %r14
movl -0x8(%r14), %eax
jmp 0x3ffc9
leaq 0x4(%rbx), %r14
movq 0x40(%rbx), %rdx
movl $0x20, %esi
movq %r14, %rdi
callq 0x2fe12
movl %eax, 0x38(%rbx)
movq %r14, 0x30(%rbx)
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x5945e(%rip), %rdi     # 0x99442
leaq 0x591cb(%rip), %rsi     # 0x991b6
movl $0x9f1, %edx            # imm = 0x9F1
callq 0x4d0e5
movl $0x1, %edi
callq 0x1f3b0
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_zset.c
// Function: zcardCommand
void zcardCommand(redisClient *c) {
    robj *key = c->argv[1];
    robj *zobj;

    // 取出有序集合
    if ((zobj = lookupKeyReadOrReply(c,key,shared.czero)) == NULL ||
        checkType(c,zobj,REDIS_ZSET)) return;

    // 返回集合基数
    addReplyLongLong(c,zsetLength(zobj));
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x38(%rdi), %rax
movq 0x8(%rax), %rsi
leaq 0x88a48(%rip), %rax     # 0xca800
movq 0x20(%rax), %rdx
callq 0x31475
testq %rax, %rax
je 0x41ddd
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
movl $0x3, %edx
callq 0x308e7
testl %eax, %eax
je 0x41de5
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %r14, %rdi
callq 0x3ea49
movl %eax, %esi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2dea3
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_zset.c
// Function: zscoreCommand
void zscoreCommand(redisClient *c) {
    robj *key = c->argv[1];
    robj *zobj;
    double score;

    if ((zobj = lookupKeyReadOrReply(c,key,shared.nullbulk)) == NULL ||
        checkType(c,zobj,REDIS_ZSET)) return;

    // ziplist
    if (zobj->encoding == REDIS_ENCODING_ZIPLIST) {
        // 取出元素
        if (zzlFind(zobj->ptr,c->argv[2],&score) != NULL)
            // 回复分值
            addReplyDouble(c,score);
        else
            addReply(c,shared.nullbulk);

    // SKIPLIST
    } else if (zobj->encoding == REDIS_ENCODING_SKIPLIST) {
        zset *zs = zobj->ptr;
        dictEntry *de;

        c->argv[2] = tryObjectEncoding(c->argv[2]);
        // 直接从字典中取出并返回分值
        de = dictFind(zs->dict,c->argv[2]);
        if (de != NULL) {
            score = *(double*)dictGetVal(de);
            addReplyDouble(c,score);
        } else {
            addReply(c,shared.nullbulk);
        }

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

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq 0x38(%rdi), %rax
movq 0x8(%rax), %rsi
leaq 0x889e7(%rip), %r15     # 0xca800
movq 0x50(%r15), %rdx
callq 0x31475
testq %rax, %rax
je 0x41e3e
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
movl $0x3, %edx
callq 0x308e7
testl %eax, %eax
je 0x41e48
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
movl (%r14), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x7, %eax
je 0x41e8a
cmpl $0x5, %eax
jne 0x41efd
movq 0x8(%r14), %rdi
movq 0x38(%rbx), %rax
movq 0x10(%rax), %rsi
leaq 0x8(%rsp), %rdx
callq 0x3e5cc
testq %rax, %rax
je 0x41eec
movsd 0x8(%rsp), %xmm0
movq %rbx, %rdi
callq 0x2dd0b
jmp 0x41e3e
movq 0x8(%r14), %r14
movq 0x38(%rbx), %rax
movq 0x10(%rax), %rdi
callq 0x30971
movq 0x38(%rbx), %rcx
movq %rax, 0x10(%rcx)
movq (%r14), %rdi
movq 0x38(%rbx), %rax
movq 0x10(%rax), %rsi
callq 0x224dc
testq %rax, %rax
je 0x41ed7
movq 0x8(%rax), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %rbx, %rdi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0x2dd0b
movq 0x50(%r15), %rsi
movq %rbx, %rdi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0x2d6f0
movq 0x50(%r15), %rsi
movq %rbx, %rdi
callq 0x2d6f0
jmp 0x41e3e
leaq 0x5544f(%rip), %rdi     # 0x97353
leaq 0x572ab(%rip), %rsi     # 0x991b6
movl $0xe7e, %edx            # imm = 0xE7E
callq 0x4d0e5
movl $0x1, %edi
callq 0x1f3b0
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_zset.c
// Function: zscanCommand
void zscanCommand(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_ZSET)) 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 0x4222d
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rsi
leaq 0x8860d(%rip), %rax     # 0xca800
movq 0x148(%rax), %rdx
movq %rbx, %rdi
callq 0x31475
testq %rax, %rax
je 0x4222d
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
movl $0x3, %edx
callq 0x308e7
testl %eax, %eax
jne 0x4222d
movq (%rsp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x31e96
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_hash.c
// Function: hashTypeTryConversion
void hashTypeTryConversion(robj *o, robj **argv, int start, int end) {
    int i;

    // 如果对象不是 ziplist 编码，那么直接返回
    if (o->encoding != REDIS_ENCODING_ZIPLIST) return;

    // 检查所有输入对象，看它们的字符串值是否超过了指定长度
    for (i = start; i <= end; i++) {
        if (sdsEncodedObject(argv[i]) &&
            sdslen(argv[i]->ptr) > server.hash_max_ziplist_value)
        {
            // 将对象的编码转换成 REDIS_ENCODING_HT
            hashTypeConvert(o, REDIS_ENCODING_HT);
            break;
        }
    }
}

// Assembly:
movl $0xf0, %eax
andl (%rdi), %eax
cmpl $0x50, %eax
setne %al
cmpl %ecx, %edx
setg %r8b
orb %al, %r8b
jne 0x42290
leaq 0x87d51(%rip), %rax     # 0xc9fa8
movq 0x760(%rax), %rax
movslq %edx, %r8
leaq (%rsi,%r8,8), %rsi
subl %edx, %ecx
incl %ecx
xorl %edx, %edx
movq (%rsi,%rdx,8), %r8
movl (%r8), %r9d
shrl $0x4, %r9d
testb $0x7, %r9b
jne 0x42289
movq 0x8(%r8), %r8
movslq -0x8(%r8), %r8
cmpq %r8, %rax
jb 0x42291
incq %rdx
cmpl %edx, %ecx
jne 0x4226b
retq
movl $0x2, %esi
jmp 0x4229b
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_hash.c
// Function: hashTypeConvert
void hashTypeConvert(robj *o, int enc) {

    if (o->encoding == REDIS_ENCODING_ZIPLIST) {
        hashTypeConvertZiplist(o, enc);

    } else if (o->encoding == REDIS_ENCODING_HT) {
        redisPanic("Not implemented");

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

// Assembly:
pushq %rax
movl (%rdi), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x5, %eax
jne 0x422af
popq %rax
jmp 0x42bf2
cmpl $0x2, %eax
jne 0x422c9
leaq 0x5737e(%rip), %rdi     # 0x99639
leaq 0x572b8(%rip), %rsi     # 0x9957a
movl $0x2b6, %edx            # imm = 0x2B6
jmp 0x422dc
leaq 0x567e3(%rip), %rdi     # 0x98ab3
leaq 0x572a3(%rip), %rsi     # 0x9957a
movl $0x2b9, %edx            # imm = 0x2B9
callq 0x4d0e5
movl $0x1, %edi
callq 0x1f3b0
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_hash.c
// Function: hashTypeGetFromZiplist
int hashTypeGetFromZiplist(robj *o, robj *field,
                           unsigned char **vstr,
                           unsigned int *vlen,
                           long long *vll)
{
    unsigned char *zl, *fptr = NULL, *vptr = NULL;
    int ret;

    // 确保编码正确
    redisAssert(o->encoding == REDIS_ENCODING_ZIPLIST);

    // 取出未编码的域
    field = getDecodedObject(field);

    // 遍历 ziplist ，查找域的位置
    zl = o->ptr;
    fptr = ziplistIndex(zl, ZIPLIST_HEAD);
    if (fptr != NULL) {
        // 定位包含域的节点
        fptr = ziplistFind(fptr, field->ptr, sdslen(field->ptr), 1);
        if (fptr != NULL) {
            /* Grab pointer to the value (fptr points to the field) */
            // 域已经找到，取出和它相对应的值的位置
            vptr = ziplistNext(zl, fptr);
            redisAssert(vptr != NULL);
        }
    }

    decrRefCount(field);

    // 从 ziplist 节点中取出值
    if (vptr != NULL) {
        ret = ziplistGet(vptr, vstr, vlen, vll);
        redisAssert(ret);
        return 0;
    }

    // 没找到
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl $0xf0, %eax
andl (%rdi), %eax
cmpl $0x50, %eax
jne 0x42405
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, %r15
movq %rdi, %r13
movq %rsi, %rdi
callq 0x30ac3
movq %rax, %r12
movq 0x8(%r13), %rbp
xorl %r13d, %r13d
movq %rbp, %rdi
xorl %esi, %esi
callq 0x2bff5
testq %rax, %rax
je 0x423b6
movq 0x8(%r12), %rsi
movl -0x8(%rsi), %edx
movq %rax, %rdi
movl $0x1, %ecx
callq 0x2c76c
testq %rax, %rax
je 0x423b3
movq %rbp, %rdi
movq %rax, %rsi
callq 0x2c2b3
movq %rax, %r13
testq %rax, %rax
jne 0x423b6
leaq 0x571de(%rip), %rdi     # 0x99583
leaq 0x571ce(%rip), %rsi     # 0x9957a
movl $0x75, %edx
jmp 0x42418
xorl %r13d, %r13d
movq %r12, %rdi
callq 0x30834
testq %r13, %r13
je 0x423f1
movq %r13, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x2c351
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
jne 0x423f6
leaq 0x571ad(%rip), %rdi     # 0x99590
leaq 0x57190(%rip), %rsi     # 0x9957a
movl $0x7e, %edx
jmp 0x42418
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x57148(%rip), %rdi     # 0x99554
leaq 0x57167(%rip), %rsi     # 0x9957a
movl $0x66, %edx
callq 0x4d037
movl $0x1, %edi
callq 0x1f3b0
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_hash.c
// Function: hashTypeGetFromHashTable
int hashTypeGetFromHashTable(robj *o, robj *field, robj **value) {
    dictEntry *de;

    // 确保编码正确
    redisAssert(o->encoding == REDIS_ENCODING_HT);

    // 在字典中查找域（键）
    de = dictFind(o->ptr, field);

    // 键不存在
    if (de == NULL) return -1;

    // 取出域（键）的值
    *value = dictGetVal(de);

    // 成功找到
    return 0;
}

// Assembly:
pushq %rbx
movl $0xf0, %eax
andl (%rdi), %eax
cmpl $0x20, %eax
jne 0x42457
movq %rdx, %rbx
movq 0x8(%rdi), %rdi
callq 0x224dc
testq %rax, %rax
je 0x42450
movq 0x8(%rax), %rax
movq %rax, (%rbx)
xorl %eax, %eax
jmp 0x42455
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
retq
leaq 0x57136(%rip), %rdi     # 0x99594
leaq 0x57115(%rip), %rsi     # 0x9957a
movl $0x91, %edx
callq 0x4d037
movl $0x1, %edi
callq 0x1f3b0
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_hash.c
// Function: hashTypeGetObject
robj *hashTypeGetObject(robj *o, robj *field) {
    robj *value = NULL;

    // 从 ziplist 中取出值
    if (o->encoding == REDIS_ENCODING_ZIPLIST) {
        unsigned char *vstr = NULL;
        unsigned int vlen = UINT_MAX;
        long long vll = LLONG_MAX;

        if (hashTypeGetFromZiplist(o, field, &vstr, &vlen, &vll) == 0) {
            // 创建值对象
            if (vstr) {
                value = createStringObject((char*)vstr, vlen);
            } else {
                value = createStringObjectFromLongLong(vll);
            }
        }

    // 从字典中取出值
    } else if (o->encoding == REDIS_ENCODING_HT) {
        robj *aux;

        if (hashTypeGetFromHashTable(o, field, &aux) == 0) {
            incrRefCount(aux);
            value = aux;
        }

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

    // 返回值对象，或者 NULL
    return value;
}

// Assembly:
pushq %rbx
subq $0x20, %rsp
movl (%rdi), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x2, %eax
je 0x424d7
cmpl $0x5, %eax
jne 0x4250e
leaq 0x8(%rsp), %rdx
movq $0x0, (%rdx)
leaq 0x14(%rsp), %rcx
movl $0xffffffff, (%rcx)     # imm = 0xFFFFFFFF
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
leaq 0x18(%rsp), %r8
movq %rax, (%r8)
callq 0x42329
testl %eax, %eax
jne 0x424e5
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x424f8
movl 0x14(%rsp), %esi
callq 0x303b7
jmp 0x42502
leaq 0x8(%rsp), %rdx
callq 0x42427
testl %eax, %eax
je 0x424e9
xorl %ebx, %ebx
jmp 0x42505
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x3041b
jmp 0x42505
movq 0x18(%rsp), %rdi
callq 0x303c6
movq %rax, %rbx
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
retq
leaq 0x5659e(%rip), %rdi     # 0x98ab3
leaq 0x5705e(%rip), %rsi     # 0x9957a
movl $0xc7, %edx
callq 0x4d0e5
movl $0x1, %edi
callq 0x1f3b0
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_hash.c
// Function: hashTypeExists
int hashTypeExists(robj *o, robj *field) {

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

        if (hashTypeGetFromZiplist(o, field, &vstr, &vlen, &vll) == 0) return 1;

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

        if (hashTypeGetFromHashTable(o, field, &aux) == 0) return 1;

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

    // 不存在
    return 0;
}

// Assembly:
subq $0x18, %rsp
movl (%rdi), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x2, %eax
je 0x42574
cmpl $0x5, %eax
jne 0x4258e
movq %rsp, %rdx
movq $0x0, (%rdx)
leaq 0xc(%rsp), %rcx
movl $0xffffffff, (%rcx)     # imm = 0xFFFFFFFF
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
leaq 0x10(%rsp), %r8
movq %rax, (%r8)
callq 0x42329
jmp 0x4257c
movq %rsp, %rdx
callq 0x42427
testl %eax, %eax
je 0x42584
xorl %eax, %eax
jmp 0x42589
movl $0x1, %eax
addq $0x18, %rsp
retq
leaq 0x5651e(%rip), %rdi     # 0x98ab3
leaq 0x56fde(%rip), %rsi     # 0x9957a
movl $0xe7, %edx
callq 0x4d0e5
movl $0x1, %edi
callq 0x1f3b0
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_hash.c
// Function: hashTypeLength
unsigned long hashTypeLength(robj *o) {
    unsigned long length = ULONG_MAX;

    if (o->encoding == REDIS_ENCODING_ZIPLIST) {
        // ziplist 中，每个 field-value 对都需要使用两个节点来保存
        length = ziplistLen(o->ptr) / 2;
    } else if (o->encoding == REDIS_ENCODING_HT) {
        length = dictSize((dict*)o->ptr);
    } else {
        redisPanic("Unknown hash encoding");
    }

    return length;
}

// Assembly:
pushq %rax
movl (%rdi), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x2, %eax
je 0x4276d
cmpl $0x5, %eax
jne 0x4277b
movq 0x8(%rdi), %rdi
callq 0x2c9a8
shrl %eax
jmp 0x42779
movq 0x8(%rdi), %rcx
movq 0x48(%rcx), %rax
addq 0x28(%rcx), %rax
popq %rcx
retq
leaq 0x56331(%rip), %rdi     # 0x98ab3
leaq 0x56df1(%rip), %rsi     # 0x9957a
movl $0x188, %edx            # imm = 0x188
callq 0x4d0e5
movl $0x1, %edi
callq 0x1f3b0
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_hash.c
// Function: hashTypeDelete
int hashTypeDelete(robj *o, robj *field) {
    int deleted = 0;

    // 从 ziplist 中删除
    if (o->encoding == REDIS_ENCODING_ZIPLIST) {
        unsigned char *zl, *fptr;

        field = getDecodedObject(field);

        zl = o->ptr;
        fptr = ziplistIndex(zl, ZIPLIST_HEAD);
        if (fptr != NULL) {
            // 定位到域
            fptr = ziplistFind(fptr, field->ptr, sdslen(field->ptr), 1);
            if (fptr != NULL) {
                // 删除域和值
                zl = ziplistDelete(zl,&fptr);
                zl = ziplistDelete(zl,&fptr);
                o->ptr = zl;
                deleted = 1;
            }
        }

        decrRefCount(field);

    // 从字典中删除
    } else if (o->encoding == REDIS_ENCODING_HT) {
        if (dictDelete((dict*)o->ptr, field) == REDIS_OK) {
            deleted = 1;

            /* Always check if the dictionary needs a resize after a delete. */
            // 删除成功时，看字典是否需要收缩
            if (htNeedsResize(o->ptr)) dictResize(o->ptr);
        }

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

    return deleted;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl (%rdi), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x2, %eax
je 0x42833
cmpl $0x5, %eax
jne 0x4286c
movq %rsi, %rdi
callq 0x30ac3
movq %rax, %r14
movq 0x8(%rbx), %r15
xorl %ebp, %ebp
movq %r15, %rdi
xorl %esi, %esi
callq 0x2bff5
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x42829
movq 0x8(%r14), %rsi
movl -0x8(%rsi), %edx
movq %rax, %rdi
movl $0x1, %ecx
callq 0x2c76c
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x42829
leaq 0x8(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x2c46e
movq %rax, %rdi
movq %r12, %rsi
callq 0x2c46e
movq %rax, 0x8(%rbx)
movl $0x1, %ebp
movq %r14, %rdi
callq 0x30834
jmp 0x4285d
movq 0x8(%rbx), %rdi
callq 0x225d3
xorl %ebp, %ebp
testl %eax, %eax
jne 0x4285d
movq 0x8(%rbx), %rdi
callq 0x2347e
movl $0x1, %ebp
testl %eax, %eax
je 0x4285d
movq 0x8(%rbx), %rdi
callq 0x21fd6
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x56240(%rip), %rdi     # 0x98ab3
leaq 0x56d00(%rip), %rsi     # 0x9957a
movl $0x175, %edx            # imm = 0x175
callq 0x4d0e5
movl $0x1, %edi
callq 0x1f3b0
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_hash.c
// Function: hashTypeInitIterator
hashTypeIterator *hashTypeInitIterator(robj *subject) {

    hashTypeIterator *hi = zmalloc(sizeof(hashTypeIterator));

    // 指向对象
    hi->subject = subject;

    // 记录编码
    hi->encoding = subject->encoding;

    // 以 ziplist 的方式初始化迭代器
    if (hi->encoding == REDIS_ENCODING_ZIPLIST) {
        hi->fptr = NULL;
        hi->vptr = NULL;

    // 以字典的方式初始化迭代器
    } else if (hi->encoding == REDIS_ENCODING_HT) {
        hi->di = dictGetIterator(subject->ptr);

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

    // 返回迭代器
    return hi;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movl $0x30, %edi
callq 0x29709
movq %rax, %rbx
movq %r14, (%rax)
movl (%r14), %eax
shrl $0x4, %eax
andl $0xf, %eax
movl %eax, 0x8(%rbx)
cmpl $0x2, %eax
je 0x428c4
cmpl $0x5, %eax
jne 0x428dc
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
jmp 0x428d1
movq 0x8(%r14), %rdi
callq 0x228b5
movq %rax, 0x20(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x561d0(%rip), %rdi     # 0x98ab3
leaq 0x56c90(%rip), %rsi     # 0x9957a
movl $0x1ab, %edx            # imm = 0x1AB
callq 0x4d0e5
movl $0x1, %edi
callq 0x1f3b0
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_hash.c
// Function: hashTypeReleaseIterator
void hashTypeReleaseIterator(hashTypeIterator *hi) {

    // 释放字典迭代器
    if (hi->encoding == REDIS_ENCODING_HT) {
        dictReleaseIterator(hi->di);
    }

    // 释放 ziplist 迭代器
    zfree(hi);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpl $0x2, 0x8(%rdi)
jne 0x42911
movq 0x20(%rbx), %rdi
callq 0x229b9
movq %rbx, %rdi
popq %rbx
jmp 0x2984b
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_hash.c
// Function: hashTypeNext
int hashTypeNext(hashTypeIterator *hi) {

    // 迭代 ziplist
    if (hi->encoding == REDIS_ENCODING_ZIPLIST) {
        unsigned char *zl;
        unsigned char *fptr, *vptr;

        zl = hi->subject->ptr;
        fptr = hi->fptr;
        vptr = hi->vptr;

        // 第一次执行时，初始化指针
        if (fptr == NULL) {
            /* Initialize cursor */
            redisAssert(vptr == NULL);
            fptr = ziplistIndex(zl, 0);

        // 获取下一个迭代节点
        } else {
            /* Advance cursor */
            redisAssert(vptr != NULL);
            fptr = ziplistNext(zl, vptr);
        }

        // 迭代完毕，或者 ziplist 为空
        if (fptr == NULL) return REDIS_ERR;

        /* Grab pointer to the value (fptr points to the field) */
        // 记录值的指针
        vptr = ziplistNext(zl, fptr);
        redisAssert(vptr != NULL);

        /* fptr, vptr now point to the first or next pair */
        // 更新迭代器指针
        hi->fptr = fptr;
        hi->vptr = vptr;

    // 迭代字典
    } else if (hi->encoding == REDIS_ENCODING_HT) {
        if ((hi->de = dictNext(hi->di)) == NULL) return REDIS_ERR;

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

    // 迭代成功
    return REDIS_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x8(%rdi), %eax
cmpl $0x2, %eax
je 0x4295a
cmpl $0x5, %eax
jne 0x429bf
movq (%rbx), %rax
movq 0x18(%rbx), %rsi
movq 0x8(%rax), %r14
cmpq $0x0, 0x10(%rbx)
je 0x42973
testq %rsi, %rsi
je 0x429d9
movq %r14, %rdi
callq 0x2c2b3
jmp 0x42986
movq 0x20(%rbx), %rdi
callq 0x22913
movq %rax, 0x28(%rbx)
testq %rax, %rax
jne 0x429b0
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x429b2
testq %rsi, %rsi
jne 0x42a03
movq %r14, %rdi
xorl %esi, %esi
callq 0x2bff5
movq %rax, %r15
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x429b2
movq %r14, %rdi
movq %r15, %rsi
callq 0x2c2b3
testq %rax, %rax
je 0x429ee
movq %r15, 0x10(%rbx)
movq %rax, 0x18(%rbx)
testq %r15, %r15
je 0x429b2
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x560ed(%rip), %rdi     # 0x98ab3
leaq 0x56bad(%rip), %rsi     # 0x9957a
movl $0x1f5, %edx            # imm = 0x1F5
callq 0x4d0e5
jmp 0x42a1b
leaq 0x56ba3(%rip), %rdi     # 0x99583
leaq 0x56b93(%rip), %rsi     # 0x9957a
movl $0x1de, %edx            # imm = 0x1DE
jmp 0x42a16
leaq 0x56b8e(%rip), %rdi     # 0x99583
leaq 0x56b7e(%rip), %rsi     # 0x9957a
movl $0x1e8, %edx            # imm = 0x1E8
jmp 0x42a16
leaq 0x56bab(%rip), %rdi     # 0x995b5
leaq 0x56b69(%rip), %rsi     # 0x9957a
movl $0x1d8, %edx            # imm = 0x1D8
callq 0x4d037
movl $0x1, %edi
callq 0x1f3b0
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_hash.c
// Function: hashTypeCurrentFromZiplist
void hashTypeCurrentFromZiplist(hashTypeIterator *hi, int what,
                                unsigned char **vstr,
                                unsigned int *vlen,
                                long long *vll)
{
    int ret;

    // 确保编码正确
    redisAssert(hi->encoding == REDIS_ENCODING_ZIPLIST);

    // 取出键
    if (what & REDIS_HASH_KEY) {
        ret = ziplistGet(hi->fptr, vstr, vlen, vll);
        redisAssert(ret);

    // 取出值
    } else {
        ret = ziplistGet(hi->vptr, vstr, vlen, vll);
        redisAssert(ret);
    }
}

// Assembly:
pushq %rax
cmpl $0x5, 0x8(%rdi)
jne 0x42a75
testb $0x1, %sil
jne 0x42a5d
movq 0x18(%rdi), %rdi
movq %rdx, %rsi
movq %rcx, %rdx
movq %r8, %rcx
callq 0x2c351
testl %eax, %eax
jne 0x42a73
leaq 0x56b41(%rip), %rdi     # 0x99590
leaq 0x56b24(%rip), %rsi     # 0x9957a
movl $0x213, %edx            # imm = 0x213
jmp 0x42a9d
movq 0x10(%rdi), %rdi
movq %rdx, %rsi
movq %rcx, %rdx
movq %r8, %rcx
callq 0x2c351
testl %eax, %eax
je 0x42a8a
popq %rax
retq
leaq 0x56b46(%rip), %rdi     # 0x995c2
leaq 0x56af7(%rip), %rsi     # 0x9957a
movl $0x209, %edx            # imm = 0x209
jmp 0x42a9d
leaq 0x56aff(%rip), %rdi     # 0x99590
leaq 0x56ae2(%rip), %rsi     # 0x9957a
movl $0x20e, %edx            # imm = 0x20E
callq 0x4d037
movl $0x1, %edi
callq 0x1f3b0
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_hash.c
// Function: hashTypeCurrentObject
robj *hashTypeCurrentObject(hashTypeIterator *hi, int what) {
    robj *dst;

    // 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) {
            dst = createStringObject((char*)vstr, vlen);
        } else {
            dst = createStringObjectFromLongLong(vll);
        }

    // 字典
    } else if (hi->encoding == REDIS_ENCODING_HT) {
        // 取出键或者值
        hashTypeCurrentFromHashTable(hi, what, &dst);
        // 对对象的引用计数进行自增
        incrRefCount(dst);

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

    // 返回对象
    return dst;
}

// Assembly:
pushq %rbx
subq $0x20, %rsp
movl 0x8(%rdi), %eax
cmpl $0x2, %eax
je 0x42b41
cmpl $0x5, %eax
jne 0x42b72
leaq 0x18(%rsp), %rbx
movq $0x0, (%rbx)
leaq 0x4(%rsp), %rcx
movl $0xffffffff, (%rcx)     # imm = 0xFFFFFFFF
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
leaq 0x10(%rsp), %r8
movq %rax, (%r8)
movq %rbx, %rdx
callq 0x42a25
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x42b58
movl 0x4(%rsp), %esi
callq 0x303b7
jmp 0x42b62
leaq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x42aac
movq (%rbx), %rdi
callq 0x3041b
jmp 0x42b67
movq 0x10(%rsp), %rdi
callq 0x303c6
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
addq $0x20, %rsp
popq %rbx
retq
leaq 0x55f3a(%rip), %rdi     # 0x98ab3
leaq 0x569fa(%rip), %rsi     # 0x9957a
movl $0x250, %edx            # imm = 0x250
callq 0x4d0e5
movl $0x1, %edi
callq 0x1f3b0
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_hash.c
// Function: hashTypeLookupWriteOrCreate
robj *hashTypeLookupWriteOrCreate(redisClient *c, robj *key) {

    robj *o = lookupKeyWrite(c->db,key);

    // 对象不存在，创建新的
    if (o == NULL) {
        o = createHashObject();
        dbAdd(c->db,key,o);

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

    // 返回对象
    return o;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r15
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
callq 0x31454
testq %rax, %rax
je 0x42bd2
movq %rax, %r14
movl (%rax), %eax
andl $0xf, %eax
cmpl $0x4, %eax
je 0x42be9
leaq 0x87c3f(%rip), %rax     # 0xca800
movq 0x70(%rax), %rsi
movq %rbx, %rdi
callq 0x2d6f0
xorl %r14d, %r14d
jmp 0x42be9
callq 0x30639
movq %rax, %r14
movq 0x8(%rbx), %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x314ef
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_hash.c
// Function: hashTypeConvertZiplist
void hashTypeConvertZiplist(robj *o, int enc) {
    redisAssert(o->encoding == REDIS_ENCODING_ZIPLIST);

    // 如果输入是 ZIPLIST ，那么不做动作
    if (enc == REDIS_ENCODING_ZIPLIST) {
        /* Nothing to do... */

    // 转换成 HT 编码
    } else if (enc == REDIS_ENCODING_HT) {

        hashTypeIterator *hi;
        dict *dict;
        int ret;

        // 创建哈希迭代器
        hi = hashTypeInitIterator(o);

        // 创建空白的新字典
        dict = dictCreate(&hashDictType, NULL);

        // 遍历整个 ziplist
        while (hashTypeNext(hi) != REDIS_ERR) {
            robj *field, *value;

            // 取出 ziplist 里的键
            field = hashTypeCurrentObject(hi, REDIS_HASH_KEY);
            field = tryObjectEncoding(field);

            // 取出 ziplist 里的值
            value = hashTypeCurrentObject(hi, REDIS_HASH_VALUE);
            value = tryObjectEncoding(value);

            // 将键值对添加到字典
            ret = dictAdd(dict, field, value);
            if (ret != DICT_OK) {
                redisLogHexDump(REDIS_WARNING,"ziplist with dup elements dump",
                    o->ptr,ziplistBlobLen(o->ptr));
                redisAssert(ret == DICT_OK);
            }
        }

        // 释放 ziplist 的迭代器
        hashTypeReleaseIterator(hi);

        // 释放对象原来的 ziplist
        zfree(o->ptr);

        // 更新哈希的编码和值对象
        o->encoding = REDIS_ENCODING_HT;
        o->ptr = dict;

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

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl $0xf0, %eax
andl (%rdi), %eax
cmpl $0x50, %eax
jne 0x42cfa
cmpl $0x5, %esi
je 0x42cee
cmpl $0x2, %esi
jne 0x42d0f
movq %rdi, %rbx
callq 0x4288e
movq %rax, %r15
leaq 0x86d62(%rip), %rdi     # 0xc9990
xorl %esi, %esi
callq 0x21f97
movq %rax, %r14
movq %r15, %rdi
callq 0x4291a
cmpl $-0x1, %eax
je 0x42ccd
movq %r15, %rdi
movl $0x1, %esi
callq 0x42aeb
movq %rax, %rdi
callq 0x30971
movq %rax, %r12
movq %r15, %rdi
movl $0x2, %esi
callq 0x42aeb
movq %rax, %rdi
callq 0x30971
movq %r14, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x222b6
testl %eax, %eax
je 0x42c38
movq 0x8(%rbx), %rbx
movq %rbx, %rdi
callq 0x2c9f5
leaq 0x56970(%rip), %rsi     # 0x9960b
movl $0x3, %edi
movq %rbx, %rdx
movq %rax, %rcx
callq 0x4e3c0
leaq 0x56978(%rip), %rdi     # 0x9962a
leaq 0x568c1(%rip), %rsi     # 0x9957a
movl $0x298, %edx            # imm = 0x298
callq 0x4d037
movl $0x1, %edi
callq 0x1f3b0
movq %r15, %rdi
callq 0x428fe
movq 0x8(%rbx), %rdi
callq 0x2984b
movl $0xffffff0f, %eax       # imm = 0xFFFFFF0F
andl (%rbx), %eax
orl $0x20, %eax
movl %eax, (%rbx)
movq %r14, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x56853(%rip), %rdi     # 0x99554
leaq 0x56872(%rip), %rsi     # 0x9957a
movl $0x274, %edx            # imm = 0x274
jmp 0x42cbe
leaq 0x55d9d(%rip), %rdi     # 0x98ab3
leaq 0x5685d(%rip), %rsi     # 0x9957a
movl $0x2a7, %edx            # imm = 0x2A7
callq 0x4d0e5
jmp 0x42cc3