#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*/ printf(char *);
scalar_t__ strcmp(char *, char *);
char *getMimeType(char *str) {
  printf("\nentered mime type");
  int i;
  char *fileExt[10];
  fileExt[0] = "html";
  fileExt[1] = "htm";
  fileExt[2] = "txt";
  fileExt[3] = "gif";
  fileExt[4] = "jpg";
  fileExt[5] = "qt";
  char *mType[10];
  mType[0] = "text/html";
  mType[1] = "text/html";
  mType[2] = "text/plain";
  mType[3] = "image/gif";
  mType[4] = "image/jpeg";
  mType[5] = "video/quicktime";
  for (i = 0; i < 6; i++) {
    if (strcmp(str, fileExt[i]) == 0) {
      printf("\nmatched");
      return mType[i];
    }
  }
  printf("\nreturning ERROR");
  char *er = "ERROR";
  return er;
}


x86 assembly (clang, -O0):
<getMimeType>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    %rdi,-0x10(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xee5(%rip),%rax
mov    %rax,-0x70(%rbp)
lea    0xec6(%rip),%rax
mov    %rax,-0x68(%rbp)
lea    0xebf(%rip),%rax
mov    %rax,-0x60(%rbp)
lea    0xeda(%rip),%rax
mov    %rax,-0x58(%rbp)
lea    0xead(%rip),%rax
mov    %rax,-0x50(%rbp)
lea    0xea6(%rip),%rax
mov    %rax,-0x48(%rbp)
lea    0xe9e(%rip),%rax
mov    %rax,-0xc0(%rbp)
lea    0xe90(%rip),%rax
mov    %rax,-0xb8(%rbp)
lea    0xe8c(%rip),%rax
mov    %rax,-0xb0(%rbp)
lea    0xe89(%rip),%rax
mov    %rax,-0xa8(%rbp)
lea    0xe85(%rip),%rax
mov    %rax,-0xa0(%rbp)
lea    0xe82(%rip),%rax
mov    %rax,-0x98(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x6,-0x14(%rbp)
jge    1232 <getMimeType+0x112>
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
mov    -0x70(%rbp,%rax,8),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    121f <getMimeType+0xff>
lea    0xe57(%rip),%rdi
call   1030 <printf@plt>
movslq -0x14(%rbp),%rax
mov    -0xc0(%rbp,%rax,8),%rax
ff
mov    %rax,-0x8(%rbp)
jmp    1257 <getMimeType+0x137>
jmp    1224 <getMimeType+0x104>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11d8 <getMimeType+0xb8>
lea    0xe2c(%rip),%rdi
call   1030 <printf@plt>
lea    0xe2b(%rip),%rax
mov    %rax,-0xc8(%rbp)
mov    -0xc8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getMimeType>:
push   %rbx
sub    $0x50,%rsp
mov    %rdi,%rbx
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xee7(%rip),%rax
mov    %rax,(%rsp)
mov    %rax,0x8(%rsp)
lea    0xee1(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0xee0(%rip),%rax
mov    %rax,0x18(%rsp)
lea    0xede(%rip),%rax
mov    %rax,0x20(%rsp)
lea    0xedd(%rip),%rax
mov    %rax,0x28(%rsp)
lea    0xeac(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1201 <getMimeType+0xe1>
lea    0xe84(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1205 <getMimeType+0xe5>
lea    0xe74(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     120c <getMimeType+0xec>
lea    0xe86(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1213 <getMimeType+0xf3>
lea    0xe50(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     121a <getMimeType+0xfa>
lea    0xe40(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1221 <getMimeType+0x101>
lea    0xe72(%rip),%rdi
call   1030 <printf@plt>
lea    0xe71(%rip),%rax
jmp    1236 <getMimeType+0x116>
xor    %ebx,%ebx
jmp    1226 <getMimeType+0x106>
mov    $0x1,%ebx
jmp    1226 <getMimeType+0x106>
mov    $0x2,%ebx
jmp    1226 <getMimeType+0x106>
mov    $0x3,%ebx
jmp    1226 <getMimeType+0x106>
mov    $0x4,%ebx
jmp    1226 <getMimeType+0x106>
mov    $0x5,%ebx
lea    0xe2f(%rip),%rdi
call   1030 <printf@plt>
mov    (%rsp,%rbx,8),%rax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"\0Aentered mime type\00"
@.str.1 = [5 x i8] c"html\00"
@.str.2 = [4 x i8] c"htm\00"
@.str.3 = [4 x i8] c"txt\00"
@.str.4 = [4 x i8] c"gif\00"
@.str.5 = [4 x i8] c"jpg\00"
@.str.6 = [3 x i8] c"qt\00"
@.str.7 = [10 x i8] c"text/html\00"
@.str.8 = [11 x i8] c"text/plain\00"
@.str.9 = [10 x i8] c"image/gif\00"
@.str.10 = [11 x i8] c"image/jpeg\00"
@.str.11 = [16 x i8] c"video/quicktime\00"
@.str.12 = [9 x i8] c"\0Amatched\00"
@.str.13 = [17 x i8] c"\0Areturning ERROR\00"
@.str.14 = [6 x i8] c"ERROR\00"
define i8* @getMimeType(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [10 x i8*]
%6 = alloca [10 x i8*]
%7 = alloca i8*
store i8* %0, i8** %3
%8 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds [10 x i8*], [10 x i8*]* %5, i64 0, i64 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %9
%10 = getelementptr inbounds [10 x i8*], [10 x i8*]* %5, i64 0, i64 1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8** %10
%11 = getelementptr inbounds [10 x i8*], [10 x i8*]* %5, i64 0, i64 2
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8** %11
%12 = getelementptr inbounds [10 x i8*], [10 x i8*]* %5, i64 0, i64 3
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8** %12
%13 = getelementptr inbounds [10 x i8*], [10 x i8*]* %5, i64 0, i64 4
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8** %13
%14 = getelementptr inbounds [10 x i8*], [10 x i8*]* %5, i64 0, i64 5
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8** %14
%15 = getelementptr inbounds [10 x i8*], [10 x i8*]* %6, i64 0, i64 0
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8** %15
%16 = getelementptr inbounds [10 x i8*], [10 x i8*]* %6, i64 0, i64 1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8** %16
%17 = getelementptr inbounds [10 x i8*], [10 x i8*]* %6, i64 0, i64 2
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i8** %17
%18 = getelementptr inbounds [10 x i8*], [10 x i8*]* %6, i64 0, i64 3
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8** %18
%19 = getelementptr inbounds [10 x i8*], [10 x i8*]* %6, i64 0, i64 4
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i8** %19
%20 = getelementptr inbounds [10 x i8*], [10 x i8*]* %6, i64 0, i64 5
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0), i8** %20
store i32 0, i32* %4
br label %21
21: ; preds = %39, %1
%22 = load i32, i32* %4
%23 = icmp slt i32 %22, 6
br i1 %23, label %24, label %42
24: ; preds = %21
%25 = load i8*, i8** %3
%26 = load i32, i32* %4
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [10 x i8*], [10 x i8*]* %5, i64 0, i64 %27
%29 = load i8*, i8** %28
%30 = call i64 @strcmp(i8* %25, i8* %29)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %38
32: ; preds = %24
%33 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0))
%34 = load i32, i32* %4
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [10 x i8*], [10 x i8*]* %6, i64 0, i64 %35
%37 = load i8*, i8** %36
store i8* %37, i8** %2
br label %45
38: ; preds = %24
br label %39
39: ; preds = %38
%40 = load i32, i32* %4
%41 = add nsw i32 %40, 1
store i32 %41, i32* %4
br label %21
42: ; preds = %21
%43 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.13, i64 0, i64 0))
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0), i8** %7
%44 = load i8*, i8** %7
store i8* %44, i8** %2
br label %45
45: ; preds = %42, %32
%46 = load i8*, i8** %2
ret i8* %46
}

LLVM IR (-O2):
@.str = [19 x i8] c"\0Aentered mime type\00"
@.str.1 = [5 x i8] c"html\00"
@.str.2 = [4 x i8] c"htm\00"
@.str.3 = [4 x i8] c"txt\00"
@.str.4 = [4 x i8] c"gif\00"
@.str.5 = [4 x i8] c"jpg\00"
@.str.6 = [3 x i8] c"qt\00"
@.str.7 = [10 x i8] c"text/html\00"
@.str.8 = [11 x i8] c"text/plain\00"
@.str.9 = [10 x i8] c"image/gif\00"
@.str.10 = [11 x i8] c"image/jpeg\00"
@.str.11 = [16 x i8] c"video/quicktime\00"
@.str.12 = [9 x i8] c"\0Amatched\00"
@.str.13 = [17 x i8] c"\0Areturning ERROR\00"
@.str.14 = [6 x i8] c"ERROR\00"
define i8* @getMimeType(i8* %0) {
%2 = alloca [10 x i8*]
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = bitcast [10 x i8*]* %2 to i8*
%5 = getelementptr inbounds [10 x i8*], [10 x i8*]* %2, i64 0, i64 0
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8** %5
%6 = getelementptr inbounds [10 x i8*], [10 x i8*]* %2, i64 0, i64 1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8** %6
%7 = getelementptr inbounds [10 x i8*], [10 x i8*]* %2, i64 0, i64 2
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i8** %7
%8 = getelementptr inbounds [10 x i8*], [10 x i8*]* %2, i64 0, i64 3
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8** %8
%9 = getelementptr inbounds [10 x i8*], [10 x i8*]* %2, i64 0, i64 4
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i8** %9
%10 = getelementptr inbounds [10 x i8*], [10 x i8*]* %2, i64 0, i64 5
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0), i8** %10
%11 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %30, %27, %24, %21, %18, %1
%14 = phi i64 [ 0, %1 ], [ 1, %18 ], [ 2, %21 ], [ 3, %24 ], [ 4, %27 ], [ 5, %30 ]
%15 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0))
%16 = getelementptr inbounds [10 x i8*], [10 x i8*]* %2, i64 0, i64 %14
%17 = load i8*, i8** %16
br label %35
18: ; preds = %1
%19 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %13, label %21
21: ; preds = %18
%22 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %13, label %24
24: ; preds = %21
%25 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %13, label %27
27: ; preds = %24
%28 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %13, label %30
30: ; preds = %27
%31 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %13, label %33
33: ; preds = %30
%34 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.13, i64 0, i64 0))
br label %35
35: ; preds = %33, %13
%36 = phi i8* [ %17, %13 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0), %33 ]
ret i8* %36
}