#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*/ HTTP_MOVETEMP;
int /*<<< orphan*/ evbuffer_free(struct evbuffer *);
struct evbuffer *evbuffer_new();
int /*<<< orphan*/ evhttp_add_header(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ evhttp_request_get_output_headers(struct evhttp_request *);
int /*<<< orphan*/ evhttp_send_reply(struct evhttp_request *,
                                     int /*<<< orphan*/, char *,
                                     struct evbuffer *);
void reply_redirect(struct evhttp_request *req, const char *where) {
  struct evbuffer *buf;
  buf = evbuffer_new();
  evhttp_add_header(evhttp_request_get_output_headers(req), "Location", where);
  evhttp_send_reply(req, HTTP_MOVETEMP, "If you were so kind", buf);
  evbuffer_free(buf);
}


x86 assembly (clang, -O0):
<reply_redirect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <evbuffer_new@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <evhttp_request_get_output_headers@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rdx
lea    0xe7f(%rip),%rsi
call   1060 <evhttp_add_header@plt>
mov    -0x8(%rbp),%rdi
mov    0x2e4f(%rip),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%rcx
lea    0xe6b(%rip),%rdx
call   1070 <evhttp_send_reply@plt>
mov    -0x18(%rbp),%rdi
call   1030 <evbuffer_free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reply_redirect>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
xor    %eax,%eax
call   1050 <evbuffer_new@plt>
mov    %rax,%rbx
mov    %r15,%rdi
call   1040 <evhttp_request_get_output_headers@plt>
lea    0xe8c(%rip),%rsi
mov    %eax,%edi
mov    %r14,%rdx
call   1060 <evhttp_add_header@plt>
mov    0x2e5b(%rip),%rax
mov    (%rax),%esi
lea    0xe7b(%rip),%rdx
mov    %r15,%rdi
mov    %rbx,%rcx
call   1070 <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 = [9 x i8] c"Location\00"
@HTTP_MOVETEMP = global i32 0
@.str.1 = [20 x i8] c"If you were so kind\00"
define void @reply_redirect(%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.evhttp_request*, %struct.evhttp_request** %3
%8 = call i32 @evhttp_request_get_output_headers(%struct.evhttp_request* %7)
%9 = load i8*, i8** %4
%10 = call i32 @evhttp_add_header(i32 %8, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = load %struct.evhttp_request*, %struct.evhttp_request** %3
%12 = load i32, i32* @HTTP_MOVETEMP
%13 = load %struct.evbuffer*, %struct.evbuffer** %5
%14 = call i32 @evhttp_send_reply(%struct.evhttp_request* %11, i32 %12, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), %struct.evbuffer* %13)
%15 = load %struct.evbuffer*, %struct.evbuffer** %5
%16 = call i32 @evbuffer_free(%struct.evbuffer* %15)
ret void
}

LLVM IR (-O2):
%struct.evhttp_request = type { i32 }
%struct.evbuffer = type { i32 }
@.str = [9 x i8] c"Location\00"
@HTTP_MOVETEMP = global i32 0
@.str.1 = [20 x i8] c"If you were so kind\00"
define void @reply_redirect(%struct.evhttp_request* %0, i8* %1) {
%3 = tail call %struct.evbuffer* (...) @evbuffer_new()
%4 = tail call i32 @evhttp_request_get_output_headers(%struct.evhttp_request* %0)
%5 = tail call i32 @evhttp_add_header(i32 %4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %1)
%6 = load i32, i32* @HTTP_MOVETEMP
%7 = tail call i32 @evhttp_send_reply(%struct.evhttp_request* %0, i32 %6, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), %struct.evbuffer* %3)
%8 = tail call i32 @evbuffer_free(%struct.evbuffer* %3)
ret void
}