#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*/ ParseCleanWhiteSpaces(char **);
scalar_t__ strlen(char *);
int ParseCommandType(char **commandLine) {
  char commandType;
  ParseCleanWhiteSpaces(commandLine);
  if (strlen((*commandLine)) == 0) {
    return 4;
  }
  commandType = (*commandLine)[0];
  if (commandType >= 'A' && commandType <= 'Z')
    commandType = 'A';
  switch (commandType) {
  case '?':
    return 2;
  case '#':
    return 3;
  case '+':
    return 1;
  case '-':
    return 1;
  case 'A':
    return 0;
  default:
    return 4;
  }
}


x86 assembly (clang, -O0):
<ParseCommandType>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <ParseCleanWhiteSpaces@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
jne    1157 <ParseCommandType+0x37>
movl   $0x4,-0x4(%rbp)
jmp    11ee <ParseCommandType+0xce>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0x41,%eax
jl     1181 <ParseCommandType+0x61>
movsbl -0x11(%rbp),%eax
cmp    $0x5a,%eax
jg     1181 <ParseCommandType+0x61>
movb   $0x41,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
add    $0xffffffdd,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x1e,%eax
ja     11e7 <ParseCommandType+0xc7>
mov    -0x20(%rbp),%rax
lea    0xe5e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x2,-0x4(%rbp)
jmp    11ee <ParseCommandType+0xce>
movl   $0x3,-0x4(%rbp)
jmp    11ee <ParseCommandType+0xce>
movl   $0x1,-0x4(%rbp)
jmp    11ee <ParseCommandType+0xce>
movl   $0x1,-0x4(%rbp)
jmp    11ee <ParseCommandType+0xce>
movl   $0x0,-0x4(%rbp)
jmp    11ee <ParseCommandType+0xce>
movl   $0x4,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ParseCommandType>:
push   %rbx
mov    %rdi,%rbx
call   1030 <ParseCleanWhiteSpaces@plt>
mov    (%rbx),%rax
mov    (%rax),%cl
mov    $0x4,%eax
test   %cl,%cl
je     116a <ParseCommandType+0x5a>
lea    -0x41(%rcx),%eax
cmp    $0x1a,%al
movzbl %cl,%eax
mov    $0x41,%ecx
cmovae %eax,%ecx
movsbl %cl,%ecx
add    $0xffffffdd,%ecx
cmp    $0x1e,%ecx
ja     1165 <ParseCommandType+0x55>
mov    $0x2,%eax
lea    0xeb2(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0x1,%eax
pop    %rbx
ret
mov    $0x3,%eax
pop    %rbx
ret
mov    $0x4,%eax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @ParseCommandType(i8** %0) {
%2 = alloca i32
%3 = alloca i8**
%4 = alloca i8
store i8** %0, i8*** %3
%5 = load i8**, i8*** %3
%6 = call i32 @ParseCleanWhiteSpaces(i8** %5)
%7 = load i8**, i8*** %3
%8 = load i8*, i8** %7
%9 = call i64 @strlen(i8* %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %1
store i32 4, i32* %2
br label %34
12: ; preds = %1
%13 = load i8**, i8*** %3
%14 = load i8*, i8** %13
%15 = getelementptr inbounds i8, i8* %14, i64 0
%16 = load i8, i8* %15
store i8 %16, i8* %4
%17 = load i8, i8* %4
%18 = sext i8 %17 to i32
%19 = icmp sge i32 %18, 65
br i1 %19, label %20, label %25
20: ; preds = %12
%21 = load i8, i8* %4
%22 = sext i8 %21 to i32
%23 = icmp sle i32 %22, 90
br i1 %23, label %24, label %25
24: ; preds = %20
store i8 65, i8* %4
br label %25
25: ; preds = %24, %20, %12
%26 = load i8, i8* %4
%27 = sext i8 %26 to i32
switch i32 %27, label %33 [
i32 63, label %28
i32 35, label %29
i32 43, label %30
i32 45, label %31
i32 65, label %32
]
28: ; preds = %25
store i32 2, i32* %2
br label %34
29: ; preds = %25
store i32 3, i32* %2
br label %34
30: ; preds = %25
store i32 1, i32* %2
br label %34
31: ; preds = %25
store i32 1, i32* %2
br label %34
32: ; preds = %25
store i32 0, i32* %2
br label %34
33: ; preds = %25
store i32 4, i32* %2
br label %34
34: ; preds = %33, %32, %31, %30, %29, %28, %11
%35 = load i32, i32* %2
ret i32 %35
}

LLVM IR (-O2):
define i32 @ParseCommandType(i8** %0) {
%2 = tail call i32 @ParseCleanWhiteSpaces(i8** %0)
%3 = load i8*, i8** %0
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
br i1 %5, label %16, label %6
6: ; preds = %1
%7 = add i8 %4, -65
%8 = icmp ult i8 %7, 26
%9 = select i1 %8, i8 65, i8 %4
%10 = sext i8 %9 to i32
switch i32 %10, label %15 [
i32 63, label %16
i32 35, label %11
i32 43, label %12
i32 45, label %13
i32 65, label %14
]
11: ; preds = %6
br label %16
12: ; preds = %6
br label %16
13: ; preds = %6
br label %16
14: ; preds = %6
br label %16
15: ; preds = %6
br label %16
16: ; preds = %6, %1, %15, %14, %13, %12, %11
%17 = phi i32 [ 4, %15 ], [ 0, %14 ], [ 1, %13 ], [ 1, %12 ], [ 3, %11 ], [ 4, %1 ], [ 2, %6 ]
ret i32 %17
}