#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 */
struct tms {
  scalar_t__ tms_stime;
  scalar_t__ tms_utime;
};
typedef scalar_t__ clock_t;

/* Variables and functions */
double CLOCKS_PER_SEC;
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ _SC_CLK_TCK;
scalar_t__ clock();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, double, ...);
unsigned long sysconf(int /*<<< orphan*/);
scalar_t__ times(struct tms *);
int main(int argc, char **argv) {
  int i, count = 0;
  struct tms t;
  clock_t clock_ticks;
  unsigned long sys_clock_ticks = 0;
  if ((clock_ticks = clock()) < 0) {
    perror("clock() ");
    exit(EXIT_FAILURE);
  }
  printf("clock() - clocks: %ld, seconds: %.2f secs\n", (long)clock_ticks,
         (double)clock_ticks / CLOCKS_PER_SEC);
  if ((sys_clock_ticks = sysconf(_SC_CLK_TCK)) < 0) {
    perror("sysconf() ");
    exit(EXIT_FAILURE);
  }
  printf("System Clock Ticks: %lu\n", sys_clock_ticks);
  if (times(&t) < 0) {
    perror("times() ");
    exit(EXIT_FAILURE);
  }
  printf("times() - User CPU: %.2f secs, System CPU: %.2f secs\n",
         (double)t.tms_utime / sys_clock_ticks,
         (double)t.tms_stime / sys_clock_ticks);
  for (i = 0; i < 10000000; i++)
    count += 1;
  if ((clock_ticks = clock()) < 0) {
    perror("clock() ");
    exit(EXIT_FAILURE);
  }
  printf("clock() - clocks: %ld, seconds: %.2f secs\n", (long)clock_ticks,
         (double)clock_ticks / CLOCKS_PER_SEC);
  if (times(&t) < 0) {
    perror("times() ");
    exit(EXIT_FAILURE);
  }
  printf("times() - User CPU: %.2f secs, System CPU: %.2f secs\n",
         (double)t.tms_utime / sys_clock_ticks,
         (double)t.tms_stime / sys_clock_ticks);
}


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)
movl   $0x0,-0x18(%rbp)
movq   $0x0,-0x38(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jge    11b4 <main+0x54>
lea    0xe7f(%rip),%rdi
call   1060 <perror@plt>
mov    0x2e23(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
cvtsi2sdq -0x30(%rbp),%xmm0
cvtsi2sdq -0x30(%rbp),%xmm1
mov    0x2e21(%rip),%rax
divsd  (%rax),%xmm1
lea    0xe57(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
mov    0x2df8(%rip),%rax
mov    (%rax),%edi
call   1070 <sysconf@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
jae    120f <main+0xaf>
lea    0xe58(%rip),%rdi
call   1060 <perror@plt>
mov    0x2dc8(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
movaps 0xdea(%rip),%xmm1
movq   -0x38(%rbp),%xmm0
punpckldq %xmm1,%xmm0
movapd 0xde9(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
lea    0xe22(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    -0x28(%rbp),%rdi
call   1050 <times@plt>
cmp    $0x0,%rax
jge    1271 <main+0x111>
lea    0xe1a(%rip),%rdi
call   1060 <perror@plt>
mov    0x2d66(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
cvtsi2sdq -0x20(%rbp),%xmm0
movaps 0xd82(%rip),%xmm1
movq   -0x38(%rbp),%xmm2
punpckldq %xmm1,%xmm2
movapd 0xd81(%rip),%xmm1
subpd  %xmm1,%xmm2
movaps %xmm2,%xmm1
unpckhpd %xmm2,%xmm2
addsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
cvtsi2sdq -0x28(%rbp),%xmm1
divsd  %xmm2,%xmm1
lea    0xdce(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x989680,-0x14(%rbp)
jge    12e5 <main+0x185>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12c1 <main+0x161>
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jge    1314 <main+0x1b4>
lea    0xd1f(%rip),%rdi
call   1060 <perror@plt>
mov    0x2cc3(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
cvtsi2sdq -0x30(%rbp),%xmm0
cvtsi2sdq -0x30(%rbp),%xmm1
mov    0x2cc1(%rip),%rax
divsd  (%rax),%xmm1
lea    0xcf7(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
lea    -0x28(%rbp),%rdi
call   1050 <times@plt>
cmp    $0x0,%rax
jge    1366 <main+0x206>
lea    0xd25(%rip),%rdi
call   1060 <perror@plt>
mov    0x2c71(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
cvtsi2sdq -0x20(%rbp),%xmm0
movaps 0xc8d(%rip),%xmm1
movq   -0x38(%rbp),%xmm2
punpckldq %xmm1,%xmm2
movapd 0xc8c(%rip),%xmm1
subpd  %xmm1,%xmm2
movaps %xmm2,%xmm1
unpckhpd %xmm2,%xmm2
addsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
cvtsi2sdq -0x28(%rbp),%xmm1
divsd  %xmm2,%xmm1
lea    0xcd9(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
xor    %eax,%eax
call   1030 <clock@plt>
test   %rax,%rax
js     1288 <main+0x128>
cvtsi2sd %rax,%xmm0
mov    0x2e67(%rip),%rbx
movapd %xmm0,%xmm1
divsd  (%rbx),%xmm1
lea    0xe99(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
mov    0x2e3a(%rip),%rax
mov    (%rax),%edi
call   1070 <sysconf@plt>
movq   %rax,%xmm1
punpckldq 0xe4e(%rip),%xmm1
subpd  0xe56(%rip),%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm1,%xmm0
lea    0xe87(%rip),%rdi
movapd %xmm0,0x10(%rsp)
mov    $0x1,%al
call   1040 <printf@plt>
mov    %rsp,%rdi
call   1050 <times@plt>
test   %rax,%rax
js     1291 <main+0x131>
xorps  %xmm0,%xmm0
cvtsi2sdq 0x8(%rsp),%xmm0
movapd 0x10(%rsp),%xmm2
divsd  %xmm2,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdq (%rsp),%xmm1
divsd  %xmm2,%xmm1
lea    0xe63(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <clock@plt>
test   %rax,%rax
js     1288 <main+0x128>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movapd %xmm0,%xmm1
divsd  (%rbx),%xmm1
lea    0xdec(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
mov    %rsp,%rdi
call   1050 <times@plt>
test   %rax,%rax
js     1291 <main+0x131>
xorps  %xmm0,%xmm0
cvtsi2sdq 0x8(%rsp),%xmm0
movapd 0x10(%rsp),%xmm2
divsd  %xmm2,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdq (%rsp),%xmm1
divsd  %xmm2,%xmm1
lea    0xdfd(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret
lea    0xd91(%rip),%rdi
jmp    1298 <main+0x138>
lea    0xdd5(%rip),%rdi
call   1060 <perror@plt>
mov    0x2d2c(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

LLVM IR (-O0):
%struct.tms = type { i64, i64 }
@.str = [9 x i8] c"clock() \00"
@EXIT_FAILURE = global i32 0
@.str.1 = [43 x i8] c"clock() - clocks: %ld, seconds: %.2f secs\0A\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
@_SC_CLK_TCK = global i32 0
@.str.2 = [11 x i8] c"sysconf() \00"
@.str.3 = [25 x i8] c"System Clock Ticks: %lu\0A\00"
@.str.4 = [9 x i8] c"times() \00"
@.str.5 = [54 x i8] c"times() - User CPU: %.2f secs, System CPU: %.2f secs\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.tms
%9 = alloca i64
%10 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
store i64 0, i64* %10
%11 = call i64 (...) @clock()
store i64 %11, i64* %9
%12 = icmp slt i64 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %2
%14 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%15 = load i32, i32* @EXIT_FAILURE
%16 = call i32 @exit(i32 %15)
unreachable
17: ; preds = %2
%18 = load i64, i64* %9
%19 = sitofp i64 %18 to double
%20 = load i64, i64* %9
%21 = sitofp i64 %20 to double
%22 = load double, double* @CLOCKS_PER_SEC
%23 = fdiv double %21, %22
%24 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), double %19, double %23)
%25 = load i32, i32* @_SC_CLK_TCK
%26 = call i64 @sysconf(i32 %25)
store i64 %26, i64* %10
%27 = icmp ult i64 %26, 0
br i1 %27, label %28, label %32
28: ; preds = %17
%29 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%30 = load i32, i32* @EXIT_FAILURE
%31 = call i32 @exit(i32 %30)
unreachable
32: ; preds = %17
%33 = load i64, i64* %10
%34 = uitofp i64 %33 to double
%35 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), double %34)
%36 = call i64 @times(%struct.tms* %8)
%37 = icmp slt i64 %36, 0
br i1 %37, label %38, label %42
38: ; preds = %32
%39 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%40 = load i32, i32* @EXIT_FAILURE
%41 = call i32 @exit(i32 %40)
unreachable
42: ; preds = %32
%43 = getelementptr inbounds %struct.tms, %struct.tms* %8, i32 0, i32 1
%44 = load i64, i64* %43
%45 = sitofp i64 %44 to double
%46 = load i64, i64* %10
%47 = uitofp i64 %46 to double
%48 = fdiv double %45, %47
%49 = getelementptr inbounds %struct.tms, %struct.tms* %8, i32 0, i32 0
%50 = load i64, i64* %49
%51 = sitofp i64 %50 to double
%52 = load i64, i64* %10
%53 = uitofp i64 %52 to double
%54 = fdiv double %51, %53
%55 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.5, i64 0, i64 0), double %48, double %54)
store i32 0, i32* %6
br label %56
56: ; preds = %62, %42
%57 = load i32, i32* %6
%58 = icmp slt i32 %57, 10000000
br i1 %58, label %59, label %65
59: ; preds = %56
%60 = load i32, i32* %7
%61 = add nsw i32 %60, 1
store i32 %61, i32* %7
br label %62
62: ; preds = %59
%63 = load i32, i32* %6
%64 = add nsw i32 %63, 1
store i32 %64, i32* %6
br label %56
65: ; preds = %56
%66 = call i64 (...) @clock()
store i64 %66, i64* %9
%67 = icmp slt i64 %66, 0
br i1 %67, label %68, label %72
68: ; preds = %65
%69 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%70 = load i32, i32* @EXIT_FAILURE
%71 = call i32 @exit(i32 %70)
unreachable
72: ; preds = %65
%73 = load i64, i64* %9
%74 = sitofp i64 %73 to double
%75 = load i64, i64* %9
%76 = sitofp i64 %75 to double
%77 = load double, double* @CLOCKS_PER_SEC
%78 = fdiv double %76, %77
%79 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), double %74, double %78)
%80 = call i64 @times(%struct.tms* %8)
%81 = icmp slt i64 %80, 0
br i1 %81, label %82, label %86
82: ; preds = %72
%83 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%84 = load i32, i32* @EXIT_FAILURE
%85 = call i32 @exit(i32 %84)
unreachable
86: ; preds = %72
%87 = getelementptr inbounds %struct.tms, %struct.tms* %8, i32 0, i32 1
%88 = load i64, i64* %87
%89 = sitofp i64 %88 to double
%90 = load i64, i64* %10
%91 = uitofp i64 %90 to double
%92 = fdiv double %89, %91
%93 = getelementptr inbounds %struct.tms, %struct.tms* %8, i32 0, i32 0
%94 = load i64, i64* %93
%95 = sitofp i64 %94 to double
%96 = load i64, i64* %10
%97 = uitofp i64 %96 to double
%98 = fdiv double %95, %97
%99 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.5, i64 0, i64 0), double %92, double %98)
%100 = load i32, i32* %3
ret i32 %100
}

LLVM IR (-O2):
%struct.tms = type { i64, i64 }
@.str = [9 x i8] c"clock() \00"
@EXIT_FAILURE = global i32 0
@.str.1 = [43 x i8] c"clock() - clocks: %ld, seconds: %.2f secs\0A\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
@_SC_CLK_TCK = global i32 0
@.str.3 = [25 x i8] c"System Clock Ticks: %lu\0A\00"
@.str.4 = [9 x i8] c"times() \00"
@.str.5 = [54 x i8] c"times() - User CPU: %.2f secs, System CPU: %.2f secs\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.tms
%4 = bitcast %struct.tms* %3 to i8*
%5 = tail call i64 (...) @clock()
%6 = icmp slt i64 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = tail call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* @EXIT_FAILURE
%10 = tail call i32 @exit(i32 %9)
unreachable
11: ; preds = %2
%12 = sitofp i64 %5 to double
%13 = load double, double* @CLOCKS_PER_SEC
%14 = fdiv double %12, %13
%15 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), double %12, double %14)
%16 = load i32, i32* @_SC_CLK_TCK
%17 = tail call i64 @sysconf(i32 %16)
%18 = uitofp i64 %17 to double
%19 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), double %18)
%20 = call i64 @times(%struct.tms* %3)
%21 = icmp slt i64 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %11
%23 = tail call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%24 = load i32, i32* @EXIT_FAILURE
%25 = tail call i32 @exit(i32 %24)
unreachable
26: ; preds = %11
%27 = getelementptr inbounds %struct.tms, %struct.tms* %3, i64 0, i32 1
%28 = load i64, i64* %27
%29 = sitofp i64 %28 to double
%30 = fdiv double %29, %18
%31 = getelementptr inbounds %struct.tms, %struct.tms* %3, i64 0, i32 0
%32 = load i64, i64* %31
%33 = sitofp i64 %32 to double
%34 = fdiv double %33, %18
%35 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.5, i64 0, i64 0), double %30, double %34)
%36 = tail call i64 (...) @clock()
%37 = icmp slt i64 %36, 0
br i1 %37, label %38, label %42
38: ; preds = %26
%39 = tail call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%40 = load i32, i32* @EXIT_FAILURE
%41 = tail call i32 @exit(i32 %40)
unreachable
42: ; preds = %26
%43 = sitofp i64 %36 to double
%44 = load double, double* @CLOCKS_PER_SEC
%45 = fdiv double %43, %44
%46 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), double %43, double %45)
%47 = call i64 @times(%struct.tms* %3)
%48 = icmp slt i64 %47, 0
br i1 %48, label %49, label %53
49: ; preds = %42
%50 = tail call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%51 = load i32, i32* @EXIT_FAILURE
%52 = tail call i32 @exit(i32 %51)
unreachable
53: ; preds = %42
%54 = load i64, i64* %27
%55 = sitofp i64 %54 to double
%56 = fdiv double %55, %18
%57 = load i64, i64* %31
%58 = sitofp i64 %57 to double
%59 = fdiv double %58, %18
%60 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.5, i64 0, i64 0), double %56, double %59)
ret i32 0
}