#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 */
struct st_trx {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ send_msg(int, char *);
int /*<<< orphan*/ sprintf(char *, char *, ...);
void http_404(int fd, struct st_trx *wb_trx) {
  char buff[8192];
  sprintf(buff, "HTTP/1.0 404 NOT FOUND\r\n");
  sprintf(buff, "%sServer: xWebserver\r\n\r\n", buff);
  sprintf(buff, "%s<html><head><title>404 Not Found</title></head>", buff);
  sprintf(buff, "%s<body><h1>404 File Not found</h1></body></html>\r\n", buff);
  send_msg(fd, buff);
}


x86 assembly (clang, -O0):
<http_404>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2010,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x2010(%rbp),%rdi
lea    0xec0(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x2010(%rbp),%rdi
lea    -0x2010(%rbp),%rdx
lea    0xebd(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x2010(%rbp),%rdi
lea    -0x2010(%rbp),%rdx
lea    0xeba(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x2010(%rbp),%rdi
lea    -0x2010(%rbp),%rdx
lea    0xed0(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
mov    -0x4(%rbp),%edi
lea    -0x2010(%rbp),%rsi
call   1030 <send_msg@plt>
add    $0x2010,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<http_404>:
push   %rbp
push   %rbx
sub    $0x2008,%rsp
mov    %edi,%ebp
movups 0xed7(%rip),%xmm0
movups %xmm0,0x9(%rsp)
movups 0xec2(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xed0(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xed2(%rip),%rsi
mov    %rbx,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xef0(%rip),%rsi
mov    %rbx,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1030 <send_msg@plt>
add    $0x2008,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.st_trx = type { i32 }
@.str = [25 x i8] c"HTTP/1.0 404 NOT FOUND\0D\0A\00"
@.str.1 = [25 x i8] c"%sServer: xWebserver\0D\0A\0D\0A\00"
@.str.2 = [50 x i8] c"%s<html><head><title>404 Not Found</title></head>\00"
@.str.3 = [52 x i8] c"%s<body><h1>404 File Not found</h1></body></html>\0D\0A\00"
define void @http_404(i32 %0, %struct.st_trx* %1) {
%3 = alloca i32
%4 = alloca %struct.st_trx*
%5 = alloca [8192 x i8]
store i32 %0, i32* %3
store %struct.st_trx* %1, %struct.st_trx** %4
%6 = getelementptr inbounds [8192 x i8], [8192 x i8]* %5, i64 0, i64 0
%7 = call i32 (i8*, i8*, ...) @sprintf(i8* %6, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds [8192 x i8], [8192 x i8]* %5, i64 0, i64 0
%9 = getelementptr inbounds [8192 x i8], [8192 x i8]* %5, i64 0, i64 0
%10 = call i32 (i8*, i8*, ...) @sprintf(i8* %8, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = getelementptr inbounds [8192 x i8], [8192 x i8]* %5, i64 0, i64 0
%12 = getelementptr inbounds [8192 x i8], [8192 x i8]* %5, i64 0, i64 0
%13 = call i32 (i8*, i8*, ...) @sprintf(i8* %11, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds [8192 x i8], [8192 x i8]* %5, i64 0, i64 0
%15 = getelementptr inbounds [8192 x i8], [8192 x i8]* %5, i64 0, i64 0
%16 = call i32 (i8*, i8*, ...) @sprintf(i8* %14, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0), i8* %15)
%17 = load i32, i32* %3
%18 = getelementptr inbounds [8192 x i8], [8192 x i8]* %5, i64 0, i64 0
%19 = call i32 @send_msg(i32 %17, i8* %18)
ret void
}

LLVM IR (-O2):
%struct.st_trx = type { i32 }
@.str = [25 x i8] c"HTTP/1.0 404 NOT FOUND\0D\0A\00"
@.str.1 = [25 x i8] c"%sServer: xWebserver\0D\0A\0D\0A\00"
@.str.2 = [50 x i8] c"%s<html><head><title>404 Not Found</title></head>\00"
@.str.3 = [52 x i8] c"%s<body><h1>404 File Not found</h1></body></html>\0D\0A\00"
define void @http_404(i32 %0, %struct.st_trx* nocapture readnone %1) {
%3 = alloca [8192 x i8]
%4 = getelementptr inbounds [8192 x i8], [8192 x i8]* %3, i64 0, i64 0
%5 = call i32 (i8*, i8*, ...) @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = call i32 (i8*, i8*, ...) @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%7 = call i32 (i8*, i8*, ...) @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%8 = call i32 @send_msg(i32 %0, i8* %4)
ret void
}