#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 *find_contenttype(char *path) {
  char *extension = strrchr(path, '.');
  if (extension != NULL) {
    if ((strcmp(extension, ".html") == 0 || strcmp(extension, ".htm") == 0)) {
      return "text/html";
    } else if (strcmp(extension, ".jpg") == 0) {
      return "image/jpeg";
    } else if (strcmp(extension, ".png") == 0) {
      return "image/png";
    } else if (strcmp(extension, ".gif") == 0) {
      return "image/gif";
    } else if (strcmp(extension, ".css") == 0) {
      return "text/css";
    } else if (strcmp(extension, ".txt") == 0 || strcmp(extension, ".c") == 0 ||
               strcmp(extension, ".cpp") == 0 ||
               strcmp(extension, ".log") == 0) {
      return "text/plain";
    }
  }
  return "application/octet-stream";
}


x86 assembly (clang, -O0):
<find_contenttype>:
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)
je     12cb <find_contenttype+0x1ab>
mov    -0x18(%rbp),%rdi
lea    0xeac(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     117d <find_contenttype+0x5d>
mov    -0x18(%rbp),%rdi
lea    0xe98(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    118d <find_contenttype+0x6d>
lea    0xe87(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12d6 <find_contenttype+0x1b6>
mov    -0x18(%rbp),%rdi
lea    0xe7d(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11b7 <find_contenttype+0x97>
lea    0xe6c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12d6 <find_contenttype+0x1b6>
mov    -0x18(%rbp),%rdi
lea    0xe63(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11e1 <find_contenttype+0xc1>
lea    0xe52(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12d6 <find_contenttype+0x1b6>
mov    -0x18(%rbp),%rdi
lea    0xe48(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    120b <find_contenttype+0xeb>
lea    0xe37(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12d6 <find_contenttype+0x1b6>
mov    -0x18(%rbp),%rdi
lea    0xe2d(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1235 <find_contenttype+0x115>
lea    0xe1c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12d6 <find_contenttype+0x1b6>
mov    -0x18(%rbp),%rdi
lea    0xe11(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     129d <find_contenttype+0x17d>
mov    -0x18(%rbp),%rdi
lea    0xdfc(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     129d <find_contenttype+0x17d>
mov    -0x18(%rbp),%rdi
lea    0xde5(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     129d <find_contenttype+0x17d>
mov    -0x18(%rbp),%rdi
lea    0xdd0(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    12ad <find_contenttype+0x18d>
lea    0xdbf(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12d6 <find_contenttype+0x1b6>
jmp    12b2 <find_contenttype+0x192>
jmp    12b7 <find_contenttype+0x197>
jmp    12bc <find_contenttype+0x19c>
jmp    12c1 <find_contenttype+0x1a1>
jmp    12c6 <find_contenttype+0x1a6>
jmp    12cb <find_contenttype+0x1ab>
lea    0xd9c(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_contenttype>:
push   %r14
push   %rbx
push   %rax
mov    $0x2e,%esi
call   1030 <strrchr@plt>
test   %rax,%rax
je     1228 <find_contenttype+0x108>
mov    %rax,%rbx
lea    0xebf(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcmp@plt>
lea    0xebb(%rip),%r14
test   %rax,%rax
je     122f <find_contenttype+0x10f>
lea    0xea6(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     122f <find_contenttype+0x10f>
lea    0xe9d(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     123a <find_contenttype+0x11a>
lea    0xe95(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1243 <find_contenttype+0x123>
lea    0xe8c(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     124c <find_contenttype+0x12c>
lea    0xe83(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1255 <find_contenttype+0x135>
lea    0xe79(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
lea    0xe7c(%rip),%r14
test   %rax,%rax
je     122f <find_contenttype+0x10f>
lea    0xe63(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     122f <find_contenttype+0x10f>
lea    0xe52(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     122f <find_contenttype+0x10f>
lea    0xe43(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     122f <find_contenttype+0x10f>
lea    0xe3f(%rip),%r14
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xdd9(%rip),%r14
jmp    122f <find_contenttype+0x10f>
lea    0xde0(%rip),%r14
jmp    122f <find_contenttype+0x10f>
lea    0xde6(%rip),%r14
jmp    122f <find_contenttype+0x10f>
lea    0xdec(%rip),%r14
jmp    122f <find_contenttype+0x10f>

LLVM IR (-O0):
@.str = [6 x i8] c".html\00"
@.str.1 = [5 x i8] c".htm\00"
@.str.2 = [10 x i8] c"text/html\00"
@.str.3 = [5 x i8] c".jpg\00"
@.str.4 = [11 x i8] c"image/jpeg\00"
@.str.5 = [5 x i8] c".png\00"
@.str.6 = [10 x i8] c"image/png\00"
@.str.7 = [5 x i8] c".gif\00"
@.str.8 = [10 x i8] c"image/gif\00"
@.str.9 = [5 x i8] c".css\00"
@.str.10 = [9 x i8] c"text/css\00"
@.str.11 = [5 x i8] c".txt\00"
@.str.12 = [3 x i8] c".c\00"
@.str.13 = [5 x i8] c".cpp\00"
@.str.14 = [5 x i8] c".log\00"
@.str.15 = [11 x i8] c"text/plain\00"
@.str.16 = [25 x i8] c"application/octet-stream\00"
define i8* @find_contenttype(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 %9, label %61
9: ; preds = %1
%10 = load i8*, i8** %4
%11 = call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %17, label %13
13: ; preds = %9
%14 = load i8*, i8** %4
%15 = call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %13, %9
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %62
18: ; preds = %13
%19 = load i8*, i8** %4
%20 = call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %18
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %62
23: ; preds = %18
%24 = load i8*, i8** %4
%25 = call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %23
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %62
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 %62
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 %62
38: ; preds = %33
%39 = load i8*, i8** %4
%40 = call i64 @strcmp(i8* %39, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0))
%41 = icmp eq i64 %40, 0
br i1 %41, label %54, label %42
42: ; preds = %38
%43 = load i8*, i8** %4
%44 = call i64 @strcmp(i8* %43, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0))
%45 = icmp eq i64 %44, 0
br i1 %45, label %54, label %46
46: ; preds = %42
%47 = load i8*, i8** %4
%48 = call i64 @strcmp(i8* %47, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0))
%49 = icmp eq i64 %48, 0
br i1 %49, label %54, label %50
50: ; preds = %46
%51 = load i8*, i8** %4
%52 = call i64 @strcmp(i8* %51, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0))
%53 = icmp eq i64 %52, 0
br i1 %53, label %54, label %55
54: ; preds = %50, %46, %42, %38
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i64 0, i64 0), i8** %2
br label %62
55: ; preds = %50
br label %56
56: ; preds = %55
br label %57
57: ; preds = %56
br label %58
58: ; preds = %57
br label %59
59: ; preds = %58
br label %60
60: ; preds = %59
br label %61
61: ; preds = %60, %1
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.16, i64 0, i64 0), i8** %2
br label %62
62: ; preds = %61, %54, %37, %32, %27, %22, %17
%63 = load i8*, i8** %2
ret i8* %63
}

LLVM IR (-O2):
@.str = [6 x i8] c".html\00"
@.str.1 = [5 x i8] c".htm\00"
@.str.2 = [10 x i8] c"text/html\00"
@.str.3 = [5 x i8] c".jpg\00"
@.str.4 = [11 x i8] c"image/jpeg\00"
@.str.5 = [5 x i8] c".png\00"
@.str.6 = [10 x i8] c"image/png\00"
@.str.7 = [5 x i8] c".gif\00"
@.str.8 = [10 x i8] c"image/gif\00"
@.str.9 = [5 x i8] c".css\00"
@.str.10 = [9 x i8] c"text/css\00"
@.str.11 = [5 x i8] c".txt\00"
@.str.12 = [3 x i8] c".c\00"
@.str.13 = [5 x i8] c".cpp\00"
@.str.14 = [5 x i8] c".log\00"
@.str.15 = [11 x i8] c"text/plain\00"
@.str.16 = [25 x i8] c"application/octet-stream\00"
define i8* @find_contenttype(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 46)
%3 = icmp eq i8* %2, null
br i1 %3, label %34, label %4
4: ; preds = %1
%5 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %35, label %7
7: ; preds = %4
%8 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %35, label %10
10: ; preds = %7
%11 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %35, label %13
13: ; preds = %10
%14 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %35, 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 %35, 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 %35, label %22
22: ; preds = %19
%23 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %35, label %25
25: ; preds = %22
%26 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %35, label %28
28: ; preds = %25
%29 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %35, label %31
31: ; preds = %28
%32 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %35, label %34
34: ; preds = %31, %1
br label %35
35: ; preds = %22, %25, %28, %31, %19, %16, %13, %10, %4, %7, %34
%36 = phi i8* [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.16, i64 0, i64 0), %34 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), %7 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), %4 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), %10 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), %13 ], [ 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 ([11 x i8], [11 x i8]* @.str.15, i64 0, i64 0), %31 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i64 0, i64 0), %28 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i64 0, i64 0), %25 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i64 0, i64 0), %22 ]
ret i8* %36
}