#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*/ strcmp(char *, char *);
char *strupper(char *);
int getDriver(char *str) {
  char *upstr = strupper(str);
  if (!strcmp(upstr, "PCM") || !strcmp(upstr, "0"))
    return 0;
  if (!strcmp(upstr, "2ADPCM") || !strcmp(upstr, "1"))
    return 1;
  if (!strcmp(upstr, "4PCM") || !strcmp(upstr, "2") || !strcmp(upstr, "3"))
    return 2;
  if (!strcmp(upstr, "VGM") || !strcmp(upstr, "4"))
    return 3;
  if (!strcmp(upstr, "XGM") || !strcmp(upstr, "5"))
    return 4;
  return 0;
}


x86 assembly (clang, -O0):
<getDriver>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strupper@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xec8(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
je     116b <getDriver+0x4b>
mov    -0x18(%rbp),%rdi
lea    0xea3(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1177 <getDriver+0x57>
movl   $0x0,-0x4(%rbp)
jmp    128f <getDriver+0x16f>
mov    -0x18(%rbp),%rdi
lea    0xe80(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
je     11a9 <getDriver+0x89>
mov    -0x18(%rbp),%rdi
lea    0xe6e(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11b5 <getDriver+0x95>
movl   $0x1,-0x4(%rbp)
jmp    128f <getDriver+0x16f>
mov    -0x18(%rbp),%rdi
lea    0xe4b(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
je     1200 <getDriver+0xe0>
mov    -0x18(%rbp),%rdi
lea    0xe37(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
je     1200 <getDriver+0xe0>
mov    -0x18(%rbp),%rdi
lea    0xe20(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    120c <getDriver+0xec>
movl   $0x2,-0x4(%rbp)
jmp    128f <getDriver+0x16f>
mov    -0x18(%rbp),%rdi
lea    0xdfd(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
je     123e <getDriver+0x11e>
mov    -0x18(%rbp),%rdi
lea    0xde8(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    124a <getDriver+0x12a>
movl   $0x3,-0x4(%rbp)
jmp    128f <getDriver+0x16f>
mov    -0x18(%rbp),%rdi
lea    0xdc5(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
je     127c <getDriver+0x15c>
mov    -0x18(%rbp),%rdi
lea    0xdb0(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1288 <getDriver+0x168>
movl   $0x4,-0x4(%rbp)
jmp    128f <getDriver+0x16f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getDriver>:
push   %rbp
push   %rbx
push   %rax
call   1040 <strupper@plt>
mov    %rax,%rbx
lea    0xeda(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcmp@plt>
xor    %ebp,%ebp
test   %eax,%eax
je     122f <getDriver+0x10f>
lea    0xeb5(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     122f <getDriver+0x10f>
lea    0xea0(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    $0x1,%ebp
test   %eax,%eax
je     122f <getDriver+0x10f>
lea    0xe8b(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     122f <getDriver+0x10f>
lea    0xe76(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    $0x2,%ebp
test   %eax,%eax
je     122f <getDriver+0x10f>
lea    0xe5f(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     122f <getDriver+0x10f>
lea    0xe4e(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     122f <getDriver+0x10f>
lea    0xe3d(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    $0x3,%ebp
test   %eax,%eax
je     122f <getDriver+0x10f>
lea    0xe29(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     122f <getDriver+0x10f>
lea    0xe18(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     122a <getDriver+0x10a>
lea    0xe09(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
xor    %ebp,%ebp
test   %eax,%eax
sete   %bpl
shl    $0x2,%ebp
jmp    122f <getDriver+0x10f>
mov    $0x4,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"PCM\00"
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [7 x i8] c"2ADPCM\00"
@.str.3 = [2 x i8] c"1\00"
@.str.4 = [5 x i8] c"4PCM\00"
@.str.5 = [2 x i8] c"2\00"
@.str.6 = [2 x i8] c"3\00"
@.str.7 = [4 x i8] c"VGM\00"
@.str.8 = [2 x i8] c"4\00"
@.str.9 = [4 x i8] c"XGM\00"
@.str.10 = [2 x i8] c"5\00"
define i32 @getDriver(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i8* @strupper(i8* %5)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @strcmp(i8* %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %1
%11 = load i8*, i8** %4
%12 = call i32 @strcmp(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp ne i32 %12, 0
br i1 %13, label %15, label %14
14: ; preds = %10, %1
store i32 0, i32* %2
br label %56
15: ; preds = %10
%16 = load i8*, i8** %4
%17 = call i32 @strcmp(i8* %16, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %15
%20 = load i8*, i8** %4
%21 = call i32 @strcmp(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%22 = icmp ne i32 %21, 0
br i1 %22, label %24, label %23
23: ; preds = %19, %15
store i32 1, i32* %2
br label %56
24: ; preds = %19
%25 = load i8*, i8** %4
%26 = call i32 @strcmp(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %36
28: ; preds = %24
%29 = load i8*, i8** %4
%30 = call i32 @strcmp(i8* %29, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %36
32: ; preds = %28
%33 = load i8*, i8** %4
%34 = call i32 @strcmp(i8* %33, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%35 = icmp ne i32 %34, 0
br i1 %35, label %37, label %36
36: ; preds = %32, %28, %24
store i32 2, i32* %2
br label %56
37: ; preds = %32
%38 = load i8*, i8** %4
%39 = call i32 @strcmp(i8* %38, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%40 = icmp ne i32 %39, 0
br i1 %40, label %41, label %45
41: ; preds = %37
%42 = load i8*, i8** %4
%43 = call i32 @strcmp(i8* %42, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%44 = icmp ne i32 %43, 0
br i1 %44, label %46, label %45
45: ; preds = %41, %37
store i32 3, i32* %2
br label %56
46: ; preds = %41
%47 = load i8*, i8** %4
%48 = call i32 @strcmp(i8* %47, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%49 = icmp ne i32 %48, 0
br i1 %49, label %50, label %54
50: ; preds = %46
%51 = load i8*, i8** %4
%52 = call i32 @strcmp(i8* %51, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%53 = icmp ne i32 %52, 0
br i1 %53, label %55, label %54
54: ; preds = %50, %46
store i32 4, i32* %2
br label %56
55: ; preds = %50
store i32 0, i32* %2
br label %56
56: ; preds = %55, %54, %45, %36, %23, %14
%57 = load i32, i32* %2
ret i32 %57
}

LLVM IR (-O2):
@.str = [4 x i8] c"PCM\00"
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [7 x i8] c"2ADPCM\00"
@.str.3 = [2 x i8] c"1\00"
@.str.4 = [5 x i8] c"4PCM\00"
@.str.5 = [2 x i8] c"2\00"
@.str.6 = [2 x i8] c"3\00"
@.str.7 = [4 x i8] c"VGM\00"
@.str.8 = [2 x i8] c"4\00"
@.str.9 = [4 x i8] c"XGM\00"
@.str.10 = [2 x i8] c"5\00"
define i32 @getDriver(i8* %0) {
%2 = tail call i8* @strupper(i8* %0)
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %2, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, 0
br i1 %4, label %36, label %5
5: ; preds = %1
%6 = tail call i32 @strcmp(i8* dereferenceable(1) %2, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i32 %6, 0
br i1 %7, label %36, label %8
8: ; preds = %5
%9 = tail call i32 @strcmp(i8* dereferenceable(1) %2, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
br i1 %10, label %36, label %11
11: ; preds = %8
%12 = tail call i32 @strcmp(i8* dereferenceable(1) %2, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%13 = icmp eq i32 %12, 0
br i1 %13, label %36, label %14
14: ; preds = %11
%15 = tail call i32 @strcmp(i8* dereferenceable(1) %2, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%16 = icmp eq i32 %15, 0
br i1 %16, label %36, label %17
17: ; preds = %14
%18 = tail call i32 @strcmp(i8* dereferenceable(1) %2, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%19 = icmp eq i32 %18, 0
br i1 %19, label %36, label %20
20: ; preds = %17
%21 = tail call i32 @strcmp(i8* dereferenceable(1) %2, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%22 = icmp eq i32 %21, 0
br i1 %22, label %36, label %23
23: ; preds = %20
%24 = tail call i32 @strcmp(i8* dereferenceable(1) %2, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%25 = icmp eq i32 %24, 0
br i1 %25, label %36, label %26
26: ; preds = %23
%27 = tail call i32 @strcmp(i8* dereferenceable(1) %2, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%28 = icmp eq i32 %27, 0
br i1 %28, label %36, label %29
29: ; preds = %26
%30 = tail call i32 @strcmp(i8* dereferenceable(1) %2, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%31 = icmp eq i32 %30, 0
br i1 %31, label %36, label %32
32: ; preds = %29
%33 = tail call i32 @strcmp(i8* dereferenceable(1) %2, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%34 = icmp eq i32 %33, 0
%35 = select i1 %34, i32 4, i32 0
br label %36
36: ; preds = %32, %29, %23, %26, %14, %17, %20, %8, %11, %1, %5
%37 = phi i32 [ 0, %5 ], [ 0, %1 ], [ 1, %11 ], [ 1, %8 ], [ 2, %20 ], [ 2, %17 ], [ 2, %14 ], [ 3, %26 ], [ 3, %23 ], [ 4, %29 ], [ %35, %32 ]
ret i32 %37
}