#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 */
scalar_t__ strcasecmp(char *, char const *);
char *strcasestr(char const *, char *);
const char *lookup(const char *path) {
  const char *MIME_type = strcasestr(path, ".");
  if (MIME_type == NULL)
    return NULL;
  if ((strcasecmp(".css", MIME_type)) == 0) {
    const char *content = "text/css";
    return content;
  } else if ((strcasecmp(".html", MIME_type)) == 0) {
    const char *content = "text/html";
    return content;
  } else if ((strcasecmp(".php", MIME_type)) == 0) {
    const char *content = "text/x-php";
    return content;
  } else if ((strcasecmp(".js", MIME_type)) == 0) {
    const char *content = "text/javascript";
    return content;
  } else if ((strcasecmp(".gif", MIME_type)) == 0) {
    const char *content = "image/gif";
    return content;
  } else if ((strcasecmp(".png", MIME_type)) == 0) {
    const char *content = "image/png";
    return content;
  } else if ((strcasecmp(".ico", MIME_type)) == 0) {
    const char *content = "image/x-icon";
    return content;
  } else if ((strcasecmp(".jpg", MIME_type)) == 0) {
    const char *content = "image/jpeg";
    return content;
  } else
    return NULL;
}


x86 assembly (clang, -O0):
<lookup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <strcasestr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1158 <lookup+0x38>
movq   $0x0,-0x8(%rbp)
jmp    12f0 <lookup+0x1d0>
mov    -0x18(%rbp),%rsi
lea    0xe9f(%rip),%rdi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    118a <lookup+0x6a>
lea    0xe8e(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    12f0 <lookup+0x1d0>
mov    -0x18(%rbp),%rsi
lea    0xe7b(%rip),%rdi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    11bc <lookup+0x9c>
lea    0xe6b(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    12f0 <lookup+0x1d0>
mov    -0x18(%rbp),%rsi
lea    0xe59(%rip),%rdi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    11ee <lookup+0xce>
lea    0xe48(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    12f0 <lookup+0x1d0>
mov    -0x18(%rbp),%rsi
lea    0xe37(%rip),%rdi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1220 <lookup+0x100>
lea    0xe25(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    12f0 <lookup+0x1d0>
mov    -0x18(%rbp),%rsi
lea    0xe19(%rip),%rdi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1252 <lookup+0x132>
lea    0xe08(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    12f0 <lookup+0x1d0>
mov    -0x18(%rbp),%rsi
lea    0xdf6(%rip),%rdi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1284 <lookup+0x164>
lea    0xde5(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    12f0 <lookup+0x1d0>
mov    -0x18(%rbp),%rsi
lea    0xdd3(%rip),%rdi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    12b6 <lookup+0x196>
lea    0xdc2(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    12f0 <lookup+0x1d0>
mov    -0x18(%rbp),%rsi
lea    0xdb3(%rip),%rdi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    12e8 <lookup+0x1c8>
lea    0xda2(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    12f0 <lookup+0x1d0>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lookup>:
push   %rbx
lea    0xed8(%rip),%rsi
call   1040 <strcasestr@plt>
test   %rax,%rax
je     11f5 <lookup+0xd5>
mov    %rax,%rbx
lea    0xec2(%rip),%rdi
mov    %rax,%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     11f9 <lookup+0xd9>
lea    0xeb8(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1202 <lookup+0xe2>
lea    0xeb0(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     120b <lookup+0xeb>
lea    0xea8(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1214 <lookup+0xf4>
lea    0xea8(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     121d <lookup+0xfd>
lea    0xea3(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1226 <lookup+0x106>
lea    0xe9e(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     122f <lookup+0x10f>
lea    0xe9c(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
lea    0xe8a(%rip),%rcx
cmove  %rcx,%rax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret
lea    0xe07(%rip),%rax
pop    %rbx
ret
lea    0xe0d(%rip),%rax
pop    %rbx
ret
lea    0xe13(%rip),%rax
pop    %rbx
ret
lea    0xe19(%rip),%rax
pop    %rbx
ret
lea    0xe25(%rip),%rax
pop    %rbx
ret
lea    0xe2b(%rip),%rax
pop    %rbx
ret
lea    0xe31(%rip),%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c".\00"
@.str.1 = [5 x i8] c".css\00"
@.str.2 = [9 x i8] c"text/css\00"
@.str.3 = [6 x i8] c".html\00"
@.str.4 = [10 x i8] c"text/html\00"
@.str.5 = [5 x i8] c".php\00"
@.str.6 = [11 x i8] c"text/x-php\00"
@.str.7 = [4 x i8] c".js\00"
@.str.8 = [16 x i8] c"text/javascript\00"
@.str.9 = [5 x i8] c".gif\00"
@.str.10 = [10 x i8] c"image/gif\00"
@.str.11 = [5 x i8] c".png\00"
@.str.12 = [10 x i8] c"image/png\00"
@.str.13 = [5 x i8] c".ico\00"
@.str.14 = [13 x i8] c"image/x-icon\00"
@.str.15 = [5 x i8] c".jpg\00"
@.str.16 = [11 x i8] c"image/jpeg\00"
define i8* @lookup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
store i8* %0, i8** %3
%13 = load i8*, i8** %3
%14 = call i8* @strcasestr(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %14, i8** %4
%15 = load i8*, i8** %4
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %18
17: ; preds = %1
store i8* null, i8** %2
br label %67
18: ; preds = %1
%19 = load i8*, i8** %4
%20 = call i64 @strcasecmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %18
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8** %5
%23 = load i8*, i8** %5
store i8* %23, i8** %2
br label %67
24: ; preds = %18
%25 = load i8*, i8** %4
%26 = call i64 @strcasecmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %25)
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %24
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8** %6
%29 = load i8*, i8** %6
store i8* %29, i8** %2
br label %67
30: ; preds = %24
%31 = load i8*, i8** %4
%32 = call i64 @strcasecmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* %31)
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %30
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8** %7
%35 = load i8*, i8** %7
store i8* %35, i8** %2
br label %67
36: ; preds = %30
%37 = load i8*, i8** %4
%38 = call i64 @strcasecmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %37)
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %36
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i8** %8
%41 = load i8*, i8** %8
store i8* %41, i8** %2
br label %67
42: ; preds = %36
%43 = load i8*, i8** %4
%44 = call i64 @strcasecmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i8* %43)
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %48
46: ; preds = %42
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i8** %9
%47 = load i8*, i8** %9
store i8* %47, i8** %2
br label %67
48: ; preds = %42
%49 = load i8*, i8** %4
%50 = call i64 @strcasecmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i8* %49)
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %54
52: ; preds = %48
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), i8** %10
%53 = load i8*, i8** %10
store i8* %53, i8** %2
br label %67
54: ; preds = %48
%55 = load i8*, i8** %4
%56 = call i64 @strcasecmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i8* %55)
%57 = icmp eq i64 %56, 0
br i1 %57, label %58, label %60
58: ; preds = %54
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0), i8** %11
%59 = load i8*, i8** %11
store i8* %59, i8** %2
br label %67
60: ; preds = %54
%61 = load i8*, i8** %4
%62 = call i64 @strcasecmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0), i8* %61)
%63 = icmp eq i64 %62, 0
br i1 %63, label %64, label %66
64: ; preds = %60
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0), i8** %12
%65 = load i8*, i8** %12
store i8* %65, i8** %2
br label %67
66: ; preds = %60
store i8* null, i8** %2
br label %67
67: ; preds = %66, %64, %58, %52, %46, %40, %34, %28, %22, %17
%68 = load i8*, i8** %2
ret i8* %68
}

LLVM IR (-O2):
@.str = [2 x i8] c".\00"
@.str.1 = [5 x i8] c".css\00"
@.str.2 = [9 x i8] c"text/css\00"
@.str.3 = [6 x i8] c".html\00"
@.str.4 = [10 x i8] c"text/html\00"
@.str.5 = [5 x i8] c".php\00"
@.str.6 = [11 x i8] c"text/x-php\00"
@.str.7 = [4 x i8] c".js\00"
@.str.8 = [16 x i8] c"text/javascript\00"
@.str.9 = [5 x i8] c".gif\00"
@.str.10 = [10 x i8] c"image/gif\00"
@.str.11 = [5 x i8] c".png\00"
@.str.12 = [10 x i8] c"image/png\00"
@.str.13 = [5 x i8] c".ico\00"
@.str.14 = [13 x i8] c"image/x-icon\00"
@.str.15 = [5 x i8] c".jpg\00"
@.str.16 = [11 x i8] c"image/jpeg\00"
define i8* @lookup(i8* %0) {
%2 = tail call i8* @strcasestr(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i8* %2, null
br i1 %3, label %29, label %4
4: ; preds = %1
%5 = tail call i64 @strcasecmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%6 = icmp eq i64 %5, 0
br i1 %6, label %29, label %7
7: ; preds = %4
%8 = tail call i64 @strcasecmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %2)
%9 = icmp eq i64 %8, 0
br i1 %9, label %29, label %10
10: ; preds = %7
%11 = tail call i64 @strcasecmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* %2)
%12 = icmp eq i64 %11, 0
br i1 %12, label %29, label %13
13: ; preds = %10
%14 = tail call i64 @strcasecmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %2)
%15 = icmp eq i64 %14, 0
br i1 %15, label %29, label %16
16: ; preds = %13
%17 = tail call i64 @strcasecmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i8* %2)
%18 = icmp eq i64 %17, 0
br i1 %18, label %29, label %19
19: ; preds = %16
%20 = tail call i64 @strcasecmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i8* %2)
%21 = icmp eq i64 %20, 0
br i1 %21, label %29, label %22
22: ; preds = %19
%23 = tail call i64 @strcasecmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i8* %2)
%24 = icmp eq i64 %23, 0
br i1 %24, label %29, label %25
25: ; preds = %22
%26 = tail call i64 @strcasecmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0), i8* %2)
%27 = icmp eq i64 %26, 0
%28 = select i1 %27, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0), i8* null
br label %29
29: ; preds = %25, %22, %19, %16, %13, %10, %7, %4, %1
%30 = phi i8* [ null, %1 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), %4 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), %7 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), %10 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), %13 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), %16 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), %19 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0), %22 ], [ %28, %25 ]
ret i8* %30
}