#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 evhttp_request {
  int dummy;
};
struct evbuffer {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ evbuffer_add_printf(struct evbuffer *, char *, ...);
int /*<<< orphan*/ evbuffer_free(struct evbuffer *);
struct evbuffer *evbuffer_new();
int /*<<< orphan*/ evhttp_add_header(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ evhttp_request_get_output_headers(struct evhttp_request *);
int /*<<< orphan*/ evhttp_send_reply(struct evhttp_request *, int, char *,
                                     struct evbuffer *);
void _serveFileErr(struct evhttp_request *req, const char *msg) {
  struct evbuffer *errBuf = evbuffer_new();
  evbuffer_add_printf(errBuf, "<html><body>\n");
  evbuffer_add_printf(errBuf, "<h1>Internal LightShoppe Error</h1>\n");
  evbuffer_add_printf(errBuf, "<p>%s</p>\n", msg);
  evbuffer_add_printf(errBuf, "</body></html>\n");
  evhttp_add_header(evhttp_request_get_output_headers(req), "Content-Type",
                    "text/html");
  evhttp_send_reply(req, 404, "File Not Found", errBuf);
  evbuffer_free(errBuf);
}


x86 assembly (clang, -O0):
<_serveFileErr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1060 <evbuffer_new@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe7a(%rip),%rsi
mov    $0x0,%al
call   1040 <evbuffer_add_printf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe76(%rip),%rsi
mov    $0x0,%al
call   1040 <evbuffer_add_printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe85(%rip),%rsi
mov    $0x0,%al
call   1040 <evbuffer_add_printf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe7e(%rip),%rsi
mov    $0x0,%al
call   1040 <evbuffer_add_printf@plt>
mov    -0x8(%rbp),%rdi
call   1050 <evhttp_request_get_output_headers@plt>
mov    %eax,%edi
lea    0xe75(%rip),%rsi
lea    0xe7b(%rip),%rdx
call   1070 <evhttp_add_header@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x194,%esi
lea    0xe6c(%rip),%rdx
call   1080 <evhttp_send_reply@plt>
mov    -0x18(%rbp),%rdi
call   1030 <evbuffer_free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_serveFileErr>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
xor    %eax,%eax
call   1060 <evbuffer_new@plt>
mov    %rax,%rbx
lea    0xe84(%rip),%rsi
mov    %rax,%rdi
xor    %eax,%eax
call   1040 <evbuffer_add_printf@plt>
lea    0xe81(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <evbuffer_add_printf@plt>
lea    0xe95(%rip),%rsi
mov    %rbx,%rdi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <evbuffer_add_printf@plt>
lea    0xe8c(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <evbuffer_add_printf@plt>
mov    %r14,%rdi
call   1050 <evhttp_request_get_output_headers@plt>
lea    0xe83(%rip),%rsi
lea    0xe89(%rip),%rdx
mov    %eax,%edi
call   1070 <evhttp_add_header@plt>
lea    0xe85(%rip),%rdx
mov    %r14,%rdi
mov    $0x194,%esi
mov    %rbx,%rcx
call   1080 <evhttp_send_reply@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <evbuffer_free@plt>

LLVM IR (-O0):
%struct.evhttp_request = type { i32 }
%struct.evbuffer = type { i32 }
@.str = [14 x i8] c"<html><body>\0A\00"
@.str.1 = [37 x i8] c"<h1>Internal LightShoppe Error</h1>\0A\00"
@.str.2 = [11 x i8] c"<p>%s</p>\0A\00"
@.str.3 = [16 x i8] c"</body></html>\0A\00"
@.str.4 = [13 x i8] c"Content-Type\00"
@.str.5 = [10 x i8] c"text/html\00"
@.str.6 = [15 x i8] c"File Not Found\00"
define void @_serveFileErr(%struct.evhttp_request* %0, i8* %1) {
%3 = alloca %struct.evhttp_request*
%4 = alloca i8*
%5 = alloca %struct.evbuffer*
store %struct.evhttp_request* %0, %struct.evhttp_request** %3
store i8* %1, i8** %4
%6 = call %struct.evbuffer* (...) @evbuffer_new()
store %struct.evbuffer* %6, %struct.evbuffer** %5
%7 = load %struct.evbuffer*, %struct.evbuffer** %5
%8 = call i32 (%struct.evbuffer*, i8*, ...) @evbuffer_add_printf(%struct.evbuffer* %7, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%9 = load %struct.evbuffer*, %struct.evbuffer** %5
%10 = call i32 (%struct.evbuffer*, i8*, ...) @evbuffer_add_printf(%struct.evbuffer* %9, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
%11 = load %struct.evbuffer*, %struct.evbuffer** %5
%12 = load i8*, i8** %4
%13 = call i32 (%struct.evbuffer*, i8*, ...) @evbuffer_add_printf(%struct.evbuffer* %11, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %12)
%14 = load %struct.evbuffer*, %struct.evbuffer** %5
%15 = call i32 (%struct.evbuffer*, i8*, ...) @evbuffer_add_printf(%struct.evbuffer* %14, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%16 = load %struct.evhttp_request*, %struct.evhttp_request** %3
%17 = call i32 @evhttp_request_get_output_headers(%struct.evhttp_request* %16)
%18 = call i32 @evhttp_add_header(i32 %17, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%19 = load %struct.evhttp_request*, %struct.evhttp_request** %3
%20 = load %struct.evbuffer*, %struct.evbuffer** %5
%21 = call i32 @evhttp_send_reply(%struct.evhttp_request* %19, i32 404, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), %struct.evbuffer* %20)
%22 = load %struct.evbuffer*, %struct.evbuffer** %5
%23 = call i32 @evbuffer_free(%struct.evbuffer* %22)
ret void
}

LLVM IR (-O2):
%struct.evhttp_request = type { i32 }
%struct.evbuffer = type { i32 }
@.str = [14 x i8] c"<html><body>\0A\00"
@.str.1 = [37 x i8] c"<h1>Internal LightShoppe Error</h1>\0A\00"
@.str.2 = [11 x i8] c"<p>%s</p>\0A\00"
@.str.3 = [16 x i8] c"</body></html>\0A\00"
@.str.4 = [13 x i8] c"Content-Type\00"
@.str.5 = [10 x i8] c"text/html\00"
@.str.6 = [15 x i8] c"File Not Found\00"
define void @_serveFileErr(%struct.evhttp_request* %0, i8* %1) {
%3 = tail call %struct.evbuffer* (...) @evbuffer_new()
%4 = tail call i32 (%struct.evbuffer*, i8*, ...) @evbuffer_add_printf(%struct.evbuffer* %3, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 (%struct.evbuffer*, i8*, ...) @evbuffer_add_printf(%struct.evbuffer* %3, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 (%struct.evbuffer*, i8*, ...) @evbuffer_add_printf(%struct.evbuffer* %3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %1)
%7 = tail call i32 (%struct.evbuffer*, i8*, ...) @evbuffer_add_printf(%struct.evbuffer* %3, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%8 = tail call i32 @evhttp_request_get_output_headers(%struct.evhttp_request* %0)
%9 = tail call i32 @evhttp_add_header(i32 %8, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%10 = tail call i32 @evhttp_send_reply(%struct.evhttp_request* %0, i32 404, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), %struct.evbuffer* %3)
%11 = tail call i32 @evbuffer_free(%struct.evbuffer* %3)
ret void
}