#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 addrinfo {
  int ai_family;
  int /*<<< orphan*/ ai_addrlen;
  int /*<<< orphan*/ ai_addr;
  int /*<<< orphan*/ ai_protocol;
  int /*<<< orphan*/ ai_socktype;
  struct addrinfo *ai_next;
  int /*<<< orphan*/ ai_flags;
};
typedef int /*<<< orphan*/ hints;

/* Variables and functions */
int /*<<< orphan*/ AI_PASSIVE;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SOMAXCONN;
int /*<<< orphan*/ SO_REUSEADDR;
scalar_t__ bind(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ eerror(char *);
int /*<<< orphan*/ error(char *, ...);
int /*<<< orphan*/ freeaddrinfo(struct addrinfo *);
int /*<<< orphan*/ gai_strerror(int);
int getaddrinfo(char const *, char const *, struct addrinfo *,
                struct addrinfo **);
int /*<<< orphan*/ info(char *, char *, char const *);
scalar_t__ listen(int, int /*<<< orphan*/);
int /*<<< orphan*/ memset(struct addrinfo *, int /*<<< orphan*/, int);
scalar_t__ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, int *, int);
int socket(int, int /*<<< orphan*/, int /*<<< orphan*/);
int getaddrlistener(const char *address, const char *service, int family) {
  struct addrinfo hints;
  struct addrinfo *servinfos;
  struct addrinfo *servinfo;
  int reuseaddr = 1;
  int ret;
  memset(&hints, 0, sizeof(hints));
  hints.ai_family = family;
  hints.ai_socktype = SOCK_STREAM;
  if (address == NULL)
    hints.ai_flags = AI_PASSIVE;
  if ((ret = getaddrinfo(address, service, &hints, &servinfos)) != 0) {
    error("Failed to get address info: %s", gai_strerror(ret));
    return -1;
  }
  for (servinfo = servinfos; servinfo != NULL; servinfo = servinfo->ai_next) {
    if ((ret = socket(servinfo->ai_family, servinfo->ai_socktype,
                      servinfo->ai_protocol)) < 0) {
      eerror("Failed to create socket");
      continue;
    }
    if (setsockopt(ret, SOL_SOCKET, SO_REUSEADDR, &reuseaddr, sizeof(int)) <
        0) {
      eerror("Failed to set socket option: SO_REUSEADDR");
      continue;
    }
    if (bind(ret, servinfo->ai_addr, servinfo->ai_addrlen) < 0) {
      close(ret);
      eerror("Failed to bind socket");
      continue;
    }
    if (listen(ret, SOMAXCONN) < 0) {
      close(ret);
      eerror("Failed to listen");
      return -1;
    }
    freeaddrinfo(servinfos);
    info("Listening on %s:%s", (address == NULL) ? "*" : address, service);
    return ret;
  }
  freeaddrinfo(servinfos);
  error("Failed to get socket");
  return -1;
}


x86 assembly (clang, -O0):
<getaddrlistener>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0x1,-0x5c(%rbp)
lea    -0x48(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    0x2dd1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1213 <getaddrlistener+0x53>
mov    0x2dd2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x48(%rbp),%rdx
lea    -0x50(%rbp),%rcx
call   10b0 <getaddrinfo@plt>
mov    %eax,-0x60(%rbp)
cmp    $0x0,%eax
je     1258 <getaddrlistener+0x98>
mov    -0x60(%rbp),%edi
call   1040 <gai_strerror@plt>
mov    %eax,%esi
lea    0xdbb(%rip),%rdi
mov    $0x0,%al
call   10a0 <error@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13ce <getaddrlistener+0x20e>
mov    -0x50(%rbp),%rax
mov    %rax,-0x58(%rbp)
cmpq   $0x0,-0x58(%rbp)
je     13b0 <getaddrlistener+0x1f0>
mov    -0x58(%rbp),%rax
mov    (%rax),%edi
mov    -0x58(%rbp),%rax
mov    0x10(%rax),%esi
mov    -0x58(%rbp),%rax
mov    0xc(%rax),%edx
call   10e0 <socket@plt>
mov    %eax,-0x60(%rbp)
cmp    $0x0,%eax
jge    12a1 <getaddrlistener+0xe1>
lea    0xd88(%rip),%rdi
call   1070 <eerror@plt>
jmp    139f <getaddrlistener+0x1df>
mov    -0x60(%rbp),%edi
mov    0x2d3d(%rip),%rax
mov    (%rax),%esi
mov    0x2d0c(%rip),%rax
mov    (%rax),%edx
lea    -0x5c(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
cmp    $0x0,%rax
jge    12e0 <getaddrlistener+0x120>
lea    0xd61(%rip),%rdi
call   1070 <eerror@plt>
jmp    139f <getaddrlistener+0x1df>
mov    -0x60(%rbp),%edi
mov    -0x58(%rbp),%rax
mov    0x8(%rax),%esi
mov    -0x58(%rbp),%rax
mov    0x4(%rax),%edx
call   1090 <bind@plt>
cmp    $0x0,%rax
jge    1319 <getaddrlistener+0x159>
mov    -0x60(%rbp),%edi
call   1060 <close@plt>
lea    0xd52(%rip),%rdi
call   1070 <eerror@plt>
jmp    139f <getaddrlistener+0x1df>
mov    -0x60(%rbp),%edi
mov    0x2cad(%rip),%rax
mov    (%rax),%esi
call   1080 <listen@plt>
cmp    $0x0,%rax
jge    1354 <getaddrlistener+0x194>
mov    -0x60(%rbp),%edi
call   1060 <close@plt>
lea    0xd34(%rip),%rdi
call   1070 <eerror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13ce <getaddrlistener+0x20e>
mov    -0x50(%rbp),%rdi
call   10d0 <freeaddrinfo@plt>
cmpq   $0x0,-0x10(%rbp)
jne    1378 <getaddrlistener+0x1b8>
lea    0xd2c(%rip),%rax
mov    %rax,-0x68(%rbp)
jmp    1380 <getaddrlistener+0x1c0>
mov    -0x10(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xcf9(%rip),%rdi
call   10c0 <info@plt>
mov    -0x60(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    13ce <getaddrlistener+0x20e>
mov    -0x58(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x58(%rbp)
jmp    1260 <getaddrlistener+0xa0>
mov    -0x50(%rbp),%rdi
call   10d0 <freeaddrinfo@plt>
lea    0xcdd(%rip),%rdi
mov    $0x0,%al
call   10a0 <error@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getaddrlistener>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%r12
movl   $0x1,0x14(%rsp)
lea    0x20(%rsp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
mov    %ebp,0x20(%rsp)
mov    0x2dce(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x30(%rsp)
test   %r12,%r12
jne    1212 <getaddrlistener+0x52>
mov    0x2dd4(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x40(%rsp)
lea    0x20(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %r12,%rdi
mov    %r14,%rsi
call   10b0 <getaddrinfo@plt>
test   %eax,%eax
je     1247 <getaddrlistener+0x87>
mov    %eax,%edi
call   1040 <gai_strerror@plt>
lea    0xdc7(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   10a0 <error@plt>
jmp    133e <getaddrlistener+0x17e>
mov    0x8(%rsp),%rbx
test   %rbx,%rbx
je     1329 <getaddrlistener+0x169>
mov    %r14,0x18(%rsp)
lea    0xdbe(%rip),%r13
lea    0x14(%rsp),%r15
lea    0xdca(%rip),%r14
jmp    1290 <getaddrlistener+0xd0>
nop
mov    %ebp,%edi
call   1060 <close@plt>
lea    0xde3(%rip),%rdi
call   1070 <eerror@plt>
mov    0x18(%rbx),%rbx
test   %rbx,%rbx
je     1322 <getaddrlistener+0x162>
mov    0x10(%rbx),%esi
mov    (%rbx),%edi
mov    0xc(%rbx),%edx
call   10e0 <socket@plt>
mov    %r13,%rdi
test   %eax,%eax
js     127e <getaddrlistener+0xbe>
mov    %eax,%ebp
mov    0x2d3b(%rip),%rax
mov    (%rax),%esi
mov    0x2d0a(%rip),%rax
mov    (%rax),%edx
mov    %ebp,%edi
mov    %r15,%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
mov    %r14,%rdi
test   %rax,%rax
js     127e <getaddrlistener+0xbe>
mov    0x4(%rbx),%edx
mov    0x8(%rbx),%esi
mov    %ebp,%edi
call   1090 <bind@plt>
test   %rax,%rax
js     1270 <getaddrlistener+0xb0>
mov    0x2ce7(%rip),%rax
mov    (%rax),%esi
mov    %ebp,%edi
call   1080 <listen@plt>
test   %rax,%rax
js     1354 <getaddrlistener+0x194>
mov    0x8(%rsp),%rdi
call   10d0 <freeaddrinfo@plt>
test   %r12,%r12
lea    0xd90(%rip),%rsi
cmovne %r12,%rsi
lea    0xd72(%rip),%rdi
mov    0x18(%rsp),%rdx
call   10c0 <info@plt>
jmp    1343 <getaddrlistener+0x183>
mov    0x8(%rsp),%rdi
jmp    132b <getaddrlistener+0x16b>
xor    %edi,%edi
call   10d0 <freeaddrinfo@plt>
lea    0xd66(%rip),%rdi
xor    %eax,%eax
call   10a0 <error@plt>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %ebp,%edi
call   1060 <close@plt>
lea    0xd15(%rip),%rdi
call   1070 <eerror@plt>
jmp    133e <getaddrlistener+0x17e>

LLVM IR (-O0):
%struct.addrinfo = type { i32, i32, i32, i32, i32, %struct.addrinfo*, i32 }
@SOCK_STREAM = global i32 0
@AI_PASSIVE = global i32 0
@.str = [31 x i8] c"Failed to get address info: %s\00"
@.str.1 = [24 x i8] c"Failed to create socket\00"
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str.2 = [42 x i8] c"Failed to set socket option: SO_REUSEADDR\00"
@.str.3 = [22 x i8] c"Failed to bind socket\00"
@SOMAXCONN = global i32 0
@.str.4 = [17 x i8] c"Failed to listen\00"
@.str.5 = [19 x i8] c"Listening on %s:%s\00"
@.str.6 = [2 x i8] c"*\00"
@.str.7 = [21 x i8] c"Failed to get socket\00"
define i32 @getaddrlistener(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca %struct.addrinfo
%9 = alloca %struct.addrinfo*
%10 = alloca %struct.addrinfo*
%11 = alloca i32
%12 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 1, i32* %11
%13 = call i32 @memset(%struct.addrinfo* %8, i32 0, i32 40)
%14 = load i32, i32* %7
%15 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %8, i32 0, i32 0
store i32 %14, i32* %15
%16 = load i32, i32* @SOCK_STREAM
%17 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %8, i32 0, i32 4
store i32 %16, i32* %17
%18 = load i8*, i8** %5
%19 = icmp eq i8* %18, null
br i1 %19, label %20, label %23
20: ; preds = %3
%21 = load i32, i32* @AI_PASSIVE
%22 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %8, i32 0, i32 6
store i32 %21, i32* %22
br label %23
23: ; preds = %20, %3
%24 = load i8*, i8** %5
%25 = load i8*, i8** %6
%26 = call i32 @getaddrinfo(i8* %24, i8* %25, %struct.addrinfo* %8, %struct.addrinfo** %9)
store i32 %26, i32* %12
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %32
28: ; preds = %23
%29 = load i32, i32* %12
%30 = call i32 @gai_strerror(i32 %29)
%31 = call i32 (i8*, ...) @error(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %30)
store i32 -1, i32* %4
br label %103
32: ; preds = %23
%33 = load %struct.addrinfo*, %struct.addrinfo** %9
store %struct.addrinfo* %33, %struct.addrinfo** %10
br label %34
34: ; preds = %95, %32
%35 = load %struct.addrinfo*, %struct.addrinfo** %10
%36 = icmp ne %struct.addrinfo* %35, null
br i1 %36, label %37, label %99
37: ; preds = %34
%38 = load %struct.addrinfo*, %struct.addrinfo** %10
%39 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %38, i32 0, i32 0
%40 = load i32, i32* %39
%41 = load %struct.addrinfo*, %struct.addrinfo** %10
%42 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %41, i32 0, i32 4
%43 = load i32, i32* %42
%44 = load %struct.addrinfo*, %struct.addrinfo** %10
%45 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %44, i32 0, i32 3
%46 = load i32, i32* %45
%47 = call i32 @socket(i32 %40, i32 %43, i32 %46)
store i32 %47, i32* %12
%48 = icmp slt i32 %47, 0
br i1 %48, label %49, label %51
49: ; preds = %37
%50 = call i32 @eerror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
br label %95
51: ; preds = %37
%52 = load i32, i32* %12
%53 = load i32, i32* @SOL_SOCKET
%54 = load i32, i32* @SO_REUSEADDR
%55 = call i64 @setsockopt(i32 %52, i32 %53, i32 %54, i32* %11, i32 4)
%56 = icmp slt i64 %55, 0
br i1 %56, label %57, label %59
57: ; preds = %51
%58 = call i32 @eerror(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0))
br label %95
59: ; preds = %51
%60 = load i32, i32* %12
%61 = load %struct.addrinfo*, %struct.addrinfo** %10
%62 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %61, i32 0, i32 2
%63 = load i32, i32* %62
%64 = load %struct.addrinfo*, %struct.addrinfo** %10
%65 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %64, i32 0, i32 1
%66 = load i32, i32* %65
%67 = call i64 @bind(i32 %60, i32 %63, i32 %66)
%68 = icmp slt i64 %67, 0
br i1 %68, label %69, label %73
69: ; preds = %59
%70 = load i32, i32* %12
%71 = call i32 @close(i32 %70)
%72 = call i32 @eerror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
br label %95
73: ; preds = %59
%74 = load i32, i32* %12
%75 = load i32, i32* @SOMAXCONN
%76 = call i64 @listen(i32 %74, i32 %75)
%77 = icmp slt i64 %76, 0
br i1 %77, label %78, label %82
78: ; preds = %73
%79 = load i32, i32* %12
%80 = call i32 @close(i32 %79)
%81 = call i32 @eerror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %4
br label %103
82: ; preds = %73
%83 = load %struct.addrinfo*, %struct.addrinfo** %9
%84 = call i32 @freeaddrinfo(%struct.addrinfo* %83)
%85 = load i8*, i8** %5
%86 = icmp eq i8* %85, null
br i1 %86, label %87, label %88
87: ; preds = %82
br label %90
88: ; preds = %82
%89 = load i8*, i8** %5
br label %90
90: ; preds = %88, %87
%91 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), %87 ], [ %89, %88 ]
%92 = load i8*, i8** %6
%93 = call i32 @info(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %91, i8* %92)
%94 = load i32, i32* %12
store i32 %94, i32* %4
br label %103
95: ; preds = %69, %57, %49
%96 = load %struct.addrinfo*, %struct.addrinfo** %10
%97 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %96, i32 0, i32 5
%98 = load %struct.addrinfo*, %struct.addrinfo** %97
store %struct.addrinfo* %98, %struct.addrinfo** %10
br label %34
99: ; preds = %34
%100 = load %struct.addrinfo*, %struct.addrinfo** %9
%101 = call i32 @freeaddrinfo(%struct.addrinfo* %100)
%102 = call i32 (i8*, ...) @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
store i32 -1, i32* %4
br label %103
103: ; preds = %99, %90, %78, %28
%104 = load i32, i32* %4
ret i32 %104
}

LLVM IR (-O2):
%struct.addrinfo = type { i32, i32, i32, i32, i32, %struct.addrinfo*, i32 }
@SOCK_STREAM = global i32 0
@AI_PASSIVE = global i32 0
@.str = [31 x i8] c"Failed to get address info: %s\00"
@.str.1 = [24 x i8] c"Failed to create socket\00"
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str.2 = [42 x i8] c"Failed to set socket option: SO_REUSEADDR\00"
@.str.3 = [22 x i8] c"Failed to bind socket\00"
@SOMAXCONN = global i32 0
@.str.4 = [17 x i8] c"Failed to listen\00"
@.str.5 = [19 x i8] c"Listening on %s:%s\00"
@.str.6 = [2 x i8] c"*\00"
@.str.7 = [21 x i8] c"Failed to get socket\00"
define i32 @getaddrlistener(i8* %0, i8* %1, i32 %2) {
%4 = alloca %struct.addrinfo
%5 = alloca %struct.addrinfo*
%6 = alloca i32
%7 = bitcast %struct.addrinfo* %4 to i8*
%8 = bitcast %struct.addrinfo** %5 to i8*
%9 = bitcast i32* %6 to i8*
store i32 1, i32* %6
%10 = call i32 @memset(%struct.addrinfo* %4, i32 0, i32 40)
%11 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %4, i64 0, i32 0
store i32 %2, i32* %11
%12 = load i32, i32* @SOCK_STREAM
%13 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %4, i64 0, i32 4
store i32 %12, i32* %13
%14 = icmp eq i8* %0, null
br i1 %14, label %15, label %18
15: ; preds = %3
%16 = load i32, i32* @AI_PASSIVE
%17 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %4, i64 0, i32 6
store i32 %16, i32* %17
br label %18
18: ; preds = %15, %3
%19 = call i32 @getaddrinfo(i8* %0, i8* %1, %struct.addrinfo* %4, %struct.addrinfo** %5)
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = load %struct.addrinfo*, %struct.addrinfo** %5
%23 = icmp eq %struct.addrinfo* %22, null
br i1 %23, label %71, label %27
24: ; preds = %18
%25 = call i32 @gai_strerror(i32 %19)
%26 = call i32 (i8*, ...) @error(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %25)
br label %75
27: ; preds = %21, %63
%28 = phi %struct.addrinfo* [ %67, %63 ], [ %22, %21 ]
%29 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %28, i64 0, i32 0
%30 = load i32, i32* %29
%31 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %28, i64 0, i32 4
%32 = load i32, i32* %31
%33 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %28, i64 0, i32 3
%34 = load i32, i32* %33
%35 = call i32 @socket(i32 %30, i32 %32, i32 %34)
%36 = icmp slt i32 %35, 0
br i1 %36, label %63, label %37
37: ; preds = %27
%38 = load i32, i32* @SOL_SOCKET
%39 = load i32, i32* @SO_REUSEADDR
%40 = call i64 @setsockopt(i32 %35, i32 %38, i32 %39, i32* %6, i32 4)
%41 = icmp slt i64 %40, 0
br i1 %41, label %63, label %42
42: ; preds = %37
%43 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %28, i64 0, i32 2
%44 = load i32, i32* %43
%45 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %28, i64 0, i32 1
%46 = load i32, i32* %45
%47 = call i64 @bind(i32 %35, i32 %44, i32 %46)
%48 = icmp slt i64 %47, 0
br i1 %48, label %49, label %51
49: ; preds = %42
%50 = call i32 @close(i32 %35)
br label %63
51: ; preds = %42
%52 = load i32, i32* @SOMAXCONN
%53 = call i64 @listen(i32 %35, i32 %52)
%54 = icmp slt i64 %53, 0
br i1 %54, label %55, label %58
55: ; preds = %51
%56 = call i32 @close(i32 %35)
%57 = call i32 @eerror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
br label %75
58: ; preds = %51
%59 = load %struct.addrinfo*, %struct.addrinfo** %5
%60 = call i32 @freeaddrinfo(%struct.addrinfo* %59)
%61 = select i1 %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), i8* %0
%62 = call i32 @info(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %61, i8* %1)
br label %75
63: ; preds = %37, %27, %49
%64 = phi i8* [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), %49 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), %27 ], [ getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), %37 ]
%65 = call i32 @eerror(i8* %64)
%66 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %28, i64 0, i32 5
%67 = load %struct.addrinfo*, %struct.addrinfo** %66
%68 = icmp eq %struct.addrinfo* %67, null
br i1 %68, label %69, label %27
69: ; preds = %63
%70 = load %struct.addrinfo*, %struct.addrinfo** %5
br label %71
71: ; preds = %69, %21
%72 = phi %struct.addrinfo* [ %70, %69 ], [ null, %21 ]
%73 = call i32 @freeaddrinfo(%struct.addrinfo* %72)
%74 = call i32 (i8*, ...) @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
br label %75
75: ; preds = %71, %58, %55, %24
%76 = phi i32 [ -1, %24 ], [ -1, %55 ], [ %35, %58 ], [ -1, %71 ]
ret i32 %76
}