#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 /*<<< orphan*/ gettimeofday_test();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
scalar_t__ strtol(char *, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ time_test();
int main(int argc, char **argv) {
  int i, times;
  times = argc > 1 ? (int)strtol(argv[1], NULL, 10) : 1;
  if (times > 1)
    printf("testing %d loops\n", times);
  for (i = 0; i < times; ++i) {
    if (times > 1)
      printf("testing loop #%d ", 1 + i);
    time_test();
    gettimeofday_test();
    printf("\n");
    if (times > 1)
      sleep(1);
  }
  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   $0x1,-0x8(%rbp)
jle    118e <main+0x3e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %eax,-0x1c(%rbp)
jmp    119b <main+0x4b>
mov    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    119b <main+0x4b>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x1,-0x18(%rbp)
jle    11bc <main+0x6c>
mov    -0x18(%rbp),%esi
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1230 <main+0xe0>
cmpl   $0x1,-0x18(%rbp)
jle    11ed <main+0x9d>
mov    -0x14(%rbp),%esi
add    $0x1,%esi
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <time_test@plt>
mov    $0x0,%al
call   1060 <gettimeofday_test@plt>
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x1,-0x18(%rbp)
jle    121d <main+0xcd>
mov    $0x1,%edi
call   1070 <sleep@plt>
jmp    1222 <main+0xd2>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11c3 <main+0x73>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x1,%r15d
cmp    $0x2,%edi
jl     11a0 <main+0x40>
mov    0x8(%rsi),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1060 <strtol@plt>
mov    %rax,%r15
cmp    $0x2,%r15d
jl     11a4 <main+0x44>
lea    0xe6e(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%bl
jmp    11b2 <main+0x52>
xor    %ebx,%ebx
jmp    11b2 <main+0x52>
cmp    $0x1,%r15d
jne    121a <main+0xba>
xor    %ebx,%ebx
mov    $0x1,%r15d
lea    0xe59(%rip),%r14
xor    %ebp,%ebp
jmp    11e0 <main+0x80>
nopl   (%rax)
xor    %eax,%eax
call   1050 <time_test@plt>
xor    %eax,%eax
call   1070 <gettimeofday_test@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    %r15d,%ebp
je     121a <main+0xba>
test   %bl,%bl
je     11c0 <main+0x60>
add    $0x1,%ebp
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <time_test@plt>
xor    %eax,%eax
call   1070 <gettimeofday_test@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
cmp    %r15d,%ebp
jne    11e0 <main+0x80>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"testing %d loops\0A\00"
@.str.1 = [18 x i8] c"testing loop #%d \00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp sgt i32 %8, 1
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i64 @strtol(i8* %13, i32* null, i32 10)
%15 = trunc i64 %14 to i32
br label %17
16: ; preds = %2
br label %17
17: ; preds = %16, %10
%18 = phi i32 [ %15, %10 ], [ 1, %16 ]
store i32 %18, i32* %7
%19 = load i32, i32* %7
%20 = icmp sgt i32 %19, 1
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = load i32, i32* %7
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %22)
br label %24
24: ; preds = %21, %17
store i32 0, i32* %6
br label %25
25: ; preds = %45, %24
%26 = load i32, i32* %6
%27 = load i32, i32* %7
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %48
29: ; preds = %25
%30 = load i32, i32* %7
%31 = icmp sgt i32 %30, 1
br i1 %31, label %32, label %36
32: ; preds = %29
%33 = load i32, i32* %6
%34 = add nsw i32 1, %33
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %34)
br label %36
36: ; preds = %32, %29
%37 = call i32 (...) @time_test()
%38 = call i32 (...) @gettimeofday_test()
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%40 = load i32, i32* %7
%41 = icmp sgt i32 %40, 1
br i1 %41, label %42, label %44
42: ; preds = %36
%43 = call i32 @sleep(i32 1)
br label %44
44: ; preds = %42, %36
br label %45
45: ; preds = %44
%46 = load i32, i32* %6
%47 = add nsw i32 %46, 1
store i32 %47, i32* %6
br label %25
48: ; preds = %25
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"testing %d loops\0A\00"
@.str.1 = [18 x i8] c"testing loop #%d \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i64 @strtol(i8* nocapture %6, i32* null, i32 10)
%8 = trunc i64 %7 to i32
%9 = icmp sgt i32 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %4
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %8)
br label %14
12: ; preds = %4
%13 = icmp eq i32 %8, 1
br i1 %13, label %14, label %34
14: ; preds = %2, %10, %12
%15 = phi i32 [ 1, %12 ], [ 1, %2 ], [ %8, %10 ]
%16 = phi i1 [ false, %12 ], [ false, %2 ], [ true, %10 ]
br label %17
17: ; preds = %14, %31
%18 = phi i32 [ %32, %31 ], [ 0, %14 ]
br i1 %16, label %19, label %26
19: ; preds = %17
%20 = add nuw nsw i32 %18, 1
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = tail call i32 (...) @time_test()
%23 = tail call i32 (...) @gettimeofday_test()
%24 = tail call i32 @putchar(i32 10)
%25 = tail call i32 @sleep(i32 1)
br label %31
26: ; preds = %17
%27 = tail call i32 (...) @time_test()
%28 = tail call i32 (...) @gettimeofday_test()
%29 = tail call i32 @putchar(i32 10)
%30 = add nuw nsw i32 %18, 1
br label %31
31: ; preds = %26, %19
%32 = phi i32 [ %30, %26 ], [ %20, %19 ]
%33 = icmp eq i32 %32, %15
br i1 %33, label %34, label %17
34: ; preds = %31, %12
ret i32 0
}