#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 dummy;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC;
int atoi(char const *);
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fr(long long *, long long *, long long *);
int /*<<< orphan*/ getMicro(long);
int /*<<< orphan*/ getMilli(long);
int /*<<< orphan*/ getSeconds(long);
long getTimeInNanos(struct timespec);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, const char *args[]) {
  long long a;
  long long b;
  long long c;
  long int start;
  long int end;
  long int duration;
  if (argc != 2) {
    printf("help: ./program <non_negative_number>\n");
    printf("size of %s: %ld\n", "long long", sizeof(long long));
    exit(1);
  }
  int exp = atoi(args[1]);
  long long iterations = 1 << exp;
  printf("iterations are %lld\n", iterations);
  a = 0;
  b = 0;
  c = 2;
  struct timespec nanos;
  clock_gettime(CLOCK_MONOTONIC, &nanos);
  start = getTimeInNanos(nanos);
  for (unsigned long long i = 0; i < iterations; i++) {
    for (unsigned long long j = 0; j < iterations; j++) {
      for (unsigned long long k = 0; k < iterations; k++) {
        fr(&a, &b, &c);
      }
    }
  }
  clock_gettime(CLOCK_MONOTONIC, &nanos);
  end = getTimeInNanos(nanos);
  duration = end - start;
  printf("a is %lld; b is %lld. It took %ld.%ld'%ld s \n", a, b,
         getSeconds(duration), getMilli(duration), getMicro(duration));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11e5 <main+0x55>
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xe5f(%rip),%rdi
lea    0xe69(%rip),%rsi
mov    $0x8,%edx
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
cltq
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rsi
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x2,-0x28(%rbp)
mov    0x2db2(%rip),%rax
mov    (%rax),%edi
lea    -0x58(%rbp),%rsi
call   1050 <clock_gettime@plt>
mov    -0x58(%rbp),%edi
call   1080 <getTimeInNanos@plt>
mov    %rax,-0x30(%rbp)
movq   $0x0,-0x60(%rbp)
mov    -0x60(%rbp),%rax
cmp    -0x50(%rbp),%rax
jae    12dd <main+0x14d>
movq   $0x0,-0x68(%rbp)
mov    -0x68(%rbp),%rax
cmp    -0x50(%rbp),%rax
jae    12c7 <main+0x137>
movq   $0x0,-0x70(%rbp)
mov    -0x70(%rbp),%rax
cmp    -0x50(%rbp),%rax
jae    12b1 <main+0x121>
lea    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdx
call   1040 <fr@plt>
mov    -0x70(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x70(%rbp)
jmp    1281 <main+0xf1>
jmp    12b6 <main+0x126>
mov    -0x68(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x68(%rbp)
jmp    126b <main+0xdb>
jmp    12cc <main+0x13c>
mov    -0x60(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x60(%rbp)
jmp    1255 <main+0xc5>
mov    0x2d04(%rip),%rax
mov    (%rax),%edi
lea    -0x58(%rbp),%rsi
call   1050 <clock_gettime@plt>
mov    -0x58(%rbp),%edi
call   1080 <getTimeInNanos@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
sub    -0x30(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x40(%rbp),%rdi
call   1060 <getSeconds@plt>
mov    %eax,-0x78(%rbp)
mov    -0x40(%rbp),%rdi
call   1090 <getMilli@plt>
mov    %eax,-0x74(%rbp)
mov    -0x40(%rbp),%rdi
call   1030 <getMicro@plt>
mov    -0x88(%rbp),%rsi
mov    -0x80(%rbp),%rdx
mov    -0x78(%rbp),%ecx
mov    -0x74(%rbp),%r8d
mov    %eax,%r9d
lea    0xd00(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
cmp    $0x2,%edi
jne    12f4 <main+0x154>
mov    0x8(%rsi),%rdi
call   10b0 <atoi@plt>
mov    $0x1,%edx
mov    %eax,%ecx
shl    %cl,%edx
movslq %edx,%rbp
lea    0xe48(%rip),%rdi
xor    %r14d,%r14d
mov    %rbp,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
movq   $0x0,0x18(%rsp)
movq   $0x0,0x10(%rsp)
movq   $0x2,0x30(%rsp)
mov    0x2de6(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   1060 <clock_gettime@plt>
mov    0x8(%rsp),%edi
call   1090 <getTimeInNanos@plt>
mov    %rax,0x20(%rsp)
lea    0x18(%rsp),%r12
lea    0x10(%rsp),%r13
lea    0x30(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
mov    %r14,0x28(%rsp)
xor    %r14d,%r14d
nopl   0x0(%rax,%rax,1)
mov    %rbp,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1050 <fr@plt>
add    $0xffffffffffffffff,%r15
jne    1250 <main+0xb0>
add    $0x1,%r14
cmp    %rbp,%r14
jne    1240 <main+0xa0>
mov    0x28(%rsp),%r14
add    $0x1,%r14
cmp    %rbp,%r14
jne    1230 <main+0x90>
mov    0x2d66(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   1060 <clock_gettime@plt>
mov    0x8(%rsp),%edi
call   1090 <getTimeInNanos@plt>
mov    %rax,%rbx
sub    0x20(%rsp),%rbx
mov    0x18(%rsp),%r14
mov    0x10(%rsp),%r15
mov    %rbx,%rdi
call   1070 <getSeconds@plt>
mov    %eax,%r12d
mov    %rbx,%rdi
call   10a0 <getMilli@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <getMicro@plt>
lea    0xd63(%rip),%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r12d,%ecx
mov    %ebp,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   1080 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd63(%rip),%rdi
call   1040 <puts@plt>
lea    0xcf9(%rip),%rdi
lea    0xd03(%rip),%rsi
mov    $0x8,%edx
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
%struct.timespec = type { i32 }
@.str = [39 x i8] c"help: ./program <non_negative_number>\0A\00"
@.str.1 = [17 x i8] c"size of %s: %ld\0A\00"
@.str.2 = [10 x i8] c"long long\00"
@.str.3 = [21 x i8] c"iterations are %lld\0A\00"
@CLOCK_MONOTONIC = global i32 0
@.str.4 = [46 x i8] c"a is %lld; b is %lld. It took %ld.%ld'%ld s \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i32
%13 = alloca i64
%14 = alloca %struct.timespec
%15 = alloca i64
%16 = alloca i64
%17 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%18 = load i32, i32* %4
%19 = icmp ne i32 %18, 2
br i1 %19, label %20, label %24
20: ; preds = %2
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i64 8)
%23 = call i32 @exit(i32 1)
unreachable
24: ; preds = %2
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i32 @atoi(i8* %27)
store i32 %28, i32* %12
%29 = load i32, i32* %12
%30 = shl i32 1, %29
%31 = sext i32 %30 to i64
store i64 %31, i64* %13
%32 = load i64, i64* %13
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i64 %32)
store i64 0, i64* %6
store i64 0, i64* %7
store i64 2, i64* %8
%34 = load i32, i32* @CLOCK_MONOTONIC
%35 = call i32 @clock_gettime(i32 %34, %struct.timespec* %14)
%36 = getelementptr inbounds %struct.timespec, %struct.timespec* %14, i32 0, i32 0
%37 = load i32, i32* %36
%38 = call i64 @getTimeInNanos(i32 %37)
store i64 %38, i64* %9
store i64 0, i64* %15
br label %39
39: ; preds = %63, %24
%40 = load i64, i64* %15
%41 = load i64, i64* %13
%42 = icmp ult i64 %40, %41
br i1 %42, label %43, label %66
43: ; preds = %39
store i64 0, i64* %16
br label %44
44: ; preds = %59, %43
%45 = load i64, i64* %16
%46 = load i64, i64* %13
%47 = icmp ult i64 %45, %46
br i1 %47, label %48, label %62
48: ; preds = %44
store i64 0, i64* %17
br label %49
49: ; preds = %55, %48
%50 = load i64, i64* %17
%51 = load i64, i64* %13
%52 = icmp ult i64 %50, %51
br i1 %52, label %53, label %58
53: ; preds = %49
%54 = call i32 @fr(i64* %6, i64* %7, i64* %8)
br label %55
55: ; preds = %53
%56 = load i64, i64* %17
%57 = add i64 %56, 1
store i64 %57, i64* %17
br label %49
58: ; preds = %49
br label %59
59: ; preds = %58
%60 = load i64, i64* %16
%61 = add i64 %60, 1
store i64 %61, i64* %16
br label %44
62: ; preds = %44
br label %63
63: ; preds = %62
%64 = load i64, i64* %15
%65 = add i64 %64, 1
store i64 %65, i64* %15
br label %39
66: ; preds = %39
%67 = load i32, i32* @CLOCK_MONOTONIC
%68 = call i32 @clock_gettime(i32 %67, %struct.timespec* %14)
%69 = getelementptr inbounds %struct.timespec, %struct.timespec* %14, i32 0, i32 0
%70 = load i32, i32* %69
%71 = call i64 @getTimeInNanos(i32 %70)
store i64 %71, i64* %10
%72 = load i64, i64* %10
%73 = load i64, i64* %9
%74 = sub nsw i64 %72, %73
store i64 %74, i64* %11
%75 = load i64, i64* %6
%76 = load i64, i64* %7
%77 = load i64, i64* %11
%78 = call i32 @getSeconds(i64 %77)
%79 = load i64, i64* %11
%80 = call i32 @getMilli(i64 %79)
%81 = load i64, i64* %11
%82 = call i32 @getMicro(i64 %81)
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0), i64 %75, i64 %76, i32 %78, i32 %80, i32 %82)
%84 = load i32, i32* %3
ret i32 %84
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@.str.1 = [17 x i8] c"size of %s: %ld\0A\00"
@.str.2 = [10 x i8] c"long long\00"
@.str.3 = [21 x i8] c"iterations are %lld\0A\00"
@CLOCK_MONOTONIC = global i32 0
@.str.4 = [46 x i8] c"a is %lld; b is %lld. It took %ld.%ld'%ld s \0A\00"
@str = [38 x i8] c"help: ./program <non_negative_number>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca %struct.timespec
%7 = bitcast i64* %3 to i8*
%8 = bitcast i64* %4 to i8*
%9 = bitcast i64* %5 to i8*
%10 = icmp eq i32 %0, 2
br i1 %10, label %15, label %11
11: ; preds = %2
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i64 8)
%14 = tail call i32 @exit(i32 1)
unreachable
15: ; preds = %2
%16 = getelementptr inbounds i8*, i8** %1, i64 1
%17 = load i8*, i8** %16
%18 = tail call i32 @atoi(i8* %17)
%19 = shl nuw i32 1, %18
%20 = sext i32 %19 to i64
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i64 %20)
store i64 0, i64* %3
store i64 0, i64* %4
store i64 2, i64* %5
%22 = bitcast %struct.timespec* %6 to i8*
%23 = load i32, i32* @CLOCK_MONOTONIC
%24 = call i32 @clock_gettime(i32 %23, %struct.timespec* %6)
%25 = getelementptr inbounds %struct.timespec, %struct.timespec* %6, i64 0, i32 0
%26 = load i32, i32* %25
%27 = call i64 @getTimeInNanos(i32 %26)
br label %28
28: ; preds = %15, %44
%29 = phi i64 [ 0, %15 ], [ %45, %44 ]
br label %42
30: ; preds = %44
%31 = load i32, i32* @CLOCK_MONOTONIC
%32 = call i32 @clock_gettime(i32 %31, %struct.timespec* %6)
%33 = load i32, i32* %25
%34 = call i64 @getTimeInNanos(i32 %33)
%35 = sub nsw i64 %34, %27
%36 = load i64, i64* %3
%37 = load i64, i64* %4
%38 = call i32 @getSeconds(i64 %35)
%39 = call i32 @getMilli(i64 %35)
%40 = call i32 @getMicro(i64 %35)
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0), i64 %36, i64 %37, i32 %38, i32 %39, i32 %40)
ret i32 0
42: ; preds = %28, %47
%43 = phi i64 [ 0, %28 ], [ %48, %47 ]
br label %50
44: ; preds = %47
%45 = add nuw i64 %29, 1
%46 = icmp eq i64 %45, %20
br i1 %46, label %30, label %28
47: ; preds = %50
%48 = add nuw i64 %43, 1
%49 = icmp eq i64 %48, %20
br i1 %49, label %44, label %42
50: ; preds = %42, %50
%51 = phi i64 [ 0, %42 ], [ %53, %50 ]
%52 = call i32 @fr(i64* %3, i64* %4, i64* %5)
%53 = add nuw i64 %51, 1
%54 = icmp eq i64 %53, %20
br i1 %54, label %47, label %50
}