#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 {
  double tv_sec;
  double tv_nsec;
};
typedef double clock_t;

/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC;
int /*<<< orphan*/ CLOCK_PROCESS_CPUTIME_ID;
int /*<<< orphan*/ CLOCK_REALTIME;
int /*<<< orphan*/ CLOCK_THREAD_CPUTIME_ID;
double clock();
int clock_getres(int /*<<< orphan*/, struct timespec *);
int clock_gettime(int /*<<< orphan*/, struct timespec *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ show_duration(char *, struct timespec, struct timespec);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ waste_some_cpu_cycles();
int main() {
  clock_t start, end;
  start = clock();
  printf("main\n");
  struct timespec realtime_start;
  int res1 = clock_gettime(CLOCK_REALTIME, &realtime_start);
  printf("CLOCK_REALTIME clock start res1  = %d\n", res1);
  printf("CLOCK_REALTIME clock start secs  = %ld\n", realtime_start.tv_sec);
  printf("CLOCK_REALTIME clock start nanos = %ld\n", realtime_start.tv_nsec);
  struct timespec monotonic_start;
  int res2 = clock_gettime(CLOCK_MONOTONIC, &monotonic_start);
  printf("CLOCK_MONOTONIC clock start res2  = %d\n", res2);
  printf("CLOCK_MONOTONIC clock start secs  = %ld\n", monotonic_start.tv_sec);
  printf("CLOCK_MONOTONIC clock start nanos = %ld\n", monotonic_start.tv_nsec);
  struct timespec process_start;
  int res3 = clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &process_start);
  printf("CLOCK_PROCESS_CPUTIME_ID clock start res3  = %d\n", res3);
  printf("CLOCK_PROCESS_CPUTIME_ID clock start secs  = %ld\n",
         process_start.tv_sec);
  printf("CLOCK_PROCESS_CPUTIME_ID clock start nanos = %ld\n",
         process_start.tv_nsec);
  struct timespec thread_start;
  int res4 = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &thread_start);
  printf("CLOCK_THREAD_CPUTIME_ID clock start res4  = %d\n", res4);
  printf("CLOCK_THREAD_CPUTIME_ID clock start secs  = %ld\n",
         thread_start.tv_sec);
  printf("CLOCK_THREAD_CPUTIME_ID clock start nanos = %ld\n",
         thread_start.tv_nsec);
  struct timespec realtime_res;
  res1 = clock_getres(CLOCK_REALTIME, &realtime_res);
  printf("CLOCK_REALTIME clock res res1  = %d\n", res1);
  printf("CLOCK_REALTIME clock res secs  = %ld\n", realtime_res.tv_sec);
  printf("CLOCK_REALTIME clock res nanos = %ld\n", realtime_res.tv_nsec);
  struct timespec monotonic_res;
  res2 = clock_getres(CLOCK_MONOTONIC, &monotonic_res);
  printf("CLOCK_MONOTONIC clock res res2  = %d\n", res2);
  printf("CLOCK_MONOTONIC clock res secs  = %ld\n", monotonic_res.tv_sec);
  printf("CLOCK_MONOTONIC clock res nanos = %ld\n", monotonic_res.tv_nsec);
  struct timespec process_res;
  res3 = clock_getres(CLOCK_PROCESS_CPUTIME_ID, &process_res);
  printf("CLOCK_PROCESS_CPUTIME_ID clock res res3  = %d\n", res3);
  printf("CLOCK_PROCESS_CPUTIME_ID clock res secs  = %ld\n",
         process_res.tv_sec);
  printf("CLOCK_PROCESS_CPUTIME_ID clock res nanos = %ld\n",
         process_res.tv_nsec);
  struct timespec thread_res;
  res4 = clock_getres(CLOCK_THREAD_CPUTIME_ID, &thread_res);
  printf("CLOCK_THREAD_CPUTIME_ID clock res res4  = %d\n", res4);
  printf("CLOCK_THREAD_CPUTIME_ID clock res secs  = %ld\n", thread_res.tv_sec);
  printf("CLOCK_THREAD_CPUTIME_ID clock res nanos = %ld\n", thread_res.tv_nsec);
  sleep(1);
  waste_some_cpu_cycles();
  struct timespec realtime_end;
  res1 = clock_gettime(CLOCK_REALTIME, &realtime_end);
  printf("CLOCK_REALTIME clock end res1  = %d\n", res1);
  printf("CLOCK_REALTIME clock end secs  = %ld\n", realtime_end.tv_sec);
  printf("CLOCK_REALTIME clock end nanos = %ld\n", realtime_end.tv_nsec);
  struct timespec monotonic_end;
  res2 = clock_gettime(CLOCK_MONOTONIC, &monotonic_end);
  printf("CLOCK_MONOTONIC clock end res2  = %d\n", res2);
  printf("CLOCK_MONOTONIC clock end secs  = %ld\n", monotonic_end.tv_sec);
  printf("CLOCK_MONOTONIC clock end nanos = %ld\n", monotonic_end.tv_nsec);
  struct timespec process_end;
  res3 = clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &process_end);
  printf("CLOCK_PROCESS_CPUTIME_ID clock end res3  = %d\n", res3);
  printf("CLOCK_PROCESS_CPUTIME_ID clock end secs  = %ld\n",
         process_end.tv_sec);
  printf("CLOCK_PROCESS_CPUTIME_ID clock end nanos = %ld\n",
         process_end.tv_nsec);
  struct timespec thread_end;
  res4 = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &thread_end);
  printf("CLOCK_THREAD_CPUTIME_ID clock end res4  = %d\n", res4);
  printf("CLOCK_THREAD_CPUTIME_ID clock end secs  = %ld\n", thread_end.tv_sec);
  printf("CLOCK_THREAD_CPUTIME_ID clock end nanos = %ld\n", thread_end.tv_nsec);
  end = clock();
  double time_taken1 = end - start;
  printf("time taken = %lg\n", time_taken1);
  show_duration("CLOCK_REALTIME", realtime_start, realtime_end);
  show_duration("CLOCK_MONOTONIC", monotonic_start, monotonic_end);
  show_duration("CLOCK_PROCESS_CPUTIME_ID", process_start, process_end);
  show_duration("CLOCK_THREAD_CPUTIME_ID", thread_start, thread_end);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <clock@plt>
movsd  %xmm0,-0x10(%rbp)
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2e25(%rip),%rax
mov    (%rax),%edi
lea    -0x28(%rbp),%rsi
call   1030 <clock_gettime@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%esi
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movsd  -0x28(%rbp),%xmm0
lea    0xe5f(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  -0x20(%rbp),%xmm0
lea    0xe74(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    0x2de9(%rip),%rax
mov    (%rax),%edi
lea    -0x40(%rbp),%rsi
call   1030 <clock_gettime@plt>
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%esi
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movsd  -0x40(%rbp),%xmm0
lea    0xe8b(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  -0x38(%rbp),%xmm0
lea    0xea1(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    0x2da5(%rip),%rax
mov    (%rax),%edi
lea    -0x58(%rbp),%rsi
call   1030 <clock_gettime@plt>
mov    %eax,-0x5c(%rbp)
mov    -0x5c(%rbp),%esi
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movsd  -0x58(%rbp),%xmm0
lea    0xec2(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  -0x50(%rbp),%xmm0
lea    0xee1(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    0x2d61(%rip),%rax
mov    (%rax),%edi
lea    -0x70(%rbp),%rsi
call   1030 <clock_gettime@plt>
mov    %eax,-0x74(%rbp)
mov    -0x74(%rbp),%esi
lea    0xeed(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movsd  -0x70(%rbp),%xmm0
lea    0xf0a(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  -0x68(%rbp),%xmm0
lea    0xf28(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    0x2cf5(%rip),%rax
mov    (%rax),%edi
lea    -0x88(%rbp),%rsi
call   1080 <clock_getres@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%esi
lea    0xf30(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movsd  -0x88(%rbp),%xmm0
ff
lea    0xf3f(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  -0x80(%rbp),%xmm0
lea    0xf52(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    0x2cb3(%rip),%rax
mov    (%rax),%edi
lea    -0x98(%rbp),%rsi
call   1080 <clock_getres@plt>
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%esi
lea    0xf4f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movsd  -0x98(%rbp),%xmm0
ff
lea    0xf5f(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  -0x90(%rbp),%xmm0
ff
lea    0xf70(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    0x2c66(%rip),%rax
mov    (%rax),%edi
lea    -0xa8(%rbp),%rsi
call   1080 <clock_getres@plt>
mov    %eax,-0x5c(%rbp)
mov    -0x5c(%rbp),%esi
lea    0xf6e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movsd  -0xa8(%rbp),%xmm0
ff
lea    0xf87(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  -0xa0(%rbp),%xmm0
ff
lea    0xfa1(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    0x2c19(%rip),%rax
mov    (%rax),%edi
lea    -0xb8(%rbp),%rsi
call   1080 <clock_getres@plt>
mov    %eax,-0x74(%rbp)
mov    -0x74(%rbp),%esi
lea    0xfa8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movsd  -0xb8(%rbp),%xmm0
ff
lea    0xfc0(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  -0xb0(%rbp),%xmm0
ff
lea    0xfd9(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   1090 <sleep@plt>
mov    $0x0,%al
call   1060 <waste_some_cpu_cycles@plt>
mov    0x2b93(%rip),%rax
mov    (%rax),%edi
lea    -0xc8(%rbp),%rsi
call   1030 <clock_gettime@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%esi
lea    0xfce(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movsd  -0xc8(%rbp),%xmm0
ff
lea    0xfdd(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  -0xc0(%rbp),%xmm0
ff
lea    0xfed(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    0x2b4e(%rip),%rax
mov    (%rax),%edi
lea    -0xd8(%rbp),%rsi
call   1030 <clock_gettime@plt>
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%esi
lea    0xfea(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movsd  -0xd8(%rbp),%xmm0
ff
lea    0xffa(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  -0xd0(%rbp),%xmm0
ff
lea    0x100b(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    0x2b01(%rip),%rax
mov    (%rax),%edi
lea    -0xe8(%rbp),%rsi
call   1030 <clock_gettime@plt>
mov    %eax,-0x5c(%rbp)
mov    -0x5c(%rbp),%esi
lea    0x1009(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movsd  -0xe8(%rbp),%xmm0
ff
lea    0x1022(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  -0xe0(%rbp),%xmm0
ff
lea    0x103c(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    0x2ab4(%rip),%rax
mov    (%rax),%edi
lea    -0xf8(%rbp),%rsi
call   1030 <clock_gettime@plt>
mov    %eax,-0x74(%rbp)
mov    -0x74(%rbp),%esi
lea    0x1043(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movsd  -0xf8(%rbp),%xmm0
ff
lea    0x105b(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  -0xf0(%rbp),%xmm0
ff
lea    0x1074(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <clock@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x100(%rbp)
ff
movsd  -0x100(%rbp),%xmm0
ff
lea    0x106f(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  -0x28(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0xc8(%rbp),%xmm2
ff
movsd  -0xc0(%rbp),%xmm3
ff
lea    0x1059(%rip),%rdi
call   1070 <show_duration@plt>
movsd  -0x40(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movsd  -0xd8(%rbp),%xmm2
ff
movsd  -0xd0(%rbp),%xmm3
ff
lea    0x1042(%rip),%rdi
call   1070 <show_duration@plt>
movsd  -0x58(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
movsd  -0xe8(%rbp),%xmm2
ff
movsd  -0xe0(%rbp),%xmm3
ff
lea    0x102c(%rip),%rdi
call   1070 <show_duration@plt>
movsd  -0x70(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm1
movsd  -0xf8(%rbp),%xmm2
ff
movsd  -0xf0(%rbp),%xmm3
ff
lea    0x101f(%rip),%rdi
call   1070 <show_duration@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xc8,%rsp
xor    %eax,%eax
call   1050 <clock@plt>
movsd  %xmm0,0x80(%rsp)
lea    0x14d5(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e17(%rip),%r14
mov    (%r14),%edi
lea    0x70(%rsp),%rsi
call   1040 <clock_gettime@plt>
lea    0xe3b(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
movsd  0x70(%rsp),%xmm0
lea    0xe4c(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movsd  0x78(%rsp),%xmm0
lea    0xe60(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    0x2ddb(%rip),%r15
mov    (%r15),%edi
lea    0x60(%rsp),%rsi
call   1040 <clock_gettime@plt>
lea    0xe66(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
movsd  0x60(%rsp),%xmm0
lea    0xe78(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movsd  0x68(%rsp),%xmm0
lea    0xe8d(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    0x2d97(%rip),%r12
mov    (%r12),%edi
lea    0x50(%rsp),%rsi
call   1040 <clock_gettime@plt>
lea    0xe93(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
movsd  0x50(%rsp),%xmm0
lea    0xeae(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movsd  0x58(%rsp),%xmm0
lea    0xecc(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    0x2d52(%rip),%rbx
mov    (%rbx),%edi
lea    0x40(%rsp),%rsi
call   1040 <clock_gettime@plt>
lea    0xedd(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
movsd  0x40(%rsp),%xmm0
lea    0xef7(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movsd  0x48(%rsp),%xmm0
lea    0xf14(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    (%r14),%edi
lea    0xb8(%rsp),%rsi
call   1090 <clock_getres@plt>
lea    0xf27(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
movsd  0xb8(%rsp),%xmm0
lea    0xf33(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movsd  0xc0(%rsp),%xmm0
lea    0xf42(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    (%r15),%edi
lea    0xa8(%rsp),%rsi
call   1090 <clock_getres@plt>
lea    0xf4a(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
movsd  0xa8(%rsp),%xmm0
lea    0xf57(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movsd  0xb0(%rsp),%xmm0
lea    0xf67(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    (%r12),%edi
lea    0x98(%rsp),%rsi
call   1090 <clock_getres@plt>
lea    0xf6f(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
movsd  0x98(%rsp),%xmm0
lea    0xf85(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movsd  0xa0(%rsp),%xmm0
lea    0xf9e(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    (%rbx),%edi
lea    0x88(%rsp),%rsi
call   1090 <clock_getres@plt>
lea    0xfb1(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
movsd  0x88(%rsp),%xmm0
lea    0xfc6(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movsd  0x90(%rsp),%xmm0
lea    0xfde(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
xor    %eax,%eax
call   1070 <waste_some_cpu_cycles@plt>
mov    (%r14),%edi
lea    0x30(%rsp),%rsi
call   1040 <clock_gettime@plt>
lea    0xfe1(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
movsd  0x30(%rsp),%xmm0
lea    0xff0(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movsd  0x38(%rsp),%xmm0
lea    0x1002(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    (%r15),%edi
lea    0x20(%rsp),%rsi
call   1040 <clock_gettime@plt>
lea    0x100d(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
movsd  0x20(%rsp),%xmm0
lea    0x101d(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movsd  0x28(%rsp),%xmm0
lea    0x1030(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    (%r12),%edi
lea    0x10(%rsp),%rsi
call   1040 <clock_gettime@plt>
lea    0x103b(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
movsd  0x10(%rsp),%xmm0
lea    0x1054(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movsd  0x18(%rsp),%xmm0
lea    0x1070(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    (%rbx),%edi
mov    %rsp,%rsi
call   1040 <clock_gettime@plt>
lea    0x1088(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
movsd  (%rsp),%xmm0
lea    0x10a1(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movsd  0x8(%rsp),%xmm0
lea    0x10bc(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
xor    %eax,%eax
call   1050 <clock@plt>
subsd  0x80(%rsp),%xmm0
lea    0x10cd(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movsd  0x70(%rsp),%xmm0
movsd  0x78(%rsp),%xmm1
movsd  0x30(%rsp),%xmm2
movsd  0x38(%rsp),%xmm3
lea    0x10b9(%rip),%rdi
call   1080 <show_duration@plt>
movsd  0x60(%rsp),%xmm0
movsd  0x68(%rsp),%xmm1
movsd  0x20(%rsp),%xmm2
movsd  0x28(%rsp),%xmm3
lea    0x10a4(%rip),%rdi
call   1080 <show_duration@plt>
movsd  0x50(%rsp),%xmm0
movsd  0x58(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
movsd  0x18(%rsp),%xmm3
lea    0x1090(%rip),%rdi
call   1080 <show_duration@plt>
movsd  0x40(%rsp),%xmm0
movsd  0x48(%rsp),%xmm1
movsd  (%rsp),%xmm2
movsd  0x8(%rsp),%xmm3
lea    0x1086(%rip),%rdi
call   1080 <show_duration@plt>
xor    %eax,%eax
add    $0xc8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.timespec = type { double, double }
@.str = [6 x i8] c"main\0A\00"
@CLOCK_REALTIME = global i32 0
@.str.1 = [39 x i8] c"CLOCK_REALTIME clock start res1 = %d\0A\00"
@.str.2 = [40 x i8] c"CLOCK_REALTIME clock start secs = %ld\0A\00"
@.str.3 = [40 x i8] c"CLOCK_REALTIME clock start nanos = %ld\0A\00"
@CLOCK_MONOTONIC = global i32 0
@.str.4 = [40 x i8] c"CLOCK_MONOTONIC clock start res2 = %d\0A\00"
@.str.5 = [41 x i8] c"CLOCK_MONOTONIC clock start secs = %ld\0A\00"
@.str.6 = [41 x i8] c"CLOCK_MONOTONIC clock start nanos = %ld\0A\00"
@CLOCK_PROCESS_CPUTIME_ID = global i32 0
@.str.7 = [49 x i8] c"CLOCK_PROCESS_CPUTIME_ID clock start res3 = %d\0A\00"
@.str.8 = [50 x i8] c"CLOCK_PROCESS_CPUTIME_ID clock start secs = %ld\0A\00"
@.str.9 = [50 x i8] c"CLOCK_PROCESS_CPUTIME_ID clock start nanos = %ld\0A\00"
@CLOCK_THREAD_CPUTIME_ID = global i32 0
@.str.10 = [48 x i8] c"CLOCK_THREAD_CPUTIME_ID clock start res4 = %d\0A\00"
@.str.11 = [49 x i8] c"CLOCK_THREAD_CPUTIME_ID clock start secs = %ld\0A\00"
@.str.12 = [49 x i8] c"CLOCK_THREAD_CPUTIME_ID clock start nanos = %ld\0A\00"
@.str.13 = [37 x i8] c"CLOCK_REALTIME clock res res1 = %d\0A\00"
@.str.14 = [38 x i8] c"CLOCK_REALTIME clock res secs = %ld\0A\00"
@.str.15 = [38 x i8] c"CLOCK_REALTIME clock res nanos = %ld\0A\00"
@.str.16 = [38 x i8] c"CLOCK_MONOTONIC clock res res2 = %d\0A\00"
@.str.17 = [39 x i8] c"CLOCK_MONOTONIC clock res secs = %ld\0A\00"
@.str.18 = [39 x i8] c"CLOCK_MONOTONIC clock res nanos = %ld\0A\00"
@.str.19 = [47 x i8] c"CLOCK_PROCESS_CPUTIME_ID clock res res3 = %d\0A\00"
@.str.20 = [48 x i8] c"CLOCK_PROCESS_CPUTIME_ID clock res secs = %ld\0A\00"
@.str.21 = [48 x i8] c"CLOCK_PROCESS_CPUTIME_ID clock res nanos = %ld\0A\00"
@.str.22 = [46 x i8] c"CLOCK_THREAD_CPUTIME_ID clock res res4 = %d\0A\00"
@.str.23 = [47 x i8] c"CLOCK_THREAD_CPUTIME_ID clock res secs = %ld\0A\00"
@.str.24 = [47 x i8] c"CLOCK_THREAD_CPUTIME_ID clock res nanos = %ld\0A\00"
@.str.25 = [37 x i8] c"CLOCK_REALTIME clock end res1 = %d\0A\00"
@.str.26 = [38 x i8] c"CLOCK_REALTIME clock end secs = %ld\0A\00"
@.str.27 = [38 x i8] c"CLOCK_REALTIME clock end nanos = %ld\0A\00"
@.str.28 = [38 x i8] c"CLOCK_MONOTONIC clock end res2 = %d\0A\00"
@.str.29 = [39 x i8] c"CLOCK_MONOTONIC clock end secs = %ld\0A\00"
@.str.30 = [39 x i8] c"CLOCK_MONOTONIC clock end nanos = %ld\0A\00"
@.str.31 = [47 x i8] c"CLOCK_PROCESS_CPUTIME_ID clock end res3 = %d\0A\00"
@.str.32 = [48 x i8] c"CLOCK_PROCESS_CPUTIME_ID clock end secs = %ld\0A\00"
@.str.33 = [48 x i8] c"CLOCK_PROCESS_CPUTIME_ID clock end nanos = %ld\0A\00"
@.str.34 = [46 x i8] c"CLOCK_THREAD_CPUTIME_ID clock end res4 = %d\0A\00"
@.str.35 = [47 x i8] c"CLOCK_THREAD_CPUTIME_ID clock end secs = %ld\0A\00"
@.str.36 = [47 x i8] c"CLOCK_THREAD_CPUTIME_ID clock end nanos = %ld\0A\00"
@.str.37 = [18 x i8] c"time taken = %lg\0A\00"
@.str.38 = [15 x i8] c"CLOCK_REALTIME\00"
@.str.39 = [16 x i8] c"CLOCK_MONOTONIC\00"
@.str.40 = [25 x i8] c"CLOCK_PROCESS_CPUTIME_ID\00"
@.str.41 = [24 x i8] c"CLOCK_THREAD_CPUTIME_ID\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca %struct.timespec
%5 = alloca i32
%6 = alloca %struct.timespec
%7 = alloca i32
%8 = alloca %struct.timespec
%9 = alloca i32
%10 = alloca %struct.timespec
%11 = alloca i32
%12 = alloca %struct.timespec
%13 = alloca %struct.timespec
%14 = alloca %struct.timespec
%15 = alloca %struct.timespec
%16 = alloca %struct.timespec
%17 = alloca %struct.timespec
%18 = alloca %struct.timespec
%19 = alloca %struct.timespec
%20 = alloca double
store i32 0, i32* %1
%21 = call double (...) @clock()
store double %21, double* %2
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%23 = load i32, i32* @CLOCK_REALTIME
%24 = call i32 @clock_gettime(i32 %23, %struct.timespec* %4)
store i32 %24, i32* %5
%25 = load i32, i32* %5
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32 %25)
%27 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i32 0, i32 0
%28 = load double, double* %27
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), double %28)
%30 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i32 0, i32 1
%31 = load double, double* %30
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), double %31)
%33 = load i32, i32* @CLOCK_MONOTONIC
%34 = call i32 @clock_gettime(i32 %33, %struct.timespec* %6)
store i32 %34, i32* %7
%35 = load i32, i32* %7
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0), i32 %35)
%37 = getelementptr inbounds %struct.timespec, %struct.timespec* %6, i32 0, i32 0
%38 = load double, double* %37
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0), double %38)
%40 = getelementptr inbounds %struct.timespec, %struct.timespec* %6, i32 0, i32 1
%41 = load double, double* %40
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0), double %41)
%43 = load i32, i32* @CLOCK_PROCESS_CPUTIME_ID
%44 = call i32 @clock_gettime(i32 %43, %struct.timespec* %8)
store i32 %44, i32* %9
%45 = load i32, i32* %9
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.7, i64 0, i64 0), i32 %45)
%47 = getelementptr inbounds %struct.timespec, %struct.timespec* %8, i32 0, i32 0
%48 = load double, double* %47
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.8, i64 0, i64 0), double %48)
%50 = getelementptr inbounds %struct.timespec, %struct.timespec* %8, i32 0, i32 1
%51 = load double, double* %50
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.9, i64 0, i64 0), double %51)
%53 = load i32, i32* @CLOCK_THREAD_CPUTIME_ID
%54 = call i32 @clock_gettime(i32 %53, %struct.timespec* %10)
store i32 %54, i32* %11
%55 = load i32, i32* %11
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.10, i64 0, i64 0), i32 %55)
%57 = getelementptr inbounds %struct.timespec, %struct.timespec* %10, i32 0, i32 0
%58 = load double, double* %57
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.11, i64 0, i64 0), double %58)
%60 = getelementptr inbounds %struct.timespec, %struct.timespec* %10, i32 0, i32 1
%61 = load double, double* %60
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.12, i64 0, i64 0), double %61)
%63 = load i32, i32* @CLOCK_REALTIME
%64 = call i32 @clock_getres(i32 %63, %struct.timespec* %12)
store i32 %64, i32* %5
%65 = load i32, i32* %5
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.13, i64 0, i64 0), i32 %65)
%67 = getelementptr inbounds %struct.timespec, %struct.timespec* %12, i32 0, i32 0
%68 = load double, double* %67
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.14, i64 0, i64 0), double %68)
%70 = getelementptr inbounds %struct.timespec, %struct.timespec* %12, i32 0, i32 1
%71 = load double, double* %70
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.15, i64 0, i64 0), double %71)
%73 = load i32, i32* @CLOCK_MONOTONIC
%74 = call i32 @clock_getres(i32 %73, %struct.timespec* %13)
store i32 %74, i32* %7
%75 = load i32, i32* %7
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.16, i64 0, i64 0), i32 %75)
%77 = getelementptr inbounds %struct.timespec, %struct.timespec* %13, i32 0, i32 0
%78 = load double, double* %77
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.17, i64 0, i64 0), double %78)
%80 = getelementptr inbounds %struct.timespec, %struct.timespec* %13, i32 0, i32 1
%81 = load double, double* %80
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.18, i64 0, i64 0), double %81)
%83 = load i32, i32* @CLOCK_PROCESS_CPUTIME_ID
%84 = call i32 @clock_getres(i32 %83, %struct.timespec* %14)
store i32 %84, i32* %9
%85 = load i32, i32* %9
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.19, i64 0, i64 0), i32 %85)
%87 = getelementptr inbounds %struct.timespec, %struct.timespec* %14, i32 0, i32 0
%88 = load double, double* %87
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.20, i64 0, i64 0), double %88)
%90 = getelementptr inbounds %struct.timespec, %struct.timespec* %14, i32 0, i32 1
%91 = load double, double* %90
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.21, i64 0, i64 0), double %91)
%93 = load i32, i32* @CLOCK_THREAD_CPUTIME_ID
%94 = call i32 @clock_getres(i32 %93, %struct.timespec* %15)
store i32 %94, i32* %11
%95 = load i32, i32* %11
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.22, i64 0, i64 0), i32 %95)
%97 = getelementptr inbounds %struct.timespec, %struct.timespec* %15, i32 0, i32 0
%98 = load double, double* %97
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.23, i64 0, i64 0), double %98)
%100 = getelementptr inbounds %struct.timespec, %struct.timespec* %15, i32 0, i32 1
%101 = load double, double* %100
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.24, i64 0, i64 0), double %101)
%103 = call i32 @sleep(i32 1)
%104 = call i32 (...) @waste_some_cpu_cycles()
%105 = load i32, i32* @CLOCK_REALTIME
%106 = call i32 @clock_gettime(i32 %105, %struct.timespec* %16)
store i32 %106, i32* %5
%107 = load i32, i32* %5
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.25, i64 0, i64 0), i32 %107)
%109 = getelementptr inbounds %struct.timespec, %struct.timespec* %16, i32 0, i32 0
%110 = load double, double* %109
%111 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.26, i64 0, i64 0), double %110)
%112 = getelementptr inbounds %struct.timespec, %struct.timespec* %16, i32 0, i32 1
%113 = load double, double* %112
%114 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.27, i64 0, i64 0), double %113)
%115 = load i32, i32* @CLOCK_MONOTONIC
%116 = call i32 @clock_gettime(i32 %115, %struct.timespec* %17)
store i32 %116, i32* %7
%117 = load i32, i32* %7
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.28, i64 0, i64 0), i32 %117)
%119 = getelementptr inbounds %struct.timespec, %struct.timespec* %17, i32 0, i32 0
%120 = load double, double* %119
%121 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.29, i64 0, i64 0), double %120)
%122 = getelementptr inbounds %struct.timespec, %struct.timespec* %17, i32 0, i32 1
%123 = load double, double* %122
%124 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.30, i64 0, i64 0), double %123)
%125 = load i32, i32* @CLOCK_PROCESS_CPUTIME_ID
%126 = call i32 @clock_gettime(i32 %125, %struct.timespec* %18)
store i32 %126, i32* %9
%127 = load i32, i32* %9
%128 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.31, i64 0, i64 0), i32 %127)
%129 = getelementptr inbounds %struct.timespec, %struct.timespec* %18, i32 0, i32 0
%130 = load double, double* %129
%131 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.32, i64 0, i64 0), double %130)
%132 = getelementptr inbounds %struct.timespec, %struct.timespec* %18, i32 0, i32 1
%133 = load double, double* %132
%134 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.33, i64 0, i64 0), double %133)
%135 = load i32, i32* @CLOCK_THREAD_CPUTIME_ID
%136 = call i32 @clock_gettime(i32 %135, %struct.timespec* %19)
store i32 %136, i32* %11
%137 = load i32, i32* %11
%138 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.34, i64 0, i64 0), i32 %137)
%139 = getelementptr inbounds %struct.timespec, %struct.timespec* %19, i32 0, i32 0
%140 = load double, double* %139
%141 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.35, i64 0, i64 0), double %140)
%142 = getelementptr inbounds %struct.timespec, %struct.timespec* %19, i32 0, i32 1
%143 = load double, double* %142
%144 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.36, i64 0, i64 0), double %143)
%145 = call double (...) @clock()
store double %145, double* %3
%146 = load double, double* %3
%147 = load double, double* %2
%148 = fsub double %146, %147
store double %148, double* %20
%149 = load double, double* %20
%150 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.37, i64 0, i64 0), double %149)
%151 = bitcast %struct.timespec* %4 to { double, double }*
%152 = getelementptr inbounds { double, double }, { double, double }* %151, i32 0, i32 0
%153 = load double, double* %152
%154 = getelementptr inbounds { double, double }, { double, double }* %151, i32 0, i32 1
%155 = load double, double* %154
%156 = bitcast %struct.timespec* %16 to { double, double }*
%157 = getelementptr inbounds { double, double }, { double, double }* %156, i32 0, i32 0
%158 = load double, double* %157
%159 = getelementptr inbounds { double, double }, { double, double }* %156, i32 0, i32 1
%160 = load double, double* %159
%161 = call i32 @show_duration(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.38, i64 0, i64 0), double %153, double %155, double %158, double %160)
%162 = bitcast %struct.timespec* %6 to { double, double }*
%163 = getelementptr inbounds { double, double }, { double, double }* %162, i32 0, i32 0
%164 = load double, double* %163
%165 = getelementptr inbounds { double, double }, { double, double }* %162, i32 0, i32 1
%166 = load double, double* %165
%167 = bitcast %struct.timespec* %17 to { double, double }*
%168 = getelementptr inbounds { double, double }, { double, double }* %167, i32 0, i32 0
%169 = load double, double* %168
%170 = getelementptr inbounds { double, double }, { double, double }* %167, i32 0, i32 1
%171 = load double, double* %170
%172 = call i32 @show_duration(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.39, i64 0, i64 0), double %164, double %166, double %169, double %171)
%173 = bitcast %struct.timespec* %8 to { double, double }*
%174 = getelementptr inbounds { double, double }, { double, double }* %173, i32 0, i32 0
%175 = load double, double* %174
%176 = getelementptr inbounds { double, double }, { double, double }* %173, i32 0, i32 1
%177 = load double, double* %176
%178 = bitcast %struct.timespec* %18 to { double, double }*
%179 = getelementptr inbounds { double, double }, { double, double }* %178, i32 0, i32 0
%180 = load double, double* %179
%181 = getelementptr inbounds { double, double }, { double, double }* %178, i32 0, i32 1
%182 = load double, double* %181
%183 = call i32 @show_duration(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.40, i64 0, i64 0), double %175, double %177, double %180, double %182)
%184 = bitcast %struct.timespec* %10 to { double, double }*
%185 = getelementptr inbounds { double, double }, { double, double }* %184, i32 0, i32 0
%186 = load double, double* %185
%187 = getelementptr inbounds { double, double }, { double, double }* %184, i32 0, i32 1
%188 = load double, double* %187
%189 = bitcast %struct.timespec* %19 to { double, double }*
%190 = getelementptr inbounds { double, double }, { double, double }* %189, i32 0, i32 0
%191 = load double, double* %190
%192 = getelementptr inbounds { double, double }, { double, double }* %189, i32 0, i32 1
%193 = load double, double* %192
%194 = call i32 @show_duration(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.41, i64 0, i64 0), double %186, double %188, double %191, double %193)
ret i32 0
}

LLVM IR (-O2):
%struct.timespec = type { double, double }
@CLOCK_REALTIME = global i32 0
@.str.1 = [39 x i8] c"CLOCK_REALTIME clock start res1 = %d\0A\00"
@.str.2 = [40 x i8] c"CLOCK_REALTIME clock start secs = %ld\0A\00"
@.str.3 = [40 x i8] c"CLOCK_REALTIME clock start nanos = %ld\0A\00"
@CLOCK_MONOTONIC = global i32 0
@.str.4 = [40 x i8] c"CLOCK_MONOTONIC clock start res2 = %d\0A\00"
@.str.5 = [41 x i8] c"CLOCK_MONOTONIC clock start secs = %ld\0A\00"
@.str.6 = [41 x i8] c"CLOCK_MONOTONIC clock start nanos = %ld\0A\00"
@CLOCK_PROCESS_CPUTIME_ID = global i32 0
@.str.7 = [49 x i8] c"CLOCK_PROCESS_CPUTIME_ID clock start res3 = %d\0A\00"
@.str.8 = [50 x i8] c"CLOCK_PROCESS_CPUTIME_ID clock start secs = %ld\0A\00"
@.str.9 = [50 x i8] c"CLOCK_PROCESS_CPUTIME_ID clock start nanos = %ld\0A\00"
@CLOCK_THREAD_CPUTIME_ID = global i32 0
@.str.10 = [48 x i8] c"CLOCK_THREAD_CPUTIME_ID clock start res4 = %d\0A\00"
@.str.11 = [49 x i8] c"CLOCK_THREAD_CPUTIME_ID clock start secs = %ld\0A\00"
@.str.12 = [49 x i8] c"CLOCK_THREAD_CPUTIME_ID clock start nanos = %ld\0A\00"
@.str.13 = [37 x i8] c"CLOCK_REALTIME clock res res1 = %d\0A\00"
@.str.14 = [38 x i8] c"CLOCK_REALTIME clock res secs = %ld\0A\00"
@.str.15 = [38 x i8] c"CLOCK_REALTIME clock res nanos = %ld\0A\00"
@.str.16 = [38 x i8] c"CLOCK_MONOTONIC clock res res2 = %d\0A\00"
@.str.17 = [39 x i8] c"CLOCK_MONOTONIC clock res secs = %ld\0A\00"
@.str.18 = [39 x i8] c"CLOCK_MONOTONIC clock res nanos = %ld\0A\00"
@.str.19 = [47 x i8] c"CLOCK_PROCESS_CPUTIME_ID clock res res3 = %d\0A\00"
@.str.20 = [48 x i8] c"CLOCK_PROCESS_CPUTIME_ID clock res secs = %ld\0A\00"
@.str.21 = [48 x i8] c"CLOCK_PROCESS_CPUTIME_ID clock res nanos = %ld\0A\00"
@.str.22 = [46 x i8] c"CLOCK_THREAD_CPUTIME_ID clock res res4 = %d\0A\00"
@.str.23 = [47 x i8] c"CLOCK_THREAD_CPUTIME_ID clock res secs = %ld\0A\00"
@.str.24 = [47 x i8] c"CLOCK_THREAD_CPUTIME_ID clock res nanos = %ld\0A\00"
@.str.25 = [37 x i8] c"CLOCK_REALTIME clock end res1 = %d\0A\00"
@.str.26 = [38 x i8] c"CLOCK_REALTIME clock end secs = %ld\0A\00"
@.str.27 = [38 x i8] c"CLOCK_REALTIME clock end nanos = %ld\0A\00"
@.str.28 = [38 x i8] c"CLOCK_MONOTONIC clock end res2 = %d\0A\00"
@.str.29 = [39 x i8] c"CLOCK_MONOTONIC clock end secs = %ld\0A\00"
@.str.30 = [39 x i8] c"CLOCK_MONOTONIC clock end nanos = %ld\0A\00"
@.str.31 = [47 x i8] c"CLOCK_PROCESS_CPUTIME_ID clock end res3 = %d\0A\00"
@.str.32 = [48 x i8] c"CLOCK_PROCESS_CPUTIME_ID clock end secs = %ld\0A\00"
@.str.33 = [48 x i8] c"CLOCK_PROCESS_CPUTIME_ID clock end nanos = %ld\0A\00"
@.str.34 = [46 x i8] c"CLOCK_THREAD_CPUTIME_ID clock end res4 = %d\0A\00"
@.str.35 = [47 x i8] c"CLOCK_THREAD_CPUTIME_ID clock end secs = %ld\0A\00"
@.str.36 = [47 x i8] c"CLOCK_THREAD_CPUTIME_ID clock end nanos = %ld\0A\00"
@.str.37 = [18 x i8] c"time taken = %lg\0A\00"
@.str.38 = [15 x i8] c"CLOCK_REALTIME\00"
@.str.39 = [16 x i8] c"CLOCK_MONOTONIC\00"
@.str.40 = [25 x i8] c"CLOCK_PROCESS_CPUTIME_ID\00"
@.str.41 = [24 x i8] c"CLOCK_THREAD_CPUTIME_ID\00"
@str = [5 x i8] c"main\00"
define i32 @main() {
%1 = alloca %struct.timespec
%2 = alloca %struct.timespec
%3 = alloca %struct.timespec
%4 = alloca %struct.timespec
%5 = alloca %struct.timespec
%6 = alloca %struct.timespec
%7 = alloca %struct.timespec
%8 = alloca %struct.timespec
%9 = alloca %struct.timespec
%10 = alloca %struct.timespec
%11 = alloca %struct.timespec
%12 = alloca %struct.timespec
%13 = tail call double (...) @clock()
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%15 = bitcast %struct.timespec* %1 to i8*
%16 = load i32, i32* @CLOCK_REALTIME
%17 = call i32 @clock_gettime(i32 %16, %struct.timespec* %1)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%20 = load double, double* %19
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), double %20)
%22 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%23 = load double, double* %22
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), double %23)
%25 = bitcast %struct.timespec* %2 to i8*
%26 = load i32, i32* @CLOCK_MONOTONIC
%27 = call i32 @clock_gettime(i32 %26, %struct.timespec* %2)
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0), i32 %27)
%29 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 0
%30 = load double, double* %29
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0), double %30)
%32 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 1
%33 = load double, double* %32
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0), double %33)
%35 = bitcast %struct.timespec* %3 to i8*
%36 = load i32, i32* @CLOCK_PROCESS_CPUTIME_ID
%37 = call i32 @clock_gettime(i32 %36, %struct.timespec* %3)
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.7, i64 0, i64 0), i32 %37)
%39 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i64 0, i32 0
%40 = load double, double* %39
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.8, i64 0, i64 0), double %40)
%42 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i64 0, i32 1
%43 = load double, double* %42
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.9, i64 0, i64 0), double %43)
%45 = bitcast %struct.timespec* %4 to i8*
%46 = load i32, i32* @CLOCK_THREAD_CPUTIME_ID
%47 = call i32 @clock_gettime(i32 %46, %struct.timespec* %4)
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.10, i64 0, i64 0), i32 %47)
%49 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i64 0, i32 0
%50 = load double, double* %49
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.11, i64 0, i64 0), double %50)
%52 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i64 0, i32 1
%53 = load double, double* %52
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.12, i64 0, i64 0), double %53)
%55 = bitcast %struct.timespec* %5 to i8*
%56 = load i32, i32* @CLOCK_REALTIME
%57 = call i32 @clock_getres(i32 %56, %struct.timespec* %5)
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.13, i64 0, i64 0), i32 %57)
%59 = getelementptr inbounds %struct.timespec, %struct.timespec* %5, i64 0, i32 0
%60 = load double, double* %59
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.14, i64 0, i64 0), double %60)
%62 = getelementptr inbounds %struct.timespec, %struct.timespec* %5, i64 0, i32 1
%63 = load double, double* %62
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.15, i64 0, i64 0), double %63)
%65 = bitcast %struct.timespec* %6 to i8*
%66 = load i32, i32* @CLOCK_MONOTONIC
%67 = call i32 @clock_getres(i32 %66, %struct.timespec* %6)
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.16, i64 0, i64 0), i32 %67)
%69 = getelementptr inbounds %struct.timespec, %struct.timespec* %6, i64 0, i32 0
%70 = load double, double* %69
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.17, i64 0, i64 0), double %70)
%72 = getelementptr inbounds %struct.timespec, %struct.timespec* %6, i64 0, i32 1
%73 = load double, double* %72
%74 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.18, i64 0, i64 0), double %73)
%75 = bitcast %struct.timespec* %7 to i8*
%76 = load i32, i32* @CLOCK_PROCESS_CPUTIME_ID
%77 = call i32 @clock_getres(i32 %76, %struct.timespec* %7)
%78 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.19, i64 0, i64 0), i32 %77)
%79 = getelementptr inbounds %struct.timespec, %struct.timespec* %7, i64 0, i32 0
%80 = load double, double* %79
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.20, i64 0, i64 0), double %80)
%82 = getelementptr inbounds %struct.timespec, %struct.timespec* %7, i64 0, i32 1
%83 = load double, double* %82
%84 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.21, i64 0, i64 0), double %83)
%85 = bitcast %struct.timespec* %8 to i8*
%86 = load i32, i32* @CLOCK_THREAD_CPUTIME_ID
%87 = call i32 @clock_getres(i32 %86, %struct.timespec* %8)
%88 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.22, i64 0, i64 0), i32 %87)
%89 = getelementptr inbounds %struct.timespec, %struct.timespec* %8, i64 0, i32 0
%90 = load double, double* %89
%91 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.23, i64 0, i64 0), double %90)
%92 = getelementptr inbounds %struct.timespec, %struct.timespec* %8, i64 0, i32 1
%93 = load double, double* %92
%94 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.24, i64 0, i64 0), double %93)
%95 = call i32 @sleep(i32 1)
%96 = call i32 (...) @waste_some_cpu_cycles()
%97 = bitcast %struct.timespec* %9 to i8*
%98 = load i32, i32* @CLOCK_REALTIME
%99 = call i32 @clock_gettime(i32 %98, %struct.timespec* %9)
%100 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.25, i64 0, i64 0), i32 %99)
%101 = getelementptr inbounds %struct.timespec, %struct.timespec* %9, i64 0, i32 0
%102 = load double, double* %101
%103 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.26, i64 0, i64 0), double %102)
%104 = getelementptr inbounds %struct.timespec, %struct.timespec* %9, i64 0, i32 1
%105 = load double, double* %104
%106 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.27, i64 0, i64 0), double %105)
%107 = bitcast %struct.timespec* %10 to i8*
%108 = load i32, i32* @CLOCK_MONOTONIC
%109 = call i32 @clock_gettime(i32 %108, %struct.timespec* %10)
%110 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.28, i64 0, i64 0), i32 %109)
%111 = getelementptr inbounds %struct.timespec, %struct.timespec* %10, i64 0, i32 0
%112 = load double, double* %111
%113 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.29, i64 0, i64 0), double %112)
%114 = getelementptr inbounds %struct.timespec, %struct.timespec* %10, i64 0, i32 1
%115 = load double, double* %114
%116 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.30, i64 0, i64 0), double %115)
%117 = bitcast %struct.timespec* %11 to i8*
%118 = load i32, i32* @CLOCK_PROCESS_CPUTIME_ID
%119 = call i32 @clock_gettime(i32 %118, %struct.timespec* %11)
%120 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.31, i64 0, i64 0), i32 %119)
%121 = getelementptr inbounds %struct.timespec, %struct.timespec* %11, i64 0, i32 0
%122 = load double, double* %121
%123 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.32, i64 0, i64 0), double %122)
%124 = getelementptr inbounds %struct.timespec, %struct.timespec* %11, i64 0, i32 1
%125 = load double, double* %124
%126 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.33, i64 0, i64 0), double %125)
%127 = bitcast %struct.timespec* %12 to i8*
%128 = load i32, i32* @CLOCK_THREAD_CPUTIME_ID
%129 = call i32 @clock_gettime(i32 %128, %struct.timespec* %12)
%130 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.34, i64 0, i64 0), i32 %129)
%131 = getelementptr inbounds %struct.timespec, %struct.timespec* %12, i64 0, i32 0
%132 = load double, double* %131
%133 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.35, i64 0, i64 0), double %132)
%134 = getelementptr inbounds %struct.timespec, %struct.timespec* %12, i64 0, i32 1
%135 = load double, double* %134
%136 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.36, i64 0, i64 0), double %135)
%137 = call double (...) @clock()
%138 = fsub double %137, %13
%139 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.37, i64 0, i64 0), double %138)
%140 = load double, double* %19
%141 = load double, double* %22
%142 = load double, double* %101
%143 = load double, double* %104
%144 = call i32 @show_duration(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.38, i64 0, i64 0), double %140, double %141, double %142, double %143)
%145 = load double, double* %29
%146 = load double, double* %32
%147 = load double, double* %111
%148 = load double, double* %114
%149 = call i32 @show_duration(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.39, i64 0, i64 0), double %145, double %146, double %147, double %148)
%150 = load double, double* %39
%151 = load double, double* %42
%152 = load double, double* %121
%153 = load double, double* %124
%154 = call i32 @show_duration(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.40, i64 0, i64 0), double %150, double %151, double %152, double %153)
%155 = load double, double* %49
%156 = load double, double* %52
%157 = load double, double* %131
%158 = load double, double* %134
%159 = call i32 @show_duration(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.41, i64 0, i64 0), double %155, double %156, double %157, double %158)
ret i32 0
}