// File: /workspace/github_cpp_makefile_star2_O1/travisdowns[P]avx-turbo/avx-turbo.cpp
// Function: inner_result run_test<RdtscClock, 101ul, 3ul>(void (*)(unsigned long), unsigned long, outer_timer&, hot_barrier*)
inner_result run_test(cal_f* func, size_t iters, outer_timer& outer, hot_barrier *barrier) {
    assert(iters % 100 == 0);

    std::array<typename CLOCK::delta_t, TRIES> results;

    inner_result result;

    if (arg_dirty) {
        dirty_it();
    }

    if (arg_dirty16) {
        dirty_it16();
    }

    result.ostart_ts = RdtscClock::now();
    for (size_t w = 0; w < WARMUP + 1; w++) {
        result.istart_ts = RdtscClock::now();
        outer.start();
        for (size_t r = 0; r < TRIES; r++) {
            auto t0 = CLOCK::now();
            func(iters);
            auto t1 = CLOCK::now();
            func(iters * 2);
            auto t2 = CLOCK::now();
            results[r] = (t2 - t1) - (t1 - t0);
        }
        outer.stop();
        result.iend_ts = RdtscClock::now();
    }

    for (barrier->increment(); !barrier->is_broken();) {
        func(iters);
    }
    result.oend_ts = RdtscClock::now();

    std::array<uint64_t, TRIES> nanos = {};
    std::transform(results.begin(), results.end(), nanos.begin(), CLOCK::to_nanos);
    DescriptiveStats stats = get_stats(nanos.begin(), nanos.end());

    result.mops = ((double)iters / stats.getMedian());
    return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x6b8, %rsp            # imm = 0x6B8
movq %rcx, %r15
movabsq $-0x70a3d70a3d70a3d7, %rax # imm = 0x8F5C28F5C28F5C29
imulq %rdx, %rax
rorq $0x2, %rax
movabsq $0x28f5c28f5c28f5d, %rcx # imm = 0x28F5C28F5C28F5D
cmpq %rcx, %rax
jae 0x14ab0
movq %r8, %r14
movq %rdx, %rbp
movq %rsi, %r12
movq %rdi, %rbx
movq 0x141c9(%rip), %rax     # 0x28a88
leaq 0x141c2(%rip), %rdi     # 0x28a88
callq *0x10(%rax)
testb %al, %al
je 0x148d2
callq 0x1dd15
movq %r12, 0x8(%rsp)
movq %r14, 0x10(%rsp)
movq 0x1426d(%rip), %rax     # 0x28b50
leaq 0x14266(%rip), %rdi     # 0x28b50
callq *0x10(%rax)
testb %al, %al
je 0x148f6
callq 0x1dd1f
lfence
rdtsc
shlq $0x20, %rdx
orq %rax, %rdx
lfence
movq %rbx, 0x18(%rsp)
movq %rdx, 0x8(%rbx)
leaq (,%rbp,2), %rax
movq %rax, 0x38(%rsp)
xorl %ecx, %ecx
movq %r15, 0x28(%rsp)
movq 0x8(%rsp), %r12
movq %rcx, 0x30(%rsp)
lfence
rdtsc
shlq $0x20, %rdx
orq %rax, %rdx
movq %rdx, 0x20(%rsp)
lfence
movq (%r15), %rax
movq %r15, %rdi
callq *(%rax)
xorl %r14d, %r14d
lfence
rdtsc
movq %rdx, %r15
shlq $0x20, %r15
orq %rax, %r15
lfence
movq %rbp, %rdi
callq *%r12
lfence
rdtsc
movq %rax, %r13
movq %rdx, %rbx
lfence
movq 0x38(%rsp), %rdi
callq *%r12
lfence
rdtsc
shlq $0x20, %rdx
addq %r13, %r13
orq %rax, %rdx
shlq $0x21, %rbx
orq %r13, %rbx
subq %rbx, %r15
lfence
addq %rdx, %r15
movq %r15, 0x390(%rsp,%r14,8)
incq %r14
cmpq $0x65, %r14
jne 0x1494b
movq 0x28(%rsp), %r15
movq (%r15), %rax
movq %r15, %rdi
callq *0x8(%rax)
lfence
rdtsc
lfence
movq 0x30(%rsp), %rcx
incq %rcx
cmpq $0x4, %rcx
jne 0x14927
shlq $0x20, %rdx
orq %rdx, %rax
movq 0x18(%rsp), %r14
movq 0x20(%rsp), %rcx
movq %rcx, 0x18(%r14)
movq %rax, 0x20(%r14)
movq 0x10(%rsp), %rbx
lock
incq 0x8(%rbx)
movq 0x8(%rbx), %rax
cmpq (%rbx), %rax
movq 0x8(%rsp), %r15
je 0x14a11
movq %rbp, %rdi
callq *%r15
movq 0x8(%rbx), %rax
cmpq (%rbx), %rax
jne 0x14a02
lfence
rdtsc
shlq $0x20, %rdx
orq %rax, %rdx
lfence
movq %rdx, 0x10(%r14)
leaq 0x68(%rsp), %rdi
xorl %ebx, %ebx
movl $0x328, %edx            # imm = 0x328
xorl %esi, %esi
callq 0x61a0
movq 0x390(%rsp,%rbx), %rdi
callq 0x14d16
movq %rax, 0x68(%rsp,%rbx)
addq $0x8, %rbx
cmpq $0x328, %rbx            # imm = 0x328
jne 0x14a37
leaq 0x390(%rsp), %rdx
leaq 0x40(%rsp), %rbx
leaq 0x68(%rsp), %rsi
movq %rbx, %rdi
callq 0x14de0
movq %rbp, %xmm0
punpckldq 0x95b3(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x95bb(%rip), %xmm0     # 0x1e040
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
divsd 0x18(%rbx), %xmm1
movsd %xmm1, (%r14)
movq %r14, %rax
addq $0x6b8, %rsp            # imm = 0x6B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xada4(%rip), %rdi      # 0x1f85b
leaq 0x9bba(%rip), %rsi      # 0x1e678
leaq 0xada7(%rip), %rcx      # 0x1f86c
movl $0x17b, %edx            # imm = 0x17B
callq 0x6210
nop