#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 *, char *);
char *strrchr(char const *, char);
const char *httpd_mimetype(const char *url) {
  char *ext = strrchr(url, '.');
  if (ext) {
    if (!strcmp(ext, ".html"))
      return "text/html";
    if (!strcmp(ext, ".htm"))
      return "text/html";
    if (!strcmp(ext, ".css"))
      return "text/css";
    if (!strcmp(ext, ".js"))
      return "text/javascript";
    if (!strcmp(ext, ".txt"))
      return "text/plain";
    if (!strcmp(ext, ".gif"))
      return "image/gif";
    if (!strcmp(ext, ".jpg"))
      return "image/jpeg";
    if (!strcmp(ext, ".jpeg"))
      return "image/jpeg";
    if (!strcmp(ext, ".png"))
      return "image/png";
    if (!strcmp(ext, ".xbm"))
      return "image/xbm";
    if (!strcmp(ext, ".zip"))
      return "application/zip";
  }
  return "application/octet-stream";
}


x86 assembly (clang, -O0):
<httpd_mimetype>:
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     1311 <httpd_mimetype+0x1f1>
mov    -0x18(%rbp),%rdi
lea    0xeac(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1172 <httpd_mimetype+0x52>
lea    0xe9d(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    131c <httpd_mimetype+0x1fc>
mov    -0x18(%rbp),%rdi
lea    0xe93(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    119b <httpd_mimetype+0x7b>
lea    0xe74(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    131c <httpd_mimetype+0x1fc>
mov    -0x18(%rbp),%rdi
lea    0xe6f(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11c4 <httpd_mimetype+0xa4>
lea    0xe5f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    131c <httpd_mimetype+0x1fc>
mov    -0x18(%rbp),%rdi
lea    0xe54(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11ed <httpd_mimetype+0xcd>
lea    0xe43(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    131c <httpd_mimetype+0x1fc>
mov    -0x18(%rbp),%rdi
lea    0xe3f(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1216 <httpd_mimetype+0xf6>
lea    0xe2f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    131c <httpd_mimetype+0x1fc>
mov    -0x18(%rbp),%rdi
lea    0xe26(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    123f <httpd_mimetype+0x11f>
lea    0xe16(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    131c <httpd_mimetype+0x1fc>
mov    -0x18(%rbp),%rdi
lea    0xe0c(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1268 <httpd_mimetype+0x148>
lea    0xdfc(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    131c <httpd_mimetype+0x1fc>
mov    -0x18(%rbp),%rdi
lea    0xdf3(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1291 <httpd_mimetype+0x171>
lea    0xdd3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    131c <httpd_mimetype+0x1fc>
mov    -0x18(%rbp),%rdi
lea    0xdd0(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    12ba <httpd_mimetype+0x19a>
lea    0xdc0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    131c <httpd_mimetype+0x1fc>
mov    -0x18(%rbp),%rdi
lea    0xdb6(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    12e3 <httpd_mimetype+0x1c3>
lea    0xda6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    131c <httpd_mimetype+0x1fc>
mov    -0x18(%rbp),%rdi
lea    0xd9c(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    130c <httpd_mimetype+0x1ec>
lea    0xd8c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    131c <httpd_mimetype+0x1fc>
jmp    1311 <httpd_mimetype+0x1f1>
lea    0xd87(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<httpd_mimetype>:
push   %r14
push   %rbx
push   %rax
mov    $0x2e,%esi
call   1030 <strrchr@plt>
test   %rax,%rax
je     1231 <httpd_mimetype+0x111>
mov    %rax,%r14
lea    0xebf(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcmp@plt>
lea    0xeb6(%rip),%rbx
test   %eax,%eax
je     1238 <httpd_mimetype+0x118>
lea    0xeb1(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1238 <httpd_mimetype+0x118>
lea    0xe9f(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1243 <httpd_mimetype+0x123>
lea    0xe96(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     124c <httpd_mimetype+0x12c>
lea    0xe93(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1255 <httpd_mimetype+0x135>
lea    0xe8c(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     125e <httpd_mimetype+0x13e>
lea    0xe84(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
lea    0xe7a(%rip),%rbx
test   %eax,%eax
je     1238 <httpd_mimetype+0x118>
lea    0xe7a(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1238 <httpd_mimetype+0x118>
lea    0xe6d(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1267 <httpd_mimetype+0x147>
lea    0xe69(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1270 <httpd_mimetype+0x150>
lea    0xe65(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1279 <httpd_mimetype+0x159>
lea    0xe67(%rip),%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xdd0(%rip),%rbx
jmp    1238 <httpd_mimetype+0x118>
lea    0xdd4(%rip),%rbx
jmp    1238 <httpd_mimetype+0x118>
lea    0xde0(%rip),%rbx
jmp    1238 <httpd_mimetype+0x118>
lea    0xde7(%rip),%rbx
jmp    1238 <httpd_mimetype+0x118>
lea    0xe03(%rip),%rbx
jmp    1238 <httpd_mimetype+0x118>
lea    0xe09(%rip),%rbx
jmp    1238 <httpd_mimetype+0x118>
lea    0xe0f(%rip),%rbx
jmp    1238 <httpd_mimetype+0x118>

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

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