#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 *);
scalar_t__ strncmp(char *, char *, int);
int getN(char *c) {
  int ret = 3;
  Uppercase(c);
  if (strncmp(c, "B", 1) == 0 || strncmp(c, "BAL", 3) == 0 ||
      strncmp(c, "BALME", 5) == 0 || strncmp(c, "NNIBALME", 8) == 0 ||
      strncmp(c, "NNI_BALME", 9) == 0) {
    ret = 3;
  } else if (strncmp(c, "O", 1) == 0 || strncmp(c, "OLS", 3) == 0 ||
             strncmp(c, "OLSME", 5) == 0 || strncmp(c, "NNIOLSME", 8) == 0 ||
             strncmp(c, "NNI_OLSME", 9) == 0) {
    ret = 4;
  }
  return ret;
}


x86 assembly (clang, -O0):
<getN>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x3,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <Uppercase@plt>
mov    -0x8(%rbp),%rdi
lea    0xeb9(%rip),%rsi
mov    $0x1,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     11d7 <getN+0xb7>
mov    -0x8(%rbp),%rdi
lea    0xe9c(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     11d7 <getN+0xb7>
mov    -0x8(%rbp),%rdi
lea    0xe84(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     11d7 <getN+0xb7>
mov    -0x8(%rbp),%rdi
lea    0xe62(%rip),%rsi
mov    $0x8,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     11d7 <getN+0xb7>
mov    -0x8(%rbp),%rdi
lea    0xe4c(%rip),%rsi
mov    $0x9,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11e3 <getN+0xc3>
movl   $0x3,-0xc(%rbp)
jmp    128a <getN+0x16a>
mov    -0x8(%rbp),%rdi
lea    0xe2b(%rip),%rsi
mov    $0x1,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     127e <getN+0x15e>
mov    -0x8(%rbp),%rdi
lea    0xe0e(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     127e <getN+0x15e>
mov    -0x8(%rbp),%rdi
lea    0xdf6(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     127e <getN+0x15e>
mov    -0x8(%rbp),%rdi
lea    0xdd4(%rip),%rsi
mov    $0x8,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     127e <getN+0x15e>
mov    -0x8(%rbp),%rdi
lea    0xdbe(%rip),%rsi
mov    $0x9,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1285 <getN+0x165>
movl   $0x4,-0xc(%rbp)
jmp    128a <getN+0x16a>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getN>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <Uppercase@plt>
lea    0xece(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     124a <getN+0x12a>
lea    0xeb3(%rip),%rsi
mov    $0x3,%ebp
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     124f <getN+0x12f>
lea    0xe98(%rip),%rsi
mov    %rbx,%rdi
mov    $0x5,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     124f <getN+0x12f>
lea    0xe78(%rip),%rsi
mov    %rbx,%rdi
mov    $0x8,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     124f <getN+0x12f>
lea    0xe64(%rip),%rsi
mov    %rbx,%rdi
mov    $0x9,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     124f <getN+0x12f>
lea    0xe51(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1243 <getN+0x123>
lea    0xe3a(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1243 <getN+0x123>
lea    0xe28(%rip),%rsi
mov    %rbx,%rdi
mov    $0x5,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1243 <getN+0x123>
lea    0xe0c(%rip),%rsi
mov    %rbx,%rdi
mov    $0x8,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1243 <getN+0x123>
lea    0xdfc(%rip),%rsi
mov    %rbx,%rdi
mov    $0x9,%edx
call   1030 <strncmp@plt>
mov    $0x3,%ebp
test   %rax,%rax
jne    124f <getN+0x12f>
mov    $0x4,%ebp
jmp    124f <getN+0x12f>
mov    $0x3,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"B\00"
@.str.1 = [4 x i8] c"BAL\00"
@.str.2 = [6 x i8] c"BALME\00"
@.str.3 = [9 x i8] c"NNIBALME\00"
@.str.4 = [10 x i8] c"NNI_BALME\00"
@.str.5 = [2 x i8] c"O\00"
@.str.6 = [4 x i8] c"OLS\00"
@.str.7 = [6 x i8] c"OLSME\00"
@.str.8 = [9 x i8] c"NNIOLSME\00"
@.str.9 = [10 x i8] c"NNI_OLSME\00"
define i32 @getN(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 3, i32* %3
%4 = load i8*, i8** %2
%5 = call i32 @Uppercase(i8* %4)
%6 = load i8*, i8** %2
%7 = call i64 @strncmp(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%8 = icmp eq i64 %7, 0
br i1 %8, label %25, label %9
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = call i64 @strncmp(i8* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%12 = icmp eq i64 %11, 0
br i1 %12, label %25, label %13
13: ; preds = %9
%14 = load i8*, i8** %2
%15 = call i64 @strncmp(i8* %14, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 5)
%16 = icmp eq i64 %15, 0
br i1 %16, label %25, label %17
17: ; preds = %13
%18 = load i8*, i8** %2
%19 = call i64 @strncmp(i8* %18, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 8)
%20 = icmp eq i64 %19, 0
br i1 %20, label %25, label %21
21: ; preds = %17
%22 = load i8*, i8** %2
%23 = call i64 @strncmp(i8* %22, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 9)
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %21, %17, %13, %9, %1
store i32 3, i32* %3
br label %48
26: ; preds = %21
%27 = load i8*, i8** %2
%28 = call i64 @strncmp(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i32 1)
%29 = icmp eq i64 %28, 0
br i1 %29, label %46, label %30
30: ; preds = %26
%31 = load i8*, i8** %2
%32 = call i64 @strncmp(i8* %31, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 3)
%33 = icmp eq i64 %32, 0
br i1 %33, label %46, label %34
34: ; preds = %30
%35 = load i8*, i8** %2
%36 = call i64 @strncmp(i8* %35, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 5)
%37 = icmp eq i64 %36, 0
br i1 %37, label %46, label %38
38: ; preds = %34
%39 = load i8*, i8** %2
%40 = call i64 @strncmp(i8* %39, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i32 8)
%41 = icmp eq i64 %40, 0
br i1 %41, label %46, label %42
42: ; preds = %38
%43 = load i8*, i8** %2
%44 = call i64 @strncmp(i8* %43, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i32 9)
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %47
46: ; preds = %42, %38, %34, %30, %26
store i32 4, i32* %3
br label %47
47: ; preds = %46, %42
br label %48
48: ; preds = %47, %25
%49 = load i32, i32* %3
ret i32 %49
}

LLVM IR (-O2):
@.str = [2 x i8] c"B\00"
@.str.1 = [4 x i8] c"BAL\00"
@.str.2 = [6 x i8] c"BALME\00"
@.str.3 = [9 x i8] c"NNIBALME\00"
@.str.4 = [10 x i8] c"NNI_BALME\00"
@.str.5 = [2 x i8] c"O\00"
@.str.6 = [4 x i8] c"OLS\00"
@.str.7 = [6 x i8] c"OLSME\00"
@.str.8 = [9 x i8] c"NNIOLSME\00"
@.str.9 = [10 x i8] c"NNI_OLSME\00"
define i32 @getN(i8* %0) {
%2 = tail call i32 @Uppercase(i8* %0)
%3 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %33, label %5
5: ; preds = %1
%6 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%7 = icmp eq i64 %6, 0
br i1 %7, label %33, label %8
8: ; preds = %5
%9 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 5)
%10 = icmp eq i64 %9, 0
br i1 %10, label %33, label %11
11: ; preds = %8
%12 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 8)
%13 = icmp eq i64 %12, 0
br i1 %13, label %33, label %14
14: ; preds = %11
%15 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 9)
%16 = icmp eq i64 %15, 0
br i1 %16, label %33, label %17
17: ; preds = %14
%18 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i32 1)
%19 = icmp eq i64 %18, 0
br i1 %19, label %32, label %20
20: ; preds = %17
%21 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 3)
%22 = icmp eq i64 %21, 0
br i1 %22, label %32, label %23
23: ; preds = %20
%24 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 5)
%25 = icmp eq i64 %24, 0
br i1 %25, label %32, label %26
26: ; preds = %23
%27 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i32 8)
%28 = icmp eq i64 %27, 0
br i1 %28, label %32, label %29
29: ; preds = %26
%30 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i32 9)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %33
32: ; preds = %29, %26, %23, %20, %17
br label %33
33: ; preds = %1, %5, %8, %11, %14, %29, %32
%34 = phi i32 [ 4, %32 ], [ 3, %29 ], [ 3, %14 ], [ 3, %11 ], [ 3, %8 ], [ 3, %5 ], [ 3, %1 ]
ret i32 %34
}