#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*/ discardheaders(int);
int /*<<< orphan*/ send(int, char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, char const *);
int /*<<< orphan*/ strlen(char *);
void not_found(int client, const char *url) {
  char buf[1024] = "";
  char *txt = "HTTP/1.0 404 NOT FOUND\r\n"
              "Server: emhttpd 0.1.0\r\n"
              "Content-Type: text/html\r\n"
              "\r\n"
              "<HTML><TITLE>Not Found</TITLE>\r\n"
              "<BODY><P>404 NOT FOUND</p>\r\n"
              "your request because the resource specified\r\n"
              "is unavailable or nonexistent.\r\n";
  discardheaders(client);
  send(client, txt, strlen(txt), 0);
  sprintf(buf, "<br>url:%s", url);
  char *txt2 = "</BODY></HTML>\r\n";
  send(client, buf, strlen(buf), 0);
  send(client, txt2, strlen(txt2), 0);
}


x86 assembly (clang, -O0):
<not_found>:
push   %rbp
mov    %rsp,%rbp
sub    $0x450,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1050 <memset@plt>
lea    0xe84(%rip),%rax
mov    %rax,-0x418(%rbp)
mov    -0x4(%rbp),%edi
call   1060 <discardheaders@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x44c(%rbp)
mov    -0x418(%rbp),%rax
mov    %rax,-0x448(%rbp)
mov    -0x418(%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
mov    -0x10(%rbp),%rdx
lea    0xefe(%rip),%rsi
call   1070 <sprintf@plt>
lea    0xefd(%rip),%rax
mov    %rax,-0x420(%rbp)
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>
mov    -0x4(%rbp),%eax
mov    %eax,-0x42c(%rbp)
mov    -0x420(%rbp),%rax
mov    %rax,-0x428(%rbp)
mov    -0x420(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x42c(%rbp),%edi
mov    -0x428(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
add    $0x450,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<not_found>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x408,%rsp
mov    %rsi,%r15
mov    %edi,%ebx
mov    %rsp,%r14
mov    $0x400,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
mov    %ebx,%edi
call   1060 <discardheaders@plt>
lea    0xe7d(%rip),%r12
mov    %r12,%rdi
call   1030 <strlen@plt>
mov    %ebx,%edi
mov    %r12,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
lea    0xf34(%rip),%rsi
mov    %r14,%rdi
mov    %r15,%rdx
call   1070 <sprintf@plt>
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
lea    0xf17(%rip),%r14
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
add    $0x408,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [212 x i8] c"HTTP/1.0 404 NOT FOUND\0D\0AServer: emhttpd 0.1.0\0D\0AContent-Type: text/html\0D\0A\0D\0A<HTML><TITLE>Not Found</TITLE>\0D\0A<BODY><P>404 NOT FOUND</p>\0D\0Ayour request because the resource specified\0D\0Ais unavailable or nonexistent.\0D\0A\00"
@.str.1 = [11 x i8] c"<br>url:%s\00"
@.str.2 = [17 x i8] c"</BODY></HTML>\0D\0A\00"
define void @not_found(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca [1024 x i8]
%6 = alloca i8*
%7 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%8 = bitcast [1024 x i8]* %5 to i8*
store i8* getelementptr inbounds ([212 x i8], [212 x i8]* @.str, i64 0, i64 0), i8** %6
%9 = load i32, i32* %3
%10 = call i32 @discardheaders(i32 %9)
%11 = load i32, i32* %3
%12 = load i8*, i8** %6
%13 = load i8*, i8** %6
%14 = call i32 @strlen(i8* %13)
%15 = call i32 @send(i32 %11, i8* %12, i32 %14, i32 0)
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%17 = load i8*, i8** %4
%18 = call i32 @sprintf(i8* %16, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %17)
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8** %7
%19 = load i32, i32* %3
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%21 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%22 = call i32 @strlen(i8* %21)
%23 = call i32 @send(i32 %19, i8* %20, i32 %22, i32 0)
%24 = load i32, i32* %3
%25 = load i8*, i8** %7
%26 = load i8*, i8** %7
%27 = call i32 @strlen(i8* %26)
%28 = call i32 @send(i32 %24, i8* %25, i32 %27, i32 0)
ret void
}

LLVM IR (-O2):
@.str = [212 x i8] c"HTTP/1.0 404 NOT FOUND\0D\0AServer: emhttpd 0.1.0\0D\0AContent-Type: text/html\0D\0A\0D\0A<HTML><TITLE>Not Found</TITLE>\0D\0A<BODY><P>404 NOT FOUND</p>\0D\0Ayour request because the resource specified\0D\0Ais unavailable or nonexistent.\0D\0A\00"
@.str.1 = [11 x i8] c"<br>url:%s\00"
@.str.2 = [17 x i8] c"</BODY></HTML>\0D\0A\00"
define void @not_found(i32 %0, i8* %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @discardheaders(i32 %0)
%6 = tail call i32 @strlen(i8* getelementptr inbounds ([212 x i8], [212 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @send(i32 %0, i8* getelementptr inbounds ([212 x i8], [212 x i8]* @.str, i64 0, i64 0), i32 %6, i32 0)
%8 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%9 = call i32 @strlen(i8* %4)
%10 = call i32 @send(i32 %0, i8* %4, i32 %9, i32 0)
%11 = call i32 @strlen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @send(i32 %0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %11, i32 0)
ret void
}