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

/* Variables and functions */
struct evhttp_connection *evhttp_connection_new(char const *, unsigned short);
int /*<<< orphan*/ evhttp_connection_set_base(struct evhttp_connection *,
                                              struct event_base *);
struct evhttp_connection *evhttp_connection_base_new(struct event_base *base,
                                                     void *ignore,
                                                     const char *address,
                                                     unsigned short port) {
  struct evhttp_connection *evcon;
  if (!base || !address || !port)
    return NULL;
  evcon = evhttp_connection_new(address, port);
  if (evcon)
    evhttp_connection_set_base(evcon, base);
  return evcon;
}


x86 assembly (clang, -O0):
<evhttp_connection_base_new>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %cx,%ax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ax,-0x22(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     115c <evhttp_connection_base_new+0x3c>
cmpq   $0x0,-0x20(%rbp)
je     115c <evhttp_connection_base_new+0x3c>
cmpw   $0x0,-0x22(%rbp)
jne    1169 <evhttp_connection_base_new+0x49>
movq   $0x0,-0x8(%rbp)
jmp    119a <evhttp_connection_base_new+0x7a>
mov    -0x20(%rbp),%rdi
movzwl -0x22(%rbp),%esi
call   1040 <evhttp_connection_new@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     1192 <evhttp_connection_base_new+0x72>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <evhttp_connection_set_base@plt>
mov    -0x30(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<evhttp_connection_base_new>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
test   %rdi,%rdi
je     115a <evhttp_connection_base_new+0x3a>
test   %rdx,%rdx
je     115a <evhttp_connection_base_new+0x3a>
test   %cx,%cx
je     115a <evhttp_connection_base_new+0x3a>
mov    %rdi,%r14
movzwl %cx,%esi
mov    %rdx,%rdi
call   1040 <evhttp_connection_new@plt>
test   %rax,%rax
je     1158 <evhttp_connection_base_new+0x38>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <evhttp_connection_set_base@plt>
jmp    115a <evhttp_connection_base_new+0x3a>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.evhttp_connection = type { i32 }
%struct.event_base = type { i32 }
define %struct.evhttp_connection* @evhttp_connection_base_new(%struct.event_base* %0, i8* %1, i8* %2, i16 zeroext %3) {
%5 = alloca %struct.evhttp_connection*
%6 = alloca %struct.event_base*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i16
%10 = alloca %struct.evhttp_connection*
store %struct.event_base* %0, %struct.event_base** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i16 %3, i16* %9
%11 = load %struct.event_base*, %struct.event_base** %6
%12 = icmp ne %struct.event_base* %11, null
br i1 %12, label %13, label %19
13: ; preds = %4
%14 = load i8*, i8** %8
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = load i16, i16* %9
%18 = icmp ne i16 %17, 0
br i1 %18, label %20, label %19
19: ; preds = %16, %13, %4
store %struct.evhttp_connection* null, %struct.evhttp_connection** %5
br label %32
20: ; preds = %16
%21 = load i8*, i8** %8
%22 = load i16, i16* %9
%23 = call %struct.evhttp_connection* @evhttp_connection_new(i8* %21, i16 zeroext %22)
store %struct.evhttp_connection* %23, %struct.evhttp_connection** %10
%24 = load %struct.evhttp_connection*, %struct.evhttp_connection** %10
%25 = icmp ne %struct.evhttp_connection* %24, null
br i1 %25, label %26, label %30
26: ; preds = %20
%27 = load %struct.evhttp_connection*, %struct.evhttp_connection** %10
%28 = load %struct.event_base*, %struct.event_base** %6
%29 = call i32 @evhttp_connection_set_base(%struct.evhttp_connection* %27, %struct.event_base* %28)
br label %30
30: ; preds = %26, %20
%31 = load %struct.evhttp_connection*, %struct.evhttp_connection** %10
store %struct.evhttp_connection* %31, %struct.evhttp_connection** %5
br label %32
32: ; preds = %30, %19
%33 = load %struct.evhttp_connection*, %struct.evhttp_connection** %5
ret %struct.evhttp_connection* %33
}

LLVM IR (-O2):
%struct.evhttp_connection = type { i32 }
%struct.event_base = type { i32 }
define %struct.evhttp_connection* @evhttp_connection_base_new(%struct.event_base* %0, i8* nocapture readnone %1, i8* %2, i16 zeroext %3) {
%5 = icmp ne %struct.event_base* %0, null
%6 = icmp ne i8* %2, null
%7 = and i1 %5, %6
%8 = icmp ne i16 %3, 0
%9 = and i1 %7, %8
br i1 %9, label %10, label %15
10: ; preds = %4
%11 = tail call %struct.evhttp_connection* @evhttp_connection_new(i8* %2, i16 zeroext %3)
%12 = icmp eq %struct.evhttp_connection* %11, null
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = tail call i32 @evhttp_connection_set_base(%struct.evhttp_connection* %11, %struct.event_base* %0)
br label %15
15: ; preds = %10, %13, %4
%16 = phi %struct.evhttp_connection* [ null, %4 ], [ %11, %13 ], [ null, %10 ]
ret %struct.evhttp_connection* %16
}