// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/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 0x530a2
movq %rsi, %r14
movq %rdi, %rbx
testb $0x1, (%rsi)
je 0x52f62
movq 0x28(%r14), %rdi
callq 0x40c8f
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 0x52fdb
cmpl $0x2, %eax
jne 0x530b1
movl 0xc(%rbx), %eax
cmpl $0x2, %eax
je 0x53072
cmpl $0x6, %eax
jne 0x530db
movq 0x18(%rbx), %rdi
movl 0x20(%rbx), %esi
leaq 0x8(%rsp), %rdx
callq 0x64e29
testb %al, %al
je 0x530a2
movq 0x8(%rsp), %rax
movq %rax, 0x40(%r14)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x48(%r14)
incl 0x20(%rbx)
jmp 0x5309d
movl 0xc(%rbx), %eax
cmpl $0x7, %eax
je 0x53045
cmpl $0x5, %eax
jne 0x530c6
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x530a2
cmpq $0x0, 0x28(%rbx)
je 0x530a2
leaq 0x30(%r14), %rsi
leaq 0x38(%r14), %rdx
leaq 0x40(%r14), %rcx
callq 0x3b7cf
testl %eax, %eax
je 0x530fd
leaq 0x20(%rbx), %r15
leaq 0x28(%rbx), %r12
movq 0x28(%rbx), %rdi
callq 0x50d7b
movsd %xmm0, 0x48(%r14)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x50f41
jmp 0x5309d
movq 0x20(%rbx), %rax
testq %rax, %rax
je 0x530a2
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 0x5309d
movq 0x28(%rbx), %rax
testq %rax, %rax
je 0x530a2
movq (%rax), %rax
movq %rax, 0x28(%r14)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x48(%r14)
movq 0x20(%rbx), %rdi
callq 0x2f015
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 0x708cd(%rip), %rdi     # 0xc3985
leaq 0x70617(%rip), %rsi     # 0xc36d6
movl $0x702, %edx            # imm = 0x702
jmp 0x530ee
leaq 0x6dbf9(%rip), %rdi     # 0xc0cc6
leaq 0x70602(%rip), %rsi     # 0xc36d6
movl $0x6ff, %edx            # imm = 0x6FF
jmp 0x530ee
leaq 0x6f988(%rip), %rdi     # 0xc2a6a
leaq 0x705ed(%rip), %rsi     # 0xc36d6
movl $0x6e9, %edx            # imm = 0x6E9
callq 0x619b4
movl $0x1, %edi
callq 0x263c0
leaq 0x70894(%rip), %rdi     # 0xc3998
leaq 0x705cb(%rip), %rsi     # 0xc36d6
movl $0x6f1, %edx            # imm = 0x6F1
callq 0x61908
jmp 0x530f3