#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 getI(char *c) {
  int ret = 21;
  Uppercase(c);
  if (strncmp(c, "M", 1) == 0 || strncmp(c, "MATRIX", 6) == 0) {
    ret = 21;
  } else if (strncmp(c, "D", 1) == 0 || strncmp(c, "DNA", 3) == 0) {
    ret = 22;
  } else if (strncmp(c, "P", 1) == 0 || strncmp(c, "PROTEIN", 7) == 0) {
    ret = 23;
  }
  return ret;
}


x86 assembly (clang, -O0):
<getI>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x15,-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     117a <getI+0x5a>
mov    -0x8(%rbp),%rdi
lea    0xe9c(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1186 <getI+0x66>
movl   $0x15,-0xc(%rbp)
jmp    121f <getI+0xff>
mov    -0x8(%rbp),%rdi
lea    0xe78(%rip),%rsi
mov    $0x1,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     11c4 <getI+0xa4>
mov    -0x8(%rbp),%rdi
lea    0xe5b(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11d0 <getI+0xb0>
movl   $0x16,-0xc(%rbp)
jmp    121a <getI+0xfa>
mov    -0x8(%rbp),%rdi
lea    0xe34(%rip),%rsi
mov    $0x1,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     120e <getI+0xee>
mov    -0x8(%rbp),%rdi
lea    0xe17(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1215 <getI+0xf5>
movl   $0x17,-0xc(%rbp)
jmp    121a <getI+0xfa>
jmp    121f <getI+0xff>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getI>:
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    $0x15,%ebp
test   %rax,%rax
je     11d9 <getI+0xb9>
lea    0xeae(%rip),%rsi
mov    %rbx,%rdi
mov    $0x6,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11d9 <getI+0xb9>
lea    0xe9c(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1030 <strncmp@plt>
mov    $0x16,%ebp
test   %rax,%rax
je     11d9 <getI+0xb9>
lea    0xe80(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11d9 <getI+0xb9>
lea    0xe6b(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11d4 <getI+0xb4>
lea    0xe54(%rip),%rsi
mov    %rbx,%rdi
mov    $0x7,%edx
call   1030 <strncmp@plt>
mov    $0x15,%ebp
test   %rax,%rax
jne    11d9 <getI+0xb9>
mov    $0x17,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"M\00"
@.str.1 = [7 x i8] c"MATRIX\00"
@.str.2 = [2 x i8] c"D\00"
@.str.3 = [4 x i8] c"DNA\00"
@.str.4 = [2 x i8] c"P\00"
@.str.5 = [8 x i8] c"PROTEIN\00"
define i32 @getI(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 21, 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 %13, label %9
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = call i64 @strncmp(i8* %10, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 6)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %9, %1
store i32 21, i32* %3
br label %34
14: ; preds = %9
%15 = load i8*, i8** %2
%16 = call i64 @strncmp(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 1)
%17 = icmp eq i64 %16, 0
br i1 %17, label %22, label %18
18: ; preds = %14
%19 = load i8*, i8** %2
%20 = call i64 @strncmp(i8* %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 3)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %18, %14
store i32 22, i32* %3
br label %33
23: ; preds = %18
%24 = load i8*, i8** %2
%25 = call i64 @strncmp(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32 1)
%26 = icmp eq i64 %25, 0
br i1 %26, label %31, label %27
27: ; preds = %23
%28 = load i8*, i8** %2
%29 = call i64 @strncmp(i8* %28, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i32 7)
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %32
31: ; preds = %27, %23
store i32 23, i32* %3
br label %32
32: ; preds = %31, %27
br label %33
33: ; preds = %32, %22
br label %34
34: ; preds = %33, %13
%35 = load i32, i32* %3
ret i32 %35
}

LLVM IR (-O2):
@.str = [2 x i8] c"M\00"
@.str.1 = [7 x i8] c"MATRIX\00"
@.str.2 = [2 x i8] c"D\00"
@.str.3 = [4 x i8] c"DNA\00"
@.str.4 = [2 x i8] c"P\00"
@.str.5 = [8 x i8] c"PROTEIN\00"
define i32 @getI(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 %21, label %5
5: ; preds = %1
%6 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 6)
%7 = icmp eq i64 %6, 0
br i1 %7, label %21, label %8
8: ; preds = %5
%9 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 1)
%10 = icmp eq i64 %9, 0
br i1 %10, label %21, label %11
11: ; preds = %8
%12 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 3)
%13 = icmp eq i64 %12, 0
br i1 %13, label %21, label %14
14: ; preds = %11
%15 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32 1)
%16 = icmp eq i64 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i32 7)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %17, %14
br label %21
21: ; preds = %8, %11, %1, %5, %20, %17
%22 = phi i32 [ 23, %20 ], [ 21, %17 ], [ 21, %5 ], [ 21, %1 ], [ 22, %11 ], [ 22, %8 ]
ret i32 %22
}