#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*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ print_help_commands();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdin;
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strip_newline_of_help(char *, int);
void print_help() {
  char helpOp[50];
  printf("gbsh - General Help\n");
  printf("-------------------\n");
  printf("Commands Help: commands\n");
  printf("-------------------\n");
  printf(">> ");
  fgets(helpOp, 50, stdin);
  strip_newline_of_help(helpOp, 50);
  if (strcmp(helpOp, "commands") == 0) {
    print_help_commands();
  } else {
    return;
  }
}


x86 assembly (clang, -O0):
<print_help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
lea    -0x40(%rbp),%rdi
mov    0x2e49(%rip),%rax
mov    (%rax),%edx
mov    $0x32,%esi
call   1040 <fgets@plt>
lea    -0x40(%rbp),%rdi
mov    $0x32,%esi
call   1070 <strip_newline_of_help@plt>
lea    -0x40(%rbp),%rdi
lea    0xe83(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11df <print_help+0x8f>
mov    $0x0,%al
call   1060 <print_help_commands@plt>
jmp    11e4 <print_help+0x94>
jmp    11e4 <print_help+0x94>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_help>:
push   %rbx
sub    $0x40,%rsp
lea    0xe98(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb8(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe91(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe65(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e41(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x32,%esi
call   1050 <fgets@plt>
mov    %rbx,%rdi
mov    $0x32,%esi
call   1080 <strip_newline_of_help@plt>
lea    0xe5a(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    11e1 <print_help+0x81>
xor    %eax,%eax
call   1070 <print_help_commands@plt>
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"gbsh - General Help\0A\00"
@.str.1 = [21 x i8] c"-------------------\0A\00"
@.str.2 = [25 x i8] c"Commands Help: commands\0A\00"
@.str.3 = [4 x i8] c">> \00"
@stdin = global i32 0
@.str.4 = [9 x i8] c"commands\00"
define void @print_help() {
%1 = alloca [50 x i8]
%2 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%7 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%8 = load i32, i32* @stdin
%9 = call i32 @fgets(i8* %7, i32 50, i32 %8)
%10 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%11 = call i32 @strip_newline_of_help(i8* %10, i32 50)
%12 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%13 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %0
%16 = call i32 (...) @print_help_commands()
br label %18
17: ; preds = %0
br label %18
18: ; preds = %17, %15
ret void
}

LLVM IR (-O2):
@.str.3 = [4 x i8] c">> \00"
@stdin = global i32 0
@.str.4 = [9 x i8] c"commands\00"
@str = [20 x i8] c"gbsh - General Help\00"
@str.6 = [24 x i8] c"Commands Help: commands\00"
@str.7 = [20 x i8] c"-------------------\00"
define void @print_help() {
%1 = alloca [50 x i8]
%2 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.7, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.6, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.7, i64 0, i64 0))
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%8 = load i32, i32* @stdin
%9 = call i32 @fgets(i8* %2, i32 50, i32 %8)
%10 = call i32 @strip_newline_of_help(i8* %2, i32 50)
%11 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %0
%14 = call i32 (...) @print_help_commands()
br label %15
15: ; preds = %0, %13
ret void
}