#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 sockaddr {
  int dummy;
};
struct event_base {
  int dummy;
};
struct evconnlistener {
  int dummy;
};
struct bufferevent {
  int dummy;
};
typedef int /*<<< orphan*/ evutil_socket_t;

/* Variables and functions */
struct bufferevent *create_event(struct event_base *, void *,
                                 int /*<<< orphan*/ *, int /*<<< orphan*/);
struct event_base *evconnlistener_get_base(struct evconnlistener *);
void on_accept(struct evconnlistener *serv, evutil_socket_t sock,
               struct sockaddr *addr, int addr_len, void *info) {
  struct event_base *base = evconnlistener_get_base(serv);
  struct bufferevent *bev = create_event(base, info, NULL, sock);
}


x86 assembly (clang, -O0):
<on_accept>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <evconnlistener_get_base@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0xc(%rbp),%ecx
xor    %eax,%eax
mov    %eax,%edx
call   1030 <create_event@plt>
mov    %rax,-0x38(%rbp)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<on_accept>:
push   %rbp
push   %rbx
push   %rax
mov    %r8,%rbx
mov    %esi,%ebp
call   1040 <evconnlistener_get_base@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
mov    %ebp,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <create_event@plt>

LLVM IR (-O0):
%struct.evconnlistener = type { i32 }
%struct.sockaddr = type { i32 }
%struct.event_base = type { i32 }
%struct.bufferevent = type { i32 }
define void @on_accept(%struct.evconnlistener* %0, i32 %1, %struct.sockaddr* %2, i32 %3, i8* %4) {
%6 = alloca %struct.evconnlistener*
%7 = alloca i32
%8 = alloca %struct.sockaddr*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca %struct.event_base*
%12 = alloca %struct.bufferevent*
store %struct.evconnlistener* %0, %struct.evconnlistener** %6
store i32 %1, i32* %7
store %struct.sockaddr* %2, %struct.sockaddr** %8
store i32 %3, i32* %9
store i8* %4, i8** %10
%13 = load %struct.evconnlistener*, %struct.evconnlistener** %6
%14 = call %struct.event_base* @evconnlistener_get_base(%struct.evconnlistener* %13)
store %struct.event_base* %14, %struct.event_base** %11
%15 = load %struct.event_base*, %struct.event_base** %11
%16 = load i8*, i8** %10
%17 = load i32, i32* %7
%18 = call %struct.bufferevent* @create_event(%struct.event_base* %15, i8* %16, i32* null, i32 %17)
store %struct.bufferevent* %18, %struct.bufferevent** %12
ret void
}

LLVM IR (-O2):
%struct.evconnlistener = type { i32 }
%struct.sockaddr = type { i32 }
%struct.event_base = type { i32 }
%struct.bufferevent = type { i32 }
define void @on_accept(%struct.evconnlistener* %0, i32 %1, %struct.sockaddr* nocapture readnone %2, i32 %3, i8* %4) {
%6 = tail call %struct.event_base* @evconnlistener_get_base(%struct.evconnlistener* %0)
%7 = tail call %struct.bufferevent* @create_event(%struct.event_base* %6, i8* %4, i32* null, i32 %1)
ret void
}