// File: /workspace/github_c_makefile_star2_O2/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 0x4a5ec
movq %rsi, %r14
movq %rdi, %rbx
testb $0x1, (%rsi)
je 0x4a4ae
movq 0x28(%r14), %rdi
callq 0x3a265
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 0x4a527
cmpl $0x2, %eax
jne 0x4a5fb
movl 0xc(%rbx), %eax
cmpl $0x2, %eax
je 0x4a5be
cmpl $0x6, %eax
jne 0x4a625
movq 0x18(%rbx), %rdi
movl 0x20(%rbx), %esi
leaq 0x8(%rsp), %rdx
callq 0x5a9c0
testb %al, %al
je 0x4a5ec
movq 0x8(%rsp), %rax
movq %rax, 0x40(%r14)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x48(%r14)
incl 0x20(%rbx)
jmp 0x4a5e9
movl 0xc(%rbx), %eax
cmpl $0x7, %eax
je 0x4a591
cmpl $0x5, %eax
jne 0x4a610
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x4a5ec
cmpq $0x0, 0x28(%rbx)
je 0x4a5ec
leaq 0x30(%r14), %rsi
leaq 0x38(%r14), %rdx
leaq 0x40(%r14), %rcx
callq 0x35be8
testl %eax, %eax
je 0x4a645
leaq 0x20(%rbx), %r15
leaq 0x28(%rbx), %r12
movq 0x28(%rbx), %rdi
callq 0x48535
movsd %xmm0, 0x48(%r14)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x486f3
jmp 0x4a5e9
movq 0x20(%rbx), %rax
testq %rax, %rax
je 0x4a5ec
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 0x4a5e9
movq 0x28(%rbx), %rax
testq %rax, %rax
je 0x4a5ec
movq (%rax), %rax
movq %rax, 0x28(%r14)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x48(%r14)
movq 0x20(%rbx), %rdi
callq 0x2a9d3
movq %rax, 0x28(%rbx)
pushq $0x1
popq %rbp
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6a7ff(%rip), %rdi     # 0xb4e01
leaq 0x6a549(%rip), %rsi     # 0xb4b52
movl $0x702, %edx            # imm = 0x702
jmp 0x4a638
leaq 0x67f87(%rip), %rdi     # 0xb259e
leaq 0x6a534(%rip), %rsi     # 0xb4b52
movl $0x6ff, %edx            # imm = 0x6FF
jmp 0x4a638
leaq 0x69afe(%rip), %rdi     # 0xb412a
leaq 0x6a51f(%rip), %rsi     # 0xb4b52
movl $0x6e9, %edx            # imm = 0x6E9
callq 0x57b45
pushq $0x1
popq %rdi
callq 0x263c0
leaq 0x6a7c8(%rip), %rdi     # 0xb4e14
leaq 0x6a4ff(%rip), %rsi     # 0xb4b52
movl $0x6f1, %edx            # imm = 0x6F1
callq 0x57ac8
jmp 0x4a63d