// File: /workspace/github_cpp_makefile_star2_O1/helayzhang[P]sorted_set/example.cc
// Function: main
int main()
{
    unsigned long rank;
    double score;
    SortedSet<int> sortedSet;
    sortedSet.zadd(300001, 300);
    sortedSet.zadd(300002, 299.9);
    sortedSet.zadd(300003, 100000);

    std::vector< std::pair<int, double> > result;

    sortedSet.zrange_withscores(0, -1, result);
    std::for_each(result.begin(), result.end(), echo_ranking);
    std::cout << std::endl;

    sortedSet.zadd(300004, 40);
    sortedSet.zrange_withscores(0, -1, result);
    std::for_each(result.begin(), result.end(), echo_ranking);
    std::cout << std::endl;

    sortedSet.zadd(300005, 40);
    sortedSet.zrange_withscores(0, -1, result);
    std::for_each(result.begin(), result.end(), echo_ranking);
    std::cout << std::endl;

    std::cout << sortedSet.zcount(40, 300, true, true) << std::endl;
    std::cout << std::endl;

    sortedSet.zrem(300005);
    sortedSet.zrange_withscores(0, -1, result);
    std::for_each(result.begin(), result.end(), echo_ranking);
    std::cout << std::endl;

    sortedSet.zincrby(300004, 500);
    sortedSet.zrange_withscores(0, -1, result);
    std::for_each(result.begin(), result.end(), echo_ranking);
    std::cout << std::endl;

    if (sortedSet.zscore(300003, score))
        std::cout << score << std::endl;
    else 
        std::cout << "nil" << std::endl;
    std::cout << std::endl;

    if (sortedSet.zrank(300002, rank)) 
        std::cout << rank << std::endl;
    else 
        std::cout << "nil" << std::endl;
    if (sortedSet.zrevrank(300002, rank)) 
        std::cout << rank << std::endl;
    else 
        std::cout << "nil" << std::endl;
    std::cout << std::endl;

    sortedSet.zrevrange_withscores(0, 1, result);
    std::for_each(result.begin(), result.end(), echo_ranking);
    std::cout << std::endl;

    sortedSet.zrangebyscore_withscores(300, 1000, result);
    std::for_each(result.begin(), result.end(), echo_ranking);
    std::cout << std::endl;

    sortedSet.zremrangebyrank(1, 2);
    sortedSet.zrange_withscores(0, -1, result);
    std::for_each(result.begin(), result.end(), echo_ranking);
    std::cout << std::endl;

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x78, %rsp
leaq -0x88(%rbp), %rbx
movq %rbx, %rdi
callq 0x1ade
movsd 0x1c47(%rip), %xmm0     # 0x3008
movq %rbx, %rdi
movl $0x493e1, %esi          # imm = 0x493E1
xorl %edx, %edx
callq 0x1eaa
leaq -0x88(%rbp), %rdi
movsd 0x1c31(%rip), %xmm0     # 0x3010
movl $0x493e2, %esi          # imm = 0x493E2
xorl %edx, %edx
callq 0x1eaa
leaq -0x88(%rbp), %rdi
movsd 0x1c1e(%rip), %xmm0     # 0x3018
movl $0x493e3, %esi          # imm = 0x493E3
xorl %edx, %edx
callq 0x1eaa
xorps %xmm0, %xmm0
leaq -0x30(%rbp), %r8
movaps %xmm0, (%r8)
movq $0x0, 0x10(%r8)
leaq -0x88(%rbp), %rdi
xorl %esi, %esi
movq $-0x1, %rdx
xorl %ecx, %ecx
callq 0x2658
movq -0x30(%rbp), %rbx
movq -0x28(%rbp), %r14
cmpq %r14, %rbx
je 0x144b
movq %rbx, %rdi
callq 0x131c
addq $0x10, %rbx
jmp 0x1438
movq 0x3b7e(%rip), %rdi      # 0x4fd0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x1120
movsbl %al, %esi
movq 0x3b63(%rip), %rbx      # 0x4fd0
movq %rbx, %rdi
callq 0x1040
movq %rax, %rdi
callq 0x10e0
leaq -0x88(%rbp), %rdi
movsd 0x1b94(%rip), %xmm0     # 0x3020
movl $0x493e4, %esi          # imm = 0x493E4
xorl %edx, %edx
callq 0x1eaa
leaq -0x88(%rbp), %rdi
leaq -0x30(%rbp), %r8
xorl %esi, %esi
movq $-0x1, %rdx
xorl %ecx, %ecx
callq 0x2658
movq -0x30(%rbp), %r14
movq -0x28(%rbp), %r15
cmpq %r15, %r14
je 0x14ce
movq %r14, %rdi
callq 0x131c
addq $0x10, %r14
jmp 0x14bb
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x1120
movsbl %al, %esi
movq 0x3ae4(%rip), %rbx      # 0x4fd0
movq %rbx, %rdi
callq 0x1040
movq %rax, %rdi
callq 0x10e0
leaq -0x88(%rbp), %rdi
movsd 0x1b15(%rip), %xmm0     # 0x3020
movl $0x493e5, %esi          # imm = 0x493E5
xorl %edx, %edx
callq 0x1eaa
leaq -0x88(%rbp), %rdi
leaq -0x30(%rbp), %r8
xorl %esi, %esi
movq $-0x1, %rdx
xorl %ecx, %ecx
callq 0x2658
movq -0x30(%rbp), %r14
movq -0x28(%rbp), %r15
cmpq %r15, %r14
je 0x154d
movq %r14, %rdi
callq 0x131c
addq $0x10, %r14
jmp 0x153a
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x1120
movsbl %al, %esi
movq 0x3a65(%rip), %rdi      # 0x4fd0
callq 0x1040
movq %rax, %rdi
callq 0x10e0
leaq -0x88(%rbp), %rdi
movsd 0x1a99(%rip), %xmm0     # 0x3020
movsd 0x1a79(%rip), %xmm1     # 0x3008
movl $0x1, %esi
movl $0x1, %edx
callq 0x1b9e
movq 0x3a2b(%rip), %rbx      # 0x4fd0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x10d0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x1120
movsbl %al, %esi
movq %r14, %rdi
callq 0x1040
movq %rax, %rdi
callq 0x10e0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x1120
movsbl %al, %esi
movq 0x39d8(%rip), %rbx      # 0x4fd0
movq %rbx, %rdi
callq 0x1040
movq %rax, %rdi
callq 0x10e0
leaq -0x88(%rbp), %rdi
movl $0x493e5, %esi          # imm = 0x493E5
callq 0x1c24
leaq -0x88(%rbp), %rdi
leaq -0x30(%rbp), %r8
xorl %esi, %esi
movq $-0x1, %rdx
xorl %ecx, %ecx
callq 0x2658
movq -0x30(%rbp), %r14
movq -0x28(%rbp), %r15
cmpq %r15, %r14
je 0x164f
movq %r14, %rdi
callq 0x131c
addq $0x10, %r14
jmp 0x163c
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x1120
movsbl %al, %esi
movq 0x3963(%rip), %rbx      # 0x4fd0
movq %rbx, %rdi
callq 0x1040
movq %rax, %rdi
callq 0x10e0
leaq -0x88(%rbp), %rdi
movsd 0x199c(%rip), %xmm0     # 0x3028
movl $0x493e4, %esi          # imm = 0x493E4
movl $0x1, %edx
callq 0x1eaa
leaq -0x88(%rbp), %rdi
leaq -0x30(%rbp), %r8
xorl %esi, %esi
movq $-0x1, %rdx
xorl %ecx, %ecx
callq 0x2658
movq -0x30(%rbp), %r14
movq -0x28(%rbp), %r15
cmpq %r15, %r14
je 0x16d1
movq %r14, %rdi
callq 0x131c
addq $0x10, %r14
jmp 0x16be
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x1120
movsbl %al, %esi
movq 0x38e1(%rip), %rbx      # 0x4fd0
movq %rbx, %rdi
callq 0x1040
movq %rax, %rdi
callq 0x10e0
movq -0x60(%rbp), %rsi
movq -0x58(%rbp), %rdi
xorl %ecx, %ecx
movl $0x493e3, %eax          # imm = 0x493E3
xorl %edx, %edx
divq %rdi
movl %edx, %eax
movq (%rsi,%rax,8), %rax
testq %rax, %rax
je 0x1736
xorl %ecx, %ecx
cmpl $0x493e3, (%rax)        # imm = 0x493E3
je 0x1733
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0x1720
jmp 0x1736
movq %rax, %rcx
testq %rcx, %rcx
jne 0x173f
movq (%rsi,%rdi,8), %rcx
movq (%rsi,%rdi,8), %rax
cmpq %rax, %rcx
je 0x174f
movsd 0x8(%rcx), %xmm0
jmp 0x174f
cmpq %rax, %rcx
je 0x1779
movq 0x3875(%rip), %rdi      # 0x4fd0
callq 0x1180
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x1120
jmp 0x17a8
movq 0x3850(%rip), %r14      # 0x4fd0
leaq 0x18c7(%rip), %rsi      # 0x304e
movl $0x3, %edx
movq %r14, %rdi
callq 0x1140
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x1120
movsbl %al, %esi
movq %r14, %rdi
callq 0x1040
movq %rax, %rdi
callq 0x10e0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x1120
movsbl %al, %esi
movq 0x37f7(%rip), %rbx      # 0x4fd0
movq %rbx, %rdi
callq 0x1040
movq %rax, %rdi
callq 0x10e0
leaq -0x88(%rbp), %rdi
leaq -0x38(%rbp), %rcx
movl $0x493e2, %esi          # imm = 0x493E2
xorl %edx, %edx
callq 0x2c0a
testb %al, %al
je 0x182d
movq -0x38(%rbp), %rsi
movq 0x37c1(%rip), %rdi      # 0x4fd0
callq 0x10d0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x1120
jmp 0x185c
movq 0x379c(%rip), %r14      # 0x4fd0
leaq 0x1813(%rip), %rsi      # 0x304e
movl $0x3, %edx
movq %r14, %rdi
callq 0x1140
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x1120
movsbl %al, %esi
movq %r14, %rdi
callq 0x1040
movq %rax, %rdi
callq 0x10e0
leaq -0x88(%rbp), %rdi
leaq -0x38(%rbp), %rcx
movl $0x493e2, %esi          # imm = 0x493E2
movl $0x1, %edx
callq 0x2c0a
testb %al, %al
je 0x18b6
movq -0x38(%rbp), %rsi
movq 0x3738(%rip), %rdi      # 0x4fd0
callq 0x10d0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x1120
jmp 0x18e5
movq 0x3713(%rip), %r14      # 0x4fd0
leaq 0x178a(%rip), %rsi      # 0x304e
movl $0x3, %edx
movq %r14, %rdi
callq 0x1140
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x1120
movsbl %al, %esi
movq %r14, %rdi
callq 0x1040
movq %rax, %rdi
callq 0x10e0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x1120
movsbl %al, %esi
movq 0x36ba(%rip), %rbx      # 0x4fd0
movq %rbx, %rdi
callq 0x1040
movq %rax, %rdi
callq 0x10e0
leaq -0x88(%rbp), %rdi
leaq -0x30(%rbp), %r8
movl $0x1, %edx
xorl %esi, %esi
movl $0x1, %ecx
callq 0x2658
movq -0x30(%rbp), %r14
movq -0x28(%rbp), %r15
cmpq %r15, %r14
je 0x195d
movq %r14, %rdi
callq 0x131c
addq $0x10, %r14
jmp 0x194a
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x1120
movsbl %al, %esi
movq 0x3655(%rip), %rbx      # 0x4fd0
movq %rbx, %rdi
callq 0x1040
movq %rax, %rdi
callq 0x10e0
leaq -0x88(%rbp), %rdi
movsd 0x166e(%rip), %xmm0     # 0x3008
movsd 0x168e(%rip), %xmm1     # 0x3030
leaq -0x30(%rbp), %rdx
xorl %esi, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x2c96
movq -0x30(%rbp), %r14
movq -0x28(%rbp), %r15
cmpq %r15, %r14
je 0x19cd
movq %r14, %rdi
callq 0x131c
addq $0x10, %r14
jmp 0x19ba
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x1120
movsbl %al, %esi
movq 0x35e5(%rip), %rbx      # 0x4fd0
movq %rbx, %rdi
callq 0x1040
movq %rax, %rdi
callq 0x10e0
cmpq $0x2, -0x78(%rbp)
jl 0x1a1c
sete %al
movzbl %al, %edx
xorl $0x3, %edx
leaq -0x88(%rbp), %rdi
movl $0x2, %esi
callq 0x2db2
leaq -0x88(%rbp), %rdi
leaq -0x30(%rbp), %r8
xorl %esi, %esi
movq $-0x1, %rdx
xorl %ecx, %ecx
callq 0x2658
movq -0x30(%rbp), %r14
movq -0x28(%rbp), %r15
cmpq %r15, %r14
je 0x1a52
movq %r14, %rdi
callq 0x131c
addq $0x10, %r14
jmp 0x1a3f
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x1120
movsbl %al, %esi
movq 0x3560(%rip), %rdi      # 0x4fd0
callq 0x1040
movq %rax, %rdi
callq 0x10e0
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0x1a8b
callq 0x1110
leaq -0x88(%rbp), %rdi
callq 0x1ca6
xorl %eax, %eax
addq $0x78, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x1aca
jmp 0x1ab9
jmp 0x1ab9
jmp 0x1ab9
jmp 0x1ab9
jmp 0x1ab9
jmp 0x1ab9
jmp 0x1ab9
jmp 0x1ab9
movq %rax, %rbx
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0x1aca
callq 0x1110
leaq -0x88(%rbp), %rdi
callq 0x1ca6
movq %rbx, %rdi
callq 0x11b0