#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 */
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ system(char *);
void help(char **tokens) {
  if (tokens[1] != NULL) {
    if (strcmp(tokens[1], "mem") == 0) {
      system("cat help/mem.txt");
      return;
    } else if (strcmp(tokens[1], "reg") == 0) {
      system("cat help/reg.txt");
      return;
    } else if (strcmp(tokens[1], "search") == 0) {
      system("cat help/search.txt");
      return;
    }
  }
  system("cat help/help.txt");
}


x86 assembly (clang, -O0):
<help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     11d7 <help+0xb7>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xeb6(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    116a <help+0x4a>
lea    0xea4(%rip),%rdi
call   1030 <system@plt>
jmp    11e3 <help+0xc3>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe9c(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1199 <help+0x79>
lea    0xe8a(%rip),%rdi
call   1030 <system@plt>
jmp    11e3 <help+0xc3>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe82(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11c8 <help+0xa8>
lea    0xe73(%rip),%rdi
call   1030 <system@plt>
jmp    11e3 <help+0xc3>
jmp    11cd <help+0xad>
jmp    11d2 <help+0xb2>
jmp    11d7 <help+0xb7>
lea    0xe67(%rip),%rdi
call   1030 <system@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<help>:
push   %rbx
mov    %rdi,%rbx
mov    0x8(%rdi),%rdi
test   %rdi,%rdi
je     1168 <help+0x48>
lea    0xecc(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1175 <help+0x55>
mov    0x8(%rbx),%rdi
lea    0xecc(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1182 <help+0x62>
mov    0x8(%rbx),%rdi
lea    0xecc(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     118f <help+0x6f>
lea    0xed6(%rip),%rdi
pop    %rbx
jmp    1030 <system@plt>
lea    0xe88(%rip),%rdi
pop    %rbx
jmp    1030 <system@plt>
lea    0xe90(%rip),%rdi
pop    %rbx
jmp    1030 <system@plt>
lea    0xe9b(%rip),%rdi
pop    %rbx
jmp    1030 <system@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"mem\00"
@.str.1 = [17 x i8] c"cat help/mem.txt\00"
@.str.2 = [4 x i8] c"reg\00"
@.str.3 = [17 x i8] c"cat help/reg.txt\00"
@.str.4 = [7 x i8] c"search\00"
@.str.5 = [20 x i8] c"cat help/search.txt\00"
@.str.6 = [18 x i8] c"cat help/help.txt\00"
define void @help(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
%4 = getelementptr inbounds i8*, i8** %3, i64 1
%5 = load i8*, i8** %4
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %34
7: ; preds = %1
%8 = load i8**, i8*** %2
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %7
%14 = call i32 @system(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %36
15: ; preds = %7
%16 = load i8**, i8*** %2
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %15
%22 = call i32 @system(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %36
23: ; preds = %15
%24 = load i8**, i8*** %2
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call i64 @strcmp(i8* %26, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %23
%30 = call i32 @system(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
br label %36
31: ; preds = %23
br label %32
32: ; preds = %31
br label %33
33: ; preds = %32
br label %34
34: ; preds = %33, %1
%35 = call i32 @system(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0))
br label %36
36: ; preds = %34, %29, %21, %13
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"mem\00"
@.str.1 = [17 x i8] c"cat help/mem.txt\00"
@.str.2 = [4 x i8] c"reg\00"
@.str.3 = [17 x i8] c"cat help/reg.txt\00"
@.str.4 = [7 x i8] c"search\00"
@.str.5 = [20 x i8] c"cat help/search.txt\00"
@.str.6 = [18 x i8] c"cat help/help.txt\00"
define void @help(i8** nocapture %0) {
%2 = getelementptr inbounds i8*, i8** %0, i64 1
%3 = load i8*, i8** %2
%4 = icmp eq i8* %3, null
br i1 %4, label %16, label %5
5: ; preds = %1
%6 = tail call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %17, label %8
8: ; preds = %5
%9 = load i8*, i8** %2
%10 = tail call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %17, label %12
12: ; preds = %8
%13 = load i8*, i8** %2
%14 = tail call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %17, label %16
16: ; preds = %12, %1
br label %17
17: ; preds = %12, %8, %5, %16
%18 = phi i8* [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), %16 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), %5 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), %8 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), %12 ]
%19 = tail call i32 @system(i8* %18)
ret void
}