// File: /workspace/github_cpp_makefile_star2_O3/ostafen[P]Fast-Insertion-Sort/src/test.cpp
// Function: main
int main()
{
    IntArrayGenerator gen;

    SortAlgorithm<int> *algo[] = {
        new BlockInsertionSort<int>,
        new FastInsertionSort<int>,
        new MergeSort<int>,
        new QuickSort<int>,
        new QuickInsertionSort<int>,
        new ChainedBlockInsertionSort<int>(0.666, new ChainedBlockInsertionSort<int>),
        new ChainedBlockInsertionSort<int>(0.8,
            new ChainedBlockInsertionSort<int>(0.666, new ChainedBlockInsertionSort<int>))
        };

    QuickSort<int> qs;
    MergeSort<int> ms;

    int num_algos = sizeof(algo) / sizeof(SortAlgorithm<int> *);
    for (int i = 0; i < num_algos; i++)
    {
        bool passed = true;
        int size = 512;
        for (int n = 0; n < TEST_NUM; n++)
        {
            SortAlgorithm<int> *oracle = typeid(algo[i]) != typeid(QuickSort<int>) ? (SortAlgorithm<int> *)&qs : (SortAlgorithm<int> *)&ms;

            int *A = gen.random(size);
            int *B = arrayCopy(A, size);
            cout << "e[A\r\e[0K" << algo[i]->name() << ": test "
                 << "[" << n + 1 << "/" << TEST_NUM << "]." << flush;

            oracle->sort(B, size);

            algo[i]->sort(A, size);

            if (!compare(A, B, size))
            {
                passed = false;
                break;
            }
            delete[] A;
            delete[] B;
            size = size * 2;
        }
        cout << "e[A\r\e[0K" << algo[i]->name() << ": " << (passed ? "[OK]." : "[FAILED].") << flush << endl;
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
xorl %edi, %edi
callq 0x20b0
movl %eax, %edi
callq 0x20c0
leaq 0x3892(%rip), %rax      # 0x5c18
movq %rax, 0x50(%rsp)
movabsq $0x7fffffff00000000, %rax # imm = 0x7FFFFFFF00000000
movq %rax, 0x58(%rsp)
movl $0x18, %edi
callq 0x20e0
leaq 0x38ad(%rip), %rcx      # 0x5c58
movq %rcx, (%rax)
leaq 0x38db(%rip), %rbx      # 0x5c90
movq %rbx, 0x10(%rax)
movq %rax, 0x60(%rsp)
movl $0x20, %edi
callq 0x20e0
leaq 0x3989(%rip), %rcx      # 0x5d58
movq %rcx, (%rax)
movq %rbx, 0x10(%rax)
movl $0x40a00000, 0x18(%rax) # imm = 0x40A00000
movq %rax, 0x68(%rsp)
movl $0x8, %edi
callq 0x20e0
leaq 0x38d5(%rip), %rcx      # 0x5cc8
movq %rcx, (%rax)
movq %rax, 0x70(%rsp)
movl $0x10, %edi
callq 0x20e0
leaq 0x38f4(%rip), %r13      # 0x5d00
movq %r13, (%rax)
movq %rbx, 0x8(%rax)
movq %rax, 0x78(%rsp)
movl $0x10, %edi
callq 0x20e0
leaq 0x38f7(%rip), %rcx      # 0x5d20
movq %rcx, (%rax)
movq %rbx, 0x8(%rax)
movq %rax, 0x80(%rsp)
movl $0x20, %edi
callq 0x20e0
movq %rax, %r14
movl $0x20, %edi
callq 0x20e0
movq %rax, %r15
leaq 0x3937(%rip), %rbp      # 0x5d90
movq %rbp, (%rax)
movl $0x8, %edi
callq 0x20e0
movq %rbx, (%rax)
movq %rax, 0x10(%r15)
movl $0x3f000000, 0x8(%r15)  # imm = 0x3F000000
movl $0x1, 0x18(%r15)
movq %rbp, (%r14)
movl $0x3f2a7efa, 0x8(%r14)  # imm = 0x3F2A7EFA
movq %r15, 0x10(%r14)
movq %r14, 0x88(%rsp)
movl $0x20, %edi
callq 0x20e0
movq %rax, %r14
movl $0x20, %edi
callq 0x20e0
movq %rax, %r15
movl $0x20, %edi
callq 0x20e0
movq %rax, %r12
movq %rbp, (%rax)
movl $0x8, %edi
callq 0x20e0
movq %rbx, (%rax)
movq %rax, 0x10(%r12)
movl $0x3f000000, 0x8(%r12)  # imm = 0x3F000000
movl $0x1, 0x18(%r12)
movq %rbp, (%r15)
movl $0x3f2a7efa, 0x8(%r15)  # imm = 0x3F2A7EFA
movq %r12, 0x10(%r15)
movq %rbp, (%r14)
movl $0x3f4ccccd, 0x8(%r14)  # imm = 0x3F4CCCCD
movq %r15, 0x10(%r14)
movq %r14, 0x90(%rsp)
leaq 0x40(%rsp), %rax
movq %r13, (%rax)
movq %rbx, 0x8(%rax)
movq $0x0, 0x30(%rsp)
movl $0x200, %ebx            # imm = 0x200
movl $0x0, 0xc(%rsp)
movq $0x0, 0x38(%rsp)
leaq 0x50(%rsp), %rdi
movl %ebx, %esi
callq 0x281a
movq %rax, %rbp
movl %ebx, %ebx
leaq (,%rbx,4), %r14
movq %r14, %rdi
callq 0x2030
movq %rax, %r12
movq %rax, %rdi
movq %rbp, %rsi
movq %r14, %rdx
callq 0x2090
movl $0x8, %edx
movq 0x3a67(%rip), %r15      # 0x5fd8
movq %r15, %rdi
leaq 0x1aaa(%rip), %rsi      # 0x4025
callq 0x2110
movq 0x30(%rsp), %rax
movq 0x60(%rsp,%rax,8), %r14
movq (%r14), %rax
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
callq *0x8(%rax)
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %r15, %rdi
callq 0x2110
movq %rax, %r15
movl $0x7, %edx
movq %rax, %rdi
leaq 0x1a72(%rip), %rsi      # 0x402e
callq 0x2110
movl $0x1, %edx
movq %r15, %rdi
leaq 0x1a66(%rip), %rsi      # 0x4036
callq 0x2110
movq 0x38(%rsp), %rax
leal 0x1(%rax), %r13d
movq %r15, %rdi
movl %r13d, %esi
callq 0x2160
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x1a3d(%rip), %rsi      # 0x4038
callq 0x2110
movq %r15, %rdi
movl $0xa, %esi
callq 0x2160
movq %rax, %r15
movl $0x2, %edx
movq %rax, %rdi
leaq 0x1a2b(%rip), %rsi      # 0x404a
callq 0x2110
movq %r15, %rdi
callq 0x2060
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x2648
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x20f0
movq 0x40(%rsp), %rax
leaq 0x40(%rsp), %rdi
movq %r12, %rsi
movl %ebx, %edx
callq *(%rax)
movq (%r14), %rax
movq %r14, %rdi
movq %rbp, %rsi
movl %ebx, %edx
callq *(%rax)
movl (%rbp), %eax
cmpl (%r12), %eax
jne 0x26bf
movl $0x1, %ecx
movq %rcx, %rax
cmpq %rcx, %rbx
je 0x268a
movl (%rbp,%rax,4), %edx
leaq 0x1(%rax), %rcx
cmpl (%r12,%rax,4), %edx
je 0x2674
cmpq %rbx, %rax
jb 0x26bf
movq %rbp, %rdi
callq 0x2130
movq %r12, %rdi
callq 0x2130
addl %ebx, %ebx
cmpl $0x9, 0x38(%rsp)
setae %al
movl %eax, 0xc(%rsp)
movl %r13d, %eax
movq %rax, 0x38(%rsp)
cmpl $0xa, %r13d
jne 0x2533
movl $0x8, %edx
movq 0x390d(%rip), %rbx      # 0x5fd8
movq %rbx, %rdi
leaq 0x1950(%rip), %rsi      # 0x4025
callq 0x2110
movq (%r14), %rax
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
callq *0x8(%rax)
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %rbx, %rdi
callq 0x2110
movq %rax, %rbx
movl $0x2, %edx
movq %rax, %rdi
leaq 0x192e(%rip), %rsi      # 0x403a
callq 0x2110
movl 0xc(%rsp), %ecx
testb $0x1, %cl
leaq 0x1924(%rip), %rsi      # 0x4043
leaq 0x1917(%rip), %rax      # 0x403d
cmovneq %rax, %rsi
notb %cl
movzbl %cl, %eax
andl $0x1, %eax
leaq 0x5(,%rax,4), %rdx
movq %rbx, %rdi
callq 0x2110
movq %rbx, %rdi
callq 0x2060
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x20d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2060
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x2790
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x20f0
movq 0x30(%rsp), %rcx
incq %rcx
movq %rcx, 0x30(%rsp)
cmpq $0x7, %rcx
jne 0x251d
xorl %eax, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x20, %esi
movq %r12, %rdi
callq 0x20f0
jmp 0x27d4
jmp 0x27d1
jmp 0x27e3
movq %rax, %rbx
movl $0x20, %esi
movq %r15, %rdi
callq 0x20f0
jmp 0x27e6
movq %rax, %rbx
movl $0x20, %esi
movq %r14, %rdi
jmp 0x280c
jmp 0x27f2
movq %rax, %rbx
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x2811
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x20f0
movq %rbx, %rdi
callq 0x2180
nop