#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 const *, char *);
char *strrchr(char *, char);
const char *get_mime(char *filename) {
  const char *extension = strrchr(filename, '.');
  if (!strcmp(extension, ".js"))
    return "application/javascript";
  if (!strcmp(extension, ".css"))
    return "text/css";
  if (!strcmp(extension, ".ico"))
    return "image/vnd.microsoft.icon";
  if (!strcmp(extension, ".woff"))
    return "application/font-woff";
  if (!strcmp(extension, ".ttf"))
    return "application/x-font-ttf";
  if (!strcmp(extension, ".eot"))
    return "application/octet-stream";
  if (!strcmp(extension, ".svg"))
    return "image/svg+xml";
  if (!strcmp(extension, ".html"))
    return "text/html";
  return "text/plain";
}


x86 assembly (clang, -O0):
<get_mime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2e,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xeb7(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1167 <get_mime+0x47>
lea    0xea6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1291 <get_mime+0x171>
mov    -0x18(%rbp),%rdi
lea    0xea9(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1190 <get_mime+0x70>
lea    0xe99(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1291 <get_mime+0x171>
mov    -0x18(%rbp),%rdi
lea    0xe8e(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11b9 <get_mime+0x99>
lea    0xe7e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1291 <get_mime+0x171>
mov    -0x18(%rbp),%rdi
lea    0xe83(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11e2 <get_mime+0xc2>
lea    0xe74(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1291 <get_mime+0x171>
mov    -0x18(%rbp),%rdi
lea    0xe76(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    120b <get_mime+0xeb>
lea    0xe66(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1291 <get_mime+0x171>
mov    -0x18(%rbp),%rdi
lea    0xe69(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1234 <get_mime+0x114>
lea    0xe59(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1291 <get_mime+0x171>
mov    -0x18(%rbp),%rdi
lea    0xe5e(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    125d <get_mime+0x13d>
lea    0xe4e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1291 <get_mime+0x171>
mov    -0x18(%rbp),%rdi
lea    0xe48(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1286 <get_mime+0x166>
lea    0xe39(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1291 <get_mime+0x171>
lea    0xe33(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_mime>:
push   %rbx
mov    $0x2e,%esi
call   1030 <strrchr@plt>
mov    %rax,%rbx
lea    0xecb(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11e4 <get_mime+0xc4>
lea    0xecf(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11ed <get_mime+0xcd>
lea    0xec6(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11f6 <get_mime+0xd6>
lea    0xecd(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11ff <get_mime+0xdf>
lea    0xed6(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1208 <get_mime+0xe8>
lea    0xedf(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1211 <get_mime+0xf1>
lea    0xeea(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     121a <get_mime+0xfa>
lea    0xeea(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
lea    0xedf(%rip),%rcx
lea    0xee2(%rip),%rax
cmove  %rcx,%rax
pop    %rbx
ret
lea    0xe19(%rip),%rax
pop    %rbx
ret
lea    0xe2c(%rip),%rax
pop    %rbx
ret
lea    0xe31(%rip),%rax
pop    %rbx
ret
lea    0xe47(%rip),%rax
pop    %rbx
ret
lea    0xe59(%rip),%rax
pop    %rbx
ret
lea    0xe6c(%rip),%rax
pop    %rbx
ret
lea    0xe81(%rip),%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c".js\00"
@.str.1 = [23 x i8] c"application/javascript\00"
@.str.2 = [5 x i8] c".css\00"
@.str.3 = [9 x i8] c"text/css\00"
@.str.4 = [5 x i8] c".ico\00"
@.str.5 = [25 x i8] c"image/vnd.microsoft.icon\00"
@.str.6 = [6 x i8] c".woff\00"
@.str.7 = [22 x i8] c"application/font-woff\00"
@.str.8 = [5 x i8] c".ttf\00"
@.str.9 = [23 x i8] c"application/x-font-ttf\00"
@.str.10 = [5 x i8] c".eot\00"
@.str.11 = [25 x i8] c"application/octet-stream\00"
@.str.12 = [5 x i8] c".svg\00"
@.str.13 = [14 x i8] c"image/svg+xml\00"
@.str.14 = [6 x i8] c".html\00"
@.str.15 = [10 x i8] c"text/html\00"
@.str.16 = [11 x i8] c"text/plain\00"
define i8* @get_mime(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i8* @strrchr(i8* %5, i8 signext 46)
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 %11, label %10
10: ; preds = %1
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %47
11: ; preds = %1
%12 = load i8*, i8** %4
%13 = call i32 @strcmp(i8* %12, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%14 = icmp ne i32 %13, 0
br i1 %14, label %16, label %15
15: ; preds = %11
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %47
16: ; preds = %11
%17 = load i8*, i8** %4
%18 = call i32 @strcmp(i8* %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%19 = icmp ne i32 %18, 0
br i1 %19, label %21, label %20
20: ; preds = %16
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %47
21: ; preds = %16
%22 = load i8*, i8** %4
%23 = call i32 @strcmp(i8* %22, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%24 = icmp ne i32 %23, 0
br i1 %24, label %26, label %25
25: ; preds = %21
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %47
26: ; preds = %21
%27 = load i8*, i8** %4
%28 = call i32 @strcmp(i8* %27, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%29 = icmp ne i32 %28, 0
br i1 %29, label %31, label %30
30: ; preds = %26
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %47
31: ; preds = %26
%32 = load i8*, i8** %4
%33 = call i32 @strcmp(i8* %32, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
%34 = icmp ne i32 %33, 0
br i1 %34, label %36, label %35
35: ; preds = %31
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0), i8** %2
br label %47
36: ; preds = %31
%37 = load i8*, i8** %4
%38 = call i32 @strcmp(i8* %37, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0))
%39 = icmp ne i32 %38, 0
br i1 %39, label %41, label %40
40: ; preds = %36
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.13, i64 0, i64 0), i8** %2
br label %47
41: ; preds = %36
%42 = load i8*, i8** %4
%43 = call i32 @strcmp(i8* %42, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0))
%44 = icmp ne i32 %43, 0
br i1 %44, label %46, label %45
45: ; preds = %41
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.15, i64 0, i64 0), i8** %2
br label %47
46: ; preds = %41
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0), i8** %2
br label %47
47: ; preds = %46, %45, %40, %35, %30, %25, %20, %15, %10
%48 = load i8*, i8** %2
ret i8* %48
}

LLVM IR (-O2):
@.str = [4 x i8] c".js\00"
@.str.1 = [23 x i8] c"application/javascript\00"
@.str.2 = [5 x i8] c".css\00"
@.str.3 = [9 x i8] c"text/css\00"
@.str.4 = [5 x i8] c".ico\00"
@.str.5 = [25 x i8] c"image/vnd.microsoft.icon\00"
@.str.6 = [6 x i8] c".woff\00"
@.str.7 = [22 x i8] c"application/font-woff\00"
@.str.8 = [5 x i8] c".ttf\00"
@.str.9 = [23 x i8] c"application/x-font-ttf\00"
@.str.10 = [5 x i8] c".eot\00"
@.str.11 = [25 x i8] c"application/octet-stream\00"
@.str.12 = [5 x i8] c".svg\00"
@.str.13 = [14 x i8] c"image/svg+xml\00"
@.str.14 = [6 x i8] c".html\00"
@.str.15 = [10 x i8] c"text/html\00"
@.str.16 = [11 x i8] c"text/plain\00"
define i8* @get_mime(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 46)
%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 %27, label %5
5: ; preds = %1
%6 = tail call i32 @strcmp(i8* dereferenceable(1) %2, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%7 = icmp eq i32 %6, 0
br i1 %7, label %27, label %8
8: ; preds = %5
%9 = 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))
%10 = icmp eq i32 %9, 0
br i1 %10, label %27, label %11
11: ; preds = %8
%12 = tail call i32 @strcmp(i8* dereferenceable(1) %2, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%13 = icmp eq i32 %12, 0
br i1 %13, label %27, 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.8, i64 0, i64 0))
%16 = icmp eq i32 %15, 0
br i1 %16, label %27, label %17
17: ; preds = %14
%18 = tail call i32 @strcmp(i8* dereferenceable(1) %2, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
%19 = icmp eq i32 %18, 0
br i1 %19, label %27, label %20
20: ; preds = %17
%21 = tail call i32 @strcmp(i8* dereferenceable(1) %2, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0))
%22 = icmp eq i32 %21, 0
br i1 %22, label %27, label %23
23: ; preds = %20
%24 = tail call i32 @strcmp(i8* dereferenceable(1) %2, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0))
%25 = icmp eq i32 %24, 0
%26 = select i1 %25, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0)
br label %27
27: ; preds = %23, %20, %17, %14, %11, %8, %5, %1
%28 = phi i8* [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), %1 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), %5 ], [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), %8 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), %11 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), %14 ], [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0), %17 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.13, i64 0, i64 0), %20 ], [ %26, %23 ]
ret i8* %28
}