#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;
};
typedef int /*<<< orphan*/ evutil_socket_t;
typedef int /*<<< orphan*/ SSL_CTX;

/* Variables and functions */
struct event_base *evconnlistener_get_base(struct evconnlistener *);
int /*<<< orphan*/ new_connection(struct event_base *, int /*<<< orphan*/ *,
                                  int /*<<< orphan*/, struct sockaddr *, int);
void listener_cb(struct evconnlistener *listener, evutil_socket_t fd,
                 struct sockaddr *sa, int socklen, void *arg) {
  SSL_CTX *ctx = arg;
  struct event_base *base = evconnlistener_get_base(listener);
  new_connection(base, ctx, fd, sa, socklen);
}


x86 assembly (clang, -O0):
<listener_cb>:
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    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <evconnlistener_get_base@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
call   1040 <new_connection@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<listener_cb>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %r8,%r15
mov    %ecx,%r14d
mov    %rdx,%rbp
mov    %esi,%ebx
call   1030 <evconnlistener_get_base@plt>
mov    %rax,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
mov    %rbp,%rcx
mov    %r14d,%r8d
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <new_connection@plt>

LLVM IR (-O0):
%struct.evconnlistener = type { i32 }
%struct.sockaddr = type { i32 }
%struct.event_base = type { i32 }
define void @listener_cb(%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 i32*
%12 = alloca %struct.event_base*
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 i8*, i8** %10
%14 = bitcast i8* %13 to i32*
store i32* %14, i32** %11
%15 = load %struct.evconnlistener*, %struct.evconnlistener** %6
%16 = call %struct.event_base* @evconnlistener_get_base(%struct.evconnlistener* %15)
store %struct.event_base* %16, %struct.event_base** %12
%17 = load %struct.event_base*, %struct.event_base** %12
%18 = load i32*, i32** %11
%19 = load i32, i32* %7
%20 = load %struct.sockaddr*, %struct.sockaddr** %8
%21 = load i32, i32* %9
%22 = call i32 @new_connection(%struct.event_base* %17, i32* %18, i32 %19, %struct.sockaddr* %20, i32 %21)
ret void
}

LLVM IR (-O2):
%struct.evconnlistener = type { i32 }
%struct.sockaddr = type { i32 }
%struct.event_base = type { i32 }
define void @listener_cb(%struct.evconnlistener* %0, i32 %1, %struct.sockaddr* %2, i32 %3, i8* %4) {
%6 = bitcast i8* %4 to i32*
%7 = tail call %struct.event_base* @evconnlistener_get_base(%struct.evconnlistener* %0)
%8 = tail call i32 @new_connection(%struct.event_base* %7, i32* %6, i32 %1, %struct.sockaddr* %2, i32 %3)
ret void
}