#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*/ double_basic_op(char *, unsigned long);
int /*<<< orphan*/ float_basic_op(char *, unsigned long);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ int_basic_op(char *, unsigned long);
int /*<<< orphan*/ long_basic_op(char *, unsigned long);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
void bench_level0(char *b, unsigned long r, char *o, char *dt) {
  if (strcmp(b, "basic_op") == 0) {
    if (strcmp(dt, "int") == 0)
      int_basic_op(o, r);
    else if (strcmp(dt, "float") == 0)
      float_basic_op(o, r);
    else if (strcmp(dt, "long") == 0)
      long_basic_op(o, r);
    else if (strcmp(dt, "double") == 0)
      double_basic_op(o, r);
    else
      fprintf(stderr, "ERROR: check you are using a valid data type...\n");
  } else
    printf("Not implemented yet.\n");
}


x86 assembly (clang, -O0):
<bench_level0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe6d(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    127b <bench_level0+0x10b>
mov    -0x20(%rbp),%rdi
lea    0xe5c(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    11ce <bench_level0+0x5e>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <int_basic_op@plt>
jmp    1276 <bench_level0+0x106>
mov    -0x20(%rbp),%rdi
lea    0xe34(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    11fa <bench_level0+0x8a>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <float_basic_op@plt>
jmp    1271 <bench_level0+0x101>
mov    -0x20(%rbp),%rdi
lea    0xe0e(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1226 <bench_level0+0xb6>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1090 <long_basic_op@plt>
jmp    126c <bench_level0+0xfc>
mov    -0x20(%rbp),%rdi
lea    0xde7(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1252 <bench_level0+0xe2>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1070 <double_basic_op@plt>
jmp    1267 <bench_level0+0xf7>
mov    0x2d87(%rip),%rax
mov    (%rax),%edi
lea    0xdbd(%rip),%rsi
call   1080 <fprintf@plt>
jmp    126c <bench_level0+0xfc>
jmp    1271 <bench_level0+0x101>
jmp    1276 <bench_level0+0x106>
jmp    1287 <bench_level0+0x117>
lea    0xdce(%rip),%rdi
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bench_level0>:
push   %r15
push   %r14
push   %rbx
mov    %rcx,%rbx
mov    %rdx,%r15
mov    %rsi,%r14
lea    0xe7b(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11a0 <bench_level0+0x30>
lea    0xeba(%rip),%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <puts@plt>
lea    0xe62(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     120a <bench_level0+0x9a>
lea    0xe52(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     121a <bench_level0+0xaa>
lea    0xe44(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     122a <bench_level0+0xba>
lea    0xe35(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     123a <bench_level0+0xca>
mov    0x2de9(%rip),%rax
mov    (%rax),%edi
lea    0xe1f(%rip),%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1080 <fprintf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <int_basic_op@plt>
mov    %r15,%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <float_basic_op@plt>
mov    %r15,%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1090 <long_basic_op@plt>
mov    %r15,%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1070 <double_basic_op@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"basic_op\00"
@.str.1 = [4 x i8] c"int\00"
@.str.2 = [6 x i8] c"float\00"
@.str.3 = [5 x i8] c"long\00"
@.str.4 = [7 x i8] c"double\00"
@stderr = global i32 0
@.str.5 = [49 x i8] c"ERROR: check you are using a valid data type...\0A\00"
@.str.6 = [22 x i8] c"Not implemented yet.\0A\00"
define void @bench_level0(i8* %0, i64 %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i8*, i8** %5
%10 = call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %51
12: ; preds = %4
%13 = load i8*, i8** %8
%14 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %12
%17 = load i8*, i8** %7
%18 = load i64, i64* %6
%19 = call i32 @int_basic_op(i8* %17, i64 %18)
br label %50
20: ; preds = %12
%21 = load i8*, i8** %8
%22 = call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %28
24: ; preds = %20
%25 = load i8*, i8** %7
%26 = load i64, i64* %6
%27 = call i32 @float_basic_op(i8* %25, i64 %26)
br label %49
28: ; preds = %20
%29 = load i8*, i8** %8
%30 = call i64 @strcmp(i8* %29, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %36
32: ; preds = %28
%33 = load i8*, i8** %7
%34 = load i64, i64* %6
%35 = call i32 @long_basic_op(i8* %33, i64 %34)
br label %48
36: ; preds = %28
%37 = load i8*, i8** %8
%38 = call i64 @strcmp(i8* %37, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %44
40: ; preds = %36
%41 = load i8*, i8** %7
%42 = load i64, i64* %6
%43 = call i32 @double_basic_op(i8* %41, i64 %42)
br label %47
44: ; preds = %36
%45 = load i32, i32* @stderr
%46 = call i32 @fprintf(i32 %45, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.5, i64 0, i64 0))
br label %47
47: ; preds = %44, %40
br label %48
48: ; preds = %47, %32
br label %49
49: ; preds = %48, %24
br label %50
50: ; preds = %49, %16
br label %53
51: ; preds = %4
%52 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
br label %53
53: ; preds = %51, %50
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"basic_op\00"
@.str.1 = [4 x i8] c"int\00"
@.str.2 = [6 x i8] c"float\00"
@.str.3 = [5 x i8] c"long\00"
@.str.4 = [7 x i8] c"double\00"
@stderr = global i32 0
@.str.5 = [49 x i8] c"ERROR: check you are using a valid data type...\0A\00"
@str = [21 x i8] c"Not implemented yet.\00"
define void @bench_level0(i8* %0, i64 %1, i8* %2, i8* %3) {
%5 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %30
7: ; preds = %4
%8 = tail call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = tail call i32 @int_basic_op(i8* %2, i64 %1)
br label %32
12: ; preds = %7
%13 = tail call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = tail call i32 @float_basic_op(i8* %2, i64 %1)
br label %32
17: ; preds = %12
%18 = tail call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = tail call i32 @long_basic_op(i8* %2, i64 %1)
br label %32
22: ; preds = %17
%23 = tail call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = tail call i32 @double_basic_op(i8* %2, i64 %1)
br label %32
27: ; preds = %22
%28 = load i32, i32* @stderr
%29 = tail call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.5, i64 0, i64 0))
br label %32
30: ; preds = %4
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
br label %32
32: ; preds = %10, %20, %27, %25, %15, %30
ret void
}