#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*/ Uppercase(char *);
int strlen(char *);
int /*<<< orphan*/ strncmp(char *, char *, int);
int getM(char *c) {
  int ret = 1;
  Uppercase(c);
  switch (strlen(c)) {
  case 1:
    if (strncmp(c, "B", 1) == 0)
      ret = 1;
    else if (strncmp(c, "I", 1) == 0)
      ret = 7;
    else if (strncmp(c, "N", 1) == 0)
      ret = 5;
    else if (strncmp(c, "O", 1) == 0)
      ret = 2;
    else if (strncmp(c, "U", 1) == 0)
      ret = 6;
    else if (strncmp(c, "S", 1) == 0)
      ret = 10;
    break;
  case 2:
    if (strncmp(c, "NJ", 2) == 0)
      ret = 5;
    break;
  case 3:
    if (strncmp(c, "BAL", 3) == 0)
      ret = 1;
    else if (strncmp(c, "OLS", 3) == 0)
      ret = 2;
    else if (strncmp(c, "UNJ", 3) == 0)
      ret = 6;
    break;
  case 4:
    if (strncmp(c, "USER", 4) == 0)
      ret = 10;
    break;
  case 5:
    if (strncmp(c, "BALME", 5) == 0)
      ret = 1;
    else if (strncmp(c, "OLSME", 5) == 0)
      ret = 2;
    else if (strncmp(c, "BIONJ", 5) == 0)
      ret = 7;
    break;
  default:
    break;
  }
  return ret;
}


x86 assembly (clang, -O0):
<getM>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <Uppercase@plt>
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x4,%eax
ja     13f4 <getM+0x2c4>
mov    -0x18(%rbp),%rax
lea    0xe8e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%rdi
lea    0xe8e(%rip),%rsi
mov    $0x1,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    11a5 <getM+0x75>
movl   $0x1,-0xc(%rbp)
jmp    128b <getM+0x15b>
mov    -0x8(%rbp),%rdi
lea    0xe66(%rip),%rsi
mov    $0x1,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    11cf <getM+0x9f>
movl   $0x7,-0xc(%rbp)
jmp    1286 <getM+0x156>
mov    -0x8(%rbp),%rdi
lea    0xe3e(%rip),%rsi
mov    $0x1,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    11f9 <getM+0xc9>
movl   $0x5,-0xc(%rbp)
jmp    1281 <getM+0x151>
mov    -0x8(%rbp),%rdi
lea    0xe16(%rip),%rsi
mov    $0x1,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1223 <getM+0xf3>
movl   $0x2,-0xc(%rbp)
jmp    127c <getM+0x14c>
mov    -0x8(%rbp),%rdi
lea    0xdee(%rip),%rsi
mov    $0x1,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    124d <getM+0x11d>
movl   $0x6,-0xc(%rbp)
jmp    1277 <getM+0x147>
mov    -0x8(%rbp),%rdi
lea    0xdcc(%rip),%rsi
mov    $0x1,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1272 <getM+0x142>
movl   $0xa,-0xc(%rbp)
jmp    1277 <getM+0x147>
jmp    127c <getM+0x14c>
jmp    1281 <getM+0x151>
jmp    1286 <getM+0x156>
jmp    128b <getM+0x15b>
jmp    13f9 <getM+0x2c9>
mov    -0x8(%rbp),%rdi
lea    0xda3(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    12b5 <getM+0x185>
movl   $0x5,-0xc(%rbp)
jmp    13f9 <getM+0x2c9>
mov    -0x8(%rbp),%rdi
lea    0xd59(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    12e4 <getM+0x1b4>
movl   $0x1,-0xc(%rbp)
jmp    133d <getM+0x20d>
mov    -0x8(%rbp),%rdi
lea    0xd33(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    130e <getM+0x1de>
movl   $0x2,-0xc(%rbp)
jmp    1338 <getM+0x208>
mov    -0x8(%rbp),%rdi
lea    0xd0d(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1333 <getM+0x203>
movl   $0x6,-0xc(%rbp)
jmp    1338 <getM+0x208>
jmp    133d <getM+0x20d>
jmp    13f9 <getM+0x2c9>
mov    -0x8(%rbp),%rdi
lea    0xcdd(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1367 <getM+0x237>
movl   $0xa,-0xc(%rbp)
jmp    13f9 <getM+0x2c9>
mov    -0x8(%rbp),%rdi
lea    0xcb8(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1396 <getM+0x266>
movl   $0x1,-0xc(%rbp)
jmp    13ef <getM+0x2bf>
mov    -0x8(%rbp),%rdi
lea    0xc94(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    13c0 <getM+0x290>
movl   $0x2,-0xc(%rbp)
jmp    13ea <getM+0x2ba>
mov    -0x8(%rbp),%rdi
lea    0xc70(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    13e5 <getM+0x2b5>
movl   $0x7,-0xc(%rbp)
jmp    13ea <getM+0x2ba>
jmp    13ef <getM+0x2bf>
jmp    13f9 <getM+0x2c9>
jmp    13f9 <getM+0x2c9>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getM>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <Uppercase@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    $0x1,%ebp
add    $0xffffffff,%eax
cmp    $0x4,%eax
ja     1320 <getM+0x1f0>
lea    0xea5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xea9(%rip),%rsi
mov    $0x1,%ebp
mov    %rbx,%rdi
mov    $0x1,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     1320 <getM+0x1f0>
lea    0xe8a(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     130d <getM+0x1dd>
lea    0xe70(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     1314 <getM+0x1e4>
lea    0xe56(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     1306 <getM+0x1d6>
lea    0xe3c(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     131b <getM+0x1eb>
lea    0xe28(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
jmp    129d <getM+0x16d>
lea    0xe2e(%rip),%rsi
mov    %rbx,%rdi
mov    $0x2,%edx
call   1030 <strncmp@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
lea    0x1(,%rcx,4),%ebp
jmp    1320 <getM+0x1f0>
lea    0xde7(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     1320 <getM+0x1f0>
lea    0xdcf(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     1306 <getM+0x1d6>
lea    0xdb7(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
lea    (%rcx,%rcx,4),%ebp
add    $0x1,%ebp
jmp    1320 <getM+0x1f0>
lea    0xd95(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1030 <strncmp@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
lea    (%rcx,%rcx,8),%ebp
add    $0x1,%ebp
jmp    1320 <getM+0x1f0>
lea    0xd77(%rip),%rsi
mov    %rbx,%rdi
mov    $0x5,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     1320 <getM+0x1f0>
lea    0xd65(%rip),%rsi
mov    %rbx,%rdi
mov    $0x5,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     1306 <getM+0x1d6>
lea    0xd53(%rip),%rsi
mov    %rbx,%rdi
mov    $0x5,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
mov    $0x7,%eax
mov    $0x1,%ebp
cmove  %eax,%ebp
jmp    1320 <getM+0x1f0>
mov    $0x2,%ebp
jmp    1320 <getM+0x1f0>
mov    $0x7,%ebp
jmp    1320 <getM+0x1f0>
mov    $0x5,%ebp
jmp    1320 <getM+0x1f0>
mov    $0x6,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"B\00"
@.str.1 = [2 x i8] c"I\00"
@.str.2 = [2 x i8] c"N\00"
@.str.3 = [2 x i8] c"O\00"
@.str.4 = [2 x i8] c"U\00"
@.str.5 = [2 x i8] c"S\00"
@.str.6 = [3 x i8] c"NJ\00"
@.str.7 = [4 x i8] c"BAL\00"
@.str.8 = [4 x i8] c"OLS\00"
@.str.9 = [4 x i8] c"UNJ\00"
@.str.10 = [5 x i8] c"USER\00"
@.str.11 = [6 x i8] c"BALME\00"
@.str.12 = [6 x i8] c"OLSME\00"
@.str.13 = [6 x i8] c"BIONJ\00"
define i32 @getM(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 1, i32* %3
%4 = load i8*, i8** %2
%5 = call i32 @Uppercase(i8* %4)
%6 = load i8*, i8** %2
%7 = call i32 @strlen(i8* %6)
switch i32 %7, label %92 [
i32 1, label %8
i32 2, label %44
i32 3, label %50
i32 4, label %68
i32 5, label %74
]
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = call i32 @strncmp(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8
store i32 1, i32* %3
br label %43
13: ; preds = %8
%14 = load i8*, i8** %2
%15 = call i32 @strncmp(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %13
store i32 7, i32* %3
br label %42
18: ; preds = %13
%19 = load i8*, i8** %2
%20 = call i32 @strncmp(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 1)
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %18
store i32 5, i32* %3
br label %41
23: ; preds = %18
%24 = load i8*, i8** %2
%25 = call i32 @strncmp(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 1)
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %23
store i32 2, i32* %3
br label %40
28: ; preds = %23
%29 = load i8*, i8** %2
%30 = call i32 @strncmp(i8* %29, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32 1)
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %33
32: ; preds = %28
store i32 6, i32* %3
br label %39
33: ; preds = %28
%34 = load i8*, i8** %2
%35 = call i32 @strncmp(i8* %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i32 1)
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %38
37: ; preds = %33
store i32 10, i32* %3
br label %38
38: ; preds = %37, %33
br label %39
39: ; preds = %38, %32
br label %40
40: ; preds = %39, %27
br label %41
41: ; preds = %40, %22
br label %42
42: ; preds = %41, %17
br label %43
43: ; preds = %42, %12
br label %93
44: ; preds = %1
%45 = load i8*, i8** %2
%46 = call i32 @strncmp(i8* %45, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 2)
%47 = icmp eq i32 %46, 0
br i1 %47, label %48, label %49
48: ; preds = %44
store i32 5, i32* %3
br label %49
49: ; preds = %48, %44
br label %93
50: ; preds = %1
%51 = load i8*, i8** %2
%52 = call i32 @strncmp(i8* %51, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 3)
%53 = icmp eq i32 %52, 0
br i1 %53, label %54, label %55
54: ; preds = %50
store i32 1, i32* %3
br label %67
55: ; preds = %50
%56 = load i8*, i8** %2
%57 = call i32 @strncmp(i8* %56, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 3)
%58 = icmp eq i32 %57, 0
br i1 %58, label %59, label %60
59: ; preds = %55
store i32 2, i32* %3
br label %66
60: ; preds = %55
%61 = load i8*, i8** %2
%62 = call i32 @strncmp(i8* %61, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 3)
%63 = icmp eq i32 %62, 0
br i1 %63, label %64, label %65
64: ; preds = %60
store i32 6, i32* %3
br label %65
65: ; preds = %64, %60
br label %66
66: ; preds = %65, %59
br label %67
67: ; preds = %66, %54
br label %93
68: ; preds = %1
%69 = load i8*, i8** %2
%70 = call i32 @strncmp(i8* %69, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i32 4)
%71 = icmp eq i32 %70, 0
br i1 %71, label %72, label %73
72: ; preds = %68
store i32 10, i32* %3
br label %73
73: ; preds = %72, %68
br label %93
74: ; preds = %1
%75 = load i8*, i8** %2
%76 = call i32 @strncmp(i8* %75, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i32 5)
%77 = icmp eq i32 %76, 0
br i1 %77, label %78, label %79
78: ; preds = %74
store i32 1, i32* %3
br label %91
79: ; preds = %74
%80 = load i8*, i8** %2
%81 = call i32 @strncmp(i8* %80, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i32 5)
%82 = icmp eq i32 %81, 0
br i1 %82, label %83, label %84
83: ; preds = %79
store i32 2, i32* %3
br label %90
84: ; preds = %79
%85 = load i8*, i8** %2
%86 = call i32 @strncmp(i8* %85, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0), i32 5)
%87 = icmp eq i32 %86, 0
br i1 %87, label %88, label %89
88: ; preds = %84
store i32 7, i32* %3
br label %89
89: ; preds = %88, %84
br label %90
90: ; preds = %89, %83
br label %91
91: ; preds = %90, %78
br label %93
92: ; preds = %1
br label %93
93: ; preds = %92, %91, %73, %67, %49, %43
%94 = load i32, i32* %3
ret i32 %94
}

LLVM IR (-O2):
@.str = [2 x i8] c"B\00"
@.str.1 = [2 x i8] c"I\00"
@.str.2 = [2 x i8] c"N\00"
@.str.3 = [2 x i8] c"O\00"
@.str.4 = [2 x i8] c"U\00"
@.str.5 = [2 x i8] c"S\00"
@.str.6 = [3 x i8] c"NJ\00"
@.str.7 = [4 x i8] c"BAL\00"
@.str.8 = [4 x i8] c"OLS\00"
@.str.9 = [4 x i8] c"UNJ\00"
@.str.10 = [5 x i8] c"USER\00"
@.str.11 = [6 x i8] c"BALME\00"
@.str.12 = [6 x i8] c"OLSME\00"
@.str.13 = [6 x i8] c"BIONJ\00"
define i32 @getM(i8* %0) {
%2 = tail call i32 @Uppercase(i8* %0)
%3 = tail call i32 @strlen(i8* %0)
switch i32 %3, label %51 [
i32 1, label %4
i32 2, label %23
i32 3, label %27
i32 4, label %37
i32 5, label %41
]
4: ; preds = %1
%5 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%6 = icmp eq i32 %5, 0
br i1 %6, label %51, label %7
7: ; preds = %4
%8 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
%9 = icmp eq i32 %8, 0
br i1 %9, label %51, label %10
10: ; preds = %7
%11 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 1)
%12 = icmp eq i32 %11, 0
br i1 %12, label %51, label %13
13: ; preds = %10
%14 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 1)
%15 = icmp eq i32 %14, 0
br i1 %15, label %51, label %16
16: ; preds = %13
%17 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32 1)
%18 = icmp eq i32 %17, 0
br i1 %18, label %51, label %19
19: ; preds = %16
%20 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i32 1)
%21 = icmp eq i32 %20, 0
%22 = select i1 %21, i32 10, i32 1
br label %51
23: ; preds = %1
%24 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 2)
%25 = icmp eq i32 %24, 0
%26 = select i1 %25, i32 5, i32 1
br label %51
27: ; preds = %1
%28 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 3)
%29 = icmp eq i32 %28, 0
br i1 %29, label %51, label %30
30: ; preds = %27
%31 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 3)
%32 = icmp eq i32 %31, 0
br i1 %32, label %51, label %33
33: ; preds = %30
%34 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 3)
%35 = icmp eq i32 %34, 0
%36 = select i1 %35, i32 6, i32 1
br label %51
37: ; preds = %1
%38 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i32 4)
%39 = icmp eq i32 %38, 0
%40 = select i1 %39, i32 10, i32 1
br label %51
41: ; preds = %1
%42 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i32 5)
%43 = icmp eq i32 %42, 0
br i1 %43, label %51, label %44
44: ; preds = %41
%45 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i32 5)
%46 = icmp eq i32 %45, 0
br i1 %46, label %51, label %47
47: ; preds = %44
%48 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0), i32 5)
%49 = icmp eq i32 %48, 0
%50 = select i1 %49, i32 7, i32 1
br label %51
51: ; preds = %47, %37, %33, %23, %19, %44, %41, %30, %27, %16, %13, %10, %7, %4, %1
%52 = phi i32 [ 1, %1 ], [ 1, %4 ], [ 7, %7 ], [ 5, %10 ], [ 2, %13 ], [ 6, %16 ], [ %22, %19 ], [ %26, %23 ], [ 1, %27 ], [ 2, %30 ], [ %36, %33 ], [ %40, %37 ], [ 1, %41 ], [ 2, %44 ], [ %50, %47 ]
ret i32 %52
}