#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*/ printf(char *);
int run_echo_test();
int run_tsmf_test();
scalar_t__ strcasecmp(char *, char *);
int main(int argc, char **argv) {
  if (argc < 2) {
    printf("usage: simple <echo|tsmf>\n");
    return 1;
  }
  if (strcasecmp(argv[1], "echo") == 0) {
    return run_echo_test();
  } else if (strcasecmp(argv[1], "tsmf") == 0) {
    return run_tsmf_test();
  } else {
    printf("usage: simple <echo|tsmf>\n");
    return 1;
  }
}


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    1178 <main+0x38>
lea    0xe99(%rip),%rdi
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11e5 <main+0xa5>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe94(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    11a5 <main+0x65>
mov    $0x0,%al
call   1060 <run_echo_test@plt>
mov    %eax,-0x4(%rbp)
jmp    11e5 <main+0xa5>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe6c(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    11d2 <main+0x92>
mov    $0x0,%al
call   1040 <run_tsmf_test@plt>
mov    %eax,-0x4(%rbp)
jmp    11e5 <main+0xa5>
lea    0xe27(%rip),%rdi
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x1,%edi
jle    1172 <main+0x32>
mov    0x8(%rsi),%rbx
lea    0xeaf(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1185 <main+0x45>
lea    0xea0(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     118d <main+0x4d>
lea    0xe91(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%eax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
jmp    1060 <run_echo_test@plt>
xor    %eax,%eax
pop    %rbx
jmp    1040 <run_tsmf_test@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"usage: simple <echo|tsmf>\0A\00"
@.str.1 = [5 x i8] c"echo\00"
@.str.2 = [5 x i8] c"tsmf\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 %10
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %28
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i64 @strcasecmp(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %10
%17 = call i32 (...) @run_echo_test()
store i32 %17, i32* %3
br label %28
18: ; preds = %10
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i64 @strcasecmp(i8* %21, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %18
%25 = call i32 (...) @run_tsmf_test()
store i32 %25, i32* %3
br label %28
26: ; preds = %18
%27 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %28
28: ; preds = %26, %24, %16, %8
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"echo\00"
@.str.2 = [5 x i8] c"tsmf\00"
@str.3 = [26 x i8] c"usage: simple <echo|tsmf>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.3, i64 0, i64 0))
br label %20
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i64 @strcasecmp(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %6
%12 = tail call i32 (...) @run_echo_test()
br label %20
13: ; preds = %6
%14 = tail call i64 @strcasecmp(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = tail call i32 (...) @run_tsmf_test()
br label %20
18: ; preds = %13
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.3, i64 0, i64 0))
br label %20
20: ; preds = %18, %16, %11, %4
%21 = phi i32 [ 1, %4 ], [ %12, %11 ], [ %17, %16 ], [ 1, %18 ]
ret i32 %21
}