// File: helayzhang[P]sorted_set/./sorted_set.hh
// Function: SortedSet<int, std::tr1::hash<int>, std::equal_to<int>>::zrange_withscores_generic(long, long, bool, std::vector<std::pair<int, double>, std::allocator<std::pair<int, double>>>&)
void zrange_withscores_generic(long start, long end, bool reverse, KeyScoreVecType &result) {
        result.clear();

        /* Sanitize indexes. */
        long llen = length();
        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) {
            return;
        }
        if (end >= llen) end = llen-1;
        unsigned long rangelen = (end-start)+1;

        SkipListNode *ln;
        /* Check if starting point is trivial, before doing log(N) lookup. */
        if (reverse) {
            ln = mTail;
            if (start > 0)
                ln = get_element_by_rank(llen-start);
        } else {
            ln = mHeader->mLevel[0].mForward;
            if (start > 0)
                ln = get_element_by_rank(start+1);
        }

        while(rangelen--) {
            assert(ln != NULL);
            result.push_back(std::make_pair(ln->mKey, ln->mScore));
            ln = reverse ? ln->mBackward : ln->mLevel[0].mForward;
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movb %cl, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
andb $0x1, %al
movb %al, -0x19(%rbp)
movq %r8, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x28(%rbp), %rdi
callq 0x4b70
movq -0x58(%rbp), %rdi
callq 0x4b90
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x10(%rbp)
jge 0x4a00
movq -0x30(%rbp), %rax
addq -0x10(%rbp), %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x18(%rbp)
jge 0x4a13
movq -0x30(%rbp), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
jge 0x4a22
movq $0x0, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq -0x18(%rbp), %rax
jg 0x4a36
movq -0x10(%rbp), %rax
cmpq -0x30(%rbp), %rax
jl 0x4a3b
jmp 0x4b66
movq -0x18(%rbp), %rax
cmpq -0x30(%rbp), %rax
jl 0x4a51
movq -0x30(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
subq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
testb $0x1, -0x19(%rbp)
je 0x4a91
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x10(%rbp)
jle 0x4a8f
movq -0x58(%rbp), %rdi
movq -0x30(%rbp), %rsi
subq -0x10(%rbp), %rsi
callq 0x4bb0
movq %rax, -0x40(%rbp)
jmp 0x4ac1
movq -0x58(%rbp), %rax
movq (%rax), %rax
movq 0x20(%rax), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x10(%rbp)
jle 0x4abf
movq -0x58(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x1, %rsi
callq 0x4bb0
movq %rax, -0x40(%rbp)
jmp 0x4ac1
jmp 0x4ac3
movq -0x38(%rbp), %rax
movq %rax, %rcx
addq $-0x1, %rcx
movq %rcx, -0x38(%rbp)
cmpq $0x0, %rax
je 0x4b66
cmpq $0x0, -0x40(%rbp)
je 0x4ae5
jmp 0x4b04
leaq 0x2576(%rip), %rdi      # 0x7062
leaq 0x257a(%rip), %rsi      # 0x706d
movl $0x1b7, %edx            # imm = 0x1B7
leaq 0x257e(%rip), %rcx      # 0x707d
callq 0x10b0
movq -0x28(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x40(%rbp), %rdi
addq $0x10, %rdi
movq -0x40(%rbp), %rsi
addq $0x8, %rsi
callq 0x4ce0
movq -0x60(%rbp), %rdi
movl %eax, -0x50(%rbp)
movsd %xmm0, -0x48(%rbp)
leaq -0x50(%rbp), %rsi
callq 0x4cb0
testb $0x1, -0x19(%rbp)
je 0x4b4a
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x68(%rbp)
jmp 0x4b59
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
movq (%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x40(%rbp)
jmp 0x4ac3
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax)