#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*/ strchr(char *, char);
scalar_t__ strcmp(int /*<<< orphan*/, char *);
char *getmime(char *filename) {
  if (strcmp(strchr(filename, '.'), ".html") == 0)
    return "\nContent-type: text/html\n\n";
  else if (strcmp(strchr(filename, '.'), ".js") == 0)
    return "\nContent-type: application/javascript\n\n";
  else if (strcmp(strchr(filename, '.'), ".txt") == 0)
    return "\nContent-type: text/plain\n\n";
  else if (strcmp(strchr(filename, '.'), ".css") == 0)
    return "\nContent-type: text/CSS\n\n";
  else
    return "\nContent-type: text/plain\n\n";
}


x86 assembly (clang, -O0):
<getmime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2e,%esi
call   1030 <strchr@plt>
mov    %eax,%edi
lea    0xebd(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1162 <getmime+0x42>
lea    0xead(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    120f <getmime+0xef>
mov    -0x10(%rbp),%rdi
mov    $0x2e,%esi
call   1030 <strchr@plt>
mov    %eax,%edi
lea    0xea8(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1198 <getmime+0x78>
lea    0xe96(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    120f <getmime+0xef>
mov    -0x10(%rbp),%rdi
mov    $0x2e,%esi
call   1030 <strchr@plt>
mov    %eax,%edi
lea    0xe9e(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11ce <getmime+0xae>
lea    0xe8d(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    120f <getmime+0xef>
mov    -0x10(%rbp),%rdi
mov    $0x2e,%esi
call   1030 <strchr@plt>
mov    %eax,%edi
lea    0xe89(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1204 <getmime+0xe4>
lea    0xe78(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    120f <getmime+0xef>
lea    0xe47(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getmime>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2e,%esi
call   1030 <strchr@plt>
lea    0xecb(%rip),%rsi
mov    %eax,%edi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11b3 <getmime+0x93>
mov    %rbx,%rdi
mov    $0x2e,%esi
call   1030 <strchr@plt>
lea    0xecc(%rip),%rsi
mov    %eax,%edi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11bc <getmime+0x9c>
mov    %rbx,%rdi
mov    $0x2e,%esi
call   1030 <strchr@plt>
lea    0xed8(%rip),%rsi
mov    %eax,%edi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11c5 <getmime+0xa5>
mov    %rbx,%rdi
mov    $0x2e,%esi
call   1030 <strchr@plt>
lea    0xed9(%rip),%rsi
mov    %eax,%edi
call   1040 <strcmp@plt>
test   %rax,%rax
lea    0xecd(%rip),%rcx
lea    0xea5(%rip),%rax
cmove  %rcx,%rax
pop    %rbx
ret
lea    0xe4c(%rip),%rax
pop    %rbx
ret
lea    0xe62(%rip),%rax
pop    %rbx
ret
lea    0xe86(%rip),%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c".html\00"
@.str.1 = [27 x i8] c"\0AContent-type: text/html\0A\0A\00"
@.str.2 = [4 x i8] c".js\00"
@.str.3 = [40 x i8] c"\0AContent-type: application/javascript\0A\0A\00"
@.str.4 = [5 x i8] c".txt\00"
@.str.5 = [28 x i8] c"\0AContent-type: text/plain\0A\0A\00"
@.str.6 = [5 x i8] c".css\00"
@.str.7 = [26 x i8] c"\0AContent-type: text/CSS\0A\0A\00"
define i8* @getmime(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32 @strchr(i8* %4, i8 signext 46)
%6 = call i64 @strcmp(i32 %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %28
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = call i32 @strchr(i8* %10, i8 signext 46)
%12 = call i64 @strcmp(i32 %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %9
store i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %28
15: ; preds = %9
%16 = load i8*, i8** %3
%17 = call i32 @strchr(i8* %16, i8 signext 46)
%18 = call i64 @strcmp(i32 %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %15
store i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %28
21: ; preds = %15
%22 = load i8*, i8** %3
%23 = call i32 @strchr(i8* %22, i8 signext 46)
%24 = call i64 @strcmp(i32 %23, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %21
store i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %28
27: ; preds = %21
store i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %28
28: ; preds = %27, %26, %20, %14, %8
%29 = load i8*, i8** %2
ret i8* %29
}

LLVM IR (-O2):
@.str = [6 x i8] c".html\00"
@.str.1 = [27 x i8] c"\0AContent-type: text/html\0A\0A\00"
@.str.2 = [4 x i8] c".js\00"
@.str.3 = [40 x i8] c"\0AContent-type: application/javascript\0A\0A\00"
@.str.4 = [5 x i8] c".txt\00"
@.str.5 = [28 x i8] c"\0AContent-type: text/plain\0A\0A\00"
@.str.6 = [5 x i8] c".css\00"
@.str.7 = [26 x i8] c"\0AContent-type: text/CSS\0A\0A\00"
define i8* @getmime(i8* %0) {
%2 = tail call i32 @strchr(i8* %0, i8 signext 46)
%3 = tail call i64 @strcmp(i32 %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i64 %3, 0
br i1 %4, label %18, label %5
5: ; preds = %1
%6 = tail call i32 @strchr(i8* %0, i8 signext 46)
%7 = tail call i64 @strcmp(i32 %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %18, label %9
9: ; preds = %5
%10 = tail call i32 @strchr(i8* %0, i8 signext 46)
%11 = tail call i64 @strcmp(i32 %10, 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 %18, label %13
13: ; preds = %9
%14 = tail call i32 @strchr(i8* %0, i8 signext 46)
%15 = tail call i64 @strcmp(i32 %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
%17 = select i1 %16, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0)
br label %18
18: ; preds = %13, %9, %5, %1
%19 = phi i8* [ getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), %1 ], [ getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), %5 ], [ getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), %9 ], [ %17, %13 ]
ret i8* %19
}