#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*/ bzero(char *, int);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, char *, char *,
                           char *, char *);
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
void error404(int cliFd, char *uri) {
  char buff[1024];
  bzero(buff, 1024);
  sprintf(buff, "%s\r\n%s\r\n%s\r\n\r\n%s%s%s", "HTTP/1.1 404 Not Found",
          "Server: frihttp 1.0 (linux)", "Connection: Closed",
          "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML "
          "2.0//EN\">\n<html>\n<head>\n<title>404 Not "
          "Found</title>\n</head>\n<body>\n<h1>Not Found</h1>\n<p>The "
          "requested URL ",
          uri, " was not found on this server.</p>\n</body>\n</html>");
  write(cliFd, buff, strlen(buff));
}


x86 assembly (clang, -O0):
<error404>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x410(%rbp),%rdi
mov    $0x400,%esi
call   1050 <bzero@plt>
lea    -0x410(%rbp),%rdi
mov    -0x10(%rbp),%r10
lea    0xe8b(%rip),%rsi
lea    0xe99(%rip),%rdx
lea    0xea9(%rip),%rcx
lea    0xebe(%rip),%r8
lea    0xeca(%rip),%r9
lea    0xf59(%rip),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1060 <sprintf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x41c(%rbp)
lea    -0x410(%rbp),%rax
mov    %rax,-0x418(%rbp)
lea    -0x410(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x41c(%rbp),%edi
mov    -0x418(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<error404>:
push   %rbp
push   %r14
push   %rbx
sub    $0x400,%rsp
mov    %rsi,%rbp
mov    %edi,%r14d
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1050 <bzero@plt>
lea    0xf89(%rip),%rax
lea    0xe91(%rip),%rsi
lea    0xe9f(%rip),%rdx
lea    0xeaf(%rip),%rcx
lea    0xec4(%rip),%r8
lea    0xed0(%rip),%r9
mov    %rbx,%rdi
push   %rax
push   %rbp
call   1060 <sprintf@plt>
add    $0x10,%rsp
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"%s\0D\0A%s\0D\0A%s\0D\0A\0D\0A%s%s%s\00"
@.str.1 = [23 x i8] c"HTTP/1.1 404 Not Found\00"
@.str.2 = [28 x i8] c"Server: frihttp 1.0 (linux)\00"
@.str.3 = [19 x i8] c"Connection: Closed\00"
@.str.4 = [150 x i8] c"<!DOCTYPE HTML PUBLIC \22-//IETF//DTD HTML 2.0//EN\22>\0A<html>\0A<head>\0A<title>404 Not Found</title>\0A</head>\0A<body>\0A<h1>Not Found</h1>\0A<p>The requested URL \00"
@.str.5 = [51 x i8] c" was not found on this server.</p>\0A</body>\0A</html>\00"
define void @error404(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca [1024 x i8]
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%7 = call i32 @bzero(i8* %6, i32 1024)
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%9 = load i8*, i8** %4
%10 = call i32 @sprintf(i8* %8, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str.4, i64 0, i64 0), i8* %9, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.5, i64 0, i64 0))
%11 = load i32, i32* %3
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%14 = call i32 @strlen(i8* %13)
%15 = call i32 @write(i32 %11, i8* %12, i32 %14)
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"%s\0D\0A%s\0D\0A%s\0D\0A\0D\0A%s%s%s\00"
@.str.1 = [23 x i8] c"HTTP/1.1 404 Not Found\00"
@.str.2 = [28 x i8] c"Server: frihttp 1.0 (linux)\00"
@.str.3 = [19 x i8] c"Connection: Closed\00"
@.str.4 = [150 x i8] c"<!DOCTYPE HTML PUBLIC \22-//IETF//DTD HTML 2.0//EN\22>\0A<html>\0A<head>\0A<title>404 Not Found</title>\0A</head>\0A<body>\0A<h1>Not Found</h1>\0A<p>The requested URL \00"
@.str.5 = [51 x i8] c" was not found on this server.</p>\0A</body>\0A</html>\00"
define void @error404(i32 %0, i8* %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = call i32 @bzero(i8* %4, i32 1024)
%6 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str.4, i64 0, i64 0), i8* %1, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.5, i64 0, i64 0))
%7 = call i32 @strlen(i8* %4)
%8 = call i32 @write(i32 %0, i8* %4, i32 %7)
ret void
}