// File: /workspace/github_cpp_makefile_star2_O3/kkloberdanz[P]Sort/main.cpp
// Function: timeAnalysis()
void timeAnalysis() {

    srand(time(0));
    std::vector<int> V;
    std::vector<int> Vcopy;
    std::vector<int> sortedVector;

    const uint64_t MAX_LOOPS = 400000000;

    std::cout << "Size, ";
    //std::cout << "Insertion, ";
    std::cout << "Quick, ";
    std::cout << "std::sort\n";

    for (uint64_t j = 2; j < MAX_LOOPS; j = j * 2) {
        for (uint64_t i = 0; i < j; i++) {
            V.push_back(rand() % 100);
        }

        clock_t startTime = clock();
        std::cout << V.size() << ", ";
        /*
        sortedVector = kgk::sort(V, "insertion");
        std::cout << 
            1000*(double)(clock() - startTime)/CLOCKS_PER_SEC 
            << "ms, ";
        sortedVector.clear();
        //V.clear();
        */

        startTime = clock();
        std::cout << "Unsorted: ";
        printVector(V);
        std::cout << std::endl;
        sortedVector = kgk::sort(V, "quick");
        std::cout << 
            1000*(double)(clock() - startTime)/CLOCKS_PER_SEC
            << "ms, ";
        std::cout << "kgk::sort Sorted vector: ";
        printVector(sortedVector);
        sortedVector.clear();
        //V.clear();

        Vcopy = V;
        startTime = clock();
        std::sort(Vcopy.begin(), Vcopy.end());
        std::cout << 
            1000*(double)(clock() - startTime)/CLOCKS_PER_SEC
            << "ms " << std::endl;
        Vcopy.clear();
        V.clear();
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
xorl %ebx, %ebx
xorl %edi, %edi
callq 0x10f0
movl %eax, %edi
callq 0x1110
movq %rbx, 0x10(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, (%rsp)
movq %rbx, 0x50(%rsp)
movapd %xmm0, 0x40(%rsp)
movq %rbx, 0x30(%rsp)
movapd %xmm0, 0x20(%rsp)
movq 0x3c80(%rip), %rdi      # 0x4fd8
leaq 0x1cd1(%rip), %rsi      # 0x3030
movl $0x6, %edx
callq 0x1140
movq 0x3c68(%rip), %rdi      # 0x4fd8
leaq 0x1cc0(%rip), %rsi      # 0x3037
movl $0x7, %edx
callq 0x1140
movq 0x3c50(%rip), %rdi      # 0x4fd8
leaq 0x1cb0(%rip), %rsi      # 0x303f
movl $0xa, %edx
callq 0x1140
movl $0x2, %ebx
movq %rsp, %r14
leaq 0x60(%rsp), %r15
movq %rbx, %r12
callq 0x1040
cltq
imulq $0x51eb851f, %rax, %rcx # imm = 0x51EB851F
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x25, %rcx
addl %edx, %ecx
imull $0x64, %ecx, %ecx
subl %ecx, %eax
movl %eax, 0x60(%rsp)
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x13e6
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x13f1
movq %r14, %rdi
movq %r15, %rdx
callq 0x20a2
decq %r12
jne 0x13a9
callq 0x1080
movq 0x8(%rsp), %rsi
subq (%rsp), %rsi
sarq $0x2, %rsi
movq 0x3bc9(%rip), %rdi      # 0x4fd8
callq 0x1090
movl $0x2, %edx
movq %rax, %rdi
leaq 0x1c11(%rip), %rsi      # 0x3034
callq 0x1140
callq 0x1080
movq %rax, %r12
movl $0xa, %edx
movq 0x3b9c(%rip), %rdi      # 0x4fd8
leaq 0x1c07(%rip), %rsi      # 0x304a
callq 0x1140
leaq 0xd0(%rsp), %rdi
movq %r14, %rsi
callq 0x1cca
leaq 0xd0(%rsp), %rdi
callq 0x1c1a
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x1477
callq 0x1100
movq 0x3b5a(%rip), %rcx      # 0x4fd8
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x1120
movsbl %al, %esi
movq 0x3b3c(%rip), %rdi      # 0x4fd8
callq 0x1030
movq %rax, %rdi
callq 0x10a0
leaq 0xb8(%rsp), %rdi
movq %r14, %rsi
callq 0x1cca
leaq 0x90(%rsp), %rax
movq %rax, 0x80(%rsp)
leaq 0x80(%rsp), %r13
movq %r13, %rdi
leaq 0x1b7a(%rip), %rsi      # 0x3055
leaq 0x1b78(%rip), %rdx      # 0x305a
callq 0x2358
movq %r15, %rdi
leaq 0xb8(%rsp), %rsi
movq %r13, %rdx
callq 0x1d4a
movq 0x20(%rsp), %rdi
movaps 0x60(%rsp), %xmm0
movaps %xmm0, 0x20(%rsp)
movq 0x70(%rsp), %rax
movq %rax, 0x30(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x60(%rsp)
movq $0x0, 0x70(%rsp)
testq %rdi, %rdi
je 0x153d
callq 0x1100
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x153d
callq 0x1100
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x1557
callq 0x1100
movq 0xb8(%rsp), %rdi
testq %rdi, %rdi
je 0x1569
callq 0x1100
callq 0x1080
subq %r12, %rax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
mulsd 0x1a87(%rip), %xmm0     # 0x3008
divsd 0x1a87(%rip), %xmm0     # 0x3010
movq 0x3a48(%rip), %rdi      # 0x4fd8
callq 0x1170
movl $0x4, %edx
movq %rax, %rdi
leaq 0x1ab7(%rip), %rsi      # 0x305b
callq 0x1140
movl $0x19, %edx
movq 0x3a23(%rip), %rdi      # 0x4fd8
leaq 0x1aa4(%rip), %rsi      # 0x3060
callq 0x1140
leaq 0xa0(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x1cca
leaq 0xa0(%rsp), %rdi
callq 0x1c1a
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x15f2
callq 0x1100
movq 0x20(%rsp), %rax
cmpq %rax, 0x28(%rsp)
je 0x1603
movq %rax, 0x28(%rsp)
leaq 0x40(%rsp), %rdi
movq %r14, %rsi
callq 0x1dd0
callq 0x1080
movq %rax, %r12
movq 0x40(%rsp), %r13
movq 0x48(%rsp), %rbp
cmpq %rbp, %r13
je 0x1654
movq %rbp, %rax
subq %r13, %rax
sarq $0x2, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r13, %rdi
movq %rbp, %rsi
callq 0x23ed
movq %r13, %rdi
movq %rbp, %rsi
callq 0x24d0
callq 0x1080
subq %r12, %rax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
mulsd 0x199c(%rip), %xmm0     # 0x3008
divsd 0x199c(%rip), %xmm0     # 0x3010
movq 0x395d(%rip), %rdi      # 0x4fd8
callq 0x1170
movq %rax, %r12
movl $0x3, %edx
movq %rax, %rdi
leaq 0x19e8(%rip), %rsi      # 0x307a
callq 0x1140
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x1120
movsbl %al, %esi
movq %r12, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x10a0
movq 0x40(%rsp), %rdi
cmpq %rdi, 0x48(%rsp)
je 0x16d0
movq %rdi, 0x48(%rsp)
movq (%rsp), %rax
cmpq %rax, 0x8(%rsp)
je 0x16e0
movq %rax, 0x8(%rsp)
leaq (%rbx,%rbx), %rax
cmpq $0xbebc200, %rbx        # imm = 0xBEBC200
movq %rax, %rbx
jb 0x13a6
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x170b
movq %rax, %rdi
callq 0x1100
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x1715
callq 0x1100
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x1723
callq 0x1100
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x178b
jmp 0x178b
movq %rax, %rbx
jmp 0x175b
movq %rax, %rbx
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x175b
callq 0x1100
movq 0xb8(%rsp), %rdi
jmp 0x177d
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
jmp 0x177d
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x178e
callq 0x1100
jmp 0x178e
jmp 0x178b
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x179d
callq 0x1100
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x17ac
callq 0x1100
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x17ba
callq 0x1100
movq %rbx, %rdi
callq 0x11a0