#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 EXIT_FAILURE;
int /*<<< orphan*/ PrintUsage(char *);
int /*<<< orphan*/ TestStrCompare();
int /*<<< orphan*/ TestStrConcat();
int /*<<< orphan*/ TestStrCopy();
int /*<<< orphan*/ TestStrGetLength();
int /*<<< orphan*/ TestStrSearch();
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  if (argc != 2) {
    PrintUsage(argv[0]);
    return (EXIT_FAILURE);
  }
  if (strcmp(argv[1], "StrCopy") == 0)
    TestStrCopy();
  if (strcmp(argv[1], "StrGetLength") == 0)
    TestStrGetLength();
  if (strcmp(argv[1], "StrSearch") == 0)
    TestStrSearch();
  if (strcmp(argv[1], "StrCompare") == 0)
    TestStrCompare();
  if (strcmp(argv[1], "StrConcat") == 0)
    TestStrConcat();
  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)
je     11ad <main+0x3d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <PrintUsage@plt>
mov    0x2e3d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    126d <main+0xfd>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe44(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    11d2 <main+0x62>
mov    $0x0,%al
call   1030 <TestStrCopy@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe27(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    11f7 <main+0x87>
mov    $0x0,%al
call   1080 <TestStrGetLength@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe0f(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    121c <main+0xac>
mov    $0x0,%al
call   1050 <TestStrSearch@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdf4(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1241 <main+0xd1>
mov    $0x0,%al
call   1090 <TestStrCompare@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdda(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1266 <main+0xf6>
mov    $0x0,%al
call   1070 <TestStrConcat@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x2,%edi
jne    120f <main+0x9f>
mov    0x8(%rbx),%rdi
lea    0xe78(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    1199 <main+0x29>
xor    %eax,%eax
call   1030 <TestStrCopy@plt>
mov    0x8(%rbx),%rdi
lea    0xe64(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    11b5 <main+0x45>
xor    %eax,%eax
call   1080 <TestStrGetLength@plt>
mov    0x8(%rbx),%rdi
lea    0xe55(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    11d1 <main+0x61>
xor    %eax,%eax
call   1050 <TestStrSearch@plt>
mov    0x8(%rbx),%rdi
lea    0xe43(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    11ed <main+0x7d>
xor    %eax,%eax
call   1090 <TestStrCompare@plt>
mov    0x8(%rbx),%rdi
lea    0xe32(%rip),%rsi
call   1060 <strcmp@plt>
xor    %ebx,%ebx
test   %rax,%rax
jne    1220 <main+0xb0>
xor    %ebx,%ebx
xor    %eax,%eax
call   1070 <TestStrConcat@plt>
jmp    1220 <main+0xb0>
mov    (%rbx),%rdi
call   1040 <PrintUsage@plt>
mov    0x2dc2(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@.str = [8 x i8] c"StrCopy\00"
@.str.1 = [13 x i8] c"StrGetLength\00"
@.str.2 = [10 x i8] c"StrSearch\00"
@.str.3 = [11 x i8] c"StrCompare\00"
@.str.4 = [10 x i8] c"StrConcat\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 ne i32 %6, 2
br i1 %7, label %8, label %14
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = call i32 @PrintUsage(i8* %11)
%13 = load i32, i32* @EXIT_FAILURE
store i32 %13, i32* %3
br label %55
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %14
%21 = call i32 (...) @TestStrCopy()
br label %22
22: ; preds = %20, %14
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i64 @strcmp(i8* %25, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %22
%29 = call i32 (...) @TestStrGetLength()
br label %30
30: ; preds = %28, %22
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = call i64 @strcmp(i8* %33, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %30
%37 = call i32 (...) @TestStrSearch()
br label %38
38: ; preds = %36, %30
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 1
%41 = load i8*, i8** %40
%42 = call i64 @strcmp(i8* %41, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %46
44: ; preds = %38
%45 = call i32 (...) @TestStrCompare()
br label %46
46: ; preds = %44, %38
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 1
%49 = load i8*, i8** %48
%50 = call i64 @strcmp(i8* %49, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %54
52: ; preds = %46
%53 = call i32 (...) @TestStrConcat()
br label %54
54: ; preds = %52, %46
store i32 0, i32* %3
br label %55
55: ; preds = %54, %8
%56 = load i32, i32* %3
ret i32 %56
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str = [8 x i8] c"StrCopy\00"
@.str.1 = [13 x i8] c"StrGetLength\00"
@.str.2 = [10 x i8] c"StrSearch\00"
@.str.3 = [11 x i8] c"StrCompare\00"
@.str.4 = [10 x i8] c"StrConcat\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @PrintUsage(i8* %5)
%7 = load i32, i32* @EXIT_FAILURE
br label %39
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %8
%14 = tail call i32 (...) @TestStrCopy()
br label %15
15: ; preds = %13, %8
%16 = load i8*, i8** %9
%17 = tail call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = tail call i32 (...) @TestStrGetLength()
br label %21
21: ; preds = %19, %15
%22 = load i8*, i8** %9
%23 = tail call i64 @strcmp(i8* %22, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = tail call i32 (...) @TestStrSearch()
br label %27
27: ; preds = %25, %21
%28 = load i8*, i8** %9
%29 = tail call i64 @strcmp(i8* %28, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = tail call i32 (...) @TestStrCompare()
br label %33
33: ; preds = %31, %27
%34 = load i8*, i8** %9
%35 = tail call i64 @strcmp(i8* %34, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %33
%38 = tail call i32 (...) @TestStrConcat()
br label %39
39: ; preds = %33, %37, %4
%40 = phi i32 [ %7, %4 ], [ 0, %37 ], [ 0, %33 ]
ret i32 %40
}