#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_OK;
int /*<<< orphan*/ evbuffer_add_printf(struct evbuffer *, char *);
struct evbuffer *evbuffer_new();
int /*<<< orphan*/ evhttp_send_reply(struct evhttp_request *,
                                     int /*<<< orphan*/, char *,
                                     struct evbuffer *);
void request_handler(struct evhttp_request *request, void *_server) {
  struct evbuffer *stdout = NULL;
  stdout = evbuffer_new();
  evbuffer_add_printf(stdout, "Hello world!\n");
  evhttp_send_reply(request, HTTP_OK, "OK", stdout);
}


x86 assembly (clang, -O0):
<request_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    $0x0,%al
call   1040 <evbuffer_new@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xea2(%rip),%rsi
call   1030 <evbuffer_add_printf@plt>
mov    -0x8(%rbp),%rdi
mov    0x2e72(%rip),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%rcx
lea    0xe93(%rip),%rdx
call   1050 <evhttp_send_reply@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<request_handler>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %eax,%eax
call   1040 <evbuffer_new@plt>
mov    %rax,%rbx
lea    0xeb8(%rip),%rsi
mov    %rax,%rdi
call   1030 <evbuffer_add_printf@plt>
mov    0x2e89(%rip),%rax
mov    (%rax),%esi
lea    0xeae(%rip),%rdx
mov    %r14,%rdi
mov    %rbx,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <evhttp_send_reply@plt>

LLVM IR (-O0):
%struct.evhttp_request = type { i32 }
%struct.evbuffer = type { i32 }
@.str = [14 x i8] c"Hello world!\0A\00"
@HTTP_OK = global i32 0
@.str.1 = [3 x i8] c"OK\00"
define void @request_handler(%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
store %struct.evbuffer* null, %struct.evbuffer** %5
%6 = call %struct.evbuffer* (...) @evbuffer_new()
store %struct.evbuffer* %6, %struct.evbuffer** %5
%7 = load %struct.evbuffer*, %struct.evbuffer** %5
%8 = call i32 @evbuffer_add_printf(%struct.evbuffer* %7, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%9 = load %struct.evhttp_request*, %struct.evhttp_request** %3
%10 = load i32, i32* @HTTP_OK
%11 = load %struct.evbuffer*, %struct.evbuffer** %5
%12 = call i32 @evhttp_send_reply(%struct.evhttp_request* %9, i32 %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %struct.evbuffer* %11)
ret void
}

LLVM IR (-O2):
%struct.evhttp_request = type { i32 }
%struct.evbuffer = type { i32 }
@.str = [14 x i8] c"Hello world!\0A\00"
@HTTP_OK = global i32 0
@.str.1 = [3 x i8] c"OK\00"
define void @request_handler(%struct.evhttp_request* %0, i8* nocapture readnone %1) {
%3 = tail call %struct.evbuffer* (...) @evbuffer_new()
%4 = tail call i32 @evbuffer_add_printf(%struct.evbuffer* %3, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @HTTP_OK
%6 = tail call i32 @evhttp_send_reply(%struct.evhttp_request* %0, i32 %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %struct.evbuffer* %3)
ret void
}