#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 argtonum(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printhelp();
int /*<<< orphan*/ printhelp_game();
int /*<<< orphan*/ printhelp_term();
int /*<<< orphan*/ strcmp(char *, char *);
int cmd_help(const char *name, char *arg) {
  if (arg) {
    if (!strcmp(arg, "game")) {
      printhelp_game();
      exit(0);
    }
    if (!strcmp(arg, "term")) {
      printhelp_term();
      exit(0);
    }
    if (*name == 'h' && !name[1] && argtonum(arg) > -1)
      return 0;
  }
  printhelp();
  exit(0);
}


x86 assembly (clang, -O0):
<cmd_help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1206 <cmd_help+0xa6>
mov    -0x10(%rbp),%rdi
lea    0xe7a(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11a2 <cmd_help+0x42>
mov    $0x0,%al
call   1030 <printhelp_game@plt>
xor    %edi,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rdi
lea    0xe58(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11c9 <cmd_help+0x69>
mov    $0x0,%al
call   1080 <printhelp_term@plt>
xor    %edi,%edi
call   1060 <exit@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x68,%eax
jne    1201 <cmd_help+0xa1>
mov    -0x8(%rbp),%rax
cmpb   $0x0,0x1(%rax)
jne    1201 <cmd_help+0xa1>
mov    -0x10(%rbp),%rdi
call   1050 <argtonum@plt>
cmp    $0xffffffff,%eax
jle    1201 <cmd_help+0xa1>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret
jmp    1206 <cmd_help+0xa6>
mov    $0x0,%al
call   1070 <printhelp@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<cmd_help>:
push   %r14
push   %rbx
push   %rax
test   %rsi,%rsi
je     11b8 <cmd_help+0x58>
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xe8a(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11c6 <cmd_help+0x66>
lea    0xe7c(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11d4 <cmd_help+0x74>
cmpb   $0x68,(%r14)
jne    11b8 <cmd_help+0x58>
cmpb   $0x0,0x1(%r14)
jne    11b8 <cmd_help+0x58>
mov    %rbx,%rdi
call   1050 <argtonum@plt>
test   %eax,%eax
js     11b8 <cmd_help+0x58>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
xor    %eax,%eax
call   1070 <printhelp@plt>
xor    %edi,%edi
call   1060 <exit@plt>
xor    %eax,%eax
call   1030 <printhelp_game@plt>
xor    %edi,%edi
call   1060 <exit@plt>
xor    %eax,%eax
call   1080 <printhelp_term@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"game\00"
@.str.1 = [5 x i8] c"term\00"
define i32 @cmd_help(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %37
7: ; preds = %2
%8 = load i8*, i8** %4
%9 = call i32 @strcmp(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%10 = icmp ne i32 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %7
%12 = call i32 (...) @printhelp_game()
%13 = call i32 @exit(i32 0)
unreachable
14: ; preds = %7
%15 = load i8*, i8** %4
%16 = call i32 @strcmp(i8* %15, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp ne i32 %16, 0
br i1 %17, label %21, label %18
18: ; preds = %14
%19 = call i32 (...) @printhelp_term()
%20 = call i32 @exit(i32 0)
unreachable
21: ; preds = %14
%22 = load i8*, i8** %3
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 104
br i1 %25, label %26, label %36
26: ; preds = %21
%27 = load i8*, i8** %3
%28 = getelementptr inbounds i8, i8* %27, i64 1
%29 = load i8, i8* %28
%30 = icmp ne i8 %29, 0
br i1 %30, label %36, label %31
31: ; preds = %26
%32 = load i8*, i8** %4
%33 = call i32 @argtonum(i8* %32)
%34 = icmp sgt i32 %33, -1
br i1 %34, label %35, label %36
35: ; preds = %31
ret i32 0
36: ; preds = %31, %26, %21
br label %37
37: ; preds = %36, %2
%38 = call i32 (...) @printhelp()
%39 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [5 x i8] c"game\00"
@.str.1 = [5 x i8] c"term\00"
define i32 @cmd_help(i8* nocapture %0, i8* %1) {
%3 = icmp eq i8* %1, null
br i1 %3, label %27, label %4
4: ; preds = %2
%5 = tail call i32 @strcmp(i8* %1, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %4
%8 = tail call i32 (...) @printhelp_game()
%9 = tail call i32 @exit(i32 0)
unreachable
10: ; preds = %4
%11 = tail call i32 @strcmp(i8* %1, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = tail call i32 (...) @printhelp_term()
%15 = tail call i32 @exit(i32 0)
unreachable
16: ; preds = %10
%17 = load i8, i8* %0
%18 = icmp eq i8 %17, 104
br i1 %18, label %19, label %27
19: ; preds = %16
%20 = getelementptr inbounds i8, i8* %0, i64 1
%21 = load i8, i8* %20
%22 = icmp eq i8 %21, 0
br i1 %22, label %23, label %27
23: ; preds = %19
%24 = tail call i32 @argtonum(i8* %1)
%25 = icmp sgt i32 %24, -1
br i1 %25, label %26, label %27
26: ; preds = %23
ret i32 0
27: ; preds = %16, %19, %23, %2
%28 = tail call i32 (...) @printhelp()
%29 = tail call i32 @exit(i32 0)
unreachable
}