// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/t_zset.c
// Function: zuiNext
int zuiNext(zsetopsrc *op, zsetopval *val) {
    if (op->subject == NULL)
        return 0;

    if (val->flags & OPVAL_DIRTY_ROBJ)
        decrRefCount(val->ele);

    memset(val,0,sizeof(zsetopval));

    if (op->type == OBJ_SET) {
        iterset *it = &op->iter.set;
        if (op->encoding == OBJ_ENCODING_INTSET) {
            int64_t ell;

            if (!intsetGet(it->is.is,it->is.ii,&ell))
                return 0;
            val->ell = ell;
            val->score = 1.0;

            /* Move to next element. */
            it->is.ii++;
        } else if (op->encoding == OBJ_ENCODING_HT) {
            if (it->ht.de == NULL)
                return 0;
            val->ele = dictGetKey(it->ht.de);
            val->score = 1.0;

            /* Move to next element. */
            it->ht.de = dictNext(it->ht.di);
        } else {
            serverPanic("Unknown set encoding");
        }
    } else if (op->type == OBJ_ZSET) {
        iterzset *it = &op->iter.zset;
        if (op->encoding == OBJ_ENCODING_ZIPLIST) {
            /* No need to check both, but better be explicit. */
            if (it->zl.eptr == NULL || it->zl.sptr == NULL)
                return 0;
            serverAssert(ziplistGet(it->zl.eptr,&val->estr,&val->elen,&val->ell));
            val->score = zzlGetScore(it->zl.sptr);

            /* Move to next element. */
            zzlNext(it->zl.zl,&it->zl.eptr,&it->zl.sptr);
        } else if (op->encoding == OBJ_ENCODING_SKIPLIST) {
            if (it->sl.node == NULL)
                return 0;
            val->ele = it->sl.node->obj;
            val->score = it->sl.node->score;

            /* Move to next element. */
            it->sl.node = it->sl.node->level[0].forward;
        } else {
            serverPanic("Unknown sorted set encoding");
        }
    } else {
        serverPanic("Unsupported type");
    }
    return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
xorl %ebp, %ebp
cmpq $0x0, (%rdi)
je 0x568d1
movq %rsi, %r14
movq %rdi, %rbx
testb $0x1, (%rsi)
je 0x56791
movq 0x28(%r14), %rdi
callq 0x440f3
xorps %xmm0, %xmm0
movups %xmm0, 0x40(%r14)
movups %xmm0, 0x30(%r14)
movups %xmm0, 0x20(%r14)
movups %xmm0, 0x10(%r14)
movups %xmm0, (%r14)
movl 0x8(%rbx), %eax
cmpl $0x3, %eax
je 0x5680a
cmpl $0x2, %eax
jne 0x568e0
movl 0xc(%rbx), %eax
cmpl $0x2, %eax
je 0x568a1
cmpl $0x6, %eax
jne 0x5690a
movq 0x18(%rbx), %rdi
movl 0x20(%rbx), %esi
leaq 0x8(%rsp), %rdx
callq 0x68a3c
testb %al, %al
je 0x568d1
movq 0x8(%rsp), %rax
movq %rax, 0x40(%r14)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x48(%r14)
incl 0x20(%rbx)
jmp 0x568cc
movl 0xc(%rbx), %eax
cmpl $0x7, %eax
je 0x56874
cmpl $0x5, %eax
jne 0x568f5
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x568d1
cmpq $0x0, 0x28(%rbx)
je 0x568d1
leaq 0x30(%r14), %rsi
leaq 0x38(%r14), %rdx
leaq 0x40(%r14), %rcx
callq 0x3eb60
testl %eax, %eax
je 0x5692c
leaq 0x20(%rbx), %r15
leaq 0x28(%rbx), %r12
movq 0x28(%rbx), %rdi
callq 0x54417
movsd %xmm0, 0x48(%r14)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x545d7
jmp 0x568cc
movq 0x20(%rbx), %rax
testq %rax, %rax
je 0x568d1
movq (%rax), %rax
movq %rax, 0x28(%r14)
movq 0x20(%rbx), %rax
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x48(%r14)
movq 0x20(%rbx), %rax
movq 0x18(%rax), %rax
movq %rax, 0x20(%rbx)
jmp 0x568cc
movq 0x28(%rbx), %rax
testq %rax, %rax
je 0x568d1
movq (%rax), %rax
movq %rax, 0x28(%r14)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x48(%r14)
movq 0x20(%rbx), %rdi
callq 0x32116
movq %rax, 0x28(%rbx)
movl $0x1, %ebp
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x7001e(%rip), %rdi     # 0xc6905
leaq 0x6fd68(%rip), %rsi     # 0xc6656
movl $0x702, %edx            # imm = 0x702
jmp 0x5691d
leaq 0x6d37a(%rip), %rdi     # 0xc3c76
leaq 0x6fd53(%rip), %rsi     # 0xc6656
movl $0x6ff, %edx            # imm = 0x6FF
jmp 0x5691d
leaq 0x6f0d9(%rip), %rdi     # 0xc59ea
leaq 0x6fd3e(%rip), %rsi     # 0xc6656
movl $0x6e9, %edx            # imm = 0x6E9
callq 0x6558d
movl $0x1, %edi
callq 0x263d0
leaq 0x6ffe5(%rip), %rdi     # 0xc6918
leaq 0x6fd1c(%rip), %rsi     # 0xc6656
movl $0x6f1, %edx            # imm = 0x6F1
callq 0x654e1
jmp 0x56922