#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 evhttp_connection {
  int dummy;
};
struct event_base {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ EVHTTP_REQ_GET;
struct evhttp_connection *evhttp_connection_new(char const *, short);
int /*<<< orphan*/ evhttp_connection_set_base(struct evhttp_connection *,
                                              struct event_base *);
int /*<<< orphan*/ evhttp_make_request(struct evhttp_connection *,
                                       struct evhttp_request *,
                                       int /*<<< orphan*/, char const *);
struct evhttp_request *
evhttp_request_new(void (*)(struct evhttp_request *, void *), void *);
void enqueue_http_request(const char *host, short port, struct event_base *base,
                          const char *url,
                          void (*cb_end)(struct evhttp_request *, void *),
                          void *ptr) {
  struct evhttp_connection *evcon = evhttp_connection_new(host, port);
  struct evhttp_request *evreq = evhttp_request_new(cb_end, ptr);
  evhttp_connection_set_base(evcon, base);
  evhttp_make_request(evcon, evreq, EVHTTP_REQ_GET, url);
}


x86 assembly (clang, -O0):
<enqueue_http_request>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
movswl -0xa(%rbp),%esi
call   1060 <evhttp_connection_new@plt>
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1030 <evhttp_request_new@plt>
mov    %rax,-0x40(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <evhttp_connection_set_base@plt>
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    0x2e47(%rip),%rax
mov    (%rax),%edx
mov    -0x20(%rbp),%rcx
call   1040 <evhttp_make_request@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<enqueue_http_request>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %r9,%r14
mov    %r8,%r13
mov    %rcx,%r15
mov    %rdx,%r12
call   1060 <evhttp_connection_new@plt>
mov    %rax,%rbx
mov    %r13,%rdi
mov    %r14,%rsi
call   1030 <evhttp_request_new@plt>
mov    %rax,%r14
mov    %rbx,%rdi
mov    %r12,%rsi
call   1050 <evhttp_connection_set_base@plt>
mov    0x2e6b(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rcx
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1040 <evhttp_make_request@plt>

LLVM IR (-O0):
%struct.event_base = type { i32 }
%struct.evhttp_request = type { i32 }
%struct.evhttp_connection = type { i32 }
@EVHTTP_REQ_GET = global i32 0
define void @enqueue_http_request(i8* %0, i16 signext %1, %struct.event_base* %2, i8* %3, void (%struct.evhttp_request*, i8*)* %4, i8* %5) {
%7 = alloca i8*
%8 = alloca i16
%9 = alloca %struct.event_base*
%10 = alloca i8*
%11 = alloca void (%struct.evhttp_request*, i8*)*
%12 = alloca i8*
%13 = alloca %struct.evhttp_connection*
%14 = alloca %struct.evhttp_request*
store i8* %0, i8** %7
store i16 %1, i16* %8
store %struct.event_base* %2, %struct.event_base** %9
store i8* %3, i8** %10
store void (%struct.evhttp_request*, i8*)* %4, void (%struct.evhttp_request*, i8*)** %11
store i8* %5, i8** %12
%15 = load i8*, i8** %7
%16 = load i16, i16* %8
%17 = call %struct.evhttp_connection* @evhttp_connection_new(i8* %15, i16 signext %16)
store %struct.evhttp_connection* %17, %struct.evhttp_connection** %13
%18 = load void (%struct.evhttp_request*, i8*)*, void (%struct.evhttp_request*, i8*)** %11
%19 = load i8*, i8** %12
%20 = call %struct.evhttp_request* @evhttp_request_new(void (%struct.evhttp_request*, i8*)* %18, i8* %19)
store %struct.evhttp_request* %20, %struct.evhttp_request** %14
%21 = load %struct.evhttp_connection*, %struct.evhttp_connection** %13
%22 = load %struct.event_base*, %struct.event_base** %9
%23 = call i32 @evhttp_connection_set_base(%struct.evhttp_connection* %21, %struct.event_base* %22)
%24 = load %struct.evhttp_connection*, %struct.evhttp_connection** %13
%25 = load %struct.evhttp_request*, %struct.evhttp_request** %14
%26 = load i32, i32* @EVHTTP_REQ_GET
%27 = load i8*, i8** %10
%28 = call i32 @evhttp_make_request(%struct.evhttp_connection* %24, %struct.evhttp_request* %25, i32 %26, i8* %27)
ret void
}

LLVM IR (-O2):
%struct.event_base = type { i32 }
%struct.evhttp_request = type { i32 }
%struct.evhttp_connection = type { i32 }
@EVHTTP_REQ_GET = global i32 0
define void @enqueue_http_request(i8* %0, i16 signext %1, %struct.event_base* %2, i8* %3, void (%struct.evhttp_request*, i8*)* %4, i8* %5) {
%7 = tail call %struct.evhttp_connection* @evhttp_connection_new(i8* %0, i16 signext %1)
%8 = tail call %struct.evhttp_request* @evhttp_request_new(void (%struct.evhttp_request*, i8*)* %4, i8* %5)
%9 = tail call i32 @evhttp_connection_set_base(%struct.evhttp_connection* %7, %struct.event_base* %2)
%10 = load i32, i32* @EVHTTP_REQ_GET
%11 = tail call i32 @evhttp_make_request(%struct.evhttp_connection* %7, %struct.evhttp_request* %8, i32 %10, i8* %3)
ret void
}