#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__ strcmp(char *, char *);
char *strrchr(char *, char);
char *http_get_mime_type(char *file_name) {
  char *file_extension = strrchr(file_name, '.');
  if (file_extension == NULL) {
    return "text/plain";
  }
  if (strcmp(file_extension, ".html") == 0 ||
      strcmp(file_extension, ".htm") == 0) {
    return "text/html";
  } else if (strcmp(file_extension, ".jpg") == 0 ||
             strcmp(file_extension, ".jpeg") == 0) {
    return "image/jpeg";
  } else if (strcmp(file_extension, ".png") == 0) {
    return "image/png";
  } else if (strcmp(file_extension, ".css") == 0) {
    return "text/css";
  } else if (strcmp(file_extension, ".js") == 0) {
    return "application/javascript";
  } else if (strcmp(file_extension, ".pdf") == 0) {
    return "application/pdf";
  } else {
    return "text/plain";
  }
}


x86 assembly (clang, -O0):
<http_get_mime_type>:
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 <http_get_mime_type+0x39>
lea    0xeb0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1294 <http_get_mime_type+0x174>
mov    -0x18(%rbp),%rdi
lea    0xea7(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     118d <http_get_mime_type+0x6d>
mov    -0x18(%rbp),%rdi
lea    0xe93(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    119d <http_get_mime_type+0x7d>
lea    0xe82(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1294 <http_get_mime_type+0x174>
mov    -0x18(%rbp),%rdi
lea    0xe78(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11d1 <http_get_mime_type+0xb1>
mov    -0x18(%rbp),%rdi
lea    0xe63(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11e1 <http_get_mime_type+0xc1>
lea    0xe53(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1294 <http_get_mime_type+0x174>
mov    -0x18(%rbp),%rdi
lea    0xe4a(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    120b <http_get_mime_type+0xeb>
lea    0xe39(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1294 <http_get_mime_type+0x174>
mov    -0x18(%rbp),%rdi
lea    0xe2f(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1235 <http_get_mime_type+0x115>
lea    0xe1e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1294 <http_get_mime_type+0x174>
mov    -0x18(%rbp),%rdi
lea    0xe13(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    125f <http_get_mime_type+0x13f>
lea    0xe01(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1294 <http_get_mime_type+0x174>
mov    -0x18(%rbp),%rdi
lea    0xe04(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1289 <http_get_mime_type+0x169>
lea    0xdf3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1294 <http_get_mime_type+0x174>
lea    0xd70(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<http_get_mime_type>:
push   %r14
push   %rbx
push   %rax
mov    $0x2e,%esi
call   1030 <strrchr@plt>
test   %rax,%rax
je     1202 <http_get_mime_type+0xe2>
mov    %rax,%rbx
lea    0xeca(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcmp@plt>
lea    0xec6(%rip),%r14
test   %rax,%rax
je     1209 <http_get_mime_type+0xe9>
lea    0xeb1(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1209 <http_get_mime_type+0xe9>
lea    0xea8(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
lea    0xea4(%rip),%r14
test   %rax,%rax
je     1209 <http_get_mime_type+0xe9>
lea    0xe92(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1209 <http_get_mime_type+0xe9>
lea    0xe8f(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1214 <http_get_mime_type+0xf4>
lea    0xe8a(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     121d <http_get_mime_type+0xfd>
lea    0xe84(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1226 <http_get_mime_type+0x106>
lea    0xe8b(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
lea    0xe7e(%rip),%rax
lea    0xe04(%rip),%r14
cmove  %rax,%r14
jmp    1209 <http_get_mime_type+0xe9>
lea    0xdf7(%rip),%r14
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe20(%rip),%r14
jmp    1209 <http_get_mime_type+0xe9>
lea    0xe26(%rip),%r14
jmp    1209 <http_get_mime_type+0xe9>
lea    0xe2a(%rip),%r14
jmp    1209 <http_get_mime_type+0xe9>

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

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