#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 */
double benchmark();
int /*<<< orphan*/ print_results(double);
int /*<<< orphan*/ print_summary(int, int);
int /*<<< orphan*/ print_version();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  double elapsed;
  int i;
  srand(time(NULL));
  print_version();
  for (i = 0; i < 3; i++) {
    printf("# c::%s\n", "minabs");
    elapsed = benchmark();
    print_results(elapsed);
    printf("ok %d benchmark finished\n", i + 1);
  }
  print_summary(3, 3);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
mov    $0x0,%al
call   1030 <print_version@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    11f4 <main+0x84>
lea    0xe52(%rip),%rdi
lea    0xe54(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1080 <benchmark@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1050 <print_results@plt>
mov    -0x14(%rbp),%esi
add    $0x1,%esi
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    119d <main+0x2d>
mov    $0x3,%esi
mov    %esi,%edi
call   1090 <print_summary@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
xor    %eax,%eax
call   1030 <print_version@plt>
lea    0xe6f(%rip),%r15
lea    0xe71(%rip),%r14
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1080 <benchmark@plt>
call   1050 <print_results@plt>
lea    0xe58(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1080 <benchmark@plt>
call   1050 <print_results@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1080 <benchmark@plt>
call   1050 <print_results@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x3,%edi
mov    $0x3,%esi
call   1090 <print_summary@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [9 x i8] c"# c::%s\0A\00"
@.str.1 = [7 x i8] c"minabs\00"
@.str.2 = [26 x i8] c"ok %d benchmark finished\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @time(i32* null)
%5 = call i32 @srand(i32 %4)
%6 = call i32 (...) @print_version()
store i32 0, i32* %3
br label %7
7: ; preds = %18, %0
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 3
br i1 %9, label %10, label %21
10: ; preds = %7
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%12 = call double (...) @benchmark()
store double %12, double* %2
%13 = load double, double* %2
%14 = call i32 @print_results(double %13)
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %10
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %7
21: ; preds = %7
%22 = call i32 @print_summary(i32 3, i32 3)
%23 = load i32, i32* %1
ret i32 %23
}

LLVM IR (-O2):
@.str = [9 x i8] c"# c::%s\0A\00"
@.str.1 = [7 x i8] c"minabs\00"
@.str.2 = [26 x i8] c"ok %d benchmark finished\0A\00"
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call i32 (...) @print_version()
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call double (...) @benchmark()
%6 = tail call i32 @print_results(double %5)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 1)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call double (...) @benchmark()
%10 = tail call i32 @print_results(double %9)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 2)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%13 = tail call double (...) @benchmark()
%14 = tail call i32 @print_results(double %13)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 3)
%16 = tail call i32 @print_summary(i32 3, i32 3)
ret i32 0
}