#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
double clock_mono_us();
int /*<<< orphan*/ printf(char *, long, long);
void run_single_test(long runs, long iters, double *times, uint64_t *gbg) {
  printf("Single test: %ld runs of %ld iterations.\n", runs, iters);
  double t0 = clock_mono_us();
  for (long run = 0; run < runs; run++) {
    for (long iter = 0; iter < iters; iter++) {
      gbg[iter]++;
    }
    double t1 = clock_mono_us();
    times[run] = t1 - t0;
    t0 = t1;
  }
}


x86 assembly (clang, -O0):
<run_single_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <clock_mono_us@plt>
movsd  %xmm0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x8(%rbp),%rax
jge    11e4 <run_single_test+0xc4>
movq   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    11a6 <run_single_test+0x86>
mov    -0x20(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1176 <run_single_test+0x56>
mov    $0x0,%al
call   1040 <clock_mono_us@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1160 <run_single_test+0x40>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_single_test>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rcx,%rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
lea    0xebf(%rip),%rdi
mov    %r12,%rsi
mov    %r15,%rdx
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <clock_mono_us@plt>
test   %r12,%r12
jle    1282 <run_single_test+0x162>
lea    -0x8(%r15),%rax
mov    %rax,0x18(%rsp)
mov    %rax,%rcx
shr    $0x3,%rcx
add    $0x1,%rcx
mov    %r15,%r13
and    $0xfffffffffffffff8,%r13
mov    %rcx,%rax
mov    %rcx,0x10(%rsp)
and    $0xfffffffffffffffe,%rcx
mov    %rcx,0x8(%rsp)
pcmpeqd %xmm4,%xmm4
xor    %ebp,%ebp
jmp    11b8 <run_single_test+0x98>
xor    %eax,%eax
call   1040 <clock_mono_us@plt>
pcmpeqd %xmm4,%xmm4
movdqa %xmm0,%xmm1
subsd  0x20(%rsp),%xmm1
movsd  %xmm1,(%r14,%rbp,8)
add    $0x1,%rbp
cmp    %r12,%rbp
je     1282 <run_single_test+0x162>
movq   %xmm0,0x20(%rsp)
test   %r15,%r15
jle    1190 <run_single_test+0x70>
cmp    $0x8,%r15
jae    11d0 <run_single_test+0xb0>
xor    %eax,%eax
jmp    1270 <run_single_test+0x150>
cmpq   $0x8,0x18(%rsp)
jae    11dc <run_single_test+0xbc>
xor    %eax,%eax
jmp    1238 <run_single_test+0x118>
mov    0x8(%rsp),%rcx
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movdqu (%rbx,%rax,4),%xmm0
movdqu 0x10(%rbx,%rax,4),%xmm1
movdqu 0x20(%rbx,%rax,4),%xmm2
movdqu 0x30(%rbx,%rax,4),%xmm3
psubd  %xmm4,%xmm0
psubd  %xmm4,%xmm1
movdqu %xmm0,(%rbx,%rax,4)
movdqu %xmm1,0x10(%rbx,%rax,4)
psubd  %xmm4,%xmm2
psubd  %xmm4,%xmm3
movdqu %xmm2,0x20(%rbx,%rax,4)
movdqu %xmm3,0x30(%rbx,%rax,4)
add    $0x10,%rax
add    $0xfffffffffffffffe,%rcx
jne    11f0 <run_single_test+0xd0>
testb  $0x1,0x10(%rsp)
je     125d <run_single_test+0x13d>
movdqu (%rbx,%rax,4),%xmm0
movdqu 0x10(%rbx,%rax,4),%xmm1
psubd  %xmm4,%xmm0
psubd  %xmm4,%xmm1
movdqu %xmm0,(%rbx,%rax,4)
movdqu %xmm1,0x10(%rbx,%rax,4)
mov    %r13,%rax
cmp    %r15,%r13
je     1190 <run_single_test+0x70>
nopl   0x0(%rax)
addl   $0x1,(%rbx,%rax,4)
add    $0x1,%rax
cmp    %rax,%r15
jne    1270 <run_single_test+0x150>
jmp    1190 <run_single_test+0x70>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [42 x i8] c"Single test: %ld runs of %ld iterations.\0A\00"
define void @run_single_test(i64 %0, i64 %1, double* %2, i32* %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca double*
%8 = alloca i32*
%9 = alloca double
%10 = alloca i64
%11 = alloca i64
%12 = alloca double
store i64 %0, i64* %5
store i64 %1, i64* %6
store double* %2, double** %7
store i32* %3, i32** %8
%13 = load i64, i64* %5
%14 = load i64, i64* %6
%15 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i64 %13, i64 %14)
%16 = call double (...) @clock_mono_us()
store double %16, double* %9
store i64 0, i64* %10
br label %17
17: ; preds = %44, %4
%18 = load i64, i64* %10
%19 = load i64, i64* %5
%20 = icmp slt i64 %18, %19
br i1 %20, label %21, label %47
21: ; preds = %17
store i64 0, i64* %11
br label %22
22: ; preds = %32, %21
%23 = load i64, i64* %11
%24 = load i64, i64* %6
%25 = icmp slt i64 %23, %24
br i1 %25, label %26, label %35
26: ; preds = %22
%27 = load i32*, i32** %8
%28 = load i64, i64* %11
%29 = getelementptr inbounds i32, i32* %27, i64 %28
%30 = load i32, i32* %29
%31 = add nsw i32 %30, 1
store i32 %31, i32* %29
br label %32
32: ; preds = %26
%33 = load i64, i64* %11
%34 = add nsw i64 %33, 1
store i64 %34, i64* %11
br label %22
35: ; preds = %22
%36 = call double (...) @clock_mono_us()
store double %36, double* %12
%37 = load double, double* %12
%38 = load double, double* %9
%39 = fsub double %37, %38
%40 = load double*, double** %7
%41 = load i64, i64* %10
%42 = getelementptr inbounds double, double* %40, i64 %41
store double %39, double* %42
%43 = load double, double* %12
store double %43, double* %9
br label %44
44: ; preds = %35
%45 = load i64, i64* %10
%46 = add nsw i64 %45, 1
store i64 %46, i64* %10
br label %17
47: ; preds = %17
ret void
}

LLVM IR (-O2):
@.str = [42 x i8] c"Single test: %ld runs of %ld iterations.\0A\00"
define void @run_single_test(i64 %0, i64 %1, double* nocapture writeonly %2, i32* nocapture %3) {
%5 = tail call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i64 %0, i64 %1)
%6 = tail call double (...) @clock_mono_us()
%7 = icmp sgt i64 %0, 0
br i1 %7, label %8, label %68
8: ; preds = %4
%9 = icmp sgt i64 %1, 0
%10 = add i64 %1, -8
%11 = lshr i64 %10, 3
%12 = add nuw nsw i64 %11, 1
%13 = icmp ult i64 %1, 8
%14 = and i64 %1, -8
%15 = and i64 %12, 1
%16 = icmp ult i64 %10, 8
%17 = and i64 %12, 4611686018427387902
%18 = icmp eq i64 %15, 0
%19 = icmp eq i64 %14, %1
br label %20
20: ; preds = %8, %69
%21 = phi double [ %6, %8 ], [ %70, %69 ]
%22 = phi i64 [ 0, %8 ], [ %73, %69 ]
br i1 %9, label %23, label %69
23: ; preds = %20
br i1 %13, label %66, label %24
24: ; preds = %23
br i1 %16, label %52, label %25
25: ; preds = %24, %25
%26 = phi i64 [ %49, %25 ], [ 0, %24 ]
%27 = phi i64 [ %50, %25 ], [ 0, %24 ]
%28 = getelementptr inbounds i32, i32* %3, i64 %26
%29 = bitcast i32* %28 to <4 x i32>*
%30 = load <4 x i32>, <4 x i32>* %29
%31 = getelementptr inbounds i32, i32* %28, i64 4
%32 = bitcast i32* %31 to <4 x i32>*
%33 = load <4 x i32>, <4 x i32>* %32
%34 = add nsw <4 x i32> %30, <i32 1, i32 1, i32 1, i32 1>
%35 = add nsw <4 x i32> %33, <i32 1, i32 1, i32 1, i32 1>
%36 = bitcast i32* %28 to <4 x i32>*
store <4 x i32> %34, <4 x i32>* %36
%37 = bitcast i32* %31 to <4 x i32>*
store <4 x i32> %35, <4 x i32>* %37
%38 = or i64 %26, 8
%39 = getelementptr inbounds i32, i32* %3, i64 %38
%40 = bitcast i32* %39 to <4 x i32>*
%41 = load <4 x i32>, <4 x i32>* %40
%42 = getelementptr inbounds i32, i32* %39, i64 4
%43 = bitcast i32* %42 to <4 x i32>*
%44 = load <4 x i32>, <4 x i32>* %43
%45 = add nsw <4 x i32> %41, <i32 1, i32 1, i32 1, i32 1>
%46 = add nsw <4 x i32> %44, <i32 1, i32 1, i32 1, i32 1>
%47 = bitcast i32* %39 to <4 x i32>*
store <4 x i32> %45, <4 x i32>* %47
%48 = bitcast i32* %42 to <4 x i32>*
store <4 x i32> %46, <4 x i32>* %48
%49 = add nuw i64 %26, 16
%50 = add i64 %27, 2
%51 = icmp eq i64 %50, %17
br i1 %51, label %52, label %25
52: ; preds = %25, %24
%53 = phi i64 [ 0, %24 ], [ %49, %25 ]
br i1 %18, label %65, label %54
54: ; preds = %52
%55 = getelementptr inbounds i32, i32* %3, i64 %53
%56 = bitcast i32* %55 to <4 x i32>*
%57 = load <4 x i32>, <4 x i32>* %56
%58 = getelementptr inbounds i32, i32* %55, i64 4
%59 = bitcast i32* %58 to <4 x i32>*
%60 = load <4 x i32>, <4 x i32>* %59
%61 = add nsw <4 x i32> %57, <i32 1, i32 1, i32 1, i32 1>
%62 = add nsw <4 x i32> %60, <i32 1, i32 1, i32 1, i32 1>
%63 = bitcast i32* %55 to <4 x i32>*
store <4 x i32> %61, <4 x i32>* %63
%64 = bitcast i32* %58 to <4 x i32>*
store <4 x i32> %62, <4 x i32>* %64
br label %65
65: ; preds = %52, %54
br i1 %19, label %69, label %66
66: ; preds = %23, %65
%67 = phi i64 [ 0, %23 ], [ %14, %65 ]
br label %75
68: ; preds = %69, %4
ret void
69: ; preds = %75, %65, %20
%70 = tail call double (...) @clock_mono_us()
%71 = fsub double %70, %21
%72 = getelementptr inbounds double, double* %2, i64 %22
store double %71, double* %72
%73 = add nuw nsw i64 %22, 1
%74 = icmp eq i64 %73, %0
br i1 %74, label %68, label %20
75: ; preds = %66, %75
%76 = phi i64 [ %80, %75 ], [ %67, %66 ]
%77 = getelementptr inbounds i32, i32* %3, i64 %76
%78 = load i32, i32* %77
%79 = add nsw i32 %78, 1
store i32 %79, i32* %77
%80 = add nuw nsw i64 %76, 1
%81 = icmp eq i64 %80, %1
br i1 %81, label %69, label %75
}