// File: /workspace/github_cpp_makefile_star2_O3/Baobaobear[P]sort/demo.cpp
// Function: main
int main(void)
{
    typedef int sort_t;
    const size_t count = 1000;
    std::vector<sort_t> arr;

    for (size_t i = 0; i < count; i++)
    {
        arr.push_back(i);
    }

    baobao::random_shuffle(arr.begin(), arr.end());
    baobao::sort::insert_sort(arr.begin(), arr.end());
    print_check_sorted(arr.begin(), arr.end());

    baobao::random_shuffle(arr.begin(), arr.end());
    baobao::sort::heap_sort(arr.begin(), arr.end());
    print_check_sorted(arr.begin(), arr.end());

    baobao::random_shuffle(arr.begin(), arr.end());
    baobao::sort::shell_sort(arr.begin(), arr.end());
    print_check_sorted(arr.begin(), arr.end());

    baobao::random_shuffle(arr.begin(), arr.end());
    baobao::sort::quick_sort(arr.begin(), arr.end());
    print_check_sorted(arr.begin(), arr.end());

    baobao::random_shuffle(arr.begin(), arr.end());
    baobao::sort::merge_sort(arr.begin(), arr.end());
    print_check_sorted(arr.begin(), arr.end());

    baobao::random_shuffle(arr.begin(), arr.end());
    baobao::sort::tim_sort(arr.begin(), arr.end());
    print_check_sorted(arr.begin(), arr.end());

    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
xorps %xmm0, %xmm0
movq %rsp, %rbx
movaps %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
xorl %r15d, %r15d
leaq 0x1c(%rsp), %r14
movl %r15d, 0x1c(%rsp)
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x16c5
movl %r15d, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x16d0
movq %rbx, %rdi
movq %r14, %rdx
callq 0xe8be
incq %r15
cmpq $0x3e8, %r15            # imm = 0x3E8
jne 0x16a6
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x1af2
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0xe9f5
movq (%rsp), %rcx
movq 0x8(%rsp), %rax
addq $0x4, %rcx
leaq 0xfa55(%rip), %rdi      # 0x11161
leaq 0xfa48(%rip), %rdx      # 0x1115b
cmpq %rax, %rcx
je 0x1729
movl (%rcx), %esi
leaq 0x4(%rcx), %r8
cmpl -0x4(%rcx), %esi
movq %r8, %rcx
jge 0x1713
movq %rdx, %rdi
callq 0x1160
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x1af2
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0xea51
movq (%rsp), %rcx
movq 0x8(%rsp), %rax
addq $0x4, %rcx
leaq 0xfa03(%rip), %rdi      # 0x11161
leaq 0xf9f6(%rip), %rdx      # 0x1115b
cmpq %rax, %rcx
je 0x177b
movl (%rcx), %esi
leaq 0x4(%rcx), %r8
cmpl -0x4(%rcx), %esi
movq %r8, %rcx
jge 0x1765
movq %rdx, %rdi
callq 0x1160
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x1af2
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0xeb17
movq (%rsp), %rcx
movq 0x8(%rsp), %rax
addq $0x4, %rcx
leaq 0xf9b1(%rip), %rdi      # 0x11161
leaq 0xf9a4(%rip), %rdx      # 0x1115b
cmpq %rax, %rcx
je 0x17cd
movl (%rcx), %esi
leaq 0x4(%rcx), %r8
cmpl -0x4(%rcx), %esi
movq %r8, %rcx
jge 0x17b7
movq %rdx, %rdi
callq 0x1160
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x1af2
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
movq %rsi, %rax
subq %rdi, %rax
cmpq $0x5, %rax
jl 0x1803
callq 0xed91
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
addq $0x4, %rdi
leaq 0xf953(%rip), %rax      # 0x11161
leaq 0xf946(%rip), %rcx      # 0x1115b
cmpq %rsi, %rdi
je 0x182b
movl (%rdi), %edx
leaq 0x4(%rdi), %r8
cmpl -0x4(%rdi), %edx
movq %r8, %rdi
jge 0x1815
movq %rcx, %rax
movq %rax, %rdi
callq 0x1160
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x1af2
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0xf118
movq (%rsp), %rcx
movq 0x8(%rsp), %rax
addq $0x4, %rcx
leaq 0xf8fe(%rip), %rdi      # 0x11161
leaq 0xf8f1(%rip), %rdx      # 0x1115b
cmpq %rax, %rcx
je 0x1880
movl (%rcx), %esi
leaq 0x4(%rcx), %r8
cmpl -0x4(%rcx), %esi
movq %r8, %rcx
jge 0x186a
movq %rdx, %rdi
callq 0x1160
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x1af2
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
movq %rsi, %rdx
subq %rdi, %rdx
sarq $0x2, %rdx
callq 0xf389
movq (%rsp), %rcx
movq 0x8(%rsp), %rax
addq $0x4, %rcx
leaq 0xf8a2(%rip), %rdi      # 0x11161
leaq 0xf895(%rip), %rdx      # 0x1115b
cmpq %rax, %rcx
je 0x18dc
movl (%rcx), %esi
leaq 0x4(%rcx), %r8
cmpl -0x4(%rcx), %esi
movq %r8, %rcx
jge 0x18c6
movq %rdx, %rdi
callq 0x1160
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x18ef
callq 0x1100
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
jmp 0x18fd
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x190e
callq 0x1100
movq %rbx, %rdi
callq 0x1190