#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 (!extension)
    return "text/plain";
  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)
cmpq   $0x0,-0x18(%rbp)
jne    1159 <get_mime+0x39>
lea    0xeb0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ac <get_mime+0x18c>
mov    -0x18(%rbp),%rdi
lea    0xea7(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1182 <get_mime+0x62>
lea    0xe96(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ac <get_mime+0x18c>
mov    -0x18(%rbp),%rdi
lea    0xe99(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11ab <get_mime+0x8b>
lea    0xe89(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ac <get_mime+0x18c>
mov    -0x18(%rbp),%rdi
lea    0xe7e(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11d4 <get_mime+0xb4>
lea    0xe6e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ac <get_mime+0x18c>
mov    -0x18(%rbp),%rdi
lea    0xe73(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11fd <get_mime+0xdd>
lea    0xe64(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ac <get_mime+0x18c>
mov    -0x18(%rbp),%rdi
lea    0xe66(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1226 <get_mime+0x106>
lea    0xe56(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ac <get_mime+0x18c>
mov    -0x18(%rbp),%rdi
lea    0xe59(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    124f <get_mime+0x12f>
lea    0xe49(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ac <get_mime+0x18c>
mov    -0x18(%rbp),%rdi
lea    0xe4e(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1278 <get_mime+0x158>
lea    0xe3e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ac <get_mime+0x18c>
mov    -0x18(%rbp),%rdi
lea    0xe38(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    12a1 <get_mime+0x181>
lea    0xe29(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ac <get_mime+0x18c>
lea    0xd58(%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>
test   %rax,%rax
je     11f1 <get_mime+0xd1>
mov    %rax,%rbx
lea    0xecd(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11fa <get_mime+0xda>
lea    0xed1(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1203 <get_mime+0xe3>
lea    0xec8(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     120c <get_mime+0xec>
lea    0xecf(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1215 <get_mime+0xf5>
lea    0xed4(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     121e <get_mime+0xfe>
lea    0xedd(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1227 <get_mime+0x107>
lea    0xee8(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1230 <get_mime+0x110>
lea    0xee8(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
lea    0xedd(%rip),%rcx
lea    0xe15(%rip),%rax
cmove  %rcx,%rax
pop    %rbx
ret
lea    0xe08(%rip),%rax
pop    %rbx
ret
lea    0xe0e(%rip),%rax
pop    %rbx
ret
lea    0xe21(%rip),%rax
pop    %rbx
ret
lea    0xe26(%rip),%rax
pop    %rbx
ret
lea    0xe3c(%rip),%rax
pop    %rbx
ret
lea    0xe4e(%rip),%rax
pop    %rbx
ret
lea    0xe61(%rip),%rax
pop    %rbx
ret
lea    0xe76(%rip),%rax
pop    %rbx
ret

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

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