#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 timespec {
  int tv_sec;
  int tv_nsec;
  int /*<<< orphan*/ member_1;
  int /*<<< orphan*/ member_0;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC;
int /*<<< orphan*/ CLOCK_MONOTONIC_RAW;
int /*<<< orphan*/ CLOCK_PROCESS_CPUTIME_ID;
int /*<<< orphan*/ CLOCK_REALTIME;
int /*<<< orphan*/ CLOCK_THREAD_CPUTIME_ID;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
int /*<<< orphan*/ printf(char *, int, ...);
int /*<<< orphan*/ sleep(int);
int time(int /*<<< orphan*/ *);
int main() {
  struct timespec time1 = {0, 0};
  struct timespec my_tm = {0, 0};
  clock_gettime(CLOCK_REALTIME, &time1);
  printf("CLOCK_REALTIME: %d, %d\n", time1.tv_sec, time1.tv_nsec);
  clock_gettime(CLOCK_MONOTONIC, &time1);
  clock_gettime(CLOCK_MONOTONIC_RAW, &my_tm);
  printf("\nCLOCK_MONOTONIC:\t%d, %d\n", time1.tv_sec, time1.tv_nsec);
  printf("CLOCK_MONOTONIC_RAW:\t%d, %d\n\n", my_tm.tv_sec, my_tm.tv_nsec);
  clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &time1);
  printf("CLOCK_PROCESS_CPUTIME_ID: %d, %d\n", time1.tv_sec, time1.tv_nsec);
  clock_gettime(CLOCK_THREAD_CPUTIME_ID, &time1);
  printf("CLOCK_THREAD_CPUTIME_ID: %d, %d\n", time1.tv_sec, time1.tv_nsec);
  clock_gettime(CLOCK_MONOTONIC_RAW, &my_tm);
  printf("CLOCK_MONOTONIC_RAW: \n%d, %d\n", my_tm.tv_sec, my_tm.tv_nsec);
  printf("time:\n%d\n", time(NULL));
  sleep(1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1050 <memset@plt>
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1050 <memset@plt>
mov    0x2e41(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1030 <clock_gettime@plt>
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2e33(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1030 <clock_gettime@plt>
mov    0x2e19(%rip),%rax
mov    (%rax),%edi
lea    -0x20(%rbp),%rsi
call   1030 <clock_gettime@plt>
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%esi
mov    -0x1c(%rbp),%edx
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2def(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1030 <clock_gettime@plt>
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2dd1(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1030 <clock_gettime@plt>
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2d93(%rip),%rax
mov    (%rax),%edi
lea    -0x20(%rbp),%rsi
call   1030 <clock_gettime@plt>
mov    -0x20(%rbp),%esi
mov    -0x1c(%rbp),%edx
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%esi
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0x10(%rsp)
mov    0x2e64(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1030 <clock_gettime@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%edx
lea    0xe89(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e53(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
call   1030 <clock_gettime@plt>
mov    0x2e3a(%rip),%r15
mov    (%r15),%edi
lea    0x10(%rsp),%r14
mov    %r14,%rsi
call   1030 <clock_gettime@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%edx
lea    0xe64(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%esi
mov    0x14(%rsp),%edx
lea    0xe68(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e08(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
call   1030 <clock_gettime@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%edx
lea    0xe60(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2dea(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
call   1030 <clock_gettime@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%edx
lea    0xe5c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%r15),%edi
mov    %r14,%rsi
call   1030 <clock_gettime@plt>
mov    0x10(%rsp),%esi
mov    0x14(%rsp),%edx
lea    0xe5c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
call   1050 <time@plt>
lea    0xe65(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i32, i32, i32 }
@CLOCK_REALTIME = global i32 0
@.str = [24 x i8] c"CLOCK_REALTIME: %d, %d\0A\00"
@CLOCK_MONOTONIC = global i32 0
@CLOCK_MONOTONIC_RAW = global i32 0
@.str.1 = [26 x i8] c"\0ACLOCK_MONOTONIC:\09%d, %d\0A\00"
@.str.2 = [30 x i8] c"CLOCK_MONOTONIC_RAW:\09%d, %d\0A\0A\00"
@CLOCK_PROCESS_CPUTIME_ID = global i32 0
@.str.3 = [34 x i8] c"CLOCK_PROCESS_CPUTIME_ID: %d, %d\0A\00"
@CLOCK_THREAD_CPUTIME_ID = global i32 0
@.str.4 = [33 x i8] c"CLOCK_THREAD_CPUTIME_ID: %d, %d\0A\00"
@.str.5 = [30 x i8] c"CLOCK_MONOTONIC_RAW: \0A%d, %d\0A\00"
@.str.6 = [10 x i8] c"time:\0A%d\0A\00"
define i32 @main() {
%1 = alloca %struct.timespec
%2 = alloca %struct.timespec
%3 = bitcast %struct.timespec* %1 to i8*
%4 = bitcast %struct.timespec* %2 to i8*
%5 = load i32, i32* @CLOCK_REALTIME
%6 = call i32 @clock_gettime(i32 %5, %struct.timespec* %1)
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 0
%8 = load i32, i32* %7
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 1
%10 = load i32, i32* %9
%11 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %10)
%12 = load i32, i32* @CLOCK_MONOTONIC
%13 = call i32 @clock_gettime(i32 %12, %struct.timespec* %1)
%14 = load i32, i32* @CLOCK_MONOTONIC_RAW
%15 = call i32 @clock_gettime(i32 %14, %struct.timespec* %2)
%16 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 0
%17 = load i32, i32* %16
%18 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 1
%19 = load i32, i32* %18
%20 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %17, i32 %19)
%21 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i32 0, i32 0
%22 = load i32, i32* %21
%23 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i32 0, i32 1
%24 = load i32, i32* %23
%25 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %22, i32 %24)
%26 = load i32, i32* @CLOCK_PROCESS_CPUTIME_ID
%27 = call i32 @clock_gettime(i32 %26, %struct.timespec* %1)
%28 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 0
%29 = load i32, i32* %28
%30 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 1
%31 = load i32, i32* %30
%32 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i32 %29, i32 %31)
%33 = load i32, i32* @CLOCK_THREAD_CPUTIME_ID
%34 = call i32 @clock_gettime(i32 %33, %struct.timespec* %1)
%35 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 0
%36 = load i32, i32* %35
%37 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 1
%38 = load i32, i32* %37
%39 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i32 %36, i32 %38)
%40 = load i32, i32* @CLOCK_MONOTONIC_RAW
%41 = call i32 @clock_gettime(i32 %40, %struct.timespec* %2)
%42 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i32 0, i32 0
%43 = load i32, i32* %42
%44 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i32 0, i32 1
%45 = load i32, i32* %44
%46 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i32 %43, i32 %45)
%47 = call i32 @time(i32* null)
%48 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 %47)
%49 = call i32 @sleep(i32 1)
ret i32 0
}

LLVM IR (-O2):
%struct.timespec = type { i32, i32, i32, i32 }
@CLOCK_REALTIME = global i32 0
@.str = [24 x i8] c"CLOCK_REALTIME: %d, %d\0A\00"
@CLOCK_MONOTONIC = global i32 0
@CLOCK_MONOTONIC_RAW = global i32 0
@.str.1 = [26 x i8] c"\0ACLOCK_MONOTONIC:\09%d, %d\0A\00"
@.str.2 = [30 x i8] c"CLOCK_MONOTONIC_RAW:\09%d, %d\0A\0A\00"
@CLOCK_PROCESS_CPUTIME_ID = global i32 0
@.str.3 = [34 x i8] c"CLOCK_PROCESS_CPUTIME_ID: %d, %d\0A\00"
@CLOCK_THREAD_CPUTIME_ID = global i32 0
@.str.4 = [33 x i8] c"CLOCK_THREAD_CPUTIME_ID: %d, %d\0A\00"
@.str.5 = [30 x i8] c"CLOCK_MONOTONIC_RAW: \0A%d, %d\0A\00"
@.str.6 = [10 x i8] c"time:\0A%d\0A\00"
define i32 @main() {
%1 = alloca %struct.timespec
%2 = alloca %struct.timespec
%3 = bitcast %struct.timespec* %1 to i8*
%4 = bitcast %struct.timespec* %2 to i8*
%5 = load i32, i32* @CLOCK_REALTIME
%6 = call i32 @clock_gettime(i32 %5, %struct.timespec* %1)
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%8 = load i32, i32* %7
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%10 = load i32, i32* %9
%11 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %10)
%12 = load i32, i32* @CLOCK_MONOTONIC
%13 = call i32 @clock_gettime(i32 %12, %struct.timespec* %1)
%14 = load i32, i32* @CLOCK_MONOTONIC_RAW
%15 = call i32 @clock_gettime(i32 %14, %struct.timespec* %2)
%16 = load i32, i32* %7
%17 = load i32, i32* %9
%18 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %16, i32 %17)
%19 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 0
%20 = load i32, i32* %19
%21 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 1
%22 = load i32, i32* %21
%23 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %20, i32 %22)
%24 = load i32, i32* @CLOCK_PROCESS_CPUTIME_ID
%25 = call i32 @clock_gettime(i32 %24, %struct.timespec* %1)
%26 = load i32, i32* %7
%27 = load i32, i32* %9
%28 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i32 %26, i32 %27)
%29 = load i32, i32* @CLOCK_THREAD_CPUTIME_ID
%30 = call i32 @clock_gettime(i32 %29, %struct.timespec* %1)
%31 = load i32, i32* %7
%32 = load i32, i32* %9
%33 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i32 %31, i32 %32)
%34 = load i32, i32* @CLOCK_MONOTONIC_RAW
%35 = call i32 @clock_gettime(i32 %34, %struct.timespec* %2)
%36 = load i32, i32* %19
%37 = load i32, i32* %21
%38 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i32 %36, i32 %37)
%39 = call i32 @time(i32* null)
%40 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 %39)
%41 = call i32 @sleep(i32 1)
ret i32 0
}