#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 */

/* Variables and functions */
int /*<<< orphan*/ init1();
int /*<<< orphan*/ init2();
double omp_get_wtime();
int /*<<< orphan*/ printf(char *, int, float);
int /*<<< orphan*/ runloop(int);
int /*<<< orphan*/ valid1();
int /*<<< orphan*/ valid2();
int main(int argc, char *argv[]) {
  double start1, start2, end1, end2;
  int r;
  init1();
  start1 = omp_get_wtime();
  for (r = 0; r < 100; r++) {
    runloop(1);
  }
  end1 = omp_get_wtime();
  valid1();
  printf("Total time for %d reps of loop 1 = %f\n", 100,
         (float)(end1 - start1));
  init2();
  start2 = omp_get_wtime();
  for (r = 0; r < 100; r++) {
    runloop(2);
  }
  end2 = omp_get_wtime();
  valid2();
  printf("Total time for %d reps of loop 2 = %f\n", 100,
         (float)(end2 - start2));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1060 <init1@plt>
mov    $0x0,%al
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,-0x18(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x64,-0x34(%rbp)
jge    11c2 <main+0x52>
mov    $0x1,%edi
call   1090 <runloop@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11a0 <main+0x30>
mov    $0x0,%al
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,-0x28(%rbp)
mov    $0x0,%al
call   1070 <valid1@plt>
movsd  -0x28(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0xe16(%rip),%rdi
mov    $0x64,%esi
call   1050 <printf@plt>
mov    $0x0,%al
call   1080 <init2@plt>
mov    $0x0,%al
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x64,-0x34(%rbp)
jge    1230 <main+0xc0>
mov    $0x2,%edi
call   1090 <runloop@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    120e <main+0x9e>
mov    $0x0,%al
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,-0x30(%rbp)
mov    $0x0,%al
call   1040 <valid2@plt>
movsd  -0x30(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0xdcf(%rip),%rdi
mov    $0x64,%esi
call   1050 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1060 <init1@plt>
xor    %eax,%eax
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,0x8(%rsp)
mov    $0x64,%ebx
xchg   %ax,%ax
mov    $0x1,%edi
call   1090 <runloop@plt>
add    $0xffffffff,%ebx
jne    1190 <main+0x20>
xor    %eax,%eax
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1070 <valid1@plt>
movsd  (%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0xe38(%rip),%rdi
mov    $0x64,%ebx
mov    $0x64,%esi
call   1050 <printf@plt>
xor    %eax,%eax
call   1080 <init2@plt>
xor    %eax,%eax
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,0x8(%rsp)
nopl   0x0(%rax,%rax,1)
mov    $0x2,%edi
call   1090 <runloop@plt>
add    $0xffffffff,%ebx
jne    11f0 <main+0x80>
xor    %eax,%eax
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1040 <valid2@plt>
movsd  (%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0xdff(%rip),%rdi
mov    $0x64,%esi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [39 x i8] c"Total time for %d reps of loop 1 = %f\0A\00"
@.str.1 = [39 x i8] c"Total time for %d reps of loop 2 = %f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = call i32 (...) @init1()
%12 = call double (...) @omp_get_wtime()
store double %12, double* %6
store i32 0, i32* %10
br label %13
13: ; preds = %18, %2
%14 = load i32, i32* %10
%15 = icmp slt i32 %14, 100
br i1 %15, label %16, label %21
16: ; preds = %13
%17 = call i32 @runloop(i32 1)
br label %18
18: ; preds = %16
%19 = load i32, i32* %10
%20 = add nsw i32 %19, 1
store i32 %20, i32* %10
br label %13
21: ; preds = %13
%22 = call double (...) @omp_get_wtime()
store double %22, double* %8
%23 = call i32 (...) @valid1()
%24 = load double, double* %8
%25 = load double, double* %6
%26 = fsub double %24, %25
%27 = fptrunc double %26 to float
%28 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 100, float %27)
%29 = call i32 (...) @init2()
%30 = call double (...) @omp_get_wtime()
store double %30, double* %7
store i32 0, i32* %10
br label %31
31: ; preds = %36, %21
%32 = load i32, i32* %10
%33 = icmp slt i32 %32, 100
br i1 %33, label %34, label %39
34: ; preds = %31
%35 = call i32 @runloop(i32 2)
br label %36
36: ; preds = %34
%37 = load i32, i32* %10
%38 = add nsw i32 %37, 1
store i32 %38, i32* %10
br label %31
39: ; preds = %31
%40 = call double (...) @omp_get_wtime()
store double %40, double* %9
%41 = call i32 (...) @valid2()
%42 = load double, double* %9
%43 = load double, double* %7
%44 = fsub double %42, %43
%45 = fptrunc double %44 to float
%46 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32 100, float %45)
%47 = load i32, i32* %3
ret i32 %47
}

LLVM IR (-O2):
@.str = [39 x i8] c"Total time for %d reps of loop 1 = %f\0A\00"
@.str.1 = [39 x i8] c"Total time for %d reps of loop 2 = %f\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @init1()
%4 = tail call double (...) @omp_get_wtime()
br label %5
5: ; preds = %2, %5
%6 = phi i32 [ 0, %2 ], [ %8, %5 ]
%7 = tail call i32 @runloop(i32 1)
%8 = add nuw nsw i32 %6, 1
%9 = icmp eq i32 %8, 100
br i1 %9, label %10, label %5
10: ; preds = %5
%11 = tail call double (...) @omp_get_wtime()
%12 = tail call i32 (...) @valid1()
%13 = fsub double %11, %4
%14 = fptrunc double %13 to float
%15 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 100, float %14)
%16 = tail call i32 (...) @init2()
%17 = tail call double (...) @omp_get_wtime()
br label %18
18: ; preds = %10, %18
%19 = phi i32 [ 0, %10 ], [ %21, %18 ]
%20 = tail call i32 @runloop(i32 2)
%21 = add nuw nsw i32 %19, 1
%22 = icmp eq i32 %21, 100
br i1 %22, label %23, label %18
23: ; preds = %18
%24 = tail call double (...) @omp_get_wtime()
%25 = tail call i32 (...) @valid2()
%26 = fsub double %24, %17
%27 = fptrunc double %26 to float
%28 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32 100, float %27)
ret i32 0
}