LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/t_zset.c
// Function: zslParseLexRangeItem
int zslParseLexRangeItem(robj *item, robj **dest, int *ex) {
    char *c = item->ptr;

    switch(c[0]) {
    case '+':
        if (c[1] != '\0') return REDIS_ERR;
        *ex = 0;
        *dest = shared.maxstring;
        incrRefCount(shared.maxstring);
        return REDIS_OK;
    case '-':
        if (c[1] != '\0') return REDIS_ERR;
        *ex = 0;
        *dest = shared.minstring;
        incrRefCount(shared.minstring);
        return REDIS_OK;
    case '(':
        *ex = 1;
        *dest = createStringObject(c+1,sdslen(c)-1);
        return REDIS_OK;
    case '[':
        *ex = 0;
        *dest = createStringObject(c+1,sdslen(c)-1);
        return REDIS_OK;
    default:
        return REDIS_ERR;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x2c(%rbp)
subl $0x28, %eax
je 0x4e9c8
jmp 0x4e8f5
movl -0x2c(%rbp), %eax
subl $0x2b, %eax
je 0x4e91a
jmp 0x4e8ff
movl -0x2c(%rbp), %eax
subl $0x2d, %eax
je 0x4e971
jmp 0x4e909
movl -0x2c(%rbp), %eax
subl $0x5b, %eax
je 0x4ea0a
jmp 0x4ea4c
movq -0x28(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x0, %eax
je 0x4e933
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4ea53
movq -0x20(%rbp), %rax
movl $0x0, (%rax)
leaq 0xc580c(%rip), %rax     # 0x114150
movq 0x158(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
leaq 0xc57f7(%rip), %rax     # 0x114150
movq 0x158(%rax), %rdi
callq 0x3a3f0
movl $0x0, -0x4(%rbp)
jmp 0x4ea53
movq -0x28(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x0, %eax
je 0x4e98a
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4ea53
movq -0x20(%rbp), %rax
movl $0x0, (%rax)
leaq 0xc57b5(%rip), %rax     # 0x114150
movq 0x150(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
leaq 0xc57a0(%rip), %rax     # 0x114150
movq 0x150(%rax), %rdi
callq 0x3a3f0
movl $0x0, -0x4(%rbp)
jmp 0x4ea53
movq -0x20(%rbp), %rax
movl $0x1, (%rax)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rdi
callq 0x4cfd0
movq -0x38(%rbp), %rdi
movq %rax, %rsi
subq $0x1, %rsi
callq 0x3a2e0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x4ea53
movq -0x20(%rbp), %rax
movl $0x0, (%rax)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rdi
callq 0x4cfd0
movq -0x40(%rbp), %rdi
movq %rax, %rsi
subq $0x1, %rsi
callq 0x3a2e0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x4ea53
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/t_zset.c
// Function: zzlGetScore
double zzlGetScore(unsigned char *sptr) {
    unsigned char *vstr;
    unsigned int vlen;
    long long vlong;
    char buf[128];
    double score;

    redisAssert(sptr != NULL);
    // 取出节点值
    redisAssert(ziplistGet(sptr,&vstr,&vlen,&vlong));

    if (vstr) {
        // 字符串转 double
        memcpy(buf,vstr,vlen);
        buf[vlen] = '\0';
        score = strtod(buf,NULL);
    } else {
        // double 值
        score = vlong;
    }

    return score;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x4ee98
jmp 0x4eeba
leaq 0x94735(%rip), %rdi     # 0xe35d4
leaq 0x943e8(%rip), %rsi     # 0xe328e
movl $0x3e5, %edx            # imm = 0x3E5
callq 0x63ca0
movl $0x1, %edi
callq 0x1f3b0
movq -0x8(%rbp), %rdi
leaq -0x10(%rbp), %rsi
leaq -0x14(%rbp), %rdx
leaq -0x20(%rbp), %rcx
callq 0x33490
cmpl $0x0, %eax
je 0x4eed6
jmp 0x4eef8
leaq 0x943c4(%rip), %rdi     # 0xe32a1
leaq 0x943aa(%rip), %rsi     # 0xe328e
movl $0x3e7, %edx            # imm = 0x3E7
callq 0x63ca0
movl $0x1, %edi
callq 0x1f3b0
cmpq $0x0, -0x10(%rbp)
je 0x4ef39
leaq -0xa0(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %eax
movl %eax, %edx
callq 0x1fbf0
movl -0x14(%rbp), %eax
movb $0x0, -0xa0(%rbp,%rax)
leaq -0xa0(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1fc60
movsd %xmm0, -0xa8(%rbp)
jmp 0x4ef47
cvtsi2sdq -0x20(%rbp), %xmm0
movsd %xmm0, -0xa8(%rbp)
movsd -0xa8(%rbp), %xmm0
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/t_zset.c
// Function: ziplistGetObject
robj *ziplistGetObject(unsigned char *sptr) {
    unsigned char *vstr;
    unsigned int vlen;
    long long vlong;

    redisAssert(sptr != NULL);
    redisAssert(ziplistGet(sptr,&vstr,&vlen,&vlong));

    if (vstr) {
        return createStringObject((char*)vstr,vlen);
    } else {
        return createStringObjectFromLongLong(vlong);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x4ef75
jmp 0x4ef97
leaq 0x94658(%rip), %rdi     # 0xe35d4
leaq 0x9430b(%rip), %rsi     # 0xe328e
movl $0x3fe, %edx            # imm = 0x3FE
callq 0x63ca0
movl $0x1, %edi
callq 0x1f3b0
movq -0x10(%rbp), %rdi
leaq -0x18(%rbp), %rsi
leaq -0x1c(%rbp), %rdx
leaq -0x28(%rbp), %rcx
callq 0x33490
cmpl $0x0, %eax
je 0x4efb3
jmp 0x4efd5
leaq 0x942e7(%rip), %rdi     # 0xe32a1
leaq 0x942cd(%rip), %rsi     # 0xe328e
movl $0x3ff, %edx            # imm = 0x3FF
callq 0x63ca0
movl $0x1, %edi
callq 0x1f3b0
cmpq $0x0, -0x18(%rbp)
je 0x4eff0
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, %esi
callq 0x3a2e0
movq %rax, -0x8(%rbp)
jmp 0x4effd
movq -0x28(%rbp), %rdi
callq 0x3a330
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/t_zset.c
// Function: zzlNext
void zzlNext(unsigned char *zl, unsigned char **eptr, unsigned char **sptr) {
    unsigned char *_eptr, *_sptr;

    redisAssert(*eptr != NULL && *sptr != NULL);

    // 指向下个成员
    _eptr = ziplistNext(zl,*sptr);
    if (_eptr != NULL) {
        // 指向下个分值
        _sptr = ziplistNext(zl,_eptr);
        redisAssert(_sptr != NULL);
    } else {
        /* No next entry. */
        _sptr = NULL;
    }

    *eptr = _eptr;
    *sptr = _sptr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x4f12a
movq -0x18(%rbp), %rax
cmpq $0x0, (%rax)
je 0x4f12a
jmp 0x4f14c
leaq 0x941b8(%rip), %rdi     # 0xe32e9
leaq 0x94156(%rip), %rsi     # 0xe328e
movl $0x437, %edx            # imm = 0x437
callq 0x63ca0
movl $0x1, %edi
callq 0x1f3b0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
callq 0x33330
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x4f1a5
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x33330
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x4f181
jmp 0x4f1a3
leaq 0x94180(%rip), %rdi     # 0xe3308
leaq 0x940ff(%rip), %rsi     # 0xe328e
movl $0x43e, %edx            # imm = 0x43E
callq 0x63ca0
movl $0x1, %edi
callq 0x1f3b0
jmp 0x4f1ad
movq $0x0, -0x28(%rbp)
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/t_zset.c
// Function: zzlFirstInRange
unsigned char *zzlFirstInRange(unsigned char *zl, zrangespec *range) {
    // 从表头开始遍历
    unsigned char *eptr = ziplistIndex(zl,0), *sptr;
    double score;

    /* If everything is out of range, return early. */
    if (!zzlIsInRange(zl,range)) return NULL;

    // 分值在 ziplist 中是从小到大排列的
    // 从表头向表尾遍历
    while (eptr != NULL) {
        sptr = ziplistNext(zl,eptr);
        redisAssert(sptr != NULL);

        score = zzlGetScore(sptr);
        if (zslValueGteMin(score,range)) {
            /* Check if score <= max. */
            // 遇上第一个符合范围的分值，
            // 返回它的节点指针
            if (zslValueLteMax(score,range))
                return eptr;
            return NULL;
        }

        /* Move to next element. */
        eptr = ziplistNext(zl,sptr);
    }

    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x32e50
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x4f2a0
cmpl $0x0, %eax
jne 0x4f3fe
movq $0x0, -0x8(%rbp)
jmp 0x4f4ad
jmp 0x4f400
cmpq $0x0, -0x20(%rbp)
je 0x4f4a5
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x33330
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x4f425
jmp 0x4f447
leaq 0x941a8(%rip), %rdi     # 0xe35d4
leaq 0x93e5b(%rip), %rsi     # 0xe328e
movl $0x498, %edx            # imm = 0x498
callq 0x63ca0
movl $0x1, %edi
callq 0x1f3b0
movq -0x28(%rbp), %rdi
callq 0x4ee80
movsd %xmm0, -0x30(%rbp)
movsd -0x30(%rbp), %xmm0
movq -0x18(%rbp), %rdi
callq 0x4db90
cmpl $0x0, %eax
je 0x4f48f
movsd -0x30(%rbp), %xmm0
movq -0x18(%rbp), %rdi
callq 0x4dbe0
cmpl $0x0, %eax
je 0x4f485
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x4f4ad
movq $0x0, -0x8(%rbp)
jmp 0x4f4ad
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x33330
movq %rax, -0x20(%rbp)
jmp 0x4f400
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/t_zset.c
// Function: zzlLastInRange
unsigned char *zzlLastInRange(unsigned char *zl, zrangespec *range) {
    // 从表尾开始遍历
    unsigned char *eptr = ziplistIndex(zl,-2), *sptr;
    double score;

    /* If everything is out of range, return early. */
    if (!zzlIsInRange(zl,range)) return NULL;

    // 在有序的 ziplist 里从表尾到表头遍历
    while (eptr != NULL) {
        sptr = ziplistNext(zl,eptr);
        redisAssert(sptr != NULL);

        // 获取节点的 score 值
        score = zzlGetScore(sptr);
        if (zslValueLteMax(score,range)) {
            /* Check if score >= min. */
            if (zslValueGteMin(score,range))
                return eptr;
            return NULL;
        }

        /* Move to previous element by moving to the score of previous element.
         * When this returns NULL, we know there also is no element. */
        sptr = ziplistPrev(zl,eptr);
        if (sptr != NULL)
            redisAssert((eptr = ziplistPrev(zl,sptr)) != NULL);
        else
            eptr = NULL;
    }

    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x32e50
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x4f2a0
cmpl $0x0, %eax
jne 0x4f501
movq $0x0, -0x8(%rbp)
jmp 0x4f5fc
jmp 0x4f503
cmpq $0x0, -0x20(%rbp)
je 0x4f5f4
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x33330
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x4f528
jmp 0x4f54a
leaq 0x940a5(%rip), %rdi     # 0xe35d4
leaq 0x93d58(%rip), %rsi     # 0xe328e
movl $0x4be, %edx            # imm = 0x4BE
callq 0x63ca0
movl $0x1, %edi
callq 0x1f3b0
movq -0x28(%rbp), %rdi
callq 0x4ee80
movsd %xmm0, -0x30(%rbp)
movsd -0x30(%rbp), %xmm0
movq -0x18(%rbp), %rdi
callq 0x4dbe0
cmpl $0x0, %eax
je 0x4f592
movsd -0x30(%rbp), %xmm0
movq -0x18(%rbp), %rdi
callq 0x4db90
cmpl $0x0, %eax
je 0x4f588
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x4f5fc
movq $0x0, -0x8(%rbp)
jmp 0x4f5fc
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x333a0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x4f5e7
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x333a0
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
je 0x4f5c3
jmp 0x4f5e5
leaq 0x93d64(%rip), %rdi     # 0xe332e
leaq 0x93cbd(%rip), %rsi     # 0xe328e
movl $0x4cd, %edx            # imm = 0x4CD
callq 0x63ca0
movl $0x1, %edi
callq 0x1f3b0
jmp 0x4f5ef
movq $0x0, -0x20(%rbp)
jmp 0x4f503
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/t_zset.c
// Function: zzlDeleteRangeByRank
unsigned char *zzlDeleteRangeByRank(unsigned char *zl, unsigned int start, unsigned int end, unsigned long *deleted) {
    unsigned int num = (end-start)+1;

    if (deleted) *deleted = num;

    // 每个元素占用两个节点，所以删除的其实位置要乘以 2 
    // 并且因为 ziplist 的索引以 0 为起始值，而 zzl 的起始值为 1 ，
    // 所以需要 start - 1 
    zl = ziplistDeleteRange(zl,2*(start-1),2*num);

    return zl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movl -0x10(%rbp), %eax
subl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x50055
movl -0x1c(%rbp), %eax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
subl $0x1, %esi
shll %esi
movl -0x1c(%rbp), %edx
shll %edx
callq 0x339c0
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl $0xffffffff, -0xc(%rbp) # imm = 0xFFFFFFFF
movq -0x8(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x5, %eax
jne 0x500b6
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x4f0e0
movl %eax, -0xc(%rbp)
jmp 0x50100
movq -0x8(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x7, %eax
jne 0x500dc
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rax
movl %eax, -0xc(%rbp)
jmp 0x500fe
leaq 0x913b8(%rip), %rdi     # 0xe149b
leaq 0x931a4(%rip), %rsi     # 0xe328e
movl $0x632, %edx            # imm = 0x632
callq 0x63d40
movl $0x1, %edi
callq 0x1f3b0
jmp 0x50100
movl -0xc(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/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:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x1, %eax
je 0x51596
movq -0x18(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x1, %eax
jne 0x515a2
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x5162f
movq -0x20(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x20(%rbp), %rax
movq $0x0, (%rax)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x20(%rbp), %rdx
addq $0x10, %rdx
callq 0x4e8c0
cmpl $-0x1, %eax
je 0x515f1
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
addq $0x8, %rsi
movq -0x20(%rbp), %rdx
addq $0x14, %rdx
callq 0x4e8c0
cmpl $-0x1, %eax
jne 0x51628
movq -0x20(%rbp), %rax
cmpq $0x0, (%rax)
je 0x51607
movq -0x20(%rbp), %rax
movq (%rax), %rdi
callq 0x3aaa0
movq -0x20(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x5161f
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x3aaa0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x5162f
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x518cb
jmp 0x519a4
movq -0x8(%rbp), %rax
cmpl $0x2, 0x8(%rax)
jne 0x5192c
movq -0x8(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x6, 0xc(%rax)
jne 0x518ed
jmp 0x5192a
movq -0x8(%rbp), %rax
cmpl $0x2, 0xc(%rax)
jne 0x51906
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x243d0
jmp 0x51928
leaq 0x91257(%rip), %rdi     # 0xe2b64
leaq 0x9197a(%rip), %rsi     # 0xe328e
movl $0x906, %edx            # imm = 0x906
callq 0x63d40
movl $0x1, %edi
callq 0x1f3b0
jmp 0x5192a
jmp 0x519a4
movq -0x8(%rbp), %rax
cmpl $0x3, 0x8(%rax)
jne 0x51980
movq -0x8(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x5, 0xc(%rax)
jne 0x5194e
jmp 0x5197e
movq -0x8(%rbp), %rax
cmpl $0x7, 0xc(%rax)
jne 0x5195a
jmp 0x5197c
leaq 0x8fb3a(%rip), %rdi     # 0xe149b
leaq 0x91926(%rip), %rsi     # 0xe328e
movl $0x914, %edx            # imm = 0x914
callq 0x63d40
movl $0x1, %edi
callq 0x1f3b0
jmp 0x5197e
jmp 0x519a2
leaq 0x91b48(%rip), %rdi     # 0xe34cf
leaq 0x91900(%rip), %rsi     # 0xe328e
movl $0x917, %edx            # imm = 0x917
callq 0x63d40
movl $0x1, %edi
callq 0x1f3b0
jmp 0x519a4
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x519d2
movl $0x0, -0x4(%rbp)
jmp 0x51ae8
movq -0x10(%rbp), %rax
cmpl $0x2, 0x8(%rax)
jne 0x51a51
movq -0x10(%rbp), %rax
cmpl $0x6, 0xc(%rax)
jne 0x519fe
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rdi
callq 0x67ab0
movl %eax, -0x4(%rbp)
jmp 0x51ae8
movq -0x10(%rbp), %rax
cmpl $0x2, 0xc(%rax)
jne 0x51a2f
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x18(%rbp), %rcx
addq 0x48(%rcx), %rax
movl %eax, -0x4(%rbp)
jmp 0x51ae8
leaq 0x9112e(%rip), %rdi     # 0xe2b64
leaq 0x91851(%rip), %rsi     # 0xe328e
movl $0x92a, %edx            # imm = 0x92A
callq 0x63d40
movl $0x1, %edi
callq 0x1f3b0
movq -0x10(%rbp), %rax
cmpl $0x3, 0x8(%rax)
jne 0x51ac6
movq -0x10(%rbp), %rax
cmpl $0x5, 0xc(%rax)
jne 0x51a7a
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rdi
callq 0x4f0e0
movl %eax, -0x4(%rbp)
jmp 0x51ae8
movq -0x10(%rbp), %rax
cmpl $0x7, 0xc(%rax)
jne 0x51aa4
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rax
movl %eax, -0x4(%rbp)
jmp 0x51ae8
leaq 0x8f9f0(%rip), %rdi     # 0xe149b
leaq 0x917dc(%rip), %rsi     # 0xe328e
movl $0x935, %edx            # imm = 0x935
callq 0x63d40
movl $0x1, %edi
callq 0x1f3b0
leaq 0x91a02(%rip), %rdi     # 0xe34cf
leaq 0x917ba(%rip), %rsi     # 0xe328e
movl $0x939, %edx            # imm = 0x939
callq 0x63d40
movl $0x1, %edi
callq 0x1f3b0
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x28(%rax)
jne 0x51fb8
movq -0x8(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x51f95
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rdi
movq -0x8(%rbp), %rax
movl 0x38(%rax), %eax
movl %eax, %esi
callq 0x3a2e0
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x28(%rax)
jmp 0x51fad
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0x3a330
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x8(%rbp), %rax
movl (%rax), %ecx
orl $0x1, %ecx
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x30(%rax)
jne 0x520fd
movq -0x8(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x520c8
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x1, %eax
jne 0x52048
movq -0x8(%rbp), %rdi
addq $0x4, %rdi
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x8(%rax), %rdx
movl $0x20, %esi
callq 0x39660
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x38(%rax)
movq -0x8(%rbp), %rcx
addq $0x4, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x30(%rax)
jmp 0x520c6
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x0, %eax
je 0x52072
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x8, %eax
jne 0x520a2
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x8(%rax), %rdi
callq 0x4cfd0
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x38(%rax)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x8(%rax), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x30(%rax)
jmp 0x520c4
leaq 0x91471(%rip), %rdi     # 0xe351a
leaq 0x911de(%rip), %rsi     # 0xe328e
movl $0x9f1, %edx            # imm = 0x9F1
callq 0x63d40
movl $0x1, %edi
callq 0x1f3b0
jmp 0x520c6
jmp 0x520fb
movq -0x8(%rbp), %rdi
addq $0x4, %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rdx
movl $0x20, %esi
callq 0x39660
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x38(%rax)
movq -0x8(%rbp), %rcx
addq $0x4, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x30(%rax)
jmp 0x520fd
movl $0x1, %eax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq 0xbf825(%rip), %rax     # 0x114150
movq 0x20(%rax), %rdx
callq 0x3c0c0
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0x54955
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl $0x3, %edx
callq 0x3abb0
cmpl $0x0, %eax
je 0x54957
jmp 0x54975
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
callq 0x50080
movq -0x20(%rbp), %rdi
movl %eax, %eax
movl %eax, %esi
callq 0x36480
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq 0xbf7a5(%rip), %rax     # 0x114150
movq 0x50(%rax), %rdx
callq 0x3c0c0
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0x549d5
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl $0x3, %edx
callq 0x3abb0
cmpl $0x0, %eax
je 0x549da
jmp 0x54af6
movq -0x18(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x5, %eax
jne 0x54a37
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x10(%rax), %rsi
leaq -0x20(%rbp), %rdx
callq 0x4f990
cmpq $0x0, %rax
je 0x54a1e
movq -0x8(%rbp), %rdi
movsd -0x20(%rbp), %xmm0
callq 0x36230
jmp 0x54a32
movq -0x8(%rbp), %rdi
leaq 0xbf727(%rip), %rax     # 0x114150
movq 0x50(%rax), %rsi
callq 0x35a70
jmp 0x54af6
movq -0x18(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x7, %eax
jne 0x54ad2
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x10(%rax), %rdi
callq 0x3acc0
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movq %rcx, 0x10(%rax)
movq -0x28(%rbp), %rax
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x10(%rax), %rsi
callq 0x23aa0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x54abc
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movsd -0x20(%rbp), %xmm0
callq 0x36230
jmp 0x54ad0
movq -0x8(%rbp), %rdi
leaq 0xbf689(%rip), %rax     # 0x114150
movq 0x50(%rax), %rsi
callq 0x35a70
jmp 0x54af4
leaq 0x8c9c2(%rip), %rdi     # 0xe149b
leaq 0x8e7ae(%rip), %rsi     # 0xe328e
movl $0xe7e, %edx            # imm = 0xE7E
callq 0x63d40
movl $0x1, %edi
callq 0x1f3b0
jmp 0x54af6
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x10(%rax), %rsi
leaq -0x18(%rbp), %rdx
callq 0x3cf50
cmpl $-0x1, %eax
jne 0x54ecc
jmp 0x54f23
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x8(%rax), %rsi
leaq 0xbf26d(%rip), %rax     # 0x114150
movq 0x148(%rax), %rdx
callq 0x3c0c0
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
je 0x54f10
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl $0x3, %edx
callq 0x3abb0
cmpl $0x0, %eax
je 0x54f12
jmp 0x54f23
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x3d000
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x5, %eax
je 0x54f9c
jmp 0x5501e
movl -0x14(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x18(%rbp), %eax
jg 0x5501e
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x0, %eax
je 0x54fdc
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x8, %eax
jne 0x55011
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rdi
callq 0x54f30
leaq 0xbe900(%rip), %rcx     # 0x1138f8
cmpq 0x760(%rcx), %rax
jbe 0x55011
movq -0x8(%rbp), %rdi
movl $0x2, %esi
callq 0x55030
jmp 0x5501e
jmp 0x55013
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x54fa2
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x5, %eax
jne 0x5505e
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x55ef0
jmp 0x550b3
movq -0x8(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x2, %eax
jne 0x55091
leaq 0x8e6b2(%rip), %rdi     # 0xe3728
leaq 0x8e5ec(%rip), %rsi     # 0xe3669
movl $0x2b6, %edx            # imm = 0x2B6
callq 0x63d40
movl $0x1, %edi
callq 0x1f3b0
leaq 0x8dae3(%rip), %rdi     # 0xe2b7b
leaq 0x8e5ca(%rip), %rsi     # 0xe3669
movl $0x2b9, %edx            # imm = 0x2B9
callq 0x63d40
movl $0x1, %edi
callq 0x1f3b0
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x5, %eax
jne 0x5516f
jmp 0x55191
leaq 0x8e4cd(%rip), %rdi     # 0xe3643
leaq 0x8e4ec(%rip), %rsi     # 0xe3669
movl $0x66, %edx
callq 0x63ca0
movl $0x1, %edi
callq 0x1f3b0
movq -0x18(%rbp), %rdi
callq 0x3aef0
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
xorl %esi, %esi
callq 0x32e50
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x55244
movq -0x40(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x54f30
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rsi
movl %eax, %edx
movl $0x1, %ecx
callq 0x33c30
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x55242
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x33330
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x5521e
jmp 0x55240
leaq 0x8e44d(%rip), %rdi     # 0xe3672
leaq 0x8e43d(%rip), %rsi     # 0xe3669
movl $0x75, %edx
callq 0x63ca0
movl $0x1, %edi
callq 0x1f3b0
jmp 0x55242
jmp 0x55244
movq -0x18(%rbp), %rdi
callq 0x3aaa0
cmpq $0x0, -0x48(%rbp)
je 0x5529f
movq -0x48(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x30(%rbp), %rcx
callq 0x33490
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x4c(%rbp)
je 0x55274
jmp 0x55296
leaq 0x8e404(%rip), %rdi     # 0xe367f
leaq 0x8e3e7(%rip), %rsi     # 0xe3669
movl $0x7e, %edx
callq 0x63ca0
movl $0x1, %edi
callq 0x1f3b0
movl $0x0, -0x4(%rbp)
jmp 0x552a6
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x2, %eax
jne 0x552d7
jmp 0x552f9
leaq 0x8e3a5(%rip), %rdi     # 0xe3683
leaq 0x8e384(%rip), %rsi     # 0xe3669
movl $0x91, %edx
callq 0x63ca0
movl $0x1, %edi
callq 0x1f3b0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x23aa0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x5531e
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x55334
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x5, %eax
jne 0x553d0
movq $0x0, -0x20(%rbp)
movl $0xffffffff, -0x24(%rbp) # imm = 0xFFFFFFFF
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x20(%rbp), %rdx
leaq -0x24(%rbp), %rcx
leaq -0x30(%rbp), %r8
callq 0x55130
cmpl $0x0, %eax
jne 0x553ce
cmpq $0x0, -0x20(%rbp)
je 0x553bf
movq -0x20(%rbp), %rdi
movl -0x24(%rbp), %eax
movl %eax, %esi
callq 0x3a2e0
movq %rax, -0x18(%rbp)
jmp 0x553cc
movq -0x30(%rbp), %rdi
callq 0x3a330
movq %rax, -0x18(%rbp)
jmp 0x553ce
jmp 0x5542e
movq -0x8(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x2, %eax
jne 0x5540a
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x38(%rbp), %rdx
callq 0x552b0
cmpl $0x0, %eax
jne 0x55408
movq -0x38(%rbp), %rdi
callq 0x3a3f0
movq -0x38(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0x5542c
leaq 0x8d76a(%rip), %rdi     # 0xe2b7b
leaq 0x8e251(%rip), %rsi     # 0xe3669
movl $0xc7, %edx
callq 0x63d40
movl $0x1, %edi
callq 0x1f3b0
jmp 0x5542e
movq -0x18(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x5, %eax
jne 0x554a7
movq $0x0, -0x20(%rbp)
movl $0xffffffff, -0x24(%rbp) # imm = 0xFFFFFFFF
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq -0x20(%rbp), %rdx
leaq -0x24(%rbp), %rcx
leaq -0x30(%rbp), %r8
callq 0x55130
cmpl $0x0, %eax
jne 0x554a5
movl $0x1, -0x4(%rbp)
jmp 0x55504
jmp 0x554fd
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x2, %eax
jne 0x554d9
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq -0x38(%rbp), %rdx
callq 0x552b0
cmpl $0x0, %eax
jne 0x554d7
movl $0x1, -0x4(%rbp)
jmp 0x55504
jmp 0x554fb
leaq 0x8d69b(%rip), %rdi     # 0xe2b7b
leaq 0x8e182(%rip), %rsi     # 0xe3669
movl $0xe7, %edx
callq 0x63d40
movl $0x1, %edi
callq 0x1f3b0
jmp 0x554fd
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq $-0x1, -0x10(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x5, %eax
jne 0x557dc
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x33f70
shrl %eax
movl %eax, %eax
movq %rax, -0x10(%rbp)
jmp 0x5582f
movq -0x8(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x2, %eax
jne 0x5580b
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x28(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x8(%rcx), %rcx
addq 0x48(%rcx), %rax
movq %rax, -0x10(%rbp)
jmp 0x5582d
leaq 0x8d369(%rip), %rdi     # 0xe2b7b
leaq 0x8de50(%rip), %rsi     # 0xe3669
movl $0x188, %edx            # imm = 0x188
callq 0x63d40
movl $0x1, %edi
callq 0x1f3b0
jmp 0x5582f
movq -0x10(%rbp), %rax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x5, %eax
jne 0x5591d
movq -0x10(%rbp), %rdi
callq 0x3aef0
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
xorl %esi, %esi
callq 0x32e50
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x55912
movq -0x28(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x54f30
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rsi
movl %eax, %edx
movl $0x1, %ecx
callq 0x33c30
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x55910
movq -0x20(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x33700
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x33700
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x1, -0x14(%rbp)
jmp 0x55912
movq -0x10(%rbp), %rdi
callq 0x3aaa0
jmp 0x55992
movq -0x8(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x2, %eax
jne 0x5596e
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x23c30
cmpl $0x0, %eax
jne 0x5596c
movl $0x1, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x25700
cmpl $0x0, %eax
je 0x5596a
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x23250
jmp 0x5596c
jmp 0x55990
leaq 0x8d206(%rip), %rdi     # 0xe2b7b
leaq 0x8dced(%rip), %rsi     # 0xe3669
movl $0x175, %edx            # imm = 0x175
callq 0x63d40
movl $0x1, %edi
callq 0x1f3b0
jmp 0x55992
movl -0x14(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl $0x30, %edi
callq 0x2e130
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rax
movl (%rax), %ecx
shrl $0x4, %ecx
andl $0xf, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x10(%rbp), %rax
cmpl $0x5, 0x8(%rax)
jne 0x559fc
movq -0x10(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x18(%rax)
jmp 0x55a44
movq -0x10(%rbp), %rax
cmpl $0x2, 0x8(%rax)
jne 0x55a20
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x241d0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x20(%rax)
jmp 0x55a42
leaq 0x8d154(%rip), %rdi     # 0xe2b7b
leaq 0x8dc3b(%rip), %rsi     # 0xe3669
movl $0x1ab, %edx            # imm = 0x1AB
callq 0x63d40
movl $0x1, %edi
callq 0x1f3b0
jmp 0x55a44
movq -0x10(%rbp), %rax
addq $0x10, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x2, 0x8(%rax)
jne 0x55a73
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x243d0
movq -0x8(%rbp), %rdi
callq 0x2e3a0
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)