#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*/ strcmp(char const *, char const *);
int CheckOptArg(const char *arg, const char opt) {
  int state = 0;
  switch (opt) {
  case '1':
    state =
        (!strcmp(arg, (const char *)"-m") || !strcmp(arg, (const char *)"-o") ||
         !strcmp(arg, (const char *)"-r") || !strcmp(arg, (const char *)"-h") ||
         !strcmp(arg, (const char *)"-s") || !strcmp(arg, (const char *)"-g"));
    break;
  case '2':
    state =
        (!strcmp(arg, (const char *)"-m") || !strcmp(arg, (const char *)"-o") ||
         !strcmp(arg, (const char *)"-r") || !strcmp(arg, (const char *)"-h") ||
         !strcmp(arg, (const char *)"-s"));
    break;
  case '3':
    state =
        (!strcmp(arg, (const char *)"-m") || !strcmp(arg, (const char *)"-r") ||
         !strcmp(arg, (const char *)"-s"));
    break;
  case '4':
    state = (!strcmp(arg, (const char *)"-o"));
    break;
  case '5':
    state = (!strcmp(arg, (const char *)"-h"));
    break;
  case '6':
    state = (!strcmp(arg, (const char *)"-g"));
    break;
  }
  return state;
}


x86 assembly (clang, -O0):
<CheckOptArg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movl   $0x0,-0x10(%rbp)
movsbl -0x9(%rbp),%eax
add    $0xffffffcf,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x5,%eax
ja     139e <CheckOptArg+0x28e>
mov    -0x18(%rbp),%rax
lea    0xeb6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%rdi
lea    0xeba(%rip),%rsi
call   1030 <strcmp@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x19(%rbp)
je     120e <CheckOptArg+0xfe>
mov    -0x8(%rbp),%rdi
lea    0xe9d(%rip),%rsi
call   1030 <strcmp@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x19(%rbp)
je     120e <CheckOptArg+0xfe>
mov    -0x8(%rbp),%rdi
lea    0xe80(%rip),%rsi
call   1030 <strcmp@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x19(%rbp)
je     120e <CheckOptArg+0xfe>
mov    -0x8(%rbp),%rdi
lea    0xe63(%rip),%rsi
call   1030 <strcmp@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x19(%rbp)
je     120e <CheckOptArg+0xfe>
mov    -0x8(%rbp),%rdi
lea    0xe46(%rip),%rsi
call   1030 <strcmp@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x19(%rbp)
je     120e <CheckOptArg+0xfe>
mov    -0x8(%rbp),%rdi
lea    0xe29(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x10(%rbp)
jmp    139e <CheckOptArg+0x28e>
mov    -0x8(%rbp),%rdi
lea    0xdef(%rip),%rsi
call   1030 <strcmp@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x1a(%rbp)
je     12b9 <CheckOptArg+0x1a9>
mov    -0x8(%rbp),%rdi
lea    0xdd2(%rip),%rsi
call   1030 <strcmp@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x1a(%rbp)
je     12b9 <CheckOptArg+0x1a9>
mov    -0x8(%rbp),%rdi
lea    0xdb5(%rip),%rsi
call   1030 <strcmp@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x1a(%rbp)
je     12b9 <CheckOptArg+0x1a9>
mov    -0x8(%rbp),%rdi
lea    0xd98(%rip),%rsi
call   1030 <strcmp@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x1a(%rbp)
je     12b9 <CheckOptArg+0x1a9>
mov    -0x8(%rbp),%rdi
lea    0xd7b(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x10(%rbp)
jmp    139e <CheckOptArg+0x28e>
mov    -0x8(%rbp),%rdi
lea    0xd44(%rip),%rsi
call   1030 <strcmp@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x1b(%rbp)
je     1324 <CheckOptArg+0x214>
mov    -0x8(%rbp),%rdi
lea    0xd2a(%rip),%rsi
call   1030 <strcmp@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x1b(%rbp)
je     1324 <CheckOptArg+0x214>
mov    -0x8(%rbp),%rdi
lea    0xd10(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x1b(%rbp)
mov    -0x1b(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x10(%rbp)
jmp    139e <CheckOptArg+0x28e>
mov    -0x8(%rbp),%rdi
lea    0xcdc(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x10(%rbp)
jmp    139e <CheckOptArg+0x28e>
mov    -0x8(%rbp),%rdi
lea    0xcbd(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x10(%rbp)
jmp    139e <CheckOptArg+0x28e>
mov    -0x8(%rbp),%rdi
lea    0xc9e(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CheckOptArg>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%eax
add    $0xffffffcf,%eax
cmp    $0x5,%eax
ja     11bf <CheckOptArg+0xaf>
mov    %rdi,%rbx
lea    0xef0(%rip),%rsi
lea    0xece(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xed6(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    $0x1,%ebp
test   %eax,%eax
je     1258 <CheckOptArg+0x148>
lea    0xebd(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1258 <CheckOptArg+0x148>
lea    0xea9(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1258 <CheckOptArg+0x148>
lea    0xe95(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1258 <CheckOptArg+0x148>
lea    0xe81(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1258 <CheckOptArg+0x148>
lea    0xe6d(%rip),%rsi
jmp    1248 <CheckOptArg+0x138>
xor    %ebp,%ebp
jmp    1258 <CheckOptArg+0x148>
lea    0xe4b(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    $0x1,%ebp
test   %eax,%eax
je     1258 <CheckOptArg+0x148>
lea    0xe36(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1258 <CheckOptArg+0x148>
lea    0xe26(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1258 <CheckOptArg+0x148>
lea    0xe16(%rip),%rsi
jmp    122c <CheckOptArg+0x11c>
lea    0xe04(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    $0x1,%ebp
test   %eax,%eax
je     1258 <CheckOptArg+0x148>
lea    0xdf2(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1258 <CheckOptArg+0x148>
lea    0xde5(%rip),%rsi
jmp    1248 <CheckOptArg+0x138>
lea    0xdd9(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
xor    %ebp,%ebp
test   %eax,%eax
sete   %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"-m\00"
@.str.1 = [3 x i8] c"-o\00"
@.str.2 = [3 x i8] c"-r\00"
@.str.3 = [3 x i8] c"-h\00"
@.str.4 = [3 x i8] c"-s\00"
@.str.5 = [3 x i8] c"-g\00"
define i32 @CheckOptArg(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
%5 = alloca i32
store i8* %0, i8** %3
store i8 %1, i8* %4
store i32 0, i32* %5
%6 = load i8, i8* %4
%7 = sext i8 %6 to i32
switch i32 %7, label %94 [
i32 49, label %8
i32 50, label %36
i32 51, label %60
i32 52, label %76
i32 53, label %82
i32 54, label %88
]
8: ; preds = %2
%9 = load i8*, i8** %3
%10 = call i32 @strcmp(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %33
12: ; preds = %8
%13 = load i8*, i8** %3
%14 = call i32 @strcmp(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %33
16: ; preds = %12
%17 = load i8*, i8** %3
%18 = call i32 @strcmp(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %33
20: ; preds = %16
%21 = load i8*, i8** %3
%22 = call i32 @strcmp(i8* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %33
24: ; preds = %20
%25 = load i8*, i8** %3
%26 = call i32 @strcmp(i8* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %33
28: ; preds = %24
%29 = load i8*, i8** %3
%30 = call i32 @strcmp(i8* %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%31 = icmp ne i32 %30, 0
%32 = xor i1 %31, true
br label %33
33: ; preds = %28, %24, %20, %16, %12, %8
%34 = phi i1 [ true, %24 ], [ true, %20 ], [ true, %16 ], [ true, %12 ], [ true, %8 ], [ %32, %28 ]
%35 = zext i1 %34 to i32
store i32 %35, i32* %5
br label %94
36: ; preds = %2
%37 = load i8*, i8** %3
%38 = call i32 @strcmp(i8* %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %57
40: ; preds = %36
%41 = load i8*, i8** %3
%42 = call i32 @strcmp(i8* %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %57
44: ; preds = %40
%45 = load i8*, i8** %3
%46 = call i32 @strcmp(i8* %45, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%47 = icmp ne i32 %46, 0
br i1 %47, label %48, label %57
48: ; preds = %44
%49 = load i8*, i8** %3
%50 = call i32 @strcmp(i8* %49, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%51 = icmp ne i32 %50, 0
br i1 %51, label %52, label %57
52: ; preds = %48
%53 = load i8*, i8** %3
%54 = call i32 @strcmp(i8* %53, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%55 = icmp ne i32 %54, 0
%56 = xor i1 %55, true
br label %57
57: ; preds = %52, %48, %44, %40, %36
%58 = phi i1 [ true, %48 ], [ true, %44 ], [ true, %40 ], [ true, %36 ], [ %56, %52 ]
%59 = zext i1 %58 to i32
store i32 %59, i32* %5
br label %94
60: ; preds = %2
%61 = load i8*, i8** %3
%62 = call i32 @strcmp(i8* %61, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%63 = icmp ne i32 %62, 0
br i1 %63, label %64, label %73
64: ; preds = %60
%65 = load i8*, i8** %3
%66 = call i32 @strcmp(i8* %65, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%67 = icmp ne i32 %66, 0
br i1 %67, label %68, label %73
68: ; preds = %64
%69 = load i8*, i8** %3
%70 = call i32 @strcmp(i8* %69, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%71 = icmp ne i32 %70, 0
%72 = xor i1 %71, true
br label %73
73: ; preds = %68, %64, %60
%74 = phi i1 [ true, %64 ], [ true, %60 ], [ %72, %68 ]
%75 = zext i1 %74 to i32
store i32 %75, i32* %5
br label %94
76: ; preds = %2
%77 = load i8*, i8** %3
%78 = call i32 @strcmp(i8* %77, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%79 = icmp ne i32 %78, 0
%80 = xor i1 %79, true
%81 = zext i1 %80 to i32
store i32 %81, i32* %5
br label %94
82: ; preds = %2
%83 = load i8*, i8** %3
%84 = call i32 @strcmp(i8* %83, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%85 = icmp ne i32 %84, 0
%86 = xor i1 %85, true
%87 = zext i1 %86 to i32
store i32 %87, i32* %5
br label %94
88: ; preds = %2
%89 = load i8*, i8** %3
%90 = call i32 @strcmp(i8* %89, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%91 = icmp ne i32 %90, 0
%92 = xor i1 %91, true
%93 = zext i1 %92 to i32
store i32 %93, i32* %5
br label %94
94: ; preds = %2, %88, %82, %76, %73, %57, %33
%95 = load i32, i32* %5
ret i32 %95
}

LLVM IR (-O2):
@.str = [3 x i8] c"-m\00"
@.str.1 = [3 x i8] c"-o\00"
@.str.2 = [3 x i8] c"-r\00"
@.str.3 = [3 x i8] c"-h\00"
@.str.4 = [3 x i8] c"-s\00"
@.str.5 = [3 x i8] c"-g\00"
define i32 @CheckOptArg(i8* nocapture %0, i8 signext %1) {
%3 = sext i8 %1 to i32
switch i32 %3, label %44 [
i32 49, label %4
i32 50, label %19
i32 51, label %31
i32 52, label %39
i32 53, label %37
i32 54, label %38
]
4: ; preds = %2
%5 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i32 %5, 0
br i1 %6, label %44, label %7
7: ; preds = %4
%8 = 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))
%9 = icmp eq i32 %8, 0
br i1 %9, label %44, label %10
10: ; preds = %7
%11 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp eq i32 %11, 0
br i1 %12, label %44, label %13
13: ; preds = %10
%14 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%15 = icmp eq i32 %14, 0
br i1 %15, label %44, label %16
16: ; preds = %13
%17 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%18 = icmp eq i32 %17, 0
br i1 %18, label %44, label %39
19: ; preds = %2
%20 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%21 = icmp eq i32 %20, 0
br i1 %21, label %44, label %22
22: ; preds = %19
%23 = 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))
%24 = icmp eq i32 %23, 0
br i1 %24, label %44, label %25
25: ; preds = %22
%26 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%27 = icmp eq i32 %26, 0
br i1 %27, label %44, label %28
28: ; preds = %25
%29 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%30 = icmp eq i32 %29, 0
br i1 %30, label %44, label %39
31: ; preds = %2
%32 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%33 = icmp eq i32 %32, 0
br i1 %33, label %44, label %34
34: ; preds = %31
%35 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%36 = icmp eq i32 %35, 0
br i1 %36, label %44, label %39
37: ; preds = %2
br label %39
38: ; preds = %2
br label %39
39: ; preds = %2, %34, %28, %16, %37, %38
%40 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), %38 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), %37 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), %16 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), %28 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), %34 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %2 ]
%41 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(3) %40)
%42 = icmp eq i32 %41, 0
%43 = zext i1 %42 to i32
br label %44
44: ; preds = %39, %31, %34, %19, %22, %25, %28, %4, %7, %10, %13, %16, %2
%45 = phi i32 [ 0, %2 ], [ 1, %16 ], [ 1, %13 ], [ 1, %10 ], [ 1, %7 ], [ 1, %4 ], [ 1, %28 ], [ 1, %25 ], [ 1, %22 ], [ 1, %19 ], [ 1, %34 ], [ 1, %31 ], [ %43, %39 ]
ret i32 %45
}