#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 getW(char *c) {
  int ret = 8;
  Uppercase(c);
  if (strncmp(c, "B", 1) == 0 || strncmp(c, "BAL", 3) == 0 ||
      strncmp(c, "BALLS", 5) == 0) {
    ret = 8;
  } else if (strncmp(c, "O", 1) == 0 || strncmp(c, "OLS", 3) == 0) {
    ret = 9;
  } else if (strncmp(c, "N", 1) == 0 || strncmp(c, "NONE", 4) == 0) {
    ret = 0;
  }
  return ret;
}


x86 assembly (clang, -O0):
<getW>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x8,-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     1199 <getW+0x79>
mov    -0x8(%rbp),%rdi
lea    0xe9c(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     1199 <getW+0x79>
mov    -0x8(%rbp),%rdi
lea    0xe81(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11a5 <getW+0x85>
movl   $0x8,-0xc(%rbp)
jmp    123e <getW+0x11e>
mov    -0x8(%rbp),%rdi
lea    0xe5c(%rip),%rsi
mov    $0x1,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     11e3 <getW+0xc3>
mov    -0x8(%rbp),%rdi
lea    0xe3f(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11ef <getW+0xcf>
movl   $0x9,-0xc(%rbp)
jmp    1239 <getW+0x119>
mov    -0x8(%rbp),%rdi
lea    0xe18(%rip),%rsi
mov    $0x1,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     122d <getW+0x10d>
mov    -0x8(%rbp),%rdi
lea    0xdfb(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1234 <getW+0x114>
movl   $0x0,-0xc(%rbp)
jmp    1239 <getW+0x119>
jmp    123e <getW+0x11e>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getW>:
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>
mov    $0x8,%ebp
test   %rax,%rax
je     11f3 <getW+0xd3>
lea    0xeae(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11f3 <getW+0xd3>
lea    0xe95(%rip),%rsi
mov    %rbx,%rdi
mov    $0x5,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11f3 <getW+0xd3>
lea    0xe82(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1030 <strncmp@plt>
mov    $0x9,%ebp
test   %rax,%rax
je     11f3 <getW+0xd3>
lea    0xe66(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11f3 <getW+0xd3>
lea    0xe51(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11f1 <getW+0xd1>
lea    0xe3a(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1030 <strncmp@plt>
mov    $0x8,%ebp
test   %rax,%rax
jne    11f3 <getW+0xd3>
xor    %ebp,%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"BALLS\00"
@.str.3 = [2 x i8] c"O\00"
@.str.4 = [4 x i8] c"OLS\00"
@.str.5 = [2 x i8] c"N\00"
@.str.6 = [5 x i8] c"NONE\00"
define i32 @getW(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 8, 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 %17, 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 %17, 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 %17, label %18
17: ; preds = %13, %9, %1
store i32 8, i32* %3
br label %38
18: ; preds = %13
%19 = load i8*, i8** %2
%20 = call i64 @strncmp(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 1)
%21 = icmp eq i64 %20, 0
br i1 %21, label %26, label %22
22: ; preds = %18
%23 = load i8*, i8** %2
%24 = call i64 @strncmp(i8* %23, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 3)
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %22, %18
store i32 9, i32* %3
br label %37
27: ; preds = %22
%28 = load i8*, i8** %2
%29 = call i64 @strncmp(i8* %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i32 1)
%30 = icmp eq i64 %29, 0
br i1 %30, label %35, label %31
31: ; preds = %27
%32 = load i8*, i8** %2
%33 = call i64 @strncmp(i8* %32, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 4)
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %36
35: ; preds = %31, %27
store i32 0, i32* %3
br label %36
36: ; preds = %35, %31
br label %37
37: ; preds = %36, %26
br label %38
38: ; preds = %37, %17
%39 = load i32, i32* %3
ret i32 %39
}

LLVM IR (-O2):
@.str = [2 x i8] c"B\00"
@.str.1 = [4 x i8] c"BAL\00"
@.str.2 = [6 x i8] c"BALLS\00"
@.str.3 = [2 x i8] c"O\00"
@.str.4 = [4 x i8] c"OLS\00"
@.str.5 = [2 x i8] c"N\00"
@.str.6 = [5 x i8] c"NONE\00"
define i32 @getW(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 %24, 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 %24, 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 %24, label %11
11: ; preds = %8
%12 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 1)
%13 = icmp eq i64 %12, 0
br i1 %13, label %24, label %14
14: ; preds = %11
%15 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 3)
%16 = icmp eq i64 %15, 0
br i1 %16, label %24, 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 %23, label %20
20: ; preds = %17
%21 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 4)
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %20, %17
br label %24
24: ; preds = %11, %14, %1, %5, %8, %23, %20
%25 = phi i32 [ 0, %23 ], [ 8, %20 ], [ 8, %8 ], [ 8, %5 ], [ 8, %1 ], [ 9, %14 ], [ 9, %11 ]
ret i32 %25
}