#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 */
char *strstr(char *, char *);
int check_command(char *p) {
  if (strstr(p, "help") == p || strstr(p, "?") == p)
    return 0;
  if (strstr(p, "fmount") == p)
    return 1;
  if (strstr(p, "fumount") == p)
    return 2;
  if (strstr(p, "structure") == p)
    return 3;
  if (strstr(p, "traverse") == p)
    return 4;
  if (strstr(p, "showfat") == p)
    return 5;
  if (strstr(p, "showsector") == p)
    return 6;
  if (strstr(p, "showfile") == p)
    return 7;
  if (strstr(p, "exit") == p || strstr(p, "quit") == p)
    return 8;
  return -1;
}


x86 assembly (clang, -O0):
<check_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strstr@plt>
cmp    -0x10(%rbp),%rax
je     1150 <check_command+0x40>
mov    -0x10(%rbp),%rdi
lea    0xec4(%rip),%rsi
call   1030 <strstr@plt>
cmp    -0x10(%rbp),%rax
jne    115c <check_command+0x4c>
movl   $0x0,-0x4(%rbp)
jmp    12ad <check_command+0x19d>
mov    -0x10(%rbp),%rdi
lea    0xea0(%rip),%rsi
call   1030 <strstr@plt>
cmp    -0x10(%rbp),%rax
jne    1182 <check_command+0x72>
movl   $0x1,-0x4(%rbp)
jmp    12ad <check_command+0x19d>
mov    -0x10(%rbp),%rdi
lea    0xe81(%rip),%rsi
call   1030 <strstr@plt>
cmp    -0x10(%rbp),%rax
jne    11a8 <check_command+0x98>
movl   $0x2,-0x4(%rbp)
jmp    12ad <check_command+0x19d>
mov    -0x10(%rbp),%rdi
lea    0xe63(%rip),%rsi
call   1030 <strstr@plt>
cmp    -0x10(%rbp),%rax
jne    11ce <check_command+0xbe>
movl   $0x3,-0x4(%rbp)
jmp    12ad <check_command+0x19d>
mov    -0x10(%rbp),%rdi
lea    0xe47(%rip),%rsi
call   1030 <strstr@plt>
cmp    -0x10(%rbp),%rax
jne    11f4 <check_command+0xe4>
movl   $0x4,-0x4(%rbp)
jmp    12ad <check_command+0x19d>
mov    -0x10(%rbp),%rdi
lea    0xe2a(%rip),%rsi
call   1030 <strstr@plt>
cmp    -0x10(%rbp),%rax
jne    121a <check_command+0x10a>
movl   $0x5,-0x4(%rbp)
jmp    12ad <check_command+0x19d>
mov    -0x10(%rbp),%rdi
lea    0xe0c(%rip),%rsi
call   1030 <strstr@plt>
cmp    -0x10(%rbp),%rax
jne    1240 <check_command+0x130>
movl   $0x6,-0x4(%rbp)
jmp    12ad <check_command+0x19d>
mov    -0x10(%rbp),%rdi
lea    0xdf1(%rip),%rsi
call   1030 <strstr@plt>
cmp    -0x10(%rbp),%rax
jne    1266 <check_command+0x156>
movl   $0x7,-0x4(%rbp)
jmp    12ad <check_command+0x19d>
mov    -0x10(%rbp),%rdi
lea    0xdd4(%rip),%rsi
call   1030 <strstr@plt>
cmp    -0x10(%rbp),%rax
je     129a <check_command+0x18a>
mov    -0x10(%rbp),%rdi
lea    0xdbf(%rip),%rsi
call   1030 <strstr@plt>
cmp    -0x10(%rbp),%rax
jne    12a6 <check_command+0x196>
movl   $0x8,-0x4(%rbp)
jmp    12ad <check_command+0x19d>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_command>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
je     1132 <check_command+0x22>
cmpb   $0x3f,(%rbx)
jne    1134 <check_command+0x24>
pop    %rbx
ret
lea    0xeca(%rip),%rsi
mov    $0x6,%edx
mov    %rbx,%rdi
call   1030 <strncmp@plt>
test   %eax,%eax
je     1225 <check_command+0x115>
lea    0xeb5(%rip),%rsi
mov    $0x7,%edx
mov    %rbx,%rdi
call   1030 <strncmp@plt>
test   %eax,%eax
je     122c <check_command+0x11c>
lea    0xea1(%rip),%rsi
mov    $0x9,%edx
mov    %rbx,%rdi
call   1030 <strncmp@plt>
test   %eax,%eax
je     1233 <check_command+0x123>
lea    0xe8f(%rip),%rsi
mov    $0x8,%edx
mov    %rbx,%rdi
call   1030 <strncmp@plt>
test   %eax,%eax
je     123a <check_command+0x12a>
lea    0xe7c(%rip),%rsi
mov    $0x7,%edx
mov    %rbx,%rdi
call   1030 <strncmp@plt>
test   %eax,%eax
je     1241 <check_command+0x131>
lea    0xe68(%rip),%rsi
mov    $0xa,%edx
mov    %rbx,%rdi
call   1030 <strncmp@plt>
test   %eax,%eax
je     1248 <check_command+0x138>
lea    0xe5b(%rip),%rsi
mov    $0x8,%edx
mov    %rbx,%rdi
call   1030 <strncmp@plt>
test   %eax,%eax
je     124f <check_command+0x13f>
lea    0xe4c(%rip),%rsi
mov    $0x4,%edx
mov    %rbx,%rdi
call   1030 <strncmp@plt>
test   %eax,%eax
je     1256 <check_command+0x146>
lea    0xe39(%rip),%rsi
mov    $0x4,%edx
mov    %rbx,%rdi
call   1030 <strncmp@plt>
neg    %eax
sbb    %eax,%eax
or     $0x8,%eax
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret
mov    $0x2,%eax
pop    %rbx
ret
mov    $0x3,%eax
pop    %rbx
ret
mov    $0x4,%eax
pop    %rbx
ret
mov    $0x5,%eax
pop    %rbx
ret
mov    $0x6,%eax
pop    %rbx
ret
mov    $0x7,%eax
pop    %rbx
ret
mov    $0x8,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"help\00"
@.str.1 = [2 x i8] c"?\00"
@.str.2 = [7 x i8] c"fmount\00"
@.str.3 = [8 x i8] c"fumount\00"
@.str.4 = [10 x i8] c"structure\00"
@.str.5 = [9 x i8] c"traverse\00"
@.str.6 = [8 x i8] c"showfat\00"
@.str.7 = [11 x i8] c"showsector\00"
@.str.8 = [9 x i8] c"showfile\00"
@.str.9 = [5 x i8] c"exit\00"
@.str.10 = [5 x i8] c"quit\00"
define i32 @check_command(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i8* @strstr(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = load i8*, i8** %3
%7 = icmp eq i8* %5, %6
br i1 %7, label %13, label %8
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i8* @strstr(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = load i8*, i8** %3
%12 = icmp eq i8* %10, %11
br i1 %12, label %13, label %14
13: ; preds = %8, %1
store i32 0, i32* %2
br label %68
14: ; preds = %8
%15 = load i8*, i8** %3
%16 = call i8* @strstr(i8* %15, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%17 = load i8*, i8** %3
%18 = icmp eq i8* %16, %17
br i1 %18, label %19, label %20
19: ; preds = %14
store i32 1, i32* %2
br label %68
20: ; preds = %14
%21 = load i8*, i8** %3
%22 = call i8* @strstr(i8* %21, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%23 = load i8*, i8** %3
%24 = icmp eq i8* %22, %23
br i1 %24, label %25, label %26
25: ; preds = %20
store i32 2, i32* %2
br label %68
26: ; preds = %20
%27 = load i8*, i8** %3
%28 = call i8* @strstr(i8* %27, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%29 = load i8*, i8** %3
%30 = icmp eq i8* %28, %29
br i1 %30, label %31, label %32
31: ; preds = %26
store i32 3, i32* %2
br label %68
32: ; preds = %26
%33 = load i8*, i8** %3
%34 = call i8* @strstr(i8* %33, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%35 = load i8*, i8** %3
%36 = icmp eq i8* %34, %35
br i1 %36, label %37, label %38
37: ; preds = %32
store i32 4, i32* %2
br label %68
38: ; preds = %32
%39 = load i8*, i8** %3
%40 = call i8* @strstr(i8* %39, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%41 = load i8*, i8** %3
%42 = icmp eq i8* %40, %41
br i1 %42, label %43, label %44
43: ; preds = %38
store i32 5, i32* %2
br label %68
44: ; preds = %38
%45 = load i8*, i8** %3
%46 = call i8* @strstr(i8* %45, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
%47 = load i8*, i8** %3
%48 = icmp eq i8* %46, %47
br i1 %48, label %49, label %50
49: ; preds = %44
store i32 6, i32* %2
br label %68
50: ; preds = %44
%51 = load i8*, i8** %3
%52 = call i8* @strstr(i8* %51, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%53 = load i8*, i8** %3
%54 = icmp eq i8* %52, %53
br i1 %54, label %55, label %56
55: ; preds = %50
store i32 7, i32* %2
br label %68
56: ; preds = %50
%57 = load i8*, i8** %3
%58 = call i8* @strstr(i8* %57, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%59 = load i8*, i8** %3
%60 = icmp eq i8* %58, %59
br i1 %60, label %66, label %61
61: ; preds = %56
%62 = load i8*, i8** %3
%63 = call i8* @strstr(i8* %62, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
%64 = load i8*, i8** %3
%65 = icmp eq i8* %63, %64
br i1 %65, label %66, label %67
66: ; preds = %61, %56
store i32 8, i32* %2
br label %68
67: ; preds = %61
store i32 -1, i32* %2
br label %68
68: ; preds = %67, %66, %55, %49, %43, %37, %31, %25, %19, %13
%69 = load i32, i32* %2
ret i32 %69
}

LLVM IR (-O2):
@.str = [5 x i8] c"help\00"
@.str.2 = [7 x i8] c"fmount\00"
@.str.3 = [8 x i8] c"fumount\00"
@.str.4 = [10 x i8] c"structure\00"
@.str.5 = [9 x i8] c"traverse\00"
@.str.6 = [8 x i8] c"showfat\00"
@.str.7 = [11 x i8] c"showsector\00"
@.str.8 = [9 x i8] c"showfile\00"
@.str.9 = [5 x i8] c"exit\00"
@.str.10 = [5 x i8] c"quit\00"
define i32 @check_command(i8* nocapture %0) {
%2 = tail call i32 @strncmp(i8* dereferenceable(1) %0, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 4)
%3 = icmp eq i32 %2, 0
br i1 %3, label %35, label %4
4: ; preds = %1
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 63
br i1 %6, label %35, label %7
7: ; preds = %4
%8 = tail call i32 @strncmp(i8* %0, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i64 6)
%9 = icmp eq i32 %8, 0
br i1 %9, label %35, label %10
10: ; preds = %7
%11 = tail call i32 @strncmp(i8* %0, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i64 7)
%12 = icmp eq i32 %11, 0
br i1 %12, label %35, label %13
13: ; preds = %10
%14 = tail call i32 @strncmp(i8* %0, i8* dereferenceable(10) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i64 9)
%15 = icmp eq i32 %14, 0
br i1 %15, label %35, label %16
16: ; preds = %13
%17 = tail call i32 @strncmp(i8* %0, i8* dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i64 8)
%18 = icmp eq i32 %17, 0
br i1 %18, label %35, label %19
19: ; preds = %16
%20 = tail call i32 @strncmp(i8* %0, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i64 7)
%21 = icmp eq i32 %20, 0
br i1 %21, label %35, label %22
22: ; preds = %19
%23 = tail call i32 @strncmp(i8* %0, i8* dereferenceable(11) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i64 10)
%24 = icmp eq i32 %23, 0
br i1 %24, label %35, label %25
25: ; preds = %22
%26 = tail call i32 @strncmp(i8* %0, i8* dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i64 8)
%27 = icmp eq i32 %26, 0
br i1 %27, label %35, label %28
28: ; preds = %25
%29 = tail call i32 @strncmp(i8* %0, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i64 4)
%30 = icmp eq i32 %29, 0
br i1 %30, label %35, label %31
31: ; preds = %28
%32 = tail call i32 @strncmp(i8* %0, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i64 4)
%33 = icmp eq i32 %32, 0
%34 = select i1 %33, i32 8, i32 -1
br label %35
35: ; preds = %31, %28, %25, %22, %19, %16, %13, %10, %7, %1, %4
%36 = phi i32 [ 0, %4 ], [ 0, %1 ], [ 1, %7 ], [ 2, %10 ], [ 3, %13 ], [ 4, %16 ], [ 5, %19 ], [ 6, %22 ], [ 7, %25 ], [ 8, %28 ], [ %34, %31 ]
ret i32 %36
}