#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 main(int argc, char **argv) {
  char *test;
  if (argc < 2) {
    printf("Usage: test_slist test1|test2|test3|test4|\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 {
    printf("Wrong test");
  }
}


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    11a8 <main+0x38>
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe67(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    11ec <main+0x7c>
mov    $0x0,%al
call   1040 <test1@plt>
jmp    127b <main+0x10b>
mov    -0x18(%rbp),%rdi
lea    0xe47(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1212 <main+0xa2>
mov    $0x0,%al
call   1080 <test2@plt>
jmp    1276 <main+0x106>
mov    -0x18(%rbp),%rdi
lea    0xe27(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1238 <main+0xc8>
mov    $0x0,%al
call   1030 <test3@plt>
jmp    1271 <main+0x101>
mov    -0x18(%rbp),%rdi
lea    0xe07(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    125e <main+0xee>
mov    $0x0,%al
call   1070 <test4@plt>
jmp    126c <main+0xfc>
lea    0xdeb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1271 <main+0x101>
jmp    1276 <main+0x106>
jmp    127b <main+0x10b>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x1,%edi
jle    1225 <main+0xa5>
mov    0x8(%rsi),%rbx
lea    0xe6b(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe66(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     11ff <main+0x7f>
lea    0xe58(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1208 <main+0x88>
lea    0xe4a(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1211 <main+0x91>
lea    0xe3c(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     121a <main+0x9a>
lea    0xe2e(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1221 <main+0xa1>
xor    %eax,%eax
call   1050 <test1@plt>
jmp    1221 <main+0xa1>
xor    %eax,%eax
call   1090 <test2@plt>
jmp    1221 <main+0xa1>
xor    %eax,%eax
call   1040 <test3@plt>
jmp    1221 <main+0xa1>
xor    %eax,%eax
call   1080 <test4@plt>
xor    %eax,%eax
pop    %rbx
ret
lea    0xe03(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [44 x i8] c"Usage: test_slist test1|test2|test3|test4|\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 = [11 x i8] c"Wrong test\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 ([44 x i8], [44 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 %46
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 %45
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 %44
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 %43
41: ; preds = %35
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
br label %43
43: ; preds = %41, %39
br label %44
44: ; preds = %43, %33
br label %45
45: ; preds = %44, %27
br label %46
46: ; preds = %45, %21
%47 = load i32, i32* %3
ret i32 %47
}

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 = [11 x i8] c"Wrong test\00"
@str = [43 x i8] c"Usage: test_slist test1|test2|test3|test4|\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 ([43 x i8], [43 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 %32
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 %32
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 %32
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 %32
30: ; preds = %25
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
br label %32
32: ; preds = %18, %28, %30, %23, %13
ret i32 0
}