#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 */
struct option {
  char *member_0;
  char member_3;
  int /*<<< orphan*/ *member_2;
  int /*<<< orphan*/ const member_1;
};

/* Variables and functions */
unsigned int atoi(char *);
unsigned long atol(char *);
int /*<<< orphan*/ bench_level1(char *, unsigned int, unsigned long, char *,
                                char *);
int getopt_long(int, char **, char *, struct option *, int /*<<< orphan*/ *);
int /*<<< orphan*/ info();
#define no_argument 129
char *optarg;
int /*<<< orphan*/ printf(char *, ...);
#define required_argument 128
int /*<<< orphan*/ settable(int, int, int, int, int, int);
int /*<<< orphan*/ usage();
int main(int argc, char **argv) {
  int c;
  settable(12345, 65435, 34221, 12345, 9983651, 95746118);
  char *bench = "blas_op";
  unsigned int size = 200;
  unsigned long rep = 1;
  char *op = "dot_product";
  char *dt = "double";
  static struct option option_list[] = {{"bench", required_argument, NULL, 'b'},
                                        {"size", required_argument, NULL, 's'},
                                        {"reps", required_argument, NULL, 'r'},
                                        {"op", required_argument, NULL, 'o'},
                                        {"dtype", required_argument, NULL, 'd'},
                                        {"info", no_argument, NULL, 'i'},
                                        {"help", no_argument, NULL, 'h'},
                                        {0, 0, 0, 0}};
  while ((c = getopt_long(argc, argv, "b:s:r:o:d:ih", option_list, NULL)) !=
         -1) {
    switch (c) {
    case 'b':
      bench = optarg;
      printf("Benchmark is %s.\n", bench);
      break;
    case 's':
      size = atoi(optarg);
      printf("Size is %d.\n", size);
      break;
    case 'r':
      rep = atol(optarg);
      printf("Number of repetitions %lu.\n", rep);
      break;
    case 'o':
      op = optarg;
      printf("Operation %s\n", op);
      break;
    case 'd':
      dt = optarg;
      printf("Data type is %s\n", dt);
      break;
    case 'i':
      info();
      return 0;
    case 'h':
      usage();
      return 0;
    default:
      printf("Undefined.\n");
      return 0;
    }
  }
  bench_level1(bench, size, rep, op, dt);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x3039,%ecx
mov    $0xff9b,%esi
mov    $0x85ad,%edx
mov    $0x9856a3,%r8d
mov    $0x5b4f846,%r9d
mov    %ecx,%edi
call   1090 <settable@plt>
lea    0xe89(%rip),%rax
mov    %rax,-0x20(%rbp)
movl   $0xc8,-0x24(%rbp)
movq   $0x1,-0x30(%rbp)
lea    0xe77(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    0xe78(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe8d(%rip),%rdx
lea    0x2e73(%rip),%rcx
xor    %eax,%eax
mov    %eax,%r8d
call   1040 <getopt_long@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     1342 <main+0x1c2>
mov    -0x14(%rbp),%eax
add    $0xffffff9e,%eax
mov    %eax,%ecx
mov    %rcx,-0x48(%rbp)
sub    $0x11,%eax
ja     1323 <main+0x1a3>
mov    -0x48(%rbp),%rax
lea    0xdcd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2db5(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    133d <main+0x1bd>
mov    0x2d90(%rip),%rax
mov    (%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xe25(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    133d <main+0x1bd>
mov    0x2d68(%rip),%rax
mov    (%rax),%rdi
call   1070 <atol@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rsi
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    133d <main+0x1bd>
mov    0x2d3e(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rsi
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    133d <main+0x1bd>
mov    0x2d19(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rsi
lea    0xde8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    133d <main+0x1bd>
mov    $0x0,%al
call   10a0 <info@plt>
movl   $0x0,-0x4(%rbp)
jmp    1361 <main+0x1e1>
mov    $0x0,%al
call   1060 <usage@plt>
movl   $0x0,-0x4(%rbp)
jmp    1361 <main+0x1e1>
lea    0xdc0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1361 <main+0x1e1>
jmp    11e8 <main+0x68>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x30(%rbp),%rdx
mov    -0x38(%rbp),%rcx
mov    -0x40(%rbp),%r8
call   1030 <bench_level1@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r14
mov    %edi,%ebp
mov    $0x3039,%edi
mov    $0xff9b,%esi
mov    $0x85ad,%edx
mov    $0x3039,%ecx
mov    $0x9856a3,%r8d
mov    $0x5b4f846,%r9d
call   10a0 <settable@plt>
lea    0xe8d(%rip),%rbx
lea    0xe7a(%rip),%rax
mov    %rax,0x20(%rsp)
mov    $0x1,%eax
mov    %rax,0x10(%rsp)
movl   $0xc8,0xc(%rsp)
lea    0xe54(%rip),%rax
mov    %rax,0x18(%rsp)
lea    0xe83(%rip),%r12
lea    0x2e69(%rip),%r13
mov    0x2dea(%rip),%r15
xchg   %ax,%ax
mov    %ebp,%edi
mov    %r14,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
xor    %r8d,%r8d
call   1050 <getopt_long@plt>
cmp    $0x64,%eax
jne    1240 <main+0xb0>
mov    (%r15),%rbx
lea    0xea7(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1210 <main+0x80>
xchg   %ax,%ax
lea    -0x62(%rax),%ecx
cmp    $0x11,%ecx
ja     12b4 <main+0x124>
lea    0xdb1(%rip),%rdx
movslq (%rdx,%rcx,4),%rax
add    %rdx,%rax
jmp    *%rax
mov    (%r15),%rsi
lea    0xe2e(%rip),%rdi
mov    %rsi,0x18(%rsp)
jmp    1235 <main+0xa5>
mov    (%r15),%rsi
lea    0xe58(%rip),%rdi
mov    %rsi,0x20(%rsp)
jmp    1235 <main+0xa5>
mov    (%r15),%rdi
call   1080 <atol@plt>
lea    0xe26(%rip),%rdi
mov    %rax,0x10(%rsp)
mov    %rax,%rsi
jmp    1235 <main+0xa5>
mov    (%r15),%rdi
call   1090 <atoi@plt>
lea    0xe00(%rip),%rdi
mov    %eax,0xc(%rsp)
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1210 <main+0x80>
cmp    $0xffffffff,%eax
jne    12d6 <main+0x146>
mov    0x18(%rsp),%rdi
mov    0xc(%rsp),%esi
mov    0x10(%rsp),%rdx
mov    0x20(%rsp),%rcx
mov    %rbx,%r8
call   1040 <bench_level1@plt>
jmp    12f4 <main+0x164>
lea    0xe0d(%rip),%rdi
call   1030 <puts@plt>
jmp    12f4 <main+0x164>
xor    %eax,%eax
call   1070 <usage@plt>
jmp    12f4 <main+0x164>
xor    %eax,%eax
call   10b0 <info@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.option = type { i8*, i8, i32*, i32 }
@.str = [8 x i8] c"blas_op\00"
@.str.1 = [12 x i8] c"dot_product\00"
@.str.2 = [7 x i8] c"double\00"
@main.option_list = internal global [8 x %struct.option] [%struct.option { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i32 0, i32 0), i8 -128, i32* null, i32 98 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i32 0, i32 0), i8 -128, i32* null, i32 115 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i32 0, i32 0), i8 -128, i32* null, i32 114 }, %struct.option { i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i32 0, i32 0), i8 -128, i32* null, i32 111 }, %struct.option { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i32 0, i32 0), i8 -128, i32* null, i32 100 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i32 0, i32 0), i8 -127, i32* null, i32 105 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i32 0, i32 0), i8 -127, i32* null, i32 104 }, %struct.option zeroinitializer]
@.str.3 = [6 x i8] c"bench\00"
@.str.4 = [5 x i8] c"size\00"
@.str.5 = [5 x i8] c"reps\00"
@.str.6 = [3 x i8] c"op\00"
@.str.7 = [6 x i8] c"dtype\00"
@.str.8 = [5 x i8] c"info\00"
@.str.9 = [5 x i8] c"help\00"
@.str.10 = [13 x i8] c"b:s:r:o:d:ih\00"
@optarg = global i8* null
@.str.11 = [18 x i8] c"Benchmark is %s.\0A\00"
@.str.12 = [13 x i8] c"Size is %d.\0A\00"
@.str.13 = [28 x i8] c"Number of repetitions %lu.\0A\00"
@.str.14 = [14 x i8] c"Operation %s\0A\00"
@.str.15 = [17 x i8] c"Data type is %s\0A\00"
@.str.16 = [12 x i8] c"Undefined.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i64
%10 = alloca i8*
%11 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = call i32 @settable(i32 12345, i32 65435, i32 34221, i32 12345, i32 9983651, i32 95746118)
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %7
store i32 200, i32* %8
store i64 1, i64* %9
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8** %10
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8** %11
br label %13
13: ; preds = %48, %2
%14 = load i32, i32* %4
%15 = load i8**, i8*** %5
%16 = call i32 @getopt_long(i32 %14, i8** %15, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), %struct.option* getelementptr inbounds ([8 x %struct.option], [8 x %struct.option]* @main.option_list, i64 0, i64 0), i32* null)
store i32 %16, i32* %6
%17 = icmp ne i32 %16, -1
br i1 %17, label %18, label %49
18: ; preds = %13
%19 = load i32, i32* %6
switch i32 %19, label %46 [
i32 98, label %20
i32 115, label %24
i32 114, label %29
i32 111, label %34
i32 100, label %38
i32 105, label %42
i32 104, label %44
]
20: ; preds = %18
%21 = load i8*, i8** @optarg
store i8* %21, i8** %7
%22 = load i8*, i8** %7
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.11, i64 0, i64 0), i8* %22)
br label %48
24: ; preds = %18
%25 = load i8*, i8** @optarg
%26 = call i32 @atoi(i8* %25)
store i32 %26, i32* %8
%27 = load i32, i32* %8
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0), i32 %27)
br label %48
29: ; preds = %18
%30 = load i8*, i8** @optarg
%31 = call i64 @atol(i8* %30)
store i64 %31, i64* %9
%32 = load i64, i64* %9
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.13, i64 0, i64 0), i64 %32)
br label %48
34: ; preds = %18
%35 = load i8*, i8** @optarg
store i8* %35, i8** %10
%36 = load i8*, i8** %10
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.14, i64 0, i64 0), i8* %36)
br label %48
38: ; preds = %18
%39 = load i8*, i8** @optarg
store i8* %39, i8** %11
%40 = load i8*, i8** %11
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.15, i64 0, i64 0), i8* %40)
br label %48
42: ; preds = %18
%43 = call i32 (...) @info()
store i32 0, i32* %3
br label %56
44: ; preds = %18
%45 = call i32 (...) @usage()
store i32 0, i32* %3
br label %56
46: ; preds = %18
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.16, i64 0, i64 0))
store i32 0, i32* %3
br label %56
48: ; preds = %38, %34, %29, %24, %20
br label %13
49: ; preds = %13
%50 = load i8*, i8** %7
%51 = load i32, i32* %8
%52 = load i64, i64* %9
%53 = load i8*, i8** %10
%54 = load i8*, i8** %11
%55 = call i32 @bench_level1(i8* %50, i32 %51, i64 %52, i8* %53, i8* %54)
store i32 0, i32* %3
br label %56
56: ; preds = %49, %46, %44, %42
%57 = load i32, i32* %3
ret i32 %57
}

LLVM IR (-O2):
%struct.option = type { i8*, i8, i32*, i32 }
@.str = [8 x i8] c"blas_op\00"
@.str.1 = [12 x i8] c"dot_product\00"
@.str.2 = [7 x i8] c"double\00"
@main.option_list = internal global [8 x %struct.option] [%struct.option { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i32 0, i32 0), i8 -128, i32* null, i32 98 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i32 0, i32 0), i8 -128, i32* null, i32 115 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i32 0, i32 0), i8 -128, i32* null, i32 114 }, %struct.option { i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i32 0, i32 0), i8 -128, i32* null, i32 111 }, %struct.option { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i32 0, i32 0), i8 -128, i32* null, i32 100 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i32 0, i32 0), i8 -127, i32* null, i32 105 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i32 0, i32 0), i8 -127, i32* null, i32 104 }, %struct.option zeroinitializer]
@.str.3 = [6 x i8] c"bench\00"
@.str.4 = [5 x i8] c"size\00"
@.str.5 = [5 x i8] c"reps\00"
@.str.6 = [3 x i8] c"op\00"
@.str.7 = [6 x i8] c"dtype\00"
@.str.8 = [5 x i8] c"info\00"
@.str.9 = [5 x i8] c"help\00"
@.str.10 = [13 x i8] c"b:s:r:o:d:ih\00"
@optarg = global i8* null
@.str.11 = [18 x i8] c"Benchmark is %s.\0A\00"
@.str.12 = [13 x i8] c"Size is %d.\0A\00"
@.str.13 = [28 x i8] c"Number of repetitions %lu.\0A\00"
@.str.14 = [14 x i8] c"Operation %s\0A\00"
@.str.15 = [17 x i8] c"Data type is %s\0A\00"
@str = [11 x i8] c"Undefined.\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @settable(i32 12345, i32 65435, i32 34221, i32 12345, i32 9983651, i32 95746118)
br label %4
4: ; preds = %25, %2
%5 = phi i8* [ %26, %25 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), %2 ]
%6 = phi i32 [ %11, %25 ], [ 200, %2 ]
%7 = phi i64 [ %16, %25 ], [ 1, %2 ]
%8 = phi i8* [ %20, %25 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), %2 ]
%9 = phi i8* [ %23, %25 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), %2 ]
br label %10
10: ; preds = %4, %28
%11 = phi i32 [ %6, %4 ], [ %30, %28 ]
%12 = phi i64 [ %7, %4 ], [ %16, %28 ]
%13 = phi i8* [ %8, %4 ], [ %20, %28 ]
%14 = phi i8* [ %9, %4 ], [ %23, %28 ]
br label %15
15: ; preds = %10, %32
%16 = phi i64 [ %12, %10 ], [ %34, %32 ]
%17 = phi i8* [ %13, %10 ], [ %20, %32 ]
%18 = phi i8* [ %14, %10 ], [ %23, %32 ]
br label %19
19: ; preds = %15, %36
%20 = phi i8* [ %17, %15 ], [ %37, %36 ]
%21 = phi i8* [ %18, %15 ], [ %23, %36 ]
br label %22
22: ; preds = %19, %39
%23 = phi i8* [ %40, %39 ], [ %21, %19 ]
%24 = tail call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), %struct.option* getelementptr inbounds ([8 x %struct.option], [8 x %struct.option]* @main.option_list, i64 0, i64 0), i32* null)
switch i32 %24, label %46 [
i32 -1, label %48
i32 98, label %25
i32 115, label %28
i32 114, label %32
i32 111, label %36
i32 100, label %39
i32 105, label %42
i32 104, label %44
]
25: ; preds = %22
%26 = load i8*, i8** @optarg
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.11, i64 0, i64 0), i8* %26)
br label %4
28: ; preds = %22
%29 = load i8*, i8** @optarg
%30 = tail call i32 @atoi(i8* %29)
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0), i32 %30)
br label %10
32: ; preds = %22
%33 = load i8*, i8** @optarg
%34 = tail call i64 @atol(i8* %33)
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.13, i64 0, i64 0), i64 %34)
br label %15
36: ; preds = %22
%37 = load i8*, i8** @optarg
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.14, i64 0, i64 0), i8* %37)
br label %19
39: ; preds = %22
%40 = load i8*, i8** @optarg
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.15, i64 0, i64 0), i8* %40)
br label %22
42: ; preds = %22
%43 = tail call i32 (...) @info()
br label %50
44: ; preds = %22
%45 = tail call i32 (...) @usage()
br label %50
46: ; preds = %22
%47 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
br label %50
48: ; preds = %22
%49 = tail call i32 @bench_level1(i8* %5, i32 %11, i64 %16, i8* %20, i8* %23)
br label %50
50: ; preds = %48, %46, %44, %42
ret i32 0
}