#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*/ benchmark_command_execution(char *, int);
int /*<<< orphan*/ benchmark_file_download(char *, int);
int /*<<< orphan*/ benchmark_file_upload(char *, int);
int /*<<< orphan*/ benchmark_simple_request(char *, int);
double get_time();
int /*<<< orphan*/ mkdir(char *, int);
char *mkdtemp(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ rmrf(char *);
int main() {
  printf("\nBenchmarking, grab a coffee...\n\n");
  char template[] = "/tmp/clax.bench.tmpdir.XXXXXX";
  char *tmp_dirname = mkdtemp(template);
  mkdir(tmp_dirname, 0755);
  double start = get_time();
  benchmark_simple_request(tmp_dirname, 1000);
  benchmark_file_upload(tmp_dirname, 1000);
  benchmark_file_download(tmp_dirname, 1000);
  benchmark_command_execution(tmp_dirname, 10);
  double end = get_time();
  rmrf(tmp_dirname);
  printf("\nTotal time elapsed: %f\n", end - start);
  printf("\nNOTE: If you finished your coffee before now, try increasing "
         "iterations number\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    0xedc(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xed9(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xed6(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed4(%rip),%eax
mov    %eax,-0x18(%rbp)
mov    0xece(%rip),%ax
mov    %ax,-0x14(%rbp)
lea    -0x30(%rbp),%rdi
call   1090 <mkdtemp@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
mov    $0x0,%al
call   1080 <get_time@plt>
movsd  %xmm0,-0x40(%rbp)
mov    -0x38(%rbp),%rdi
mov    $0x3e8,%esi
call   1050 <benchmark_simple_request@plt>
mov    -0x38(%rbp),%rdi
mov    $0x3e8,%esi
call   10a0 <benchmark_file_upload@plt>
mov    -0x38(%rbp),%rdi
mov    $0x3e8,%esi
call   10b0 <benchmark_file_download@plt>
mov    -0x38(%rbp),%rdi
mov    $0xa,%esi
call   1070 <benchmark_command_execution@plt>
mov    $0x0,%al
call   1080 <get_time@plt>
movsd  %xmm0,-0x48(%rbp)
mov    -0x38(%rbp),%rdi
call   1040 <rmrf@plt>
movsd  -0x48(%rbp),%xmm0
subsd  -0x40(%rbp),%xmm0
lea    0xdbb(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
lea    0xdc6(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
lea    0xe8b(%rip),%rdi
call   1040 <puts@plt>
movups 0xe56(%rip),%xmm0
movups %xmm0,0x1e(%rsp)
movaps 0xe3c(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0x10(%rsp),%rdi
call   10a0 <mkdtemp@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
xor    %eax,%eax
call   1090 <get_time@plt>
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
mov    $0x3e8,%esi
call   1060 <benchmark_simple_request@plt>
mov    %rbx,%rdi
mov    $0x3e8,%esi
call   10b0 <benchmark_file_upload@plt>
mov    %rbx,%rdi
mov    $0x3e8,%esi
call   10c0 <benchmark_file_download@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1080 <benchmark_command_execution@plt>
xor    %eax,%eax
call   1090 <get_time@plt>
movsd  %xmm0,(%rsp)
mov    %rbx,%rdi
call   1050 <rmrf@plt>
movsd  (%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
lea    0xdd4(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
lea    0xe00(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [34 x i8] c"\0ABenchmarking, grab a coffee...\0A\0A\00"
@__const.main.template = [30 x i8] c"/tmp/clax.bench.tmpdir.XXXXXX\00"
@.str.1 = [25 x i8] c"\0ATotal time elapsed: %f\0A\00"
@.str.2 = [82 x i8] c"\0ANOTE: If you finished your coffee before now, try increasing iterations number\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [30 x i8]
%3 = alloca i8*
%4 = alloca double
%5 = alloca double
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%7 = bitcast [30 x i8]* %2 to i8*
%8 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%9 = call i8* @mkdtemp(i8* %8)
store i8* %9, i8** %3
%10 = load i8*, i8** %3
%11 = call i32 @mkdir(i8* %10, i32 493)
%12 = call double (...) @get_time()
store double %12, double* %4
%13 = load i8*, i8** %3
%14 = call i32 @benchmark_simple_request(i8* %13, i32 1000)
%15 = load i8*, i8** %3
%16 = call i32 @benchmark_file_upload(i8* %15, i32 1000)
%17 = load i8*, i8** %3
%18 = call i32 @benchmark_file_download(i8* %17, i32 1000)
%19 = load i8*, i8** %3
%20 = call i32 @benchmark_command_execution(i8* %19, i32 10)
%21 = call double (...) @get_time()
store double %21, double* %5
%22 = load i8*, i8** %3
%23 = call i32 @rmrf(i8* %22)
%24 = load double, double* %5
%25 = load double, double* %4
%26 = fsub double %24, %25
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), double %26)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@__const.main.template = [30 x i8] c"/tmp/clax.bench.tmpdir.XXXXXX\00"
@.str.1 = [25 x i8] c"\0ATotal time elapsed: %f\0A\00"
@str = [33 x i8] c"\0ABenchmarking, grab a coffee...\0A\00"
@str.3 = [81 x i8] c"\0ANOTE: If you finished your coffee before now, try increasing iterations number\0A\00"
define i32 @main() {
%1 = alloca [30 x i8]
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
%3 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%4 = call i8* @mkdtemp(i8* %3)
%5 = call i32 @mkdir(i8* %4, i32 493)
%6 = call double (...) @get_time()
%7 = call i32 @benchmark_simple_request(i8* %4, i32 1000)
%8 = call i32 @benchmark_file_upload(i8* %4, i32 1000)
%9 = call i32 @benchmark_file_download(i8* %4, i32 1000)
%10 = call i32 @benchmark_command_execution(i8* %4, i32 10)
%11 = call double (...) @get_time()
%12 = call i32 @rmrf(i8* %4)
%13 = fsub double %11, %6
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), double %13)
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([81 x i8], [81 x i8]* @str.3, i64 0, i64 0))
ret i32 0
}