#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*/ CLOCK_BOOTTIME;
int /*<<< orphan*/ CLOCK_MONOTONIC;
int /*<<< orphan*/ CLOCK_MONOTONIC_COARSE;
int /*<<< orphan*/ CLOCK_MONOTONIC_RAW;
int /*<<< orphan*/ CLOCK_PROCESS_CPUTIME_ID;
int /*<<< orphan*/ CLOCK_REALTIME;
int /*<<< orphan*/ CLOCK_REALTIME_COARSE;
int /*<<< orphan*/ CLOCK_THREAD_CPUTIME_ID;
int /*<<< orphan*/ ftime_overhead();
int /*<<< orphan*/ gettimeofday_overhead();
int /*<<< orphan*/ measure_clock(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ time_overhead();
int main(void) {
  printf("=> Testing Clock...\n");
  time_overhead();
  ftime_overhead();
  gettimeofday_overhead();
  measure_clock("CLOCK_REALTIME", CLOCK_REALTIME);
  measure_clock("CLOCK_REALTIME_COARSE", CLOCK_REALTIME_COARSE);
  measure_clock("CLOCK_MONOTONIC", CLOCK_MONOTONIC);
  measure_clock("CLOCK_MONOTONIC_COARSE", CLOCK_MONOTONIC_COARSE);
  measure_clock("CLOCK_MONOTONIC_RAW", CLOCK_MONOTONIC_RAW);
  measure_clock("CLOCK_BOOTTIME", CLOCK_BOOTTIME);
  measure_clock("CLOCK_PROCESS_CPUTIME_ID", CLOCK_PROCESS_CPUTIME_ID);
  measure_clock("CLOCK_THREAD_CPUTIME_ID", CLOCK_THREAD_CPUTIME_ID);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1070 <time_overhead@plt>
mov    $0x0,%al
call   1050 <ftime_overhead@plt>
mov    $0x0,%al
call   1060 <gettimeofday_overhead@plt>
mov    0x2e21(%rip),%rax
mov    (%rax),%esi
lea    0xe85(%rip),%rdi
call   1040 <measure_clock@plt>
mov    0x2e14(%rip),%rax
mov    (%rax),%esi
lea    0xe7f(%rip),%rdi
call   1040 <measure_clock@plt>
mov    0x2e1f(%rip),%rax
mov    (%rax),%esi
lea    0xe80(%rip),%rdi
call   1040 <measure_clock@plt>
mov    0x2e02(%rip),%rax
mov    (%rax),%esi
lea    0xe7b(%rip),%rdi
call   1040 <measure_clock@plt>
mov    0x2de5(%rip),%rax
mov    (%rax),%esi
lea    0xe7d(%rip),%rdi
call   1040 <measure_clock@plt>
mov    0x2df0(%rip),%rax
mov    (%rax),%esi
lea    0xe7c(%rip),%rdi
call   1040 <measure_clock@plt>
mov    0x2dd3(%rip),%rax
mov    (%rax),%esi
lea    0xe76(%rip),%rdi
call   1040 <measure_clock@plt>
mov    0x2dce(%rip),%rax
mov    (%rax),%esi
lea    0xe7a(%rip),%rdi
call   1040 <measure_clock@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf48(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1070 <time_overhead@plt>
xor    %eax,%eax
call   1050 <ftime_overhead@plt>
xor    %eax,%eax
call   1060 <gettimeofday_overhead@plt>
mov    0x2e2f(%rip),%rax
mov    (%rax),%esi
lea    0xe7e(%rip),%rdi
call   1040 <measure_clock@plt>
mov    0x2e22(%rip),%rax
mov    (%rax),%esi
lea    0xe78(%rip),%rdi
call   1040 <measure_clock@plt>
mov    0x2e2d(%rip),%rax
mov    (%rax),%esi
lea    0xe79(%rip),%rdi
call   1040 <measure_clock@plt>
mov    0x2e10(%rip),%rax
mov    (%rax),%esi
lea    0xe74(%rip),%rdi
call   1040 <measure_clock@plt>
mov    0x2df3(%rip),%rax
mov    (%rax),%esi
lea    0xe76(%rip),%rdi
call   1040 <measure_clock@plt>
mov    0x2dfe(%rip),%rax
mov    (%rax),%esi
lea    0xe75(%rip),%rdi
call   1040 <measure_clock@plt>
mov    0x2de1(%rip),%rax
mov    (%rax),%esi
lea    0xe6f(%rip),%rdi
call   1040 <measure_clock@plt>
mov    0x2ddc(%rip),%rax
mov    (%rax),%esi
lea    0xe73(%rip),%rdi
call   1040 <measure_clock@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"=> Testing Clock...\0A\00"
@.str.1 = [15 x i8] c"CLOCK_REALTIME\00"
@CLOCK_REALTIME = global i32 0
@.str.2 = [22 x i8] c"CLOCK_REALTIME_COARSE\00"
@CLOCK_REALTIME_COARSE = global i32 0
@.str.3 = [16 x i8] c"CLOCK_MONOTONIC\00"
@CLOCK_MONOTONIC = global i32 0
@.str.4 = [23 x i8] c"CLOCK_MONOTONIC_COARSE\00"
@CLOCK_MONOTONIC_COARSE = global i32 0
@.str.5 = [20 x i8] c"CLOCK_MONOTONIC_RAW\00"
@CLOCK_MONOTONIC_RAW = global i32 0
@.str.6 = [15 x i8] c"CLOCK_BOOTTIME\00"
@CLOCK_BOOTTIME = global i32 0
@.str.7 = [25 x i8] c"CLOCK_PROCESS_CPUTIME_ID\00"
@CLOCK_PROCESS_CPUTIME_ID = global i32 0
@.str.8 = [24 x i8] c"CLOCK_THREAD_CPUTIME_ID\00"
@CLOCK_THREAD_CPUTIME_ID = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @time_overhead()
%4 = call i32 (...) @ftime_overhead()
%5 = call i32 (...) @gettimeofday_overhead()
%6 = load i32, i32* @CLOCK_REALTIME
%7 = call i32 @measure_clock(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = load i32, i32* @CLOCK_REALTIME_COARSE
%9 = call i32 @measure_clock(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %8)
%10 = load i32, i32* @CLOCK_MONOTONIC
%11 = call i32 @measure_clock(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %10)
%12 = load i32, i32* @CLOCK_MONOTONIC_COARSE
%13 = call i32 @measure_clock(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %12)
%14 = load i32, i32* @CLOCK_MONOTONIC_RAW
%15 = call i32 @measure_clock(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32 %14)
%16 = load i32, i32* @CLOCK_BOOTTIME
%17 = call i32 @measure_clock(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i32 %16)
%18 = load i32, i32* @CLOCK_PROCESS_CPUTIME_ID
%19 = call i32 @measure_clock(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i32 %18)
%20 = load i32, i32* @CLOCK_THREAD_CPUTIME_ID
%21 = call i32 @measure_clock(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0), i32 %20)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [15 x i8] c"CLOCK_REALTIME\00"
@CLOCK_REALTIME = global i32 0
@.str.2 = [22 x i8] c"CLOCK_REALTIME_COARSE\00"
@CLOCK_REALTIME_COARSE = global i32 0
@.str.3 = [16 x i8] c"CLOCK_MONOTONIC\00"
@CLOCK_MONOTONIC = global i32 0
@.str.4 = [23 x i8] c"CLOCK_MONOTONIC_COARSE\00"
@CLOCK_MONOTONIC_COARSE = global i32 0
@.str.5 = [20 x i8] c"CLOCK_MONOTONIC_RAW\00"
@CLOCK_MONOTONIC_RAW = global i32 0
@.str.6 = [15 x i8] c"CLOCK_BOOTTIME\00"
@CLOCK_BOOTTIME = global i32 0
@.str.7 = [25 x i8] c"CLOCK_PROCESS_CPUTIME_ID\00"
@CLOCK_PROCESS_CPUTIME_ID = global i32 0
@.str.8 = [24 x i8] c"CLOCK_THREAD_CPUTIME_ID\00"
@CLOCK_THREAD_CPUTIME_ID = global i32 0
@str = [20 x i8] c"=> Testing Clock...\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @time_overhead()
%3 = tail call i32 (...) @ftime_overhead()
%4 = tail call i32 (...) @gettimeofday_overhead()
%5 = load i32, i32* @CLOCK_REALTIME
%6 = tail call i32 @measure_clock(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = load i32, i32* @CLOCK_REALTIME_COARSE
%8 = tail call i32 @measure_clock(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = load i32, i32* @CLOCK_MONOTONIC
%10 = tail call i32 @measure_clock(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %9)
%11 = load i32, i32* @CLOCK_MONOTONIC_COARSE
%12 = tail call i32 @measure_clock(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %11)
%13 = load i32, i32* @CLOCK_MONOTONIC_RAW
%14 = tail call i32 @measure_clock(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32 %13)
%15 = load i32, i32* @CLOCK_BOOTTIME
%16 = tail call i32 @measure_clock(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i32 %15)
%17 = load i32, i32* @CLOCK_PROCESS_CPUTIME_ID
%18 = tail call i32 @measure_clock(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i32 %17)
%19 = load i32, i32* @CLOCK_THREAD_CPUTIME_ID
%20 = tail call i32 @measure_clock(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0), i32 %19)
ret i32 0
}