#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__ strstr(char *, char *);
char *get_type(char *uri) {
  if (strstr(uri, ".html")) {
    return "text/html";
  } else if (strstr(uri, ".css")) {
    return "text/css";
  } else if (strstr(uri, ".jpg")) {
    return "image/jpeg";
  } else if (strstr(uri, ".png")) {
    return "image/png";
  } else if (strstr(uri, ".gif")) {
    return "image/gif";
  } else {
    return "application/octet-stream";
  }
}


x86 assembly (clang, -O0):
<get_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strstr@plt>
cmp    $0x0,%rax
je     1146 <get_type+0x36>
lea    0xec9(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f9 <get_type+0xe9>
mov    -0x10(%rbp),%rdi
lea    0xebf(%rip),%rsi
call   1030 <strstr@plt>
cmp    $0x0,%rax
je     1170 <get_type+0x60>
lea    0xeae(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f9 <get_type+0xe9>
mov    -0x10(%rbp),%rdi
lea    0xea3(%rip),%rsi
call   1030 <strstr@plt>
cmp    $0x0,%rax
je     119a <get_type+0x8a>
lea    0xe92(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f9 <get_type+0xe9>
mov    -0x10(%rbp),%rdi
lea    0xe89(%rip),%rsi
call   1030 <strstr@plt>
cmp    $0x0,%rax
je     11c4 <get_type+0xb4>
lea    0xe78(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f9 <get_type+0xe9>
mov    -0x10(%rbp),%rdi
lea    0xe6e(%rip),%rsi
call   1030 <strstr@plt>
cmp    $0x0,%rax
je     11ee <get_type+0xde>
lea    0xe5d(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f9 <get_type+0xe9>
lea    0xe57(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_type>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rsi
call   1030 <strstr@plt>
test   %rax,%rax
je     112e <get_type+0x1e>
lea    0xeda(%rip),%rax
pop    %rbx
ret
lea    0xedb(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strstr@plt>
test   %rax,%rax
je     114b <get_type+0x3b>
lea    0xecc(%rip),%rax
pop    %rbx
ret
lea    0xecc(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strstr@plt>
test   %rax,%rax
je     1168 <get_type+0x58>
lea    0xebd(%rip),%rax
pop    %rbx
ret
lea    0xebf(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strstr@plt>
test   %rax,%rax
je     1185 <get_type+0x75>
lea    0xeb0(%rip),%rax
pop    %rbx
ret
lea    0xeb1(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strstr@plt>
test   %rax,%rax
lea    0xeae(%rip),%rcx
lea    0xe9d(%rip),%rax
cmove  %rcx,%rax
pop    %rbx
ret

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".css\00"
@.str.3 = [9 x i8] c"text/css\00"
@.str.4 = [5 x i8] c".jpg\00"
@.str.5 = [11 x i8] c"image/jpeg\00"
@.str.6 = [5 x i8] c".png\00"
@.str.7 = [10 x i8] c"image/png\00"
@.str.8 = [5 x i8] c".gif\00"
@.str.9 = [10 x i8] c"image/gif\00"
@.str.10 = [25 x i8] c"application/octet-stream\00"
define i8* @get_type(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i64 @strstr(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %29
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i64 @strstr(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %29
13: ; preds = %8
%14 = load i8*, i8** %3
%15 = call i64 @strstr(i8* %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %13
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %29
18: ; preds = %13
%19 = load i8*, i8** %3
%20 = call i64 @strstr(i8* %19, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %18
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %29
23: ; preds = %18
%24 = load i8*, i8** %3
%25 = call i64 @strstr(i8* %24, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %23
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %29
28: ; preds = %23
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0), i8** %2
br label %29
29: ; preds = %28, %27, %22, %17, %12, %7
%30 = load i8*, i8** %2
ret i8* %30
}

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".css\00"
@.str.3 = [9 x i8] c"text/css\00"
@.str.4 = [5 x i8] c".jpg\00"
@.str.5 = [11 x i8] c"image/jpeg\00"
@.str.6 = [5 x i8] c".png\00"
@.str.7 = [10 x i8] c"image/png\00"
@.str.8 = [5 x i8] c".gif\00"
@.str.9 = [10 x i8] c"image/gif\00"
@.str.10 = [25 x i8] c"application/octet-stream\00"
define i8* @get_type(i8* %0) {
%2 = tail call i64 @strstr(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %17
4: ; preds = %1
%5 = tail call i64 @strstr(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %17
7: ; preds = %4
%8 = tail call i64 @strstr(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %17
10: ; preds = %7
%11 = tail call i64 @strstr(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %10
%14 = tail call i64 @strstr(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
%16 = select i1 %15, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0)
br label %17
17: ; preds = %13, %10, %7, %4, %1
%18 = phi i8* [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), %1 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), %7 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), %10 ], [ %16, %13 ]
ret i8* %18
}