#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 /*<<< orphan*/ strcmp(char *, char *);
int help(char *buf) {
  if (!strcmp(buf, "help\n") || !strcmp(buf, "h\n")) {
    printf("exit :       exit emulator\n"
           "showregs:    display current contents of registers\n"
           "step [n]:    execute n operations\n"
           "continue:    execute forever\n"
           "setb [n]:    set a breakpoint for address n\n"
           "showmem [n]: display contents of memory address n\n"
           "disasm [n]:  disassemble instruction at address n \n");
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
je     115e <help+0x3e>
mov    -0x10(%rbp),%rdi
lea    0xeb6(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1176 <help+0x56>
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    117d <help+0x5d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<help>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
je     114d <help+0x2d>
lea    0xecb(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
je     114d <help+0x2d>
pop    %rbx
ret
lea    0xeb5(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"help\0A\00"
@.str.1 = [3 x i8] c"h\0A\00"
@.str.2 = [287 x i8] c"exit : exit emulator\0Ashowregs: display current contents of registers\0Astep [n]: execute n operations\0Acontinue: execute forever\0Asetb [n]: set a breakpoint for address n\0Ashowmem [n]: display contents of memory address n\0Adisasm [n]: disassemble instruction at address n \0A\00"
define i32 @help(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32 @strcmp(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = call i32 @strcmp(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp ne i32 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %7, %1
%12 = call i32 @printf(i8* getelementptr inbounds ([287 x i8], [287 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %2
br label %14
13: ; preds = %7
store i32 0, i32* %2
br label %14
14: ; preds = %13, %11
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
@.str = [6 x i8] c"help\0A\00"
@.str.1 = [3 x i8] c"h\0A\00"
@str = [286 x i8] c"exit : exit emulator\0Ashowregs: display current contents of registers\0Astep [n]: execute n operations\0Acontinue: execute forever\0Asetb [n]: set a breakpoint for address n\0Ashowmem [n]: display contents of memory address n\0Adisasm [n]: disassemble instruction at address n \00"
define i32 @help(i8* nocapture %0) {
%2 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %4, %1
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([286 x i8], [286 x i8]* @str, i64 0, i64 0))
br label %9
9: ; preds = %4, %7
%10 = phi i32 [ 1, %7 ], [ 0, %4 ]
ret i32 %10
}