#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 *);
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
void error400(int cliFd) {
  char buff[1024];
  bzero(buff, 1024);
  sprintf(buff, "%s\r\n%s\r\n%s\r\n\r\n%s%s", "HTTP/1.1 400 Bad Request",
          "Server: frihttp 1.0 (linux)", "Connection: Closed",
          "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML "
          "2.0//EN\">\n<html>\n<head>\n<title>400 Bad "
          "Request</title>\n</head>\n<body>\n<h1>Bad Request</h1>\n<p>",
          "Your browser sent a request that this server could not "
          "understand.</p>\n</body>\n</html>");
  write(cliFd, buff, strlen(buff));
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x410(%rbp),%rdi
mov    $0x400,%esi
call   1050 <bzero@plt>
lea    -0x410(%rbp),%rdi
lea    0xe93(%rip),%rsi
lea    0xe9f(%rip),%rdx
lea    0xeb1(%rip),%rcx
lea    0xec6(%rip),%r8
lea    0xed2(%rip),%r9
lea    0xf53(%rip),%rax
mov    %rax,(%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):
push   %rbp
push   %rbx
sub    $0x418,%rsp
mov    %edi,%ebp
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1050 <bzero@plt>
lea    0xf7f(%rip),%rax
mov    %rax,(%rsp)
lea    0xe91(%rip),%rsi
lea    0xe9d(%rip),%rdx
lea    0xeaf(%rip),%rcx
lea    0xec4(%rip),%r8
lea    0xed0(%rip),%r9
mov    %rbx,%rdi
call   1060 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
add    $0x418,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"%s\0D\0A%s\0D\0A%s\0D\0A\0D\0A%s%s\00"
@.str.1 = [25 x i8] c"HTTP/1.1 400 Bad Request\00"
@.str.2 = [28 x i8] c"Server: frihttp 1.0 (linux)\00"
@.str.3 = [19 x i8] c"Connection: Closed\00"
@.str.4 = [136 x i8] c"<!DOCTYPE HTML PUBLIC \22-//IETF//DTD HTML 2.0//EN\22>\0A<html>\0A<head>\0A<title>400 Bad Request</title>\0A</head>\0A<body>\0A<h1>Bad Request</h1>\0A<p>\00"
@.str.5 = [87 x i8] c"Your browser sent a request that this server could not understand.</p>\0A</body>\0A</html>\00"
define void @error400(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 @bzero(i8* %4, i32 1024)
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%7 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 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 ([136 x i8], [136 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str.5, 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 @write(i32 %8, i8* %9, i32 %11)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"%s\0D\0A%s\0D\0A%s\0D\0A\0D\0A%s%s\00"
@.str.1 = [25 x i8] c"HTTP/1.1 400 Bad Request\00"
@.str.2 = [28 x i8] c"Server: frihttp 1.0 (linux)\00"
@.str.3 = [19 x i8] c"Connection: Closed\00"
@.str.4 = [136 x i8] c"<!DOCTYPE HTML PUBLIC \22-//IETF//DTD HTML 2.0//EN\22>\0A<html>\0A<head>\0A<title>400 Bad Request</title>\0A</head>\0A<body>\0A<h1>Bad Request</h1>\0A<p>\00"
@.str.5 = [87 x i8] c"Your browser sent a request that this server could not understand.</p>\0A</body>\0A</html>\00"
define void @error400(i32 %0) {
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = call i32 @bzero(i8* %3, i32 1024)
%5 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 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 ([136 x i8], [136 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str.5, i64 0, i64 0))
%6 = call i32 @strlen(i8* %3)
%7 = call i32 @write(i32 %0, i8* %3, i32 %6)
ret void
}