#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 /*<<< orphan*/ test7();
int main(int argc, char **argv) {
  char *test;
  if (argc < 2) {
    printf("Usage: test_resizable_table test1|test2|...test7\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 if (strcmp(test, "test7") == 0) {
    test7();
  } 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    11d8 <main+0x38>
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe3d(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    121c <main+0x7c>
mov    $0x0,%al
call   1060 <test1@plt>
jmp    1336 <main+0x196>
mov    -0x18(%rbp),%rdi
lea    0xe1d(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1242 <main+0xa2>
mov    $0x0,%al
call   10b0 <test2@plt>
jmp    1331 <main+0x191>
mov    -0x18(%rbp),%rdi
lea    0xdfd(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1268 <main+0xc8>
mov    $0x0,%al
call   1050 <test3@plt>
jmp    132c <main+0x18c>
mov    -0x18(%rbp),%rdi
lea    0xddd(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    128e <main+0xee>
mov    $0x0,%al
call   10a0 <test4@plt>
jmp    1327 <main+0x187>
mov    -0x18(%rbp),%rdi
lea    0xdbd(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    12b4 <main+0x114>
mov    $0x0,%al
call   1040 <test5@plt>
jmp    1322 <main+0x182>
mov    -0x18(%rbp),%rdi
lea    0xd9d(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    12da <main+0x13a>
mov    $0x0,%al
call   1090 <test6@plt>
jmp    131d <main+0x17d>
mov    -0x18(%rbp),%rdi
lea    0xd7d(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1300 <main+0x160>
mov    $0x0,%al
call   1030 <test7@plt>
jmp    1318 <main+0x178>
lea    0xd61(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
jmp    131d <main+0x17d>
jmp    1322 <main+0x182>
jmp    1327 <main+0x187>
jmp    132c <main+0x18c>
jmp    1331 <main+0x191>
jmp    1336 <main+0x196>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x1,%edi
jle    12a0 <main+0xf0>
mov    0x8(%rsi),%rbx
lea    0xe3b(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xe36(%rip),%rsi
mov    %rbx,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     1268 <main+0xb8>
lea    0xe24(%rip),%rsi
mov    %rbx,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     1271 <main+0xc1>
lea    0xe16(%rip),%rsi
mov    %rbx,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     127a <main+0xca>
lea    0xe08(%rip),%rsi
mov    %rbx,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     1283 <main+0xd3>
lea    0xdfa(%rip),%rsi
mov    %rbx,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     128c <main+0xdc>
lea    0xdec(%rip),%rsi
mov    %rbx,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     1295 <main+0xe5>
lea    0xe1b(%rip),%rsi
mov    %rbx,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
jne    12b6 <main+0x106>
xor    %eax,%eax
call   1040 <test7@plt>
jmp    129c <main+0xec>
xor    %eax,%eax
call   1070 <test1@plt>
jmp    129c <main+0xec>
xor    %eax,%eax
call   10c0 <test2@plt>
jmp    129c <main+0xec>
xor    %eax,%eax
call   1060 <test3@plt>
jmp    129c <main+0xec>
xor    %eax,%eax
call   10b0 <test4@plt>
jmp    129c <main+0xec>
xor    %eax,%eax
call   1050 <test5@plt>
jmp    129c <main+0xec>
xor    %eax,%eax
call   10a0 <test6@plt>
xor    %eax,%eax
pop    %rbx
ret
lea    0xd9b(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
lea    0xd73(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
@.str = [50 x i8] c"Usage: test_resizable_table test1|test2|...test7\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 = [6 x i8] c"test7\00"
@.str.9 = [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 ([50 x i8], [50 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 %68
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 %67
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 %66
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 %65
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 %64
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 %63
53: ; preds = %47
%54 = load i8*, i8** %6
%55 = call i64 @strcmp(i8* %54, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%56 = icmp eq i64 %55, 0
br i1 %56, label %57, label %59
57: ; preds = %53
%58 = call i32 (...) @test7()
br label %62
59: ; preds = %53
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0))
%61 = call i32 @exit(i32 1)
unreachable
62: ; preds = %57
br label %63
63: ; preds = %62, %51
br label %64
64: ; preds = %63, %45
br label %65
65: ; preds = %64, %39
br label %66
66: ; preds = %65, %33
br label %67
67: ; preds = %66, %27
br label %68
68: ; preds = %67, %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 = [6 x i8] c"test7\00"
@.str.9 = [18 x i8] c"Test not found!!n\00"
@str = [49 x i8] c"Usage: test_resizable_table test1|test2|...test7\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 ([49 x i8], [49 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 %48
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 %48
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 %48
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 %48
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 %48
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 %48
40: ; preds = %35
%41 = tail call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = tail call i32 (...) @test7()
br label %48
45: ; preds = %40
%46 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0))
%47 = tail call i32 @exit(i32 1)
unreachable
48: ; preds = %18, %28, %38, %43, %33, %23, %13
ret i32 0
}