// File: helayzhang[P]sorted_set/./sorted_set.hh
// Function: SortedSet<int, std::tr1::hash<int>, std::equal_to<int>>::private_delete_range_by_rank(unsigned int, unsigned int)
unsigned long private_delete_range_by_rank(unsigned int start, unsigned int end) {
        SkipListNode *update[SKIPLIST_MAXLEVEL], *x;
        unsigned long traversed = 0, removed = 0;
        int i;

        x = mHeader;
        for (i = mLevel-1; i >= 0; i--) {
            while (x->mLevel[i].mForward && (traversed + x->mLevel[i].mSpan) < start) {
                traversed += x->mLevel[i].mSpan;
                x = x->mLevel[i].mForward;
            }
            update[i] = x;
        }

        traversed++;
        x = x->mLevel[0].mForward;
        while (x && traversed <= end) {
            SkipListNode *next = x->mLevel[0].mForward;
            private_delete_node(x, update);
            mDict.erase(x->mKey);
            delete x;
            removed++;
            traversed++;
            x = next;
        }
        return removed;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x140(%rbp)
movq $0x0, -0x120(%rbp)
movq $0x0, -0x128(%rbp)
movq (%rax), %rcx
movq %rcx, -0x118(%rbp)
movl 0x18(%rax), %eax
subl $0x1, %eax
movl %eax, -0x12c(%rbp)
cmpl $0x0, -0x12c(%rbp)
jl 0x617f
jmp 0x609b
movq -0x118(%rbp), %rax
movq 0x20(%rax), %rcx
movslq -0x12c(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rcx
xorl %eax, %eax
cmpq $0x0, (%rcx)
movb %al, -0x141(%rbp)
je 0x60f7
movq -0x120(%rbp), %rax
movq -0x118(%rbp), %rcx
movq 0x20(%rcx), %rcx
movslq -0x12c(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
addq %rcx, %rax
movl -0xc(%rbp), %ecx
cmpq %rcx, %rax
setb %al
movb %al, -0x141(%rbp)
movb -0x141(%rbp), %al
testb $0x1, %al
jne 0x6103
jmp 0x6155
movq -0x118(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x12c(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
addq -0x120(%rbp), %rax
movq %rax, -0x120(%rbp)
movq -0x118(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x12c(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x118(%rbp)
jmp 0x609b
movq -0x118(%rbp), %rcx
movslq -0x12c(%rbp), %rax
movq %rcx, -0x110(%rbp,%rax,8)
movl -0x12c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x12c(%rbp)
jmp 0x608c
movq -0x120(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x120(%rbp)
movq -0x118(%rbp), %rax
movq 0x20(%rax), %rax
movq (%rax), %rax
movq %rax, -0x118(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x118(%rbp)
movb %al, -0x142(%rbp)
je 0x61ce
movq -0x120(%rbp), %rax
movl -0x10(%rbp), %ecx
cmpq %rcx, %rax
setbe %al
movb %al, -0x142(%rbp)
movb -0x142(%rbp), %al
testb $0x1, %al
jne 0x61dd
jmp 0x628a
movq -0x140(%rbp), %rdi
movq -0x118(%rbp), %rax
movq 0x20(%rax), %rax
movq (%rax), %rax
movq %rax, -0x138(%rbp)
movq -0x118(%rbp), %rsi
leaq -0x110(%rbp), %rdx
callq 0x3b40
movq -0x140(%rbp), %rdi
addq $0x20, %rdi
movq -0x118(%rbp), %rsi
addq $0x10, %rsi
callq 0x62a0
movq -0x118(%rbp), %rax
movq %rax, -0x150(%rbp)
cmpq $0x0, %rax
je 0x6253
movq -0x150(%rbp), %rdi
callq 0x2ee0
movq -0x150(%rbp), %rdi
callq 0x10e0
movq -0x128(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x128(%rbp)
movq -0x120(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x120(%rbp)
movq -0x138(%rbp), %rax
movq %rax, -0x118(%rbp)
jmp 0x61a6
movq -0x128(%rbp), %rax
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
nopw (%rax,%rax)