#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 */
char **malloc(int);
int /*<<< orphan*/ printFF(char *, char **, int /*<<< orphan*/);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ strcmp(char *, char *);
void man(char *buffer) {
  char **s = malloc(sizeof(char *));
  char *man;
  if (!strcmp("help", buffer)) {
    man = "HELP\n use this comand to see all the comands";
  } else if (!strcmp("clear", buffer)) {
    man = "CLEAR\n clear the video use by the shell";
  } else if (!strcmp("echo", buffer)) {
    man = "ECHO\n Use \"echo on\" to turn on the echo and \"echo off\" to turn "
          "it off  ";
  } else if (!strcmp("ls", buffer)) {
    man = "LS\n display all modules";
  } else {
    man = "invalid command for man";
  }
  s[0] = man;
  printFF("%s", s, 0);
  putchar('\n');
}


x86 assembly (clang, -O0):
<man>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x8,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xe9b(%rip),%rdi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1183 <man+0x43>
lea    0xe8b(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    1218 <man+0xd8>
mov    -0x8(%rbp),%rsi
lea    0xea4(%rip),%rdi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11ac <man+0x6c>
lea    0xe95(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    1213 <man+0xd3>
mov    -0x8(%rbp),%rsi
lea    0xea9(%rip),%rdi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11d5 <man+0x95>
lea    0xe99(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    120e <man+0xce>
mov    -0x8(%rbp),%rsi
lea    0xecd(%rip),%rdi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11fe <man+0xbe>
lea    0xebb(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    1209 <man+0xc9>
lea    0xec3(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    120e <man+0xce>
jmp    1213 <man+0xd3>
jmp    1218 <man+0xd8>
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rsi
lea    0xeb2(%rip),%rdi
xor    %edx,%edx
call   1040 <printFF@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<man>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x8,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
lea    0xea5(%rip),%rdi
mov    %rbx,%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
je     11b2 <man+0x72>
lea    0xec4(%rip),%rdi
mov    %rbx,%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
je     11bb <man+0x7b>
lea    0xedf(%rip),%rdi
mov    %rbx,%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
je     11c4 <man+0x84>
lea    0xf19(%rip),%rdi
mov    %rbx,%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
lea    0xf0b(%rip),%rcx
lea    0xf1c(%rip),%rax
cmove  %rcx,%rax
jmp    11cb <man+0x8b>
lea    0xe4c(%rip),%rax
jmp    11cb <man+0x8b>
lea    0xe76(%rip),%rax
jmp    11cb <man+0x8b>
lea    0xe9a(%rip),%rax
mov    %rax,(%r14)
lea    0xf0b(%rip),%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   1040 <printFF@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"help\00"
@.str.1 = [45 x i8] c"HELP\0A use this comand to see all the comands\00"
@.str.2 = [6 x i8] c"clear\00"
@.str.3 = [40 x i8] c"CLEAR\0A clear the video use by the shell\00"
@.str.4 = [5 x i8] c"echo\00"
@.str.5 = [72 x i8] c"ECHO\0A Use \22echo on\22 to turn on the echo and \22echo off\22 to turn it off \00"
@.str.6 = [3 x i8] c"ls\00"
@.str.7 = [24 x i8] c"LS\0A display all modules\00"
@.str.8 = [24 x i8] c"invalid command for man\00"
@.str.9 = [3 x i8] c"%s\00"
define void @man(i8* %0) {
%2 = alloca i8*
%3 = alloca i8**
%4 = alloca i8*
store i8* %0, i8** %2
%5 = call i8** @malloc(i32 8)
store i8** %5, i8*** %3
%6 = load i8*, i8** %2
%7 = call i32 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = icmp ne i32 %7, 0
br i1 %8, label %10, label %9
9: ; preds = %1
store i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i8** %4
br label %29
10: ; preds = %1
%11 = load i8*, i8** %2
%12 = call i32 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %11)
%13 = icmp ne i32 %12, 0
br i1 %13, label %15, label %14
14: ; preds = %10
store i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i8** %4
br label %28
15: ; preds = %10
%16 = load i8*, i8** %2
%17 = call i32 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* %16)
%18 = icmp ne i32 %17, 0
br i1 %18, label %20, label %19
19: ; preds = %15
store i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.5, i64 0, i64 0), i8** %4
br label %27
20: ; preds = %15
%21 = load i8*, i8** %2
%22 = call i32 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %21)
%23 = icmp ne i32 %22, 0
br i1 %23, label %25, label %24
24: ; preds = %20
store i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), i8** %4
br label %26
25: ; preds = %20
store i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0), i8** %4
br label %26
26: ; preds = %25, %24
br label %27
27: ; preds = %26, %19
br label %28
28: ; preds = %27, %14
br label %29
29: ; preds = %28, %9
%30 = load i8*, i8** %4
%31 = load i8**, i8*** %3
%32 = getelementptr inbounds i8*, i8** %31, i64 0
store i8* %30, i8** %32
%33 = load i8**, i8*** %3
%34 = call i32 @printFF(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8** %33, i32 0)
%35 = call i32 @putchar(i8 signext 10)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"help\00"
@.str.1 = [45 x i8] c"HELP\0A use this comand to see all the comands\00"
@.str.2 = [6 x i8] c"clear\00"
@.str.3 = [40 x i8] c"CLEAR\0A clear the video use by the shell\00"
@.str.4 = [5 x i8] c"echo\00"
@.str.5 = [72 x i8] c"ECHO\0A Use \22echo on\22 to turn on the echo and \22echo off\22 to turn it off \00"
@.str.6 = [3 x i8] c"ls\00"
@.str.7 = [24 x i8] c"LS\0A display all modules\00"
@.str.8 = [24 x i8] c"invalid command for man\00"
@.str.9 = [3 x i8] c"%s\00"
define void @man(i8* nocapture %0) {
%2 = tail call i8** @malloc(i32 8)
%3 = tail call i32 @strcmp(i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* dereferenceable(1) %0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %1
%6 = tail call i32 @strcmp(i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* dereferenceable(1) %0)
%7 = icmp eq i32 %6, 0
br i1 %7, label %15, label %8
8: ; preds = %5
%9 = tail call i32 @strcmp(i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* dereferenceable(1) %0)
%10 = icmp eq i32 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %8
%12 = tail call i32 @strcmp(i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* dereferenceable(1) %0)
%13 = icmp eq i32 %12, 0
%14 = select i1 %13, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0)
br label %15
15: ; preds = %11, %8, %5, %1
%16 = phi i8* [ getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), %1 ], [ getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), %5 ], [ getelementptr inbounds ([72 x i8], [72 x i8]* @.str.5, i64 0, i64 0), %8 ], [ %14, %11 ]
store i8* %16, i8** %2
%17 = tail call i32 @printFF(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8** %2, i32 0)
%18 = tail call i32 @putchar(i8 signext 10)
ret void
}