#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 *, char *);
struct evbuffer *evbuffer_new();
int /*<<< orphan*/ evhttp_send_reply(struct evhttp_request *, int, char *,
                                     struct evbuffer *);
void general_request_cb(struct evhttp_request *req, void *arg) {
  struct evbuffer *evb = evbuffer_new();
  evbuffer_add_printf(evb, "%s", "<h1>It works!\n</h1>");
  evhttp_send_reply(req, 200, "ok", evb);
}


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

x86 assembly (clang, -O2):
<general_request_cb>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %eax,%eax
call   1040 <evbuffer_new@plt>
mov    %rax,%rbx
lea    0xeb8(%rip),%rsi
lea    0xeb4(%rip),%rdx
mov    %rax,%rdi
call   1030 <evbuffer_add_printf@plt>
lea    0xeb9(%rip),%rdx
mov    %r14,%rdi
mov    $0xc8,%esi
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 = [3 x i8] c"%s\00"
@.str.1 = [20 x i8] c"<h1>It works!\0A</h1>\00"
@.str.2 = [3 x i8] c"ok\00"
define void @general_request_cb(%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 @evbuffer_add_printf(%struct.evbuffer* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%9 = load %struct.evhttp_request*, %struct.evhttp_request** %3
%10 = load %struct.evbuffer*, %struct.evbuffer** %5
%11 = call i32 @evhttp_send_reply(%struct.evhttp_request* %9, i32 200, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), %struct.evbuffer* %10)
ret void
}

LLVM IR (-O2):
%struct.evhttp_request = type { i32 }
%struct.evbuffer = type { i32 }
@.str = [3 x i8] c"%s\00"
@.str.1 = [20 x i8] c"<h1>It works!\0A</h1>\00"
@.str.2 = [3 x i8] c"ok\00"
define void @general_request_cb(%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 ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @evhttp_send_reply(%struct.evhttp_request* %0, i32 200, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), %struct.evbuffer* %3)
ret void
}