#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 mg_connection {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ mg_printf(struct mg_connection *, char *, int /*<<< orphan*/,
                             char *);
int /*<<< orphan*/ strlen(char *);
void send_404(struct mg_connection *conn) {
  char *msg = "404: File not found.";
  mg_printf(conn,
            "HTTP/1.1 404 Not Found"
            "Expires: Thu, 01-Jan-1970 00:00:01 GMT\r\n"
            "Cache: no-cache\r\n"
            "max-age: 0\r\n"
            "s-maxage: 0\r\n"
            "Cache-Control: no-cache, no-store, must-revalidate\r\n"
            "Content-Type: text/plain\r\n"
            "Content-Length: %d\r\n\r\n"
            "%s",
            strlen(msg), msg);
}


x86 assembly (clang, -O0):
<send_404>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%edx
mov    -0x10(%rbp),%rcx
lea    0xebc(%rip),%rsi
call   1030 <mg_printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_404>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xed2(%rip),%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
lea    0xed8(%rip),%rsi
mov    %rbx,%rdi
mov    %eax,%edx
mov    %r14,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <mg_printf@plt>

LLVM IR (-O0):
%struct.mg_connection = type { i32 }
@.str = [21 x i8] c"404: File not found.\00"
@.str.1 = [207 x i8] c"HTTP/1.1 404 Not FoundExpires: Thu, 01-Jan-1970 00:00:01 GMT\0D\0ACache: no-cache\0D\0Amax-age: 0\0D\0As-maxage: 0\0D\0ACache-Control: no-cache, no-store, must-revalidate\0D\0AContent-Type: text/plain\0D\0AContent-Length: %d\0D\0A\0D\0A%s\00"
define void @send_404(%struct.mg_connection* %0) {
%2 = alloca %struct.mg_connection*
%3 = alloca i8*
store %struct.mg_connection* %0, %struct.mg_connection** %2
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8** %3
%4 = load %struct.mg_connection*, %struct.mg_connection** %2
%5 = load i8*, i8** %3
%6 = call i32 @strlen(i8* %5)
%7 = load i8*, i8** %3
%8 = call i32 @mg_printf(%struct.mg_connection* %4, i8* getelementptr inbounds ([207 x i8], [207 x i8]* @.str.1, i64 0, i64 0), i32 %6, i8* %7)
ret void
}

LLVM IR (-O2):
%struct.mg_connection = type { i32 }
@.str = [21 x i8] c"404: File not found.\00"
@.str.1 = [207 x i8] c"HTTP/1.1 404 Not FoundExpires: Thu, 01-Jan-1970 00:00:01 GMT\0D\0ACache: no-cache\0D\0Amax-age: 0\0D\0As-maxage: 0\0D\0ACache-Control: no-cache, no-store, must-revalidate\0D\0AContent-Type: text/plain\0D\0AContent-Length: %d\0D\0A\0D\0A%s\00"
define void @send_404(%struct.mg_connection* %0) {
%2 = tail call i32 @strlen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @mg_printf(%struct.mg_connection* %0, i8* getelementptr inbounds ([207 x i8], [207 x i8]* @.str.1, i64 0, i64 0), i32 %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret void
}