#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 */
typedef int time_t;

/* Variables and functions */
int /*<<< orphan*/ fn_test1();
int /*<<< orphan*/ fn_test2();
int /*<<< orphan*/ fn_test3();
int /*<<< orphan*/ fn_test4();
int /*<<< orphan*/ printf(char *, ...);
int time(int /*<<< orphan*/ *);
int main() {
  int i;
  time_t t1, t2;
  t1 = time(NULL);
  for (i = 0; i < 100000; i++) {
    printf("%d:\n", i);
    fn_test1();
    fn_test2();
    fn_test3();
    fn_test4();
    printf("\n");
  }
  t2 = time(NULL);
  printf("Runtime: %d\n", t2 - t1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x186a0,-0x8(%rbp)
jge    11d8 <main+0x78>
mov    -0x8(%rbp),%esi
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1070 <fn_test1@plt>
mov    $0x0,%al
call   1050 <fn_test2@plt>
mov    $0x0,%al
call   1080 <fn_test3@plt>
mov    $0x0,%al
call   1040 <fn_test4@plt>
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1182 <main+0x22>
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
sub    -0xc(%rbp),%esi
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%r14d
lea    0xe7b(%rip),%rbx
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1080 <fn_test1@plt>
xor    %eax,%eax
call   1060 <fn_test2@plt>
xor    %eax,%eax
call   1090 <fn_test3@plt>
xor    %eax,%eax
call   1050 <fn_test4@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    $0x186a0,%ebp
jne    1190 <main+0x20>
xor    %edi,%edi
call   1070 <time@plt>
sub    %r14d,%eax
lea    0xe27(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%d:\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [13 x i8] c"Runtime: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @time(i32* null)
store i32 %5, i32* %3
store i32 0, i32* %2
br label %6
6: ; preds = %17, %0
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 100000
br i1 %8, label %9, label %20
9: ; preds = %6
%10 = load i32, i32* %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = call i32 (...) @fn_test1()
%13 = call i32 (...) @fn_test2()
%14 = call i32 (...) @fn_test3()
%15 = call i32 (...) @fn_test4()
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %17
17: ; preds = %9
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 1
store i32 %19, i32* %2
br label %6
20: ; preds = %6
%21 = call i32 @time(i32* null)
store i32 %21, i32* %4
%22 = load i32, i32* %4
%23 = load i32, i32* %3
%24 = sub nsw i32 %22, %23
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %24)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%d:\0A\00"
@.str.2 = [13 x i8] c"Runtime: %d\0A\00"
define i32 @main() {
%1 = tail call i32 @time(i32* null)
br label %2
2: ; preds = %0, %2
%3 = phi i32 [ 0, %0 ], [ %10, %2 ]
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 (...) @fn_test1()
%6 = tail call i32 (...) @fn_test2()
%7 = tail call i32 (...) @fn_test3()
%8 = tail call i32 (...) @fn_test4()
%9 = tail call i32 @putchar(i32 10)
%10 = add nuw nsw i32 %3, 1
%11 = icmp eq i32 %10, 100000
br i1 %11, label %12, label %2
12: ; preds = %2
%13 = tail call i32 @time(i32* null)
%14 = sub nsw i32 %13, %1
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %14)
ret i32 0
}