#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*/ testWithInt();
int /*<<< orphan*/ testWithIntDescending();
int /*<<< orphan*/ testWithStudents1();
int /*<<< orphan*/ testWithStudents2();
int /*<<< orphan*/ testWithStudents3();
int main(int argc, char **argv) {
  if (argc < 2) {
    printf("test_mysort [test1|test2|test3|test4|test5]\n");
    exit(1);
  }
  if (strcmp(argv[1], "test1") == 0) {
    testWithInt();
  } else if (strcmp(argv[1], "test2") == 0) {
    testWithIntDescending();
  } else if (strcmp(argv[1], "test3") == 0) {
    testWithStudents1();
  } else if (strcmp(argv[1], "test4") == 0) {
    testWithStudents2();
  } else if (strcmp(argv[1], "test5") == 0) {
    testWithStudents3();
  } else {
    printf("Invalid test\n");
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11b6 <main+0x36>
lea    0xe59(%rip),%rdi
call   1050 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe68(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    11e0 <main+0x60>
mov    $0x0,%al
call   1030 <testWithInt@plt>
jmp    12b4 <main+0x134>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe44(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    120a <main+0x8a>
mov    $0x0,%al
call   1060 <testWithIntDescending@plt>
jmp    12af <main+0x12f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe20(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1234 <main+0xb4>
mov    $0x0,%al
call   1090 <testWithStudents1@plt>
jmp    12aa <main+0x12a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdfc(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    125e <main+0xde>
mov    $0x0,%al
call   1040 <testWithStudents2@plt>
jmp    12a5 <main+0x125>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdd8(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1288 <main+0x108>
mov    $0x0,%al
call   1080 <testWithStudents3@plt>
jmp    12a0 <main+0x120>
lea    0xdbc(%rip),%rdi
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12bb <main+0x13b>
jmp    12a5 <main+0x125>
jmp    12aa <main+0x12a>
jmp    12af <main+0x12f>
jmp    12b4 <main+0x134>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x1,%edi
jle    1242 <main+0xc2>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xe68(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1209 <main+0x89>
mov    0x8(%rbx),%rdi
lea    0xe59(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1214 <main+0x94>
mov    0x8(%rbx),%rdi
lea    0xe4a(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     121f <main+0x9f>
mov    0x8(%rbx),%rdi
lea    0xe3b(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     122a <main+0xaa>
mov    0x8(%rbx),%rdi
lea    0xe2c(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1235 <main+0xb5>
lea    0xe21(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%ebx
jmp    123e <main+0xbe>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <testWithInt@plt>
jmp    123e <main+0xbe>
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <testWithIntDescending@plt>
jmp    123e <main+0xbe>
xor    %ebx,%ebx
xor    %eax,%eax
call   1090 <testWithStudents1@plt>
jmp    123e <main+0xbe>
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <testWithStudents2@plt>
jmp    123e <main+0xbe>
xor    %ebx,%ebx
xor    %eax,%eax
call   1080 <testWithStudents3@plt>
mov    %ebx,%eax
pop    %rbx
ret
lea    0xde2(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>

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

LLVM IR (-O2):
@.str.1 = [6 x i8] c"test1\00"
@.str.2 = [6 x i8] c"test2\00"
@.str.3 = [6 x i8] c"test3\00"
@.str.4 = [6 x i8] c"test4\00"
@.str.5 = [6 x i8] c"test5\00"
@str = [13 x i8] c"Invalid test\00"
@str.7 = [44 x i8] c"test_mysort [test1|test2|test3|test4|test5]\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 ([44 x i8], [44 x i8]* @str.7, 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 i64 @strcmp(i8* %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = tail call i32 (...) @testWithInt()
br label %40
14: ; preds = %7
%15 = load i8*, i8** %8
%16 = tail call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = tail call i32 (...) @testWithIntDescending()
br label %40
20: ; preds = %14
%21 = load i8*, i8** %8
%22 = tail call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = tail call i32 (...) @testWithStudents1()
br label %40
26: ; preds = %20
%27 = load i8*, i8** %8
%28 = tail call i64 @strcmp(i8* %27, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = tail call i32 (...) @testWithStudents2()
br label %40
32: ; preds = %26
%33 = load i8*, i8** %8
%34 = tail call i64 @strcmp(i8* %33, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %32
%37 = tail call i32 (...) @testWithStudents3()
br label %40
38: ; preds = %32
%39 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
br label %40
40: ; preds = %12, %24, %36, %30, %18, %38
%41 = phi i32 [ 1, %38 ], [ 0, %18 ], [ 0, %30 ], [ 0, %36 ], [ 0, %24 ], [ 0, %12 ]
ret i32 %41
}