#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__ strcasecmp(char const *, char *);
int cmd_is_help_option(const char *arg) {
  if (arg[0] == '-') {
    arg++;
  }
  if (arg[0] == '-') {
    arg++;
  }
  if ((strcasecmp(arg, "?") == 0) || (strcasecmp(arg, "h") == 0) ||
      (strcasecmp(arg, "help") == 0)) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<cmd_is_help_option>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1138 <cmd_is_help_option+0x28>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1154 <cmd_is_help_option+0x44>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xea1(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     11a2 <cmd_is_help_option+0x92>
mov    -0x10(%rbp),%rdi
lea    0xe89(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     11a2 <cmd_is_help_option+0x92>
mov    -0x10(%rbp),%rdi
lea    0xe71(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    11ae <cmd_is_help_option+0x9e>
movl   $0x1,-0x4(%rbp)
jmp    11b5 <cmd_is_help_option+0xa5>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_is_help_option>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
cmpb   $0x2d,(%rdi)
sete   %al
xor    %ebx,%ebx
cmpb   $0x2d,(%rdi,%rax,1)
sete   %bl
add    %rdi,%rbx
add    %rax,%rbx
lea    0xecf(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
mov    $0x1,%ebp
test   %rax,%rax
je     116f <cmd_is_help_option+0x5f>
lea    0xeb8(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     116f <cmd_is_help_option+0x5f>
lea    0xea6(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
xor    %ebp,%ebp
test   %rax,%rax
sete   %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"?\00"
@.str.1 = [2 x i8] c"h\00"
@.str.2 = [5 x i8] c"help\00"
define i32 @cmd_is_help_option(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 45
%4 = zext i1 %3 to i64
%5 = getelementptr i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 45
%8 = zext i1 %7 to i64
%9 = getelementptr i8, i8* %5, i64 %8
%10 = tail call i64 @strcasecmp(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %19, label %12
12: ; preds = %1
%13 = tail call i64 @strcasecmp(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %19, label %15
15: ; preds = %12
%16 = tail call i64 @strcasecmp(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
%18 = zext i1 %17 to i32
br label %19
19: ; preds = %15, %1, %12
%20 = phi i32 [ 1, %12 ], [ 1, %1 ], [ %18, %15 ]
ret i32 %20
}