#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*/ printf(char *, char *, char *);
int /*<<< orphan*/ vn_get_mime_type(char *, char *);
int main(void) {
  char *filepath = "/index.html";
  char mime_type[50];
  vn_get_mime_type(filepath, mime_type);
  printf("filepath = %s, mime_type = %s\n", filepath, mime_type);
  filepath = "index.";
  vn_get_mime_type(filepath, mime_type);
  printf("filepath = %s, mime_type = %s\n", filepath, mime_type);
  filepath = "index";
  vn_get_mime_type(filepath, mime_type);
  printf("filepath = %s, mime_type = %s\n", filepath, mime_type);
  filepath = "index.pdf";
  vn_get_mime_type(filepath, mime_type);
  printf("filepath = %s, mime_type = %s\n", filepath, mime_type);
  filepath = "index.html.html";
  vn_get_mime_type(filepath, mime_type);
  printf("filepath = %s, mime_type = %s\n", filepath, mime_type);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1040 <vn_get_mime_type@plt>
mov    -0x10(%rbp),%rsi
lea    -0x50(%rbp),%rdx
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
lea    0xec9(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1040 <vn_get_mime_type@plt>
mov    -0x10(%rbp),%rsi
lea    -0x50(%rbp),%rdx
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
lea    0xea4(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1040 <vn_get_mime_type@plt>
mov    -0x10(%rbp),%rsi
lea    -0x50(%rbp),%rdx
lea    0xe5e(%rip),%rdi
call   1030 <printf@plt>
lea    0xe7e(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1040 <vn_get_mime_type@plt>
mov    -0x10(%rbp),%rsi
lea    -0x50(%rbp),%rdx
lea    0xe32(%rip),%rdi
call   1030 <printf@plt>
lea    0xe5c(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1040 <vn_get_mime_type@plt>
mov    -0x10(%rbp),%rsi
lea    -0x50(%rbp),%rdx
lea    0xe06(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
lea    0xed0(%rip),%r15
mov    %rsp,%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <vn_get_mime_type@plt>
lea    0xec7(%rip),%r14
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1030 <printf@plt>
lea    0xed1(%rip),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <vn_get_mime_type@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1030 <printf@plt>
lea    0xeb8(%rip),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <vn_get_mime_type@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1030 <printf@plt>
lea    0xe9e(%rip),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <vn_get_mime_type@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1030 <printf@plt>
lea    0xe88(%rip),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <vn_get_mime_type@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [12 x i8] c"/index.html\00"
@.str.1 = [31 x i8] c"filepath = %s, mime_type = %s\0A\00"
@.str.2 = [7 x i8] c"index.\00"
@.str.3 = [6 x i8] c"index\00"
@.str.4 = [10 x i8] c"index.pdf\00"
@.str.5 = [16 x i8] c"index.html.html\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca [50 x i8]
store i32 0, i32* %1
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%6 = call i32 @vn_get_mime_type(i8* %4, i8* %5)
%7 = load i8*, i8** %2
%8 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%9 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %7, i8* %8)
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8** %2
%10 = load i8*, i8** %2
%11 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%12 = call i32 @vn_get_mime_type(i8* %10, i8* %11)
%13 = load i8*, i8** %2
%14 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%15 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %13, i8* %14)
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8** %2
%16 = load i8*, i8** %2
%17 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%18 = call i32 @vn_get_mime_type(i8* %16, i8* %17)
%19 = load i8*, i8** %2
%20 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%21 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %19, i8* %20)
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8** %2
%22 = load i8*, i8** %2
%23 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%24 = call i32 @vn_get_mime_type(i8* %22, i8* %23)
%25 = load i8*, i8** %2
%26 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%27 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %25, i8* %26)
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i8** %2
%28 = load i8*, i8** %2
%29 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%30 = call i32 @vn_get_mime_type(i8* %28, i8* %29)
%31 = load i8*, i8** %2
%32 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%33 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %31, i8* %32)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"/index.html\00"
@.str.1 = [31 x i8] c"filepath = %s, mime_type = %s\0A\00"
@.str.2 = [7 x i8] c"index.\00"
@.str.3 = [6 x i8] c"index\00"
@.str.4 = [10 x i8] c"index.pdf\00"
@.str.5 = [16 x i8] c"index.html.html\00"
define i32 @main() {
%1 = alloca [50 x i8]
%2 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%3 = call i32 @vn_get_mime_type(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %2)
%5 = call i32 @vn_get_mime_type(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%6 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%7 = call i32 @vn_get_mime_type(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %2)
%8 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %2)
%9 = call i32 @vn_get_mime_type(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %2)
%10 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %2)
%11 = call i32 @vn_get_mime_type(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i8* %2)
%12 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i8* %2)
ret i32 0
}