#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 *);
char *strrchr(char const *, char);
const char *lookup(const char *path) {
  char *mime_type = NULL;
  char *extension_pos;
  if ((extension_pos = strrchr(path, '.'))) {
    char *extension = extension_pos + 1;
    if (strcasecmp("css", extension) == 0) {
      mime_type = "text/css";
    }
    if (strcasecmp("html", extension) == 0) {
      mime_type = "text/html";
    }
    if (strcasecmp("gif", extension) == 0) {
      mime_type = "image/gif";
    }
    if (strcasecmp("ico", extension) == 0) {
      mime_type = "image/x-icon";
    }
    if (strcasecmp("jpg", extension) == 0) {
      mime_type = "image/jpeg";
    }
    if (strcasecmp("js", extension) == 0) {
      mime_type = "text/javascript";
    }
    if (strcasecmp("php", extension) == 0) {
      mime_type = "text/x-php";
    }
    if (strcasecmp("png", extension) == 0) {
      mime_type = "image/png";
    }
  }
  return mime_type;
}


x86 assembly (clang, -O0):
<lookup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2e,%esi
call   1040 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1289 <lookup+0x169>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe9e(%rip),%rdi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1181 <lookup+0x61>
lea    0xe83(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe82(%rip),%rdi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    11a6 <lookup+0x86>
lea    0xe67(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe68(%rip),%rdi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    11cb <lookup+0xab>
lea    0xe4c(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe47(%rip),%rdi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    11f0 <lookup+0xd0>
lea    0xe35(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe33(%rip),%rdi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1215 <lookup+0xf5>
lea    0xe21(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe1d(%rip),%rdi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    123a <lookup+0x11a>
lea    0xe0a(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe12(%rip),%rdi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    125f <lookup+0x13f>
lea    0xdf5(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xdf7(%rip),%rdi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1284 <lookup+0x164>
lea    0xddb(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1289 <lookup+0x169>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lookup>:
push   %r15
push   %r14
push   %rbx
mov    $0x2e,%esi
call   1040 <strrchr@plt>
test   %rax,%rax
je     122c <lookup+0x10c>
mov    %rax,%rbx
add    $0x1,%rbx
lea    0xebf(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
xor    %r14d,%r14d
test   %rax,%rax
lea    0xea5(%rip),%rax
cmove  %rax,%r14
lea    0xea8(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
lea    0xe91(%rip),%r15
cmovne %r14,%r15
lea    0xe96(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
lea    0xe7e(%rip),%r14
cmovne %r15,%r14
lea    0xe7d(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
lea    0xe6f(%rip),%r15
cmovne %r14,%r15
lea    0xe71(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
lea    0xe63(%rip),%r14
cmovne %r15,%r14
lea    0xe63(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
lea    0xe54(%rip),%r15
cmovne %r14,%r15
lea    0xe60(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
lea    0xe47(%rip),%r14
cmovne %r15,%r14
lea    0xe4d(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
lea    0xe35(%rip),%rax
cmovne %r14,%rax
jmp    122e <lookup+0x10e>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

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