#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 EXIT_SUCCESS;
long double get_nanos();
int /*<<< orphan*/ printf(char *, long double);
unsigned long long strtoull(char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
int main(int argc, char **argv) {
  long double start;
  unsigned long long int i, niters;
  if (argc > 1) {
    niters = strtoull(argv[1], NULL, 0);
  } else {
    niters = 3;
  }
  i = 0;
  start = get_nanos();
  while (1) {
    printf("%Lf\n", get_nanos() - start);
    i++;
    if (i == niters)
      break;
  }
  return EXIT_SUCCESS;
}


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)
cmpl   $0x1,-0x8(%rbp)
jle    116c <main+0x3c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1040 <strtoull@plt>
mov    %rax,-0x30(%rbp)
jmp    1174 <main+0x44>
movq   $0x3,-0x30(%rbp)
movq   $0x0,-0x28(%rbp)
xor    %eax,%eax
call   1050 <get_nanos@plt>
fstpt  -0x20(%rbp)
xor    %eax,%eax
call   1050 <get_nanos@plt>
fldt   -0x20(%rbp)
fsubrp %st,%st(1)
mov    %rsp,%rax
fstpt  (%rax)
lea    0xe62(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x30(%rbp),%rax
jne    11c2 <main+0x92>
jmp    11c7 <main+0x97>
jmp    1186 <main+0x56>
mov    0x2e12(%rip),%rax
mov    (%rax),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    $0x3,%ebx
cmp    $0x2,%edi
jl     1151 <main+0x21>
mov    0x8(%rsi),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1040 <strtoull@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1050 <get_nanos@plt>
fstpt  0x1c(%rsp)
lea    0xe9d(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1050 <get_nanos@plt>
fldt   0x1c(%rsp)
fsubrp %st,%st(1)
fstpt  (%rsp)
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0xffffffffffffffff,%rbx
jne    1170 <main+0x40>
mov    0x2e4b(%rip),%rax
mov    (%rax),%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%Lf\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca x86_fp80
%7 = alloca i64
%8 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp sgt i32 %9, 1
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i64 @strtoull(i8* %14, i32* null, i32 0)
store i64 %15, i64* %8
br label %17
16: ; preds = %2
store i64 3, i64* %8
br label %17
17: ; preds = %16, %11
store i64 0, i64* %7
%18 = call x86_fp80 (...) @get_nanos()
store x86_fp80 %18, x86_fp80* %6
br label %19
19: ; preds = %17, %30
%20 = call x86_fp80 (...) @get_nanos()
%21 = load x86_fp80, x86_fp80* %6
%22 = fsub x86_fp80 %20, %21
%23 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), x86_fp80 %22)
%24 = load i64, i64* %7
%25 = add i64 %24, 1
store i64 %25, i64* %7
%26 = load i64, i64* %7
%27 = load i64, i64* %8
%28 = icmp eq i64 %26, %27
br i1 %28, label %29, label %30
29: ; preds = %19
br label %31
30: ; preds = %19
br label %19
31: ; preds = %29
%32 = load i32, i32* @EXIT_SUCCESS
ret i32 %32
}

LLVM IR (-O2):
@.str = [5 x i8] c"%Lf\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i64 @strtoull(i8* nocapture %6, i32* null, i32 0)
br label %8
8: ; preds = %2, %4
%9 = phi i64 [ %7, %4 ], [ 3, %2 ]
%10 = tail call x86_fp80 (...) @get_nanos()
br label %11
11: ; preds = %11, %8
%12 = phi i64 [ 0, %8 ], [ %16, %11 ]
%13 = tail call x86_fp80 (...) @get_nanos()
%14 = fsub x86_fp80 %13, %10
%15 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), x86_fp80 %14)
%16 = add i64 %12, 1
%17 = icmp eq i64 %16, %9
br i1 %17, label %18, label %11
18: ; preds = %11
%19 = load i32, i32* @EXIT_SUCCESS
ret i32 %19
}