#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*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ test1();
int /*<<< orphan*/ test2();
int /*<<< orphan*/ test3();
int /*<<< orphan*/ test4();
int /*<<< orphan*/ test5();
int /*<<< orphan*/ test6();
int main(int argc, char **argv) {
  char *test;
  if (argc < 2) {
    printf("Usage: test_array test1|test2|test3|test4|test5|test6\n");
    exit(1);
  }
  test = argv[1];
  printf("Running %s\n", test);
  if (strcmp(test, "test1") == 0) {
    test1();
  } else if (strcmp(test, "test2") == 0) {
    test2();
  } else if (strcmp(test, "test3") == 0) {
    test3();
  } else if (strcmp(test, "test4") == 0) {
    test4();
  } else if (strcmp(test, "test5") == 0) {
    test5();
  } else if (strcmp(test, "test6") == 0) {
    test6();
  } else {
    printf("Test not found!!n");
    exit(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11c8 <main+0x38>
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe52(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    120c <main+0x7c>
mov    $0x0,%al
call   1050 <test1@plt>
jmp    12fb <main+0x16b>
mov    -0x18(%rbp),%rdi
lea    0xe32(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1232 <main+0xa2>
mov    $0x0,%al
call   10a0 <test2@plt>
jmp    12f6 <main+0x166>
mov    -0x18(%rbp),%rdi
lea    0xe12(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1258 <main+0xc8>
mov    $0x0,%al
call   1040 <test3@plt>
jmp    12f1 <main+0x161>
mov    -0x18(%rbp),%rdi
lea    0xdf2(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    127e <main+0xee>
mov    $0x0,%al
call   1090 <test4@plt>
jmp    12ec <main+0x15c>
mov    -0x18(%rbp),%rdi
lea    0xdd2(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    12a4 <main+0x114>
mov    $0x0,%al
call   1030 <test5@plt>
jmp    12e7 <main+0x157>
mov    -0x18(%rbp),%rdi
lea    0xdb2(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    12ca <main+0x13a>
mov    $0x0,%al
call   1080 <test6@plt>
jmp    12e2 <main+0x152>
lea    0xd96(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
jmp    12e7 <main+0x157>
jmp    12ec <main+0x15c>
jmp    12f1 <main+0x161>
jmp    12f6 <main+0x166>
jmp    12fb <main+0x16b>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x1,%edi
jle    126f <main+0xcf>
mov    0x8(%rsi),%rbx
lea    0xe4b(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xe46(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1240 <main+0xa0>
lea    0xe38(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1249 <main+0xa9>
lea    0xe2a(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1252 <main+0xb2>
lea    0xe1c(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     125b <main+0xbb>
lea    0xe0e(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1264 <main+0xc4>
lea    0xe42(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
jne    1285 <main+0xe5>
xor    %eax,%eax
call   1090 <test6@plt>
jmp    126b <main+0xcb>
xor    %eax,%eax
call   1060 <test1@plt>
jmp    126b <main+0xcb>
xor    %eax,%eax
call   10b0 <test2@plt>
jmp    126b <main+0xcb>
xor    %eax,%eax
call   1050 <test3@plt>
jmp    126b <main+0xcb>
xor    %eax,%eax
call   10a0 <test4@plt>
jmp    126b <main+0xcb>
xor    %eax,%eax
call   1040 <test5@plt>
xor    %eax,%eax
pop    %rbx
ret
lea    0xdc6(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
lea    0xd9e(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@.str = [55 x i8] c"Usage: test_array test1|test2|test3|test4|test5|test6\0A\00"
@.str.1 = [12 x i8] c"Running %s\0A\00"
@.str.2 = [6 x i8] c"test1\00"
@.str.3 = [6 x i8] c"test2\00"
@.str.4 = [6 x i8] c"test3\00"
@.str.5 = [6 x i8] c"test4\00"
@.str.6 = [6 x i8] c"test5\00"
@.str.7 = [6 x i8] c"test6\00"
@.str.8 = [18 x i8] c"Test not found!!n\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
store i8* %15, i8** %6
%16 = load i8*, i8** %6
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%18 = load i8*, i8** %6
%19 = call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %12
%22 = call i32 (...) @test1()
br label %61
23: ; preds = %12
%24 = load i8*, i8** %6
%25 = call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %23
%28 = call i32 (...) @test2()
br label %60
29: ; preds = %23
%30 = load i8*, i8** %6
%31 = call i64 @strcmp(i8* %30, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %29
%34 = call i32 (...) @test3()
br label %59
35: ; preds = %29
%36 = load i8*, i8** %6
%37 = call i64 @strcmp(i8* %36, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%38 = icmp eq i64 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %35
%40 = call i32 (...) @test4()
br label %58
41: ; preds = %35
%42 = load i8*, i8** %6
%43 = call i64 @strcmp(i8* %42, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%44 = icmp eq i64 %43, 0
br i1 %44, label %45, label %47
45: ; preds = %41
%46 = call i32 (...) @test5()
br label %57
47: ; preds = %41
%48 = load i8*, i8** %6
%49 = call i64 @strcmp(i8* %48, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%50 = icmp eq i64 %49, 0
br i1 %50, label %51, label %53
51: ; preds = %47
%52 = call i32 (...) @test6()
br label %56
53: ; preds = %47
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
%55 = call i32 @exit(i32 1)
unreachable
56: ; preds = %51
br label %57
57: ; preds = %56, %45
br label %58
58: ; preds = %57, %39
br label %59
59: ; preds = %58, %33
br label %60
60: ; preds = %59, %27
br label %61
61: ; preds = %60, %21
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [12 x i8] c"Running %s\0A\00"
@.str.2 = [6 x i8] c"test1\00"
@.str.3 = [6 x i8] c"test2\00"
@.str.4 = [6 x i8] c"test3\00"
@.str.5 = [6 x i8] c"test4\00"
@.str.6 = [6 x i8] c"test5\00"
@.str.7 = [6 x i8] c"test6\00"
@.str.8 = [18 x i8] c"Test not found!!n\00"
@str = [54 x i8] c"Usage: test_array test1|test2|test3|test4|test5|test6\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = tail call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %7
%14 = tail call i32 (...) @test1()
br label %43
15: ; preds = %7
%16 = tail call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = tail call i32 (...) @test2()
br label %43
20: ; preds = %15
%21 = tail call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = tail call i32 (...) @test3()
br label %43
25: ; preds = %20
%26 = tail call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = tail call i32 (...) @test4()
br label %43
30: ; preds = %25
%31 = tail call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = tail call i32 (...) @test5()
br label %43
35: ; preds = %30
%36 = tail call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %35
%39 = tail call i32 (...) @test6()
br label %43
40: ; preds = %35
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
%42 = tail call i32 @exit(i32 1)
unreachable
43: ; preds = %18, %28, %38, %33, %23, %13
ret i32 0
}