#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 */
double atof(char *);
int atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ run_benchmark(int, int, double, char *);
int /*<<< orphan*/ srand(int);
int main(int argc, char *argv[]) {
  int n, seed, size;
  double baseline_power_consumption;
  if (argc != 5) {
    perror("[-] Usage: bench <n> <array_size> <seed> <baseline_power_cons>\n");
    exit(1);
  }
  n = atoi(argv[1]);
  size = atoi(argv[2]);
  seed = atoi(argv[3]);
  baseline_power_consumption = atof(argv[4]);
  srand(seed);
  run_benchmark(n, size, baseline_power_consumption, argv[0]);
  exit(0);
}


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)
cmpl   $0x5,-0x8(%rbp)
je     1196 <main+0x36>
lea    0xe79(%rip),%rdi
call   1060 <perror@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x18(%rbp),%edi
call   1040 <srand@plt>
mov    -0x14(%rbp),%edi
mov    -0x1c(%rbp),%esi
movsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
call   1050 <run_benchmark@plt>
xor    %edi,%edi
call   1080 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    $0x5,%edi
jne    11c1 <main+0x61>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1070 <atoi@plt>
mov    %eax,%r14d
mov    0x10(%rbx),%rdi
call   1070 <atoi@plt>
mov    %eax,%r15d
mov    0x18(%rbx),%rdi
call   1070 <atoi@plt>
mov    %eax,%ebp
mov    0x20(%rbx),%rdi
call   1030 <atof@plt>
movsd  %xmm0,(%rsp)
mov    %ebp,%edi
call   1040 <srand@plt>
mov    (%rbx),%rdx
mov    %r14d,%edi
mov    %r15d,%esi
movsd  (%rsp),%xmm0
call   1050 <run_benchmark@plt>
xor    %edi,%edi
call   1080 <exit@plt>
lea    0xe38(%rip),%rdi
call   1060 <perror@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [64 x i8] c"[-] Usage: bench <n> <array_size> <seed> <baseline_power_cons>\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 5
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = call i32 @perror(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
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 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 2
%22 = load i8*, i8** %21
%23 = call i32 @atoi(i8* %22)
store i32 %23, i32* %8
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 3
%26 = load i8*, i8** %25
%27 = call i32 @atoi(i8* %26)
store i32 %27, i32* %7
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 4
%30 = load i8*, i8** %29
%31 = call double @atof(i8* %30)
store double %31, double* %9
%32 = load i32, i32* %7
%33 = call i32 @srand(i32 %32)
%34 = load i32, i32* %6
%35 = load i32, i32* %8
%36 = load double, double* %9
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 0
%39 = load i8*, i8** %38
%40 = call i32 @run_benchmark(i32 %34, i32 %35, double %36, i8* %39)
%41 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [64 x i8] c"[-] Usage: bench <n> <array_size> <seed> <baseline_power_cons>\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 5
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = tail call i32 @perror(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @atoi(i8* %9)
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call i32 @atoi(i8* %12)
%14 = getelementptr inbounds i8*, i8** %1, i64 3
%15 = load i8*, i8** %14
%16 = tail call i32 @atoi(i8* %15)
%17 = getelementptr inbounds i8*, i8** %1, i64 4
%18 = load i8*, i8** %17
%19 = tail call double @atof(i8* %18)
%20 = tail call i32 @srand(i32 %16)
%21 = load i8*, i8** %1
%22 = tail call i32 @run_benchmark(i32 %10, i32 %13, double %19, i8* %21)
%23 = tail call i32 @exit(i32 0)
unreachable
}