#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 long ULONG_MAX;
unsigned long atol(char *);
int /*<<< orphan*/ bench_level0(char *, 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*/ usage();
int main(int argc, char **argv) {
  int c;
  char *bench = "simd";
  unsigned long rep = ULONG_MAX;
  char *op = "+";
  char *dt = "int";
  static struct option option_list[] = {{"bench", required_argument, NULL, 'b'},
                                        {"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:t:r:o:d:ih", option_list, NULL)) !=
         -1) {
    switch (c) {
    case 'b':
      bench = optarg;
      printf("Benchmark is %s.\n", bench);
      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_level0(bench, rep, op, dt);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec7(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2e48(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
lea    0xeb3(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xeaa(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xeba(%rip),%rdx
lea    0x2ea6(%rip),%rcx
xor    %eax,%eax
mov    %eax,%r8d
call   1030 <getopt_long@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     12d7 <main+0x177>
mov    -0x14(%rbp),%eax
add    $0xffffff9e,%eax
mov    %eax,%ecx
mov    %rcx,-0x40(%rbp)
sub    $0x10,%eax
ja     12b8 <main+0x158>
mov    -0x40(%rbp),%rax
lea    0xe10(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2df8(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12d2 <main+0x172>
mov    0x2dd3(%rip),%rax
mov    (%rax),%rdi
call   1070 <atol@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12d2 <main+0x172>
mov    0x2da9(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rsi
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12d2 <main+0x172>
mov    0x2d84(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rsi
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12d2 <main+0x172>
mov    $0x0,%al
call   1080 <info@plt>
movl   $0x0,-0x4(%rbp)
jmp    12f3 <main+0x193>
mov    $0x0,%al
call   1050 <usage@plt>
movl   $0x0,-0x4(%rbp)
jmp    12f3 <main+0x193>
lea    0xe0a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12f3 <main+0x193>
jmp    11a5 <main+0x45>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x38(%rbp),%rcx
call   1060 <bench_level0@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r15
mov    %edi,%ebp
mov    0x2e46(%rip),%rax
mov    (%rax),%rax
mov    %rax,(%rsp)
lea    0xeb3(%rip),%rbx
lea    0xeaa(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0xe99(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0xeb6(%rip),%r14
lea    0x2ea2(%rip),%r12
mov    0x2e33(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebp,%edi
mov    %r15,%rsi
mov    %r14,%rdx
mov    %r12,%rcx
xor    %r8d,%r8d
call   1040 <getopt_long@plt>
cmp    $0x64,%eax
jne    11ff <main+0x8f>
mov    0x0(%r13),%rbx
lea    0xec5(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11d0 <main+0x60>
lea    -0x62(%rax),%ecx
cmp    $0x10,%ecx
ja     1254 <main+0xe4>
lea    0xdf2(%rip),%rdx
movslq (%rdx,%rcx,4),%rax
add    %rdx,%rax
jmp    *%rax
mov    0x0(%r13),%rsi
lea    0xe5a(%rip),%rdi
mov    %rsi,0x8(%rsp)
jmp    11f6 <main+0x86>
mov    0x0(%r13),%rsi
lea    0xe76(%rip),%rdi
mov    %rsi,0x10(%rsp)
jmp    11f6 <main+0x86>
mov    0x0(%r13),%rdi
call   1080 <atol@plt>
lea    0xe43(%rip),%rdi
mov    %rax,(%rsp)
mov    %rax,%rsi
jmp    11f6 <main+0x86>
cmp    $0xffffffff,%eax
jne    1271 <main+0x101>
mov    0x8(%rsp),%rdi
mov    (%rsp),%rsi
mov    0x10(%rsp),%rdx
mov    %rbx,%rcx
call   1070 <bench_level0@plt>
jmp    128f <main+0x11f>
lea    0xe51(%rip),%rdi
call   1030 <puts@plt>
jmp    128f <main+0x11f>
xor    %eax,%eax
call   1060 <usage@plt>
jmp    128f <main+0x11f>
xor    %eax,%eax
call   1090 <info@plt>
xor    %eax,%eax
add    $0x18,%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 = [5 x i8] c"simd\00"
@ULONG_MAX = global i64 0
@.str.1 = [2 x i8] c"+\00"
@.str.2 = [4 x i8] c"int\00"
@main.option_list = internal global [7 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 114 }, %struct.option { i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i32 0, i32 0), i8 -128, i32* null, i32 111 }, %struct.option { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i32 0, i32 0), i8 -128, i32* null, i32 100 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i32 0, i32 0), i8 -127, i32* null, i32 105 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, 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"reps\00"
@.str.5 = [3 x i8] c"op\00"
@.str.6 = [6 x i8] c"dtype\00"
@.str.7 = [5 x i8] c"info\00"
@.str.8 = [5 x i8] c"help\00"
@.str.9 = [15 x i8] c"b:s:t:r:o:d:ih\00"
@optarg = global i8* null
@.str.10 = [18 x i8] c"Benchmark is %s.\0A\00"
@.str.11 = [28 x i8] c"Number of repetitions %lu.\0A\00"
@.str.12 = [14 x i8] c"Operation %s\0A\00"
@.str.13 = [17 x i8] c"Data type is %s\0A\00"
@.str.14 = [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 i64
%9 = alloca i8*
%10 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %7
%11 = load i64, i64* @ULONG_MAX
store i64 %11, i64* %8
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8** %9
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8** %10
br label %12
12: ; preds = %42, %2
%13 = load i32, i32* %4
%14 = load i8**, i8*** %5
%15 = call i32 @getopt_long(i32 %13, i8** %14, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), %struct.option* getelementptr inbounds ([7 x %struct.option], [7 x %struct.option]* @main.option_list, i64 0, i64 0), i32* null)
store i32 %15, i32* %6
%16 = icmp ne i32 %15, -1
br i1 %16, label %17, label %43
17: ; preds = %12
%18 = load i32, i32* %6
switch i32 %18, label %40 [
i32 98, label %19
i32 114, label %23
i32 111, label %28
i32 100, label %32
i32 105, label %36
i32 104, label %38
]
19: ; preds = %17
%20 = load i8*, i8** @optarg
store i8* %20, i8** %7
%21 = load i8*, i8** %7
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0), i8* %21)
br label %42
23: ; preds = %17
%24 = load i8*, i8** @optarg
%25 = call i64 @atol(i8* %24)
store i64 %25, i64* %8
%26 = load i64, i64* %8
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0), i64 %26)
br label %42
28: ; preds = %17
%29 = load i8*, i8** @optarg
store i8* %29, i8** %9
%30 = load i8*, i8** %9
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0), i8* %30)
br label %42
32: ; preds = %17
%33 = load i8*, i8** @optarg
store i8* %33, i8** %10
%34 = load i8*, i8** %10
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.13, i64 0, i64 0), i8* %34)
br label %42
36: ; preds = %17
%37 = call i32 (...) @info()
store i32 0, i32* %3
br label %49
38: ; preds = %17
%39 = call i32 (...) @usage()
store i32 0, i32* %3
br label %49
40: ; preds = %17
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.14, i64 0, i64 0))
store i32 0, i32* %3
br label %49
42: ; preds = %32, %28, %23, %19
br label %12
43: ; preds = %12
%44 = load i8*, i8** %7
%45 = load i64, i64* %8
%46 = load i8*, i8** %9
%47 = load i8*, i8** %10
%48 = call i32 @bench_level0(i8* %44, i64 %45, i8* %46, i8* %47)
store i32 0, i32* %3
br label %49
49: ; preds = %43, %40, %38, %36
%50 = load i32, i32* %3
ret i32 %50
}

LLVM IR (-O2):
%struct.option = type { i8*, i8, i32*, i32 }
@.str = [5 x i8] c"simd\00"
@ULONG_MAX = global i64 0
@.str.1 = [2 x i8] c"+\00"
@.str.2 = [4 x i8] c"int\00"
@main.option_list = internal global [7 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 114 }, %struct.option { i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i32 0, i32 0), i8 -128, i32* null, i32 111 }, %struct.option { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i32 0, i32 0), i8 -128, i32* null, i32 100 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i32 0, i32 0), i8 -127, i32* null, i32 105 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, 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"reps\00"
@.str.5 = [3 x i8] c"op\00"
@.str.6 = [6 x i8] c"dtype\00"
@.str.7 = [5 x i8] c"info\00"
@.str.8 = [5 x i8] c"help\00"
@.str.9 = [15 x i8] c"b:s:t:r:o:d:ih\00"
@optarg = global i8* null
@.str.10 = [18 x i8] c"Benchmark is %s.\0A\00"
@.str.11 = [28 x i8] c"Number of repetitions %lu.\0A\00"
@.str.12 = [14 x i8] c"Operation %s\0A\00"
@.str.13 = [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 = load i64, i64* @ULONG_MAX
br label %4
4: ; preds = %19, %2
%5 = phi i8* [ %20, %19 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %2 ]
%6 = phi i64 [ %10, %19 ], [ %3, %2 ]
%7 = phi i8* [ %14, %19 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), %2 ]
%8 = phi i8* [ %17, %19 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), %2 ]
br label %9
9: ; preds = %4, %22
%10 = phi i64 [ %6, %4 ], [ %24, %22 ]
%11 = phi i8* [ %7, %4 ], [ %14, %22 ]
%12 = phi i8* [ %8, %4 ], [ %17, %22 ]
br label %13
13: ; preds = %9, %26
%14 = phi i8* [ %11, %9 ], [ %27, %26 ]
%15 = phi i8* [ %12, %9 ], [ %17, %26 ]
br label %16
16: ; preds = %13, %29
%17 = phi i8* [ %30, %29 ], [ %15, %13 ]
%18 = tail call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), %struct.option* getelementptr inbounds ([7 x %struct.option], [7 x %struct.option]* @main.option_list, i64 0, i64 0), i32* null)
switch i32 %18, label %36 [
i32 -1, label %38
i32 98, label %19
i32 114, label %22
i32 111, label %26
i32 100, label %29
i32 105, label %32
i32 104, label %34
]
19: ; preds = %16
%20 = load i8*, i8** @optarg
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0), i8* %20)
br label %4
22: ; preds = %16
%23 = load i8*, i8** @optarg
%24 = tail call i64 @atol(i8* %23)
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0), i64 %24)
br label %9
26: ; preds = %16
%27 = load i8*, i8** @optarg
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0), i8* %27)
br label %13
29: ; preds = %16
%30 = load i8*, i8** @optarg
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.13, i64 0, i64 0), i8* %30)
br label %16
32: ; preds = %16
%33 = tail call i32 (...) @info()
br label %40
34: ; preds = %16
%35 = tail call i32 (...) @usage()
br label %40
36: ; preds = %16
%37 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
br label %40
38: ; preds = %16
%39 = tail call i32 @bench_level0(i8* %5, i64 %10, i8* %14, i8* %17)
br label %40
40: ; preds = %38, %36, %34, %32
ret i32 0
}