#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 atoi(char *);
long getMilliseconds();
int /*<<< orphan*/ loop1(int);
int /*<<< orphan*/ loop2(int);
int /*<<< orphan*/ loop3(int);
int /*<<< orphan*/ loop4(int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int m;
  long start;
  if (argc < 2) {
    printf("usage: %s <iters>\n", argv[0]);
    return 0;
  }
  m = atoi(argv[1]);
  start = getMilliseconds();
  printf("loop%d: ", 1);
  loop1(m);
  printf("%ld ms\n", getMilliseconds() - start);
  start = getMilliseconds();
  printf("loop%d: ", 2);
  loop2(m);
  printf("%ld ms\n", getMilliseconds() - start);
  start = getMilliseconds();
  printf("loop%d: ", 3);
  loop3(m);
  printf("%ld ms\n", getMilliseconds() - start);
  start = getMilliseconds();
  printf("loop%d: ", 4);
  loop4(m);
  printf("%ld ms\n", getMilliseconds() - start);
  printf("done\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11b1 <main+0x41>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12de <main+0x16e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1060 <getMilliseconds@plt>
mov    %rax,-0x20(%rbp)
lea    0xe40(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%edi
call   1080 <loop1@plt>
mov    $0x0,%al
call   1060 <getMilliseconds@plt>
mov    %rax,%rsi
sub    -0x20(%rbp),%rsi
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <getMilliseconds@plt>
mov    %rax,-0x20(%rbp)
lea    0xdfe(%rip),%rdi
mov    $0x2,%esi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%edi
call   1040 <loop2@plt>
mov    $0x0,%al
call   1060 <getMilliseconds@plt>
mov    %rax,%rsi
sub    -0x20(%rbp),%rsi
lea    0xdde(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <getMilliseconds@plt>
mov    %rax,-0x20(%rbp)
lea    0xdbc(%rip),%rdi
mov    $0x3,%esi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%edi
call   1070 <loop3@plt>
mov    $0x0,%al
call   1060 <getMilliseconds@plt>
mov    %rax,%rsi
sub    -0x20(%rbp),%rsi
lea    0xd9c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <getMilliseconds@plt>
mov    %rax,-0x20(%rbp)
lea    0xd7a(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%edi
call   1030 <loop4@plt>
mov    $0x0,%al
call   1060 <getMilliseconds@plt>
mov    %rax,%rsi
sub    -0x20(%rbp),%rsi
lea    0xd5a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd54(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    $0x1,%edi
jg     11a2 <main+0x22>
mov    (%rsi),%rsi
lea    0xe6a(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    12a3 <main+0x123>
mov    0x8(%rsi),%rdi
call   10a0 <atoi@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1070 <getMilliseconds@plt>
mov    %rax,%rbx
lea    0xe55(%rip),%r14
mov    %r14,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %ebp,%edi
call   1090 <loop1@plt>
xor    %eax,%eax
call   1070 <getMilliseconds@plt>
sub    %rbx,%rax
lea    0xe37(%rip),%r15
mov    %r15,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1070 <getMilliseconds@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %ebp,%edi
call   1050 <loop2@plt>
xor    %eax,%eax
call   1070 <getMilliseconds@plt>
sub    %rbx,%rax
mov    %r15,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1070 <getMilliseconds@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %ebp,%edi
call   1080 <loop3@plt>
xor    %eax,%eax
call   1070 <getMilliseconds@plt>
sub    %rbx,%rax
mov    %r15,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1070 <getMilliseconds@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %ebp,%edi
call   1040 <loop4@plt>
xor    %eax,%eax
call   1070 <getMilliseconds@plt>
sub    %rbx,%rax
mov    %r15,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xd86(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"usage: %s <iters>\0A\00"
@.str.1 = [9 x i8] c"loop%d: \00"
@.str.2 = [8 x i8] c"%ld ms\0A\00"
@.str.3 = [6 x i8] c"done\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 2
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %13)
store i32 0, i32* %3
br label %53
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32 @atoi(i8* %18)
store i32 %19, i32* %6
%20 = call i64 (...) @getMilliseconds()
store i64 %20, i64* %7
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 1)
%22 = load i32, i32* %6
%23 = call i32 @loop1(i32 %22)
%24 = call i64 (...) @getMilliseconds()
%25 = load i64, i64* %7
%26 = sub nsw i64 %24, %25
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i64 %26)
%28 = call i64 (...) @getMilliseconds()
store i64 %28, i64* %7
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 2)
%30 = load i32, i32* %6
%31 = call i32 @loop2(i32 %30)
%32 = call i64 (...) @getMilliseconds()
%33 = load i64, i64* %7
%34 = sub nsw i64 %32, %33
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i64 %34)
%36 = call i64 (...) @getMilliseconds()
store i64 %36, i64* %7
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 3)
%38 = load i32, i32* %6
%39 = call i32 @loop3(i32 %38)
%40 = call i64 (...) @getMilliseconds()
%41 = load i64, i64* %7
%42 = sub nsw i64 %40, %41
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i64 %42)
%44 = call i64 (...) @getMilliseconds()
store i64 %44, i64* %7
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 4)
%46 = load i32, i32* %6
%47 = call i32 @loop4(i32 %46)
%48 = call i64 (...) @getMilliseconds()
%49 = load i64, i64* %7
%50 = sub nsw i64 %48, %49
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i64 %50)
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %3
br label %53
53: ; preds = %15, %10
%54 = load i32, i32* %3
ret i32 %54
}

LLVM IR (-O2):
@.str = [19 x i8] c"usage: %s <iters>\0A\00"
@.str.1 = [9 x i8] c"loop%d: \00"
@.str.2 = [8 x i8] c"%ld ms\0A\00"
@str = [5 x i8] c"done\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %36
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @atoi(i8* %9)
%11 = tail call i64 (...) @getMilliseconds()
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 1)
%13 = tail call i32 @loop1(i32 %10)
%14 = tail call i64 (...) @getMilliseconds()
%15 = sub nsw i64 %14, %11
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i64 %15)
%17 = tail call i64 (...) @getMilliseconds()
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 2)
%19 = tail call i32 @loop2(i32 %10)
%20 = tail call i64 (...) @getMilliseconds()
%21 = sub nsw i64 %20, %17
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i64 %21)
%23 = tail call i64 (...) @getMilliseconds()
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 3)
%25 = tail call i32 @loop3(i32 %10)
%26 = tail call i64 (...) @getMilliseconds()
%27 = sub nsw i64 %26, %23
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i64 %27)
%29 = tail call i64 (...) @getMilliseconds()
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 4)
%31 = tail call i32 @loop4(i32 %10)
%32 = tail call i64 (...) @getMilliseconds()
%33 = sub nsw i64 %32, %29
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i64 %33)
%35 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
br label %36
36: ; preds = %7, %4
ret i32 0
}