// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/t_zset.c
// Function: zremrangeGenericCommand
void zremrangeGenericCommand(client *c, int rangetype) {
    robj *key = c->argv[1];
    robj *zobj;
    int keyremoved = 0;
    unsigned long deleted = 0;
    zrangespec range;
    zlexrangespec lexrange;
    long start, end, llen;

    /* Step 1: Parse the range. */
    if (rangetype == ZRANGE_RANK) {
        if ((getLongFromObjectOrReply(c,c->argv[2],&start,NULL) != C_OK) ||
            (getLongFromObjectOrReply(c,c->argv[3],&end,NULL) != C_OK))
            return;
    } else if (rangetype == ZRANGE_SCORE) {
        if (zslParseRange(c->argv[2],c->argv[3],&range) != C_OK) {
            addReplyError(c,"min or max is not a float");
            return;
        }
    } else if (rangetype == ZRANGE_LEX) {
        if (zslParseLexRange(c->argv[2],c->argv[3],&lexrange) != C_OK) {
            addReplyError(c,"min or max not valid string range item");
            return;
        }
    }

    /* Step 2: Lookup & range sanity checks if needed. */
    if ((zobj = lookupKeyWriteOrReply(c,key,shared.czero)) == NULL ||
        checkType(c,zobj,OBJ_ZSET)) goto cleanup;

    if (rangetype == ZRANGE_RANK) {
        /* Sanitize indexes. */
        llen = zsetLength(zobj);
        if (start < 0) start = llen+start;
        if (end < 0) end = llen+end;
        if (start < 0) start = 0;

        /* Invariant: start >= 0, so this test will be true when end < 0.
         * The range is empty when start > end or start >= length. */
        if (start > end || start >= llen) {
            addReply(c,shared.czero);
            goto cleanup;
        }
        if (end >= llen) end = llen-1;
    }

    /* Step 3: Perform the range deletion operation. */
    if (zobj->encoding == OBJ_ENCODING_ZIPLIST) {
        switch(rangetype) {
        case ZRANGE_RANK:
            zobj->ptr = zzlDeleteRangeByRank(zobj->ptr,start+1,end+1,&deleted);
            break;
        case ZRANGE_SCORE:
            zobj->ptr = zzlDeleteRangeByScore(zobj->ptr,&range,&deleted);
            break;
        case ZRANGE_LEX:
            zobj->ptr = zzlDeleteRangeByLex(zobj->ptr,&lexrange,&deleted);
            break;
        }
        if (zzlLength(zobj->ptr) == 0) {
            dbDelete(c->db,key);
            keyremoved = 1;
        }
    } else if (zobj->encoding == OBJ_ENCODING_SKIPLIST) {
        zset *zs = zobj->ptr;
        switch(rangetype) {
        case ZRANGE_RANK:
            deleted = zslDeleteRangeByRank(zs->zsl,start+1,end+1,zs->dict);
            break;
        case ZRANGE_SCORE:
            deleted = zslDeleteRangeByScore(zs->zsl,&range,zs->dict);
            break;
        case ZRANGE_LEX:
            deleted = zslDeleteRangeByLex(zs->zsl,&lexrange,zs->dict);
            break;
        }
        if (htNeedsResize(zs->dict)) dictResize(zs->dict);
        if (dictSize(zs->dict) == 0) {
            dbDelete(c->db,key);
            keyremoved = 1;
        }
    } else {
        serverPanic("Unknown sorted set encoding");
    }

    /* Step 4: Notifications and reply. */
    if (deleted) {
        char *event[3] = {"zremrangebyrank","zremrangebyscore","zremrangebylex"};
        signalModifiedKey(c->db,key);
        notifyKeyspaceEvent(NOTIFY_ZSET,event[rangetype],key,c->db->id);
        if (keyremoved)
            notifyKeyspaceEvent(NOTIFY_GENERIC,"del",key,c->db->id);
    }
    server.dirty += deleted;
    addReplyLongLong(c,deleted);

cleanup:
    if (rangetype == ZRANGE_LEX) zslFreeLexRange(&lexrange);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
movl $0x0, -0x24(%rbp)
movq $0x0, -0x30(%rbp)
cmpl $0x0, -0xc(%rbp)
jne 0x62305
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rsi
leaq -0x68(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x49f20
cmpl $0x0, %eax
jne 0x622fb
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x18(%rax), %rsi
leaq -0x70(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x49f20
cmpl $0x0, %eax
je 0x62300
jmp 0x62739
jmp 0x6238f
cmpl $0x1, -0xc(%rbp)
jne 0x62348
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x18(%rax), %rsi
leaq -0x48(%rbp), %rdx
callq 0x62750
cmpl $0x0, %eax
je 0x62346
movq -0x8(%rbp), %rdi
leaq 0xdbb40(%rip), %rsi     # 0x13de7c
callq 0x42f90
jmp 0x62739
jmp 0x6238d
cmpl $0x2, -0xc(%rbp)
jne 0x6238b
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x18(%rax), %rsi
leaq -0x60(%rbp), %rdx
callq 0x62950
cmpl $0x0, %eax
je 0x62389
movq -0x8(%rbp), %rdi
leaq 0xdbb17(%rip), %rsi     # 0x13de96
callq 0x42f90
jmp 0x62739
jmp 0x6238b
jmp 0x6238d
jmp 0x6238f
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq 0x1168a2(%rip), %rax    # 0x178c40
movq 0x20(%rax), %rdx
callq 0x4a780
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
je 0x623c8
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl $0x3, %edx
callq 0x490a0
cmpl $0x0, %eax
je 0x623cd
jmp 0x6272a
cmpl $0x0, -0xc(%rbp)
jne 0x62460
movq -0x20(%rbp), %rdi
callq 0x61060
movl %eax, %eax
movq %rax, -0x78(%rbp)
cmpq $0x0, -0x68(%rbp)
jge 0x623f9
movq -0x78(%rbp), %rax
addq -0x68(%rbp), %rax
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x70(%rbp)
jge 0x6240c
movq -0x78(%rbp), %rax
addq -0x70(%rbp), %rax
movq %rax, -0x70(%rbp)
cmpq $0x0, -0x68(%rbp)
jge 0x6241b
movq $0x0, -0x68(%rbp)
movq -0x68(%rbp), %rax
cmpq -0x70(%rbp), %rax
jg 0x6242f
movq -0x68(%rbp), %rax
cmpq -0x78(%rbp), %rax
jl 0x62448
movq -0x8(%rbp), %rdi
leaq 0x116806(%rip), %rax    # 0x178c40
movq 0x20(%rax), %rsi
callq 0x42cc0
jmp 0x6272a
movq -0x70(%rbp), %rax
cmpq -0x78(%rbp), %rax
jl 0x6245e
movq -0x78(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x62460
movq -0x20(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x5, %eax
jne 0x62541
movl -0xc(%rbp), %eax
movl %eax, -0xa4(%rbp)
testl %eax, %eax
je 0x6249e
jmp 0x62484
movl -0xa4(%rbp), %eax
subl $0x1, %eax
je 0x624d0
jmp 0x62491
movl -0xa4(%rbp), %eax
subl $0x2, %eax
je 0x624f2
jmp 0x62512
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x68(%rbp), %rax
addq $0x1, %rax
movl %eax, %esi
movq -0x70(%rbp), %rax
addq $0x1, %rax
movl %eax, %edx
leaq -0x30(%rbp), %rcx
callq 0x61000
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0x62512
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
leaq -0x48(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0x60e30
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0x62512
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
leaq -0x60(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0x60f20
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x600c0
cmpl $0x0, %eax
jne 0x6253c
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x4ac10
movl $0x1, -0x24(%rbp)
jmp 0x6266a
movq -0x20(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x7, %eax
jne 0x62646
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x80(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0xa8(%rbp)
testl %eax, %eax
je 0x6258b
jmp 0x62571
movl -0xa8(%rbp), %eax
subl $0x1, %eax
je 0x625b9
jmp 0x6257e
movl -0xa8(%rbp), %eax
subl $0x2, %eax
je 0x625d7
jmp 0x625f3
movq -0x80(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x68(%rbp), %rax
addq $0x1, %rax
movl %eax, %esi
movq -0x70(%rbp), %rax
addq $0x1, %rax
movl %eax, %edx
movq -0x80(%rbp), %rax
movq (%rax), %rcx
callq 0x5f360
movq %rax, -0x30(%rbp)
jmp 0x625f3
movq -0x80(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x80(%rbp), %rax
movq (%rax), %rdx
leaq -0x48(%rbp), %rsi
callq 0x5ee10
movq %rax, -0x30(%rbp)
jmp 0x625f3
movq -0x80(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x80(%rbp), %rax
movq (%rax), %rdx
leaq -0x60(%rbp), %rsi
callq 0x5f0a0
movq %rax, -0x30(%rbp)
movq -0x80(%rbp), %rax
movq (%rax), %rdi
callq 0x30420
cmpl $0x0, %eax
je 0x62610
movq -0x80(%rbp), %rax
movq (%rax), %rdi
callq 0x2d3e0
movq -0x80(%rbp), %rax
movq (%rax), %rax
movq 0x28(%rax), %rax
movq -0x80(%rbp), %rcx
movq (%rcx), %rcx
addq 0x48(%rcx), %rax
cmpq $0x0, %rax
jne 0x62644
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x4ac10
movl $0x1, -0x24(%rbp)
jmp 0x62668
leaq 0xd909d(%rip), %rdi     # 0x13b6ea
leaq 0xdb5ce(%rip), %rsi     # 0x13dc22
movl $0x615, %edx            # imm = 0x615
callq 0x76d80
movl $0x1, %edi
callq 0x263c0
jmp 0x6266a
cmpq $0x0, -0x30(%rbp)
je 0x626fd
movq 0x10dfe4(%rip), %rax    # 0x170660
movq %rax, -0xa0(%rbp)
movq 0x10dfde(%rip), %rax    # 0x170668
movq %rax, -0x98(%rbp)
movq 0x10dfd8(%rip), %rax    # 0x170670
movq %rax, -0x90(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x4aa60
movslq -0xc(%rbp), %rax
movq -0xa0(%rbp,%rax,8), %rsi
movq -0x18(%rbp), %rdx
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl 0x30(%rax), %ecx
movl $0x80, %edi
callq 0x9ce20
cmpl $0x0, -0x24(%rbp)
je 0x626fb
movq -0x18(%rbp), %rdx
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl 0x30(%rax), %ecx
movl $0x4, %edi
leaq 0xd6da2(%rip), %rsi     # 0x139498
callq 0x9ce20
jmp 0x626fd
movq -0x30(%rbp), %rcx
leaq 0x115ad0(%rip), %rax    # 0x1781d8
addq 0x720(%rax), %rcx
leaq 0x115ac2(%rip), %rax    # 0x1781d8
movq %rcx, 0x720(%rax)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x43780
cmpl $0x2, -0xc(%rbp)
jne 0x62739
leaq -0x60(%rbp), %rdi
callq 0x5fa40
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)