#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 EXIT_SUCCESS;
unsigned int atoi(char *);
int /*<<< orphan*/ getMinBufferSize(unsigned int);
int /*<<< orphan*/ hp_free(double *);
double *hp_malloc(int /*<<< orphan*/);
int /*<<< orphan*/ print_common_header();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ runBench(double *, int /*<<< orphan*/, unsigned int);
int /*<<< orphan*/ setModeStr(char *);
int main(int argc, char *argv[]) {
  double *buffer = NULL;
  unsigned int pth = 1;
  if (argc >= 2)
    pth = atoi(argv[1]);
  if (argc >= 3)
    setModeStr(argv[2]);
  printf("#mem alloc : malloc\n");
  printf("#using %i threads\n", pth);
  print_common_header();
  printf("#mem_size   nb_double   time\n");
  buffer = hp_malloc(getMinBufferSize(pth));
  runBench(buffer, getMinBufferSize(pth), pth);
  hp_free(buffer);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
cmpl   $0x2,-0x8(%rbp)
jl     11bf <main+0x3f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x3,-0x8(%rbp)
jl     11d6 <main+0x56>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1090 <setModeStr@plt>
lea    0xe23(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <print_common_header@plt>
lea    0xe25(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%edi
call   1030 <getMinBufferSize@plt>
mov    %eax,%edi
call   1080 <hp_malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x1c(%rbp),%edi
call   1030 <getMinBufferSize@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%esi
mov    -0x1c(%rbp),%edx
call   1050 <runBench@plt>
mov    -0x18(%rbp),%rdi
call   10a0 <hp_free@plt>
mov    0x2d95(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    $0x1,%ebx
cmp    $0x2,%edi
jl     11bc <main+0x2c>
mov    %rsi,%r14
mov    %edi,%ebp
mov    0x8(%rsi),%rdi
call   1080 <atoi@plt>
mov    %eax,%ebx
cmp    $0x2,%ebp
je     11bc <main+0x2c>
mov    0x10(%r14),%rdi
call   10a0 <setModeStr@plt>
lea    0xe50(%rip),%rdi
call   1030 <puts@plt>
lea    0xe31(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1070 <print_common_header@plt>
lea    0xe41(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%edi
call   1040 <getMinBufferSize@plt>
mov    %eax,%edi
call   1090 <hp_malloc@plt>
mov    %rax,%rbp
mov    %ebx,%edi
call   1040 <getMinBufferSize@plt>
mov    %rbp,%rdi
mov    %eax,%esi
mov    %ebx,%edx
call   1060 <runBench@plt>
mov    %rbp,%rdi
call   10b0 <hp_free@plt>
mov    0x2dc2(%rip),%rax
mov    (%rax),%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"#mem alloc : malloc\0A\00"
@.str.1 = [19 x i8] c"#using %i threads\0A\00"
@.str.2 = [30 x i8] c"#mem_size nb_double time\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double*
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store double* null, double** %6
store i32 1, i32* %7
%8 = load i32, i32* %4
%9 = icmp sge 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 1
%13 = load i8*, i8** %12
%14 = call i32 @atoi(i8* %13)
store i32 %14, i32* %7
br label %15
15: ; preds = %10, %2
%16 = load i32, i32* %4
%17 = icmp sge i32 %16, 3
br i1 %17, label %18, label %23
18: ; preds = %15
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 2
%21 = load i8*, i8** %20
%22 = call i32 @setModeStr(i8* %21)
br label %23
23: ; preds = %18, %15
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%25 = load i32, i32* %7
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %25)
%27 = call i32 (...) @print_common_header()
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%29 = load i32, i32* %7
%30 = call i32 @getMinBufferSize(i32 %29)
%31 = call double* @hp_malloc(i32 %30)
store double* %31, double** %6
%32 = load double*, double** %6
%33 = load i32, i32* %7
%34 = call i32 @getMinBufferSize(i32 %33)
%35 = load i32, i32* %7
%36 = call i32 @runBench(double* %32, i32 %34, i32 %35)
%37 = load double*, double** %6
%38 = call i32 @hp_free(double* %37)
%39 = load i32, i32* @EXIT_SUCCESS
ret i32 %39
}

LLVM IR (-O2):
@.str.1 = [19 x i8] c"#using %i threads\0A\00"
@EXIT_SUCCESS = global i32 0
@str = [20 x i8] c"#mem alloc : malloc\00"
@str.3 = [29 x i8] c"#mem_size nb_double time\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
%8 = icmp eq i32 %0, 2
br i1 %8, label %13, label %9
9: ; preds = %4
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = tail call i32 @setModeStr(i8* %11)
br label %13
13: ; preds = %2, %9, %4
%14 = phi i32 [ %7, %9 ], [ %7, %4 ], [ 1, %2 ]
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%17 = tail call i32 (...) @print_common_header()
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.3, i64 0, i64 0))
%19 = tail call i32 @getMinBufferSize(i32 %14)
%20 = tail call double* @hp_malloc(i32 %19)
%21 = tail call i32 @getMinBufferSize(i32 %14)
%22 = tail call i32 @runBench(double* %20, i32 %21, i32 %14)
%23 = tail call i32 @hp_free(double* %20)
%24 = load i32, i32* @EXIT_SUCCESS
ret i32 %24
}