#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 process_internal_command(char *cmd) {
  if (strstr(cmd, "exit") == cmd || strstr(cmd, "quit") == cmd) {
    return 1;
  }
  if (strstr(cmd, "clear") == cmd || strstr(cmd, "cls") == cmd) {
    return 2;
  }
  if (strstr(cmd, "path") == cmd) {
    return 3;
  }
  if (strstr(cmd, "cd") == cmd) {
    return 4;
  }
  if (strstr(cmd, "fmount") == cmd) {
    return 5;
  }
  if (strstr(cmd, "fumount") == cmd) {
    return 6;
  }
  return 0;
}


x86 assembly (clang, -O0):
<process_internal_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 <process_internal_command+0x40>
mov    -0x10(%rbp),%rdi
lea    0xec4(%rip),%rsi
call   1030 <strstr@plt>
cmp    -0x10(%rbp),%rax
jne    115c <process_internal_command+0x4c>
movl   $0x1,-0x4(%rbp)
jmp    123b <process_internal_command+0x12b>
mov    -0x10(%rbp),%rdi
lea    0xea3(%rip),%rsi
call   1030 <strstr@plt>
cmp    -0x10(%rbp),%rax
je     1190 <process_internal_command+0x80>
mov    -0x10(%rbp),%rdi
lea    0xe8f(%rip),%rsi
call   1030 <strstr@plt>
cmp    -0x10(%rbp),%rax
jne    119c <process_internal_command+0x8c>
movl   $0x2,-0x4(%rbp)
jmp    123b <process_internal_command+0x12b>
mov    -0x10(%rbp),%rdi
lea    0xe6d(%rip),%rsi
call   1030 <strstr@plt>
cmp    -0x10(%rbp),%rax
jne    11c2 <process_internal_command+0xb2>
movl   $0x3,-0x4(%rbp)
jmp    123b <process_internal_command+0x12b>
mov    -0x10(%rbp),%rdi
lea    0xe4c(%rip),%rsi
call   1030 <strstr@plt>
cmp    -0x10(%rbp),%rax
jne    11e8 <process_internal_command+0xd8>
movl   $0x4,-0x4(%rbp)
jmp    123b <process_internal_command+0x12b>
mov    -0x10(%rbp),%rdi
lea    0xe29(%rip),%rsi
call   1030 <strstr@plt>
cmp    -0x10(%rbp),%rax
jne    120e <process_internal_command+0xfe>
movl   $0x5,-0x4(%rbp)
jmp    123b <process_internal_command+0x12b>
mov    -0x10(%rbp),%rdi
lea    0xe0a(%rip),%rsi
call   1030 <strstr@plt>
cmp    -0x10(%rbp),%rax
jne    1234 <process_internal_command+0x124>
movl   $0x6,-0x4(%rbp)
jmp    123b <process_internal_command+0x12b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_internal_command>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xee3(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
mov    $0x1,%ebp
test   %eax,%eax
je     1206 <process_internal_command+0xf6>
lea    0xeca(%rip),%rsi
mov    $0x4,%edx
mov    %rbx,%rdi
call   1030 <strncmp@plt>
test   %eax,%eax
je     1206 <process_internal_command+0xf6>
lea    0xeb3(%rip),%rsi
mov    $0x5,%edx
mov    %rbx,%rdi
call   1030 <strncmp@plt>
mov    $0x2,%ebp
test   %eax,%eax
je     1206 <process_internal_command+0xf6>
lea    0xe98(%rip),%rsi
mov    $0x3,%edx
mov    %rbx,%rdi
call   1030 <strncmp@plt>
test   %eax,%eax
je     1206 <process_internal_command+0xf6>
lea    0xe84(%rip),%rsi
mov    $0x4,%edx
mov    %rbx,%rdi
call   1030 <strncmp@plt>
test   %eax,%eax
je     11f3 <process_internal_command+0xe3>
lea    0xe71(%rip),%rsi
mov    $0x2,%edx
mov    %rbx,%rdi
call   1030 <strncmp@plt>
test   %eax,%eax
je     11fa <process_internal_command+0xea>
lea    0xe5c(%rip),%rsi
mov    $0x6,%edx
mov    %rbx,%rdi
call   1030 <strncmp@plt>
test   %eax,%eax
je     1201 <process_internal_command+0xf1>
lea    0xe4b(%rip),%rsi
mov    $0x7,%edx
mov    %rbx,%rdi
call   1030 <strncmp@plt>
xor    %ecx,%ecx
test   %eax,%eax
mov    $0x6,%ebp
cmovne %ecx,%ebp
jmp    1206 <process_internal_command+0xf6>
mov    $0x3,%ebp
jmp    1206 <process_internal_command+0xf6>
mov    $0x4,%ebp
jmp    1206 <process_internal_command+0xf6>
mov    $0x5,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"exit\00"
@.str.1 = [5 x i8] c"quit\00"
@.str.2 = [6 x i8] c"clear\00"
@.str.3 = [4 x i8] c"cls\00"
@.str.4 = [5 x i8] c"path\00"
@.str.5 = [3 x i8] c"cd\00"
@.str.6 = [7 x i8] c"fmount\00"
@.str.7 = [8 x i8] c"fumount\00"
define i32 @process_internal_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 ([5 x i8], [5 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 1, i32* %2
br label %50
14: ; preds = %8
%15 = load i8*, i8** %3
%16 = call i8* @strstr(i8* %15, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%17 = load i8*, i8** %3
%18 = icmp eq i8* %16, %17
br i1 %18, label %24, label %19
19: ; preds = %14
%20 = load i8*, i8** %3
%21 = call i8* @strstr(i8* %20, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%22 = load i8*, i8** %3
%23 = icmp eq i8* %21, %22
br i1 %23, label %24, label %25
24: ; preds = %19, %14
store i32 2, i32* %2
br label %50
25: ; preds = %19
%26 = load i8*, i8** %3
%27 = call i8* @strstr(i8* %26, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%28 = load i8*, i8** %3
%29 = icmp eq i8* %27, %28
br i1 %29, label %30, label %31
30: ; preds = %25
store i32 3, i32* %2
br label %50
31: ; preds = %25
%32 = load i8*, i8** %3
%33 = call i8* @strstr(i8* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%34 = load i8*, i8** %3
%35 = icmp eq i8* %33, %34
br i1 %35, label %36, label %37
36: ; preds = %31
store i32 4, i32* %2
br label %50
37: ; preds = %31
%38 = load i8*, i8** %3
%39 = call i8* @strstr(i8* %38, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%40 = load i8*, i8** %3
%41 = icmp eq i8* %39, %40
br i1 %41, label %42, label %43
42: ; preds = %37
store i32 5, i32* %2
br label %50
43: ; preds = %37
%44 = load i8*, i8** %3
%45 = call i8* @strstr(i8* %44, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%46 = load i8*, i8** %3
%47 = icmp eq i8* %45, %46
br i1 %47, label %48, label %49
48: ; preds = %43
store i32 6, i32* %2
br label %50
49: ; preds = %43
store i32 0, i32* %2
br label %50
50: ; preds = %49, %48, %42, %36, %30, %24, %13
%51 = load i32, i32* %2
ret i32 %51
}

LLVM IR (-O2):
@.str = [5 x i8] c"exit\00"
@.str.1 = [5 x i8] c"quit\00"
@.str.2 = [6 x i8] c"clear\00"
@.str.3 = [4 x i8] c"cls\00"
@.str.4 = [5 x i8] c"path\00"
@.str.5 = [3 x i8] c"cd\00"
@.str.6 = [7 x i8] c"fmount\00"
@.str.7 = [8 x i8] c"fumount\00"
define i32 @process_internal_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 %26, label %4
4: ; preds = %1
%5 = tail call i32 @strncmp(i8* dereferenceable(1) %0, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 4)
%6 = icmp eq i32 %5, 0
br i1 %6, label %26, label %7
7: ; preds = %4
%8 = tail call i32 @strncmp(i8* dereferenceable(1) %0, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i64 5)
%9 = icmp eq i32 %8, 0
br i1 %9, label %26, label %10
10: ; preds = %7
%11 = tail call i32 @strncmp(i8* dereferenceable(1) %0, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i64 3)
%12 = icmp eq i32 %11, 0
br i1 %12, label %26, label %13
13: ; preds = %10
%14 = tail call i32 @strncmp(i8* dereferenceable(1) %0, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i64 4)
%15 = icmp eq i32 %14, 0
br i1 %15, label %26, label %16
16: ; preds = %13
%17 = tail call i32 @strncmp(i8* dereferenceable(1) %0, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i64 2)
%18 = icmp eq i32 %17, 0
br i1 %18, label %26, label %19
19: ; preds = %16
%20 = tail call i32 @strncmp(i8* dereferenceable(1) %0, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i64 6)
%21 = icmp eq i32 %20, 0
br i1 %21, label %26, label %22
22: ; preds = %19
%23 = tail call i32 @strncmp(i8* dereferenceable(1) %0, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i64 7)
%24 = icmp eq i32 %23, 0
%25 = select i1 %24, i32 6, i32 0
br label %26
26: ; preds = %22, %19, %16, %13, %7, %10, %1, %4
%27 = phi i32 [ 1, %4 ], [ 1, %1 ], [ 2, %10 ], [ 2, %7 ], [ 3, %13 ], [ 4, %16 ], [ 5, %19 ], [ %25, %22 ]
ret i32 %27
}