#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*/ send(int, char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *);
int /*<<< orphan*/ strlen(char *);
void unimplemented(int fd) {
  char buf[1024];
  sprintf(buf, "HTTP/1.0 501 Method Not Implemented\r\n");
  sprintf(buf, "Server: tinyhttpd/0.1.0\r\n");
  send(fd, buf, strlen(buf), 0);
  sprintf(buf, "Content-Type: text/html\r\n");
  send(fd, buf, strlen(buf), 0);
  sprintf(buf, "\r\n");
  send(fd, buf, strlen(buf), 0);
  sprintf(buf, "<HTML><HEAD><TITLE>Method Not Implemented\r\n");
  send(fd, buf, strlen(buf), 0);
  sprintf(buf, "</TITLE></HEAD>\r\n");
  send(fd, buf, strlen(buf), 0);
  sprintf(buf, "<BODY><P>HTTP request method not supported.\r\n");
  send(fd, buf, strlen(buf), 0);
  sprintf(buf, "</BODY></HTML>\r\n");
  send(fd, buf, strlen(buf), 0);
}


x86 assembly (clang, -O0):
<unimplemented>:
push   %rbp
mov    %rsp,%rbp
sub    $0x480,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x410(%rbp),%rdi
lea    0xeb4(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x410(%rbp),%rdi
lea    0xec7(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x47c(%rbp)
lea    -0x410(%rbp),%rax
mov    %rax,-0x478(%rbp)
lea    -0x410(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x47c(%rbp),%edi
mov    -0x478(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
lea    -0x410(%rbp),%rdi
lea    0xe95(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x46c(%rbp)
lea    -0x410(%rbp),%rax
mov    %rax,-0x468(%rbp)
lea    -0x410(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x46c(%rbp),%edi
mov    -0x468(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
lea    -0x410(%rbp),%rdi
lea    0xecc(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x45c(%rbp)
lea    -0x410(%rbp),%rax
mov    %rax,-0x458(%rbp)
lea    -0x410(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x45c(%rbp),%edi
mov    -0x458(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
lea    -0x410(%rbp),%rdi
lea    0xe17(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x44c(%rbp)
lea    -0x410(%rbp),%rax
mov    %rax,-0x448(%rbp)
lea    -0x410(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x44c(%rbp),%edi
mov    -0x448(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
lea    -0x410(%rbp),%rdi
lea    0xdf7(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x43c(%rbp)
lea    -0x410(%rbp),%rax
mov    %rax,-0x438(%rbp)
lea    -0x410(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x43c(%rbp),%edi
mov    -0x438(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
lea    -0x410(%rbp),%rdi
lea    0xdbd(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x42c(%rbp)
lea    -0x410(%rbp),%rax
mov    %rax,-0x428(%rbp)
lea    -0x410(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x42c(%rbp),%edi
mov    -0x428(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
lea    -0x410(%rbp),%rdi
lea    0xd9f(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x41c(%rbp)
lea    -0x410(%rbp),%rax
mov    %rax,-0x418(%rbp)
lea    -0x410(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x41c(%rbp),%edi
mov    -0x418(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
add    $0x480,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unimplemented>:
push   %rbp
push   %rbx
sub    $0x408,%rsp
mov    %edi,%ebp
movups 0xece(%rip),%xmm0
movaps %xmm0,(%rsp)
movups 0xed3(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movabs $0xa0d6465746e65,%rax
mov    %rax,0x1e(%rsp)
movups 0xece(%rip),%xmm0
movaps %xmm0,(%rsp)
movups 0xecd(%rip),%xmm0
movups %xmm0,0xa(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
movups 0xeb8(%rip),%xmm0
movaps %xmm0,(%rsp)
movups 0xeb7(%rip),%xmm0
movups %xmm0,0xa(%rsp)
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
movw   $0xa0d,(%rsp)
movb   $0x0,0x2(%rsp)
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
movups 0xe84(%rip),%xmm0
movaps %xmm0,(%rsp)
movups 0xe89(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movups 0xe89(%rip),%xmm0
movups %xmm0,0x1c(%rsp)
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
movups 0xe77(%rip),%xmm0
movaps %xmm0,(%rsp)
movw   $0xa,0x10(%rsp)
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
movups 0xe61(%rip),%xmm0
movaps %xmm0,(%rsp)
movups 0xe66(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movups 0xe68(%rip),%xmm0
movups %xmm0,0x1e(%rsp)
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
movups 0xe56(%rip),%xmm0
movaps %xmm0,(%rsp)
movb   $0x0,0x10(%rsp)
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
add    $0x408,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [38 x i8] c"HTTP/1.0 501 Method Not Implemented\0D\0A\00"
@.str.1 = [26 x i8] c"Server: tinyhttpd/0.1.0\0D\0A\00"
@.str.2 = [26 x i8] c"Content-Type: text/html\0D\0A\00"
@.str.3 = [3 x i8] c"\0D\0A\00"
@.str.4 = [44 x i8] c"<HTML><HEAD><TITLE>Method Not Implemented\0D\0A\00"
@.str.5 = [18 x i8] c"</TITLE></HEAD>\0D\0A\00"
@.str.6 = [46 x i8] c"<BODY><P>HTTP request method not supported.\0D\0A\00"
@.str.7 = [17 x i8] c"</BODY></HTML>\0D\0A\00"
define void @unimplemented(i32 %0) {
%2 = alloca i32
%3 = alloca [1024 x i8]
store i32 %0, i32* %2
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%7 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%8 = load i32, i32* %2
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%11 = call i32 @strlen(i8* %10)
%12 = call i32 @send(i32 %8, i8* %9, i32 %11, i32 0)
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%14 = call i32 @sprintf(i8* %13, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%15 = load i32, i32* %2
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%17 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%18 = call i32 @strlen(i8* %17)
%19 = call i32 @send(i32 %15, i8* %16, i32 %18, i32 0)
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%21 = call i32 @sprintf(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%22 = load i32, i32* %2
%23 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%24 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%25 = call i32 @strlen(i8* %24)
%26 = call i32 @send(i32 %22, i8* %23, i32 %25, i32 0)
%27 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%28 = call i32 @sprintf(i8* %27, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0))
%29 = load i32, i32* %2
%30 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%31 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%32 = call i32 @strlen(i8* %31)
%33 = call i32 @send(i32 %29, i8* %30, i32 %32, i32 0)
%34 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%35 = call i32 @sprintf(i8* %34, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%36 = load i32, i32* %2
%37 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%38 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%39 = call i32 @strlen(i8* %38)
%40 = call i32 @send(i32 %36, i8* %37, i32 %39, i32 0)
%41 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%42 = call i32 @sprintf(i8* %41, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0))
%43 = load i32, i32* %2
%44 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%45 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%46 = call i32 @strlen(i8* %45)
%47 = call i32 @send(i32 %43, i8* %44, i32 %46, i32 0)
%48 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%49 = call i32 @sprintf(i8* %48, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0))
%50 = load i32, i32* %2
%51 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%52 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%53 = call i32 @strlen(i8* %52)
%54 = call i32 @send(i32 %50, i8* %51, i32 %53, i32 0)
ret void
}

LLVM IR (-O2):
@.str = [38 x i8] c"HTTP/1.0 501 Method Not Implemented\0D\0A\00"
@.str.1 = [26 x i8] c"Server: tinyhttpd/0.1.0\0D\0A\00"
@.str.2 = [26 x i8] c"Content-Type: text/html\0D\0A\00"
@.str.3 = [3 x i8] c"\0D\0A\00"
@.str.4 = [44 x i8] c"<HTML><HEAD><TITLE>Method Not Implemented\0D\0A\00"
@.str.5 = [18 x i8] c"</TITLE></HEAD>\0D\0A\00"
@.str.6 = [46 x i8] c"<BODY><P>HTTP request method not supported.\0D\0A\00"
@.str.7 = [17 x i8] c"</BODY></HTML>\0D\0A\00"
define void @unimplemented(i32 %0) {
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = call i32 @strlen(i8* %3)
%5 = call i32 @send(i32 %0, i8* %3, i32 %4, i32 0)
%6 = call i32 @strlen(i8* %3)
%7 = call i32 @send(i32 %0, i8* %3, i32 %6, i32 0)
%8 = call i32 @strlen(i8* %3)
%9 = call i32 @send(i32 %0, i8* %3, i32 %8, i32 0)
%10 = call i32 @strlen(i8* %3)
%11 = call i32 @send(i32 %0, i8* %3, i32 %10, i32 0)
%12 = call i32 @strlen(i8* %3)
%13 = call i32 @send(i32 %0, i8* %3, i32 %12, i32 0)
%14 = call i32 @strlen(i8* %3)
%15 = call i32 @send(i32 %0, i8* %3, i32 %14, i32 0)
%16 = call i32 @strlen(i8* %3)
%17 = call i32 @send(i32 %0, i8* %3, i32 %16, i32 0)
ret void
}