// File: /workspace/github_cpp_makefile_star2_O3/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 0x1ac0
movsd 0x1c47(%rip), %xmm0     # 0x3008
movq %rbx, %rdi
movl $0x493e1, %esi          # imm = 0x493E1
xorl %edx, %edx
callq 0x1e74
leaq -0x88(%rbp), %rdi
movsd 0x1c31(%rip), %xmm0     # 0x3010
movl $0x493e2, %esi          # imm = 0x493E2
xorl %edx, %edx
callq 0x1e74
leaq -0x88(%rbp), %rdi
movsd 0x1c1e(%rip), %xmm0     # 0x3018
movl $0x493e3, %esi          # imm = 0x493E3
xorl %edx, %edx
callq 0x1e74
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 0x25f6
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 0x1e74
leaq -0x88(%rbp), %rdi
leaq -0x30(%rbp), %r8
xorl %esi, %esi
movq $-0x1, %rdx
xorl %ecx, %ecx
callq 0x25f6
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 0x1e74
leaq -0x88(%rbp), %rdi
leaq -0x30(%rbp), %r8
xorl %esi, %esi
movq $-0x1, %rdx
xorl %ecx, %ecx
callq 0x25f6
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 0x1b80
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 0x1c06
leaq -0x88(%rbp), %rdi
leaq -0x30(%rbp), %r8
xorl %esi, %esi
movq $-0x1, %rdx
xorl %ecx, %ecx
callq 0x25f6
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 0x1e74
leaq -0x88(%rbp), %rdi
leaq -0x30(%rbp), %r8
xorl %esi, %esi
movq $-0x1, %rdx
xorl %ecx, %ecx
callq 0x25f6
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), %rcx
movq -0x58(%rbp), %rsi
movl $0x493e3, %eax          # imm = 0x493E3
xorl %edx, %edx
divq %rsi
movl %edx, %eax
movq (%rcx,%rax,8), %rax
testq %rax, %rax
je 0x175a
cmpl $0x493e3, (%rax)        # imm = 0x493E3
je 0x172a
movq 0x10(%rax), %rax
jmp 0x1717
cmpq (%rcx,%rsi,8), %rax
je 0x175a
movsd 0x8(%rax), %xmm0
movq 0x3894(%rip), %rdi      # 0x4fd0
callq 0x1180
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x1120
jmp 0x1789
movq 0x386f(%rip), %r14      # 0x4fd0
leaq 0x18e6(%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 0x3816(%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 0x2bce
testb %al, %al
je 0x180e
movq -0x38(%rbp), %rsi
movq 0x37e0(%rip), %rdi      # 0x4fd0
callq 0x10d0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x1120
jmp 0x183d
movq 0x37bb(%rip), %r14      # 0x4fd0
leaq 0x1832(%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 0x2bce
testb %al, %al
je 0x1897
movq -0x38(%rbp), %rsi
movq 0x3757(%rip), %rdi      # 0x4fd0
callq 0x10d0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x1120
jmp 0x18c6
movq 0x3732(%rip), %r14      # 0x4fd0
leaq 0x17a9(%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 0x36d9(%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 0x25f6
movq -0x30(%rbp), %r14
movq -0x28(%rbp), %r15
cmpq %r15, %r14
je 0x193e
movq %r14, %rdi
callq 0x131c
addq $0x10, %r14
jmp 0x192b
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x1120
movsbl %al, %esi
movq 0x3674(%rip), %rbx      # 0x4fd0
movq %rbx, %rdi
callq 0x1040
movq %rax, %rdi
callq 0x10e0
leaq -0x88(%rbp), %rdi
movsd 0x168d(%rip), %xmm0     # 0x3008
movsd 0x16ad(%rip), %xmm1     # 0x3030
leaq -0x30(%rbp), %rdx
xorl %esi, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x2c40
movq -0x30(%rbp), %r14
movq -0x28(%rbp), %r15
cmpq %r15, %r14
je 0x19ae
movq %r14, %rdi
callq 0x131c
addq $0x10, %r14
jmp 0x199b
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x1120
movsbl %al, %esi
movq 0x3604(%rip), %rbx      # 0x4fd0
movq %rbx, %rdi
callq 0x1040
movq %rax, %rdi
callq 0x10e0
cmpq $0x2, -0x78(%rbp)
jl 0x19fd
sete %al
movzbl %al, %edx
xorl $0x3, %edx
leaq -0x88(%rbp), %rdi
movl $0x2, %esi
callq 0x2d56
leaq -0x88(%rbp), %rdi
leaq -0x30(%rbp), %r8
xorl %esi, %esi
movq $-0x1, %rdx
xorl %ecx, %ecx
callq 0x25f6
movq -0x30(%rbp), %r14
movq -0x28(%rbp), %r15
cmpq %r15, %r14
je 0x1a33
movq %r14, %rdi
callq 0x131c
addq $0x10, %r14
jmp 0x1a20
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x1120
movsbl %al, %esi
movq 0x357f(%rip), %rdi      # 0x4fd0
callq 0x1040
movq %rax, %rdi
callq 0x10e0
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0x1a6c
callq 0x1110
leaq -0x88(%rbp), %rdi
callq 0x1c74
xorl %eax, %eax
addq $0x78, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x1aab
jmp 0x1a9a
jmp 0x1a9a
jmp 0x1a9a
jmp 0x1a9a
jmp 0x1a9a
jmp 0x1a9a
jmp 0x1a9a
jmp 0x1a9a
movq %rax, %rbx
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0x1aab
callq 0x1110
leaq -0x88(%rbp), %rdi
callq 0x1c74
movq %rbx, %rdi
callq 0x11b0
nop