#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 const *, char);
const char *infer_content_type(const char *fn) {
  const char *ext = fn ? strrchr(fn, '.') : 0;
  if (!ext)
    return 0;
  ext++;
  if (!strcmp(ext, "svg"))
    return "image/svg+xml";
  if (!strcmp(ext, "js"))
    return "application/javascript";
  if (!strcmp(ext, "css"))
    return "text/css";
  if (!strcmp(ext, "png"))
    return "image/png";
  if (!strcmp(ext, "jpeg") || !strcmp(ext, "jpg"))
    return "image/jpeg";
  return 0;
}


x86 assembly (clang, -O0):
<infer_content_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     114e <infer_content_type+0x2e>
mov    -0x10(%rbp),%rdi
mov    $0x2e,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x20(%rbp)
jmp    1159 <infer_content_type+0x39>
xor    %eax,%eax
mov    %rax,-0x20(%rbp)
jmp    1159 <infer_content_type+0x39>
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1179 <infer_content_type+0x59>
movq   $0x0,-0x8(%rbp)
jmp    1273 <infer_content_type+0x153>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe70(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11ae <infer_content_type+0x8e>
lea    0xe5f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1273 <infer_content_type+0x153>
mov    -0x18(%rbp),%rdi
lea    0xe59(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11d7 <infer_content_type+0xb7>
lea    0xe47(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1273 <infer_content_type+0x153>
mov    -0x18(%rbp),%rdi
lea    0xe4f(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1200 <infer_content_type+0xe0>
lea    0xe35(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1273 <infer_content_type+0x153>
mov    -0x18(%rbp),%rdi
lea    0xe30(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1229 <infer_content_type+0x109>
lea    0xe15(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1273 <infer_content_type+0x153>
mov    -0x18(%rbp),%rdi
lea    0xe15(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
je     125b <infer_content_type+0x13b>
mov    -0x18(%rbp),%rdi
lea    0xdf2(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    126b <infer_content_type+0x14b>
lea    0xde1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1273 <infer_content_type+0x153>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<infer_content_type>:
push   %rbx
test   %rdi,%rdi
je     11c5 <infer_content_type+0xa5>
mov    $0x2e,%esi
call   1030 <strrchr@plt>
test   %rax,%rax
je     11c5 <infer_content_type+0xa5>
mov    %rax,%rbx
add    $0x1,%rbx
lea    0xeb5(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11c9 <infer_content_type+0xa9>
lea    0xeb4(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11d2 <infer_content_type+0xb2>
lea    0xec0(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11db <infer_content_type+0xbb>
lea    0xeb7(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11e4 <infer_content_type+0xc4>
lea    0xeb2(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11ed <infer_content_type+0xcd>
lea    0xe95(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
lea    0xe84(%rip),%rcx
cmove  %rcx,%rax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret
lea    0xe34(%rip),%rax
pop    %rbx
ret
lea    0xe3c(%rip),%rax
pop    %rbx
ret
lea    0xe4a(%rip),%rax
pop    %rbx
ret
lea    0xe4a(%rip),%rax
pop    %rbx
ret
lea    0xe4f(%rip),%rax
pop    %rbx
ret

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

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