// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/t_list.c
// Function: lrangeCommand
void lrangeCommand(client *c) {
    robj *o;
    long start, end, llen, rangelen;

    if ((getLongFromObjectOrReply(c, c->argv[2], &start, NULL) != C_OK) ||
        (getLongFromObjectOrReply(c, c->argv[3], &end, NULL) != C_OK)) return;

    if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.emptymultibulk)) == NULL
         || checkType(c,o,OBJ_LIST)) return;
    llen = listTypeLength(o);

    /* convert negative indexes */
    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.emptymultibulk);
        return;
    }
    if (end >= llen) end = llen-1;
    rangelen = (end-start)+1;

    /* Return the result in form of a multi-bulk reply */
    addReplyMultiBulkLen(c,rangelen);
    if (o->encoding == OBJ_ENCODING_QUICKLIST) {
        listTypeIterator *iter = listTypeInitIterator(o, start, LIST_TAIL);

        while(rangelen--) {
            listTypeEntry entry;
            listTypeNext(iter, &entry);
            quicklistEntry *qe = &entry.entry;
            if (qe->value) {
                addReplyBulkCBuffer(c,qe->value,qe->sz);
            } else {
                addReplyBulkLongLong(c,qe->longval);
            }
        }
        listTypeReleaseIterator(iter);
    } else {
        serverPanic("List encoding is not QUICKLIST!");
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x50, %rsp
movq %rdi, %rbx
movq 0x40(%rdi), %rax
movq 0x10(%rax), %rsi
leaq 0x8(%rsp), %rdx
xorl %ecx, %ecx
callq 0x44ba1
testl %eax, %eax
jne 0x507b6
movq 0x40(%rbx), %rax
movq 0x18(%rax), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x44ba1
testl %eax, %eax
je 0x507c4
addq $0x50, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rsi
leaq 0xb6add(%rip), %r15     # 0x1072b0
movq 0x68(%r15), %rdx
movq %rbx, %rdi
callq 0x44f89
testq %rax, %rax
je 0x507b6
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
movl $0x1, %edx
callq 0x441ab
testl %eax, %eax
jne 0x507b6
movq %r14, %rdi
callq 0x4fc1c
movq 0x8(%rsp), %rcx
testq %rcx, %rcx
jns 0x50815
addq %rax, %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rsp), %rcx
testq %rcx, %rcx
jns 0x50827
addq %rax, %rcx
movq %rcx, 0x10(%rsp)
cmpq $0x0, 0x8(%rsp)
jns 0x50838
movq $0x0, 0x8(%rsp)
movq 0x8(%rsp), %r13
movq 0x10(%rsp), %rcx
cmpq %rcx, %r13
jg 0x508fd
cmpq %rax, %r13
jge 0x508fd
cmpq %rax, %rcx
jl 0x50861
decq %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %r12
movq %r12, %r15
subq %r13, %r15
incq %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4063b
movl $0xf0, %eax
andl (%r14), %eax
cmpl $0x90, %eax
jne 0x5090e
movq 0x8(%rsp), %rsi
movq %r14, %rdi
movl $0x1, %edx
callq 0x4fc5a
movq %rax, %r14
testq %r15, %r15
je 0x508e7
notq %r12
addq %r13, %r12
leaq 0x18(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x4fcf2
movq 0x38(%rsp), %rsi
testq %rsi, %rsi
je 0x508d5
movl 0x48(%rsp), %edx
movq %rbx, %rdi
callq 0x4070f
jmp 0x508e2
movq 0x40(%rsp), %rsi
movq %rbx, %rdi
callq 0x407de
incq %r12
jne 0x508b2
movq 0x10(%r14), %rdi
callq 0x3b3df
movq %r14, %rdi
callq 0x3b3df
jmp 0x507b6
movq 0x68(%r15), %rsi
movq %rbx, %rdi
callq 0x3fc19
jmp 0x507b6
leaq 0x75a55(%rip), %rdi     # 0xc636a
leaq 0x759a0(%rip), %rsi     # 0xc62bc
movl $0x1af, %edx            # imm = 0x1AF
callq 0x6558d
movl $0x1, %edi
callq 0x263d0