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


x86 assembly (clang, -O0):
<lookup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2e,%esi
call   1040 <strrchr@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb7(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1168 <lookup+0x48>
lea    0xea6(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    12b9 <lookup+0x199>
mov    -0x10(%rbp),%rdi
lea    0xe9b(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1192 <lookup+0x72>
lea    0xe8b(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    12b4 <lookup+0x194>
mov    -0x10(%rbp),%rdi
lea    0xe81(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    11bc <lookup+0x9c>
lea    0xe70(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    12af <lookup+0x18f>
mov    -0x10(%rbp),%rdi
lea    0xe66(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    11e6 <lookup+0xc6>
lea    0xe55(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    12aa <lookup+0x18a>
mov    -0x10(%rbp),%rdi
lea    0xe4d(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1210 <lookup+0xf0>
lea    0xe3c(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    12a5 <lookup+0x185>
mov    -0x10(%rbp),%rdi
lea    0xe33(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    123a <lookup+0x11a>
lea    0xe21(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    12a0 <lookup+0x180>
mov    -0x10(%rbp),%rdi
lea    0xe1d(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1264 <lookup+0x144>
lea    0xe0c(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    129b <lookup+0x17b>
mov    -0x10(%rbp),%rdi
lea    0xe03(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    128e <lookup+0x16e>
lea    0xdf2(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    1296 <lookup+0x176>
movq   $0x0,-0x18(%rbp)
jmp    129b <lookup+0x17b>
jmp    12a0 <lookup+0x180>
jmp    12a5 <lookup+0x185>
jmp    12aa <lookup+0x18a>
jmp    12af <lookup+0x18f>
jmp    12b4 <lookup+0x194>
jmp    12b9 <lookup+0x199>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lookup>:
push   %rbx
mov    $0x2e,%esi
call   1040 <strrchr@plt>
mov    %rax,%rbx
lea    0xecb(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     11ea <lookup+0xca>
lea    0xec1(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     11f3 <lookup+0xd3>
lea    0xeb9(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     11fc <lookup+0xdc>
lea    0xeb0(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1205 <lookup+0xe5>
lea    0xead(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     120e <lookup+0xee>
lea    0xea9(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1217 <lookup+0xf7>
lea    0xea9(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1220 <lookup+0x100>
lea    0xea5(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
lea    0xe93(%rip),%rcx
cmove  %rcx,%rax
pop    %rbx
ret
lea    0xe14(%rip),%rax
pop    %rbx
ret
lea    0xe1a(%rip),%rax
pop    %rbx
ret
lea    0xe20(%rip),%rax
pop    %rbx
ret
lea    0xe26(%rip),%rax
pop    %rbx
ret
lea    0xe2e(%rip),%rax
pop    %rbx
ret
lea    0xe34(%rip),%rax
pop    %rbx
ret
lea    0xe40(%rip),%rax
pop    %rbx
ret

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

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