// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/t_zset.c
// Function: genericZrangebyscoreCommand
void genericZrangebyscoreCommand(client *c, int reverse) {
    zrangespec range;
    robj *key = c->argv[1];
    robj *zobj;
    long offset = 0, limit = -1;
    int withscores = 0;
    unsigned long rangelen = 0;
    void *replylen = NULL;
    int minidx, maxidx;

    /* Parse the range arguments. */
    if (reverse) {
        /* Range is given as [max,min] */
        maxidx = 2; minidx = 3;
    } else {
        /* Range is given as [min,max] */
        minidx = 2; maxidx = 3;
    }

    if (zslParseRange(c->argv[minidx],c->argv[maxidx],&range) != C_OK) {
        addReplyError(c,"min or max is not a float");
        return;
    }

    /* Parse optional extra arguments. Note that ZCOUNT will exactly have
     * 4 arguments, so we'll never enter the following code path. */
    if (c->argc > 4) {
        int remaining = c->argc - 4;
        int pos = 4;

        while (remaining) {
            if (remaining >= 1 && !strcasecmp(c->argv[pos]->ptr,"withscores")) {
                pos++; remaining--;
                withscores = 1;
            } else if (remaining >= 3 && !strcasecmp(c->argv[pos]->ptr,"limit")) {
                if ((getLongFromObjectOrReply(c, c->argv[pos+1], &offset, NULL) != C_OK) ||
                    (getLongFromObjectOrReply(c, c->argv[pos+2], &limit, NULL) != C_OK)) return;
                pos += 3; remaining -= 3;
            } else {
                addReply(c,shared.syntaxerr);
                return;
            }
        }
    }

    /* Ok, lookup the key and get the range */
    if ((zobj = lookupKeyReadOrReply(c,key,shared.emptymultibulk)) == NULL ||
        checkType(c,zobj,OBJ_ZSET)) return;

    if (zobj->encoding == OBJ_ENCODING_ZIPLIST) {
        unsigned char *zl = zobj->ptr;
        unsigned char *eptr, *sptr;
        unsigned char *vstr;
        unsigned int vlen;
        long long vlong;
        double score;

        /* If reversed, get the last node in range as starting point. */
        if (reverse) {
            eptr = zzlLastInRange(zl,&range);
        } else {
            eptr = zzlFirstInRange(zl,&range);
        }

        /* No "first" element in the specified interval. */
        if (eptr == NULL) {
            addReply(c, shared.emptymultibulk);
            return;
        }

        /* Get score pointer for the first element. */
        serverAssertWithInfo(c,zobj,eptr != NULL);
        sptr = ziplistNext(zl,eptr);

        /* We don't know in advance how many matching elements there are in the
         * list, so we push this object that will represent the multi-bulk
         * length in the output buffer, and will "fix" it later */
        replylen = addDeferredMultiBulkLength(c);

        /* If there is an offset, just traverse the number of elements without
         * checking the score because that is done in the next loop. */
        while (eptr && offset--) {
            if (reverse) {
                zzlPrev(zl,&eptr,&sptr);
            } else {
                zzlNext(zl,&eptr,&sptr);
            }
        }

        while (eptr && limit--) {
            score = zzlGetScore(sptr);

            /* Abort when the node is no longer in range. */
            if (reverse) {
                if (!zslValueGteMin(score,&range)) break;
            } else {
                if (!zslValueLteMax(score,&range)) break;
            }

            /* We know the element exists, so ziplistGet should always succeed */
            serverAssertWithInfo(c,zobj,ziplistGet(eptr,&vstr,&vlen,&vlong));

            rangelen++;
            if (vstr == NULL) {
                addReplyBulkLongLong(c,vlong);
            } else {
                addReplyBulkCBuffer(c,vstr,vlen);
            }

            if (withscores) {
                addReplyDouble(c,score);
            }

            /* Move to next node */
            if (reverse) {
                zzlPrev(zl,&eptr,&sptr);
            } else {
                zzlNext(zl,&eptr,&sptr);
            }
        }
    } else if (zobj->encoding == OBJ_ENCODING_SKIPLIST) {
        zset *zs = zobj->ptr;
        zskiplist *zsl = zs->zsl;
        zskiplistNode *ln;

        /* If reversed, get the last node in range as starting point. */
        if (reverse) {
            ln = zslLastInRange(zsl,&range);
        } else {
            ln = zslFirstInRange(zsl,&range);
        }

        /* No "first" element in the specified interval. */
        if (ln == NULL) {
            addReply(c, shared.emptymultibulk);
            return;
        }

        /* We don't know in advance how many matching elements there are in the
         * list, so we push this object that will represent the multi-bulk
         * length in the output buffer, and will "fix" it later */
        replylen = addDeferredMultiBulkLength(c);

        /* If there is an offset, just traverse the number of elements without
         * checking the score because that is done in the next loop. */
        while (ln && offset--) {
            if (reverse) {
                ln = ln->backward;
            } else {
                ln = ln->level[0].forward;
            }
        }

        while (ln && limit--) {
            /* Abort when the node is no longer in range. */
            if (reverse) {
                if (!zslValueGteMin(ln->score,&range)) break;
            } else {
                if (!zslValueLteMax(ln->score,&range)) break;
            }

            rangelen++;
            addReplyBulk(c,ln->obj);

            if (withscores) {
                addReplyDouble(c,ln->score);
            }

            /* Move to next node */
            if (reverse) {
                ln = ln->backward;
            } else {
                ln = ln->level[0].forward;
            }
        }
    } else {
        serverPanic("Unknown sorted set encoding");
    }

    if (withscores) {
        rangelen *= 2;
    }

    setDeferredMultiBulkLength(c, replylen, rangelen);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movq $0x0, -0x40(%rbp)
movq $-0x1, -0x48(%rbp)
movl $0x0, -0x4c(%rbp)
movq $0x0, -0x58(%rbp)
movq $0x0, -0x60(%rbp)
cmpl $0x0, -0xc(%rbp)
je 0x64a2f
movl $0x2, -0x68(%rbp)
movl $0x3, -0x64(%rbp)
jmp 0x64a3d
movl $0x2, -0x64(%rbp)
movl $0x3, -0x68(%rbp)
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x64(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x68(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq -0x28(%rbp), %rdx
callq 0x62750
cmpl $0x0, %eax
je 0x64a80
movq -0x8(%rbp), %rdi
leaq 0xd9406(%rip), %rsi     # 0x13de7c
callq 0x42f90
jmp 0x650cb
movq -0x8(%rbp), %rax
cmpl $0x4, 0x38(%rax)
jle 0x64bb8
movq -0x8(%rbp), %rax
movl 0x38(%rax), %eax
subl $0x4, %eax
movl %eax, -0x6c(%rbp)
movl $0x4, -0x70(%rbp)
cmpl $0x0, -0x6c(%rbp)
je 0x64bb6
cmpl $0x1, -0x6c(%rbp)
jl 0x64af5
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rdi
leaq 0xd94ea(%rip), %rsi     # 0x13dfb7
callq 0x26300
cmpl $0x0, %eax
jne 0x64af5
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
movl -0x6c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x6c(%rbp)
movl $0x1, -0x4c(%rbp)
jmp 0x64bb1
cmpl $0x3, -0x6c(%rbp)
jl 0x64b93
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rdi
leaq 0xd99e1(%rip), %rsi     # 0x13e4fb
callq 0x26300
cmpl $0x0, %eax
jne 0x64b93
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x70(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rsi
leaq -0x40(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x49f20
cmpl $0x0, %eax
jne 0x64b7a
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x70(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rsi
leaq -0x48(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x49f20
cmpl $0x0, %eax
je 0x64b7f
jmp 0x650cb
movl -0x70(%rbp), %eax
addl $0x3, %eax
movl %eax, -0x70(%rbp)
movl -0x6c(%rbp), %eax
subl $0x3, %eax
movl %eax, -0x6c(%rbp)
jmp 0x64baf
movq -0x8(%rbp), %rdi
leaq 0x1140a2(%rip), %rax    # 0x178c40
movq 0x80(%rax), %rsi
callq 0x42cc0
jmp 0x650cb
jmp 0x64bb1
jmp 0x64aa2
jmp 0x64bb8
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
leaq 0x114079(%rip), %rax    # 0x178c40
movq 0x68(%rax), %rdx
callq 0x4a730
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
je 0x64bf1
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
movl $0x3, %edx
callq 0x490a0
cmpl $0x0, %eax
je 0x64bf6
jmp 0x650cb
movq -0x38(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x5, %eax
jne 0x64e90
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x78(%rbp)
cmpl $0x0, -0xc(%rbp)
je 0x64c30
movq -0x78(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x604a0
movq %rax, -0x80(%rbp)
jmp 0x64c41
movq -0x78(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x603a0
movq %rax, -0x80(%rbp)
cmpq $0x0, -0x80(%rbp)
jne 0x64c61
movq -0x8(%rbp), %rdi
leaq 0x113fed(%rip), %rax    # 0x178c40
movq 0x68(%rax), %rsi
callq 0x42cc0
jmp 0x650cb
cmpq $0x0, -0x80(%rbp)
je 0x64c6a
jmp 0x64c95
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
leaq 0xd9032(%rip), %rdx     # 0x13dcab
leaq 0xd8fa2(%rip), %rcx     # 0x13dc22
movl $0x93c, %r8d            # imm = 0x93C
callq 0x78360
movl $0x1, %edi
callq 0x263c0
movq -0x78(%rbp), %rdi
movq -0x80(%rbp), %rsi
callq 0x412e0
movq %rax, -0x88(%rbp)
movq -0x8(%rbp), %rdi
callq 0x432a0
movq %rax, -0x60(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x80(%rbp)
movb %al, -0xc1(%rbp)
je 0x64ce1
movq -0x40(%rbp), %rax
movq %rax, %rcx
addq $-0x1, %rcx
movq %rcx, -0x40(%rbp)
cmpq $0x0, %rax
setne %al
movb %al, -0xc1(%rbp)
movb -0xc1(%rbp), %al
testb $0x1, %al
jne 0x64ced
jmp 0x64d1f
cmpl $0x0, -0xc(%rbp)
je 0x64d09
movq -0x78(%rbp), %rdi
leaq -0x80(%rbp), %rsi
leaq -0x88(%rbp), %rdx
callq 0x601b0
jmp 0x64d1d
movq -0x78(%rbp), %rdi
leaq -0x80(%rbp), %rsi
leaq -0x88(%rbp), %rdx
callq 0x600e0
jmp 0x64cb6
jmp 0x64d21
xorl %eax, %eax
cmpq $0x0, -0x80(%rbp)
movb %al, -0xc2(%rbp)
je 0x64d4c
movq -0x48(%rbp), %rax
movq %rax, %rcx
addq $-0x1, %rcx
movq %rcx, -0x48(%rbp)
cmpq $0x0, %rax
setne %al
movb %al, -0xc2(%rbp)
movb -0xc2(%rbp), %al
testb $0x1, %al
jne 0x64d5b
jmp 0x64e8b
movq -0x88(%rbp), %rdi
callq 0x5fe60
movsd %xmm0, -0xa8(%rbp)
cmpl $0x0, -0xc(%rbp)
je 0x64d92
movsd -0xa8(%rbp), %xmm0
leaq -0x28(%rbp), %rdi
callq 0x5eb40
cmpl $0x0, %eax
jne 0x64d90
jmp 0x64e8b
jmp 0x64daf
movsd -0xa8(%rbp), %xmm0
leaq -0x28(%rbp), %rdi
callq 0x5ea10
cmpl $0x0, %eax
jne 0x64dad
jmp 0x64e8b
jmp 0x64daf
movq -0x80(%rbp), %rdi
leaq -0x90(%rbp), %rsi
leaq -0x94(%rbp), %rdx
leaq -0xa0(%rbp), %rcx
callq 0x41470
cmpl $0x0, %eax
je 0x64dd4
jmp 0x64dff
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
leaq 0xd8e76(%rip), %rdx     # 0x13dc59
leaq 0xd8e38(%rip), %rcx     # 0x13dc22
movl $0x959, %r8d            # imm = 0x959
callq 0x78360
movl $0x1, %edi
callq 0x263c0
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x90(%rbp)
jne 0x64e27
movq -0x8(%rbp), %rdi
movq -0xa0(%rbp), %rsi
callq 0x439f0
jmp 0x64e3f
movq -0x8(%rbp), %rdi
movq -0x90(%rbp), %rsi
movl -0x94(%rbp), %eax
movl %eax, %edx
callq 0x43920
cmpl $0x0, -0x4c(%rbp)
je 0x64e56
movq -0x8(%rbp), %rdi
movsd -0xa8(%rbp), %xmm0
callq 0x43480
cmpl $0x0, -0xc(%rbp)
je 0x64e72
movq -0x78(%rbp), %rdi
leaq -0x80(%rbp), %rsi
leaq -0x88(%rbp), %rdx
callq 0x601b0
jmp 0x64e86
movq -0x78(%rbp), %rdi
leaq -0x80(%rbp), %rsi
leaq -0x88(%rbp), %rdx
callq 0x600e0
jmp 0x64d21
jmp 0x650a9
movq -0x38(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x7, %eax
jne 0x65085
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xb8(%rbp)
cmpl $0x0, -0xc(%rbp)
je 0x64ee5
movq -0xb8(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x5ecd0
movq %rax, -0xc0(%rbp)
jmp 0x64efc
movq -0xb8(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x5eb90
movq %rax, -0xc0(%rbp)
cmpq $0x0, -0xc0(%rbp)
jne 0x64f1f
movq -0x8(%rbp), %rdi
leaq 0x113d2f(%rip), %rax    # 0x178c40
movq 0x68(%rax), %rsi
callq 0x42cc0
jmp 0x650cb
movq -0x8(%rbp), %rdi
callq 0x432a0
movq %rax, -0x60(%rbp)
xorl %eax, %eax
cmpq $0x0, -0xc0(%rbp)
movb %al, -0xc3(%rbp)
je 0x64f5a
movq -0x40(%rbp), %rax
movq %rax, %rcx
addq $-0x1, %rcx
movq %rcx, -0x40(%rbp)
cmpq $0x0, %rax
setne %al
movb %al, -0xc3(%rbp)
movb -0xc3(%rbp), %al
testb $0x1, %al
jne 0x64f66
jmp 0x64f94
cmpl $0x0, -0xc(%rbp)
je 0x64f80
movq -0xc0(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0xc0(%rbp)
jmp 0x64f92
movq -0xc0(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0xc0(%rbp)
jmp 0x64f2c
jmp 0x64f96
xorl %eax, %eax
cmpq $0x0, -0xc0(%rbp)
movb %al, -0xc4(%rbp)
je 0x64fc4
movq -0x48(%rbp), %rax
movq %rax, %rcx
addq $-0x1, %rcx
movq %rcx, -0x48(%rbp)
cmpq $0x0, %rax
setne %al
movb %al, -0xc4(%rbp)
movb -0xc4(%rbp), %al
testb $0x1, %al
jne 0x64fd3
jmp 0x65083
cmpl $0x0, -0xc(%rbp)
je 0x64ffa
movq -0xc0(%rbp), %rax
movsd 0x8(%rax), %xmm0
leaq -0x28(%rbp), %rdi
callq 0x5eb40
cmpl $0x0, %eax
jne 0x64ff8
jmp 0x65083
jmp 0x65018
movq -0xc0(%rbp), %rax
movsd 0x8(%rax), %xmm0
leaq -0x28(%rbp), %rdi
callq 0x5ea10
cmpl $0x0, %eax
jne 0x65016
jmp 0x65083
jmp 0x65018
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rdi
movq -0xc0(%rbp), %rax
movq (%rax), %rsi
callq 0x43630
cmpl $0x0, -0x4c(%rbp)
je 0x65052
movq -0x8(%rbp), %rdi
movq -0xc0(%rbp), %rax
movsd 0x8(%rax), %xmm0
callq 0x43480
cmpl $0x0, -0xc(%rbp)
je 0x6506c
movq -0xc0(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0xc0(%rbp)
jmp 0x6507e
movq -0xc0(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0xc0(%rbp)
jmp 0x64f96
jmp 0x650a7
leaq 0xd665e(%rip), %rdi     # 0x13b6ea
leaq 0xd8b8f(%rip), %rsi     # 0x13dc22
movl $0x9a5, %edx            # imm = 0x9A5
callq 0x76d80
movl $0x1, %edi
callq 0x263c0
jmp 0x650a9
cmpl $0x0, -0x4c(%rbp)
je 0x650ba
movq -0x58(%rbp), %rax
shlq %rax
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rdi
movq -0x60(%rbp), %rsi
movq -0x58(%rbp), %rdx
callq 0x43310
addq $0xd0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)