#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 scalar_t__ clock_t;

/* Variables and functions */
double CLOCKS_PER_SEC;
scalar_t__ clock();
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ withRegister();
int /*<<< orphan*/ withoutRegister();
int main() {
  clock_t start, finish;
  start = clock();
  withRegister();
  finish = clock();
  printf("withRegister duration: %f\n",
         ((double)(finish - start)) / CLOCKS_PER_SEC);
  start = clock();
  withoutRegister();
  finish = clock();
  printf("withoutRegister duration: %f\n",
         ((double)(finish - start)) / CLOCKS_PER_SEC);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <clock@plt>
mov    %rax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <withRegister@plt>
mov    $0x0,%al
call   1040 <clock@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
sub    -0x8(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2e6f(%rip),%rax
divsd  (%rax),%xmm0
lea    0xe7c(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <clock@plt>
mov    %rax,-0x8(%rbp)
mov    $0x0,%al
call   1060 <withoutRegister@plt>
mov    $0x0,%al
call   1040 <clock@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
sub    -0x8(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2e2e(%rip),%rax
divsd  (%rax),%xmm0
lea    0xe56(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <clock@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1030 <withRegister@plt>
xor    %eax,%eax
call   1040 <clock@plt>
sub    %rbx,%rax
cvtsi2sd %rax,%xmm0
mov    0x2e7d(%rip),%r14
divsd  (%r14),%xmm0
lea    0xe89(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
call   1040 <clock@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1060 <withoutRegister@plt>
xor    %eax,%eax
call   1040 <clock@plt>
sub    %rbx,%rax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  (%r14),%xmm0
lea    0xe70(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [27 x i8] c"withRegister duration: %f\0A\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
@.str.1 = [30 x i8] c"withoutRegister duration: %f\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = call i64 (...) @clock()
store i64 %3, i64* %1
%4 = call i32 (...) @withRegister()
%5 = call i64 (...) @clock()
store i64 %5, i64* %2
%6 = load i64, i64* %2
%7 = load i64, i64* %1
%8 = sub nsw i64 %6, %7
%9 = sitofp i64 %8 to double
%10 = load double, double* @CLOCKS_PER_SEC
%11 = fdiv double %9, %10
%12 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), double %11)
%13 = call i64 (...) @clock()
store i64 %13, i64* %1
%14 = call i32 (...) @withoutRegister()
%15 = call i64 (...) @clock()
store i64 %15, i64* %2
%16 = load i64, i64* %2
%17 = load i64, i64* %1
%18 = sub nsw i64 %16, %17
%19 = sitofp i64 %18 to double
%20 = load double, double* @CLOCKS_PER_SEC
%21 = fdiv double %19, %20
%22 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), double %21)
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"withRegister duration: %f\0A\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
@.str.1 = [30 x i8] c"withoutRegister duration: %f\0A\00"
define i32 @main() {
%1 = tail call i64 (...) @clock()
%2 = tail call i32 (...) @withRegister()
%3 = tail call i64 (...) @clock()
%4 = sub nsw i64 %3, %1
%5 = sitofp i64 %4 to double
%6 = load double, double* @CLOCKS_PER_SEC
%7 = fdiv double %5, %6
%8 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), double %7)
%9 = tail call i64 (...) @clock()
%10 = tail call i32 (...) @withoutRegister()
%11 = tail call i64 (...) @clock()
%12 = sub nsw i64 %11, %9
%13 = sitofp i64 %12 to double
%14 = load double, double* @CLOCKS_PER_SEC
%15 = fdiv double %13, %14
%16 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), double %15)
ret i32 0
}