#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct sockaddr_in6 {
  int dummy;
};
struct sockaddr_in {
  int dummy;
};
struct ifaddrs {
  char *ifa_name;
  TYPE_1__ *ifa_addr;
  struct ifaddrs *ifa_next;
};
struct TYPE_2__ {
  int sa_family;
};

/* Variables and functions */
int AF_INET;
int AF_INET6;
int AF_UNSPEC;
int NI_MAXHOST;
int /*<<< orphan*/ NI_NUMERICHOST;
int /*<<< orphan*/ eerror(char *);
int /*<<< orphan*/ error(char *, ...);
int /*<<< orphan*/ freeifaddrs(struct ifaddrs *);
int /*<<< orphan*/ gai_strerror(int);
int getaddrlistener(char *, char const *, int);
scalar_t__ getifaddrs(struct ifaddrs **);
int getnameinfo(TYPE_1__ *, int, char *, int, int /*<<< orphan*/ *,
                int /*<<< orphan*/, int /*<<< orphan*/);
scalar_t__ strcmp(char const *, char *);
int getintflistener(const char *interface, const char *service, int family) {
  struct ifaddrs *ifaddrs;
  struct ifaddrs *ifaddr;
  char address[NI_MAXHOST];
  int iffamily;
  int ret;
  if (strcmp(interface, "any") == 0) {
    ;
    return getaddrlistener(NULL, service, family);
  }
  if (getifaddrs(&ifaddrs) < 0) {
    eerror("Failed to get interface info");
    return -1;
  }
  for (ifaddr = ifaddrs; ifaddr != NULL; ifaddr = ifaddr->ifa_next) {
    if (ifaddr->ifa_addr == NULL)
      continue;
    iffamily = ifaddr->ifa_addr->sa_family;
    if ((family == AF_INET && iffamily != AF_INET) ||
        (family == AF_INET6 && iffamily != AF_INET6) ||
        (family == AF_UNSPEC && iffamily != AF_INET && iffamily != AF_INET6))
      continue;
    if ((ret = getnameinfo(ifaddr->ifa_addr,
                           (iffamily == AF_INET) ? sizeof(struct sockaddr_in)
                                                 : sizeof(struct sockaddr_in6),
                           address, NI_MAXHOST, NULL, 0, NI_NUMERICHOST)) < 0) {
      error("Failed to get interface name info: %s", gai_strerror(ret));
      continue;
    }
    if (strcmp(interface, ifaddr->ifa_name) == 0) {
      if ((ret = getaddrlistener(address, service, iffamily)) < 0) {
        ;
        continue;
      }
      freeifaddrs(ifaddrs);
      return ret;
    }
  }
  freeifaddrs(ifaddrs);
  error("Failed to get interface address");
  return -1;
}


x86 assembly (clang, -O0):
<getintflistener>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    0x2e26(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x58(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe36(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    11f8 <getintflistener+0x78>
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
xor    %eax,%eax
mov    %eax,%edi
call   1040 <getaddrlistener@plt>
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x4c(%rbp)
jmp    13e8 <getintflistener+0x268>
lea    -0x28(%rbp),%rdi
call   1080 <getifaddrs@plt>
cmp    $0x0,%rax
jge    122a <getintflistener+0xaa>
lea    0xdf2(%rip),%rdi
call   1070 <eerror@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x4c(%rbp)
jmp    13e8 <getintflistener+0x268>
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     13c3 <getintflistener+0x243>
mov    -0x30(%rbp),%rax
cmpq   $0x0,0x8(%rax)
jne    1251 <getintflistener+0xd1>
jmp    13b2 <getintflistener+0x232>
mov    -0x30(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x2d80(%rip),%rcx
cmp    (%rcx),%eax
jne    1282 <getintflistener+0x102>
mov    -0x44(%rbp),%eax
mov    0x2d6e(%rip),%rcx
cmp    (%rcx),%eax
jne    12dc <getintflistener+0x15c>
mov    -0x1c(%rbp),%eax
mov    0x2d4c(%rip),%rcx
cmp    (%rcx),%eax
jne    12a6 <getintflistener+0x126>
mov    -0x44(%rbp),%eax
mov    0x2d3a(%rip),%rcx
cmp    (%rcx),%eax
jne    12dc <getintflistener+0x15c>
mov    -0x1c(%rbp),%eax
mov    0x2d30(%rip),%rcx
cmp    (%rcx),%eax
jne    12e1 <getintflistener+0x161>
mov    -0x44(%rbp),%eax
mov    0x2d26(%rip),%rcx
cmp    (%rcx),%eax
je     12e1 <getintflistener+0x161>
mov    -0x44(%rbp),%eax
mov    0x2d04(%rip),%rcx
cmp    (%rcx),%eax
je     12e1 <getintflistener+0x161>
jmp    13b2 <getintflistener+0x232>
mov    -0x58(%rbp),%rdx
mov    -0x30(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x44(%rbp),%ecx
mov    0x2cf1(%rip),%rax
mov    (%rax),%esi
mov    $0x4,%eax
cmp    %esi,%ecx
cmove  %rax,%rax
mov    %eax,%esi
mov    0x2cb3(%rip),%rax
mov    (%rax),%ecx
mov    0x2cb2(%rip),%rax
mov    (%rax),%eax
xor    %r8d,%r8d
xor    %r9d,%r9d
sub    $0x10,%rsp
mov    %eax,(%rsp)
call   1050 <getnameinfo@plt>
add    $0x10,%rsp
mov    %eax,-0x48(%rbp)
cmp    $0x0,%eax
jge    1357 <getintflistener+0x1d7>
mov    -0x48(%rbp),%edi
call   1030 <gai_strerror@plt>
mov    %eax,%esi
lea    0xcd6(%rip),%rdi
mov    $0x0,%al
call   10a0 <error@plt>
jmp    13b2 <getintflistener+0x232>
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rax
mov    (%rax),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    13ad <getintflistener+0x22d>
mov    -0x58(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x44(%rbp),%edx
call   1040 <getaddrlistener@plt>
mov    %eax,-0x48(%rbp)
cmp    $0x0,%eax
jge    1392 <getintflistener+0x212>
jmp    13b2 <getintflistener+0x232>
mov    -0x28(%rbp),%rdi
call   1090 <freeifaddrs@plt>
mov    -0x48(%rbp),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x4c(%rbp)
jmp    13e8 <getintflistener+0x268>
jmp    13b2 <getintflistener+0x232>
mov    -0x30(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x30(%rbp)
jmp    1232 <getintflistener+0xb2>
mov    -0x28(%rbp),%rdi
call   1090 <freeifaddrs@plt>
lea    0xc74(%rip),%rdi
mov    $0x0,%al
call   10a0 <error@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x4c(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getintflistener>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %edx,%ebx
mov    %rsi,%r13
mov    %rdi,%r14
mov    %rsp,%r15
mov    0x2e1d(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r12
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
lea    0xe43(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11fe <getintflistener+0x7e>
lea    -0x30(%rbp),%rdi
call   1080 <getifaddrs@plt>
test   %rax,%rax
js     1212 <getintflistener+0x92>
mov    %r14,-0x48(%rbp)
mov    -0x30(%rbp),%r14
test   %r14,%r14
je     1321 <getintflistener+0x1a1>
mov    %r13,-0x40(%rbp)
mov    %r15,-0x38(%rbp)
mov    0x2df3(%rip),%r15
mov    0x2ddc(%rip),%rdx
jmp    125d <getintflistener+0xdd>
xor    %edi,%edi
mov    %r13,%rsi
mov    %ebx,%edx
call   1040 <getaddrlistener@plt>
mov    %eax,%r13d
jmp    133c <getintflistener+0x1bc>
lea    0xdeb(%rip),%rdi
call   1070 <eerror@plt>
jmp    1336 <getintflistener+0x1b6>
mov    %eax,%edi
call   1030 <gai_strerror@plt>
lea    0xdf0(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   10a0 <error@plt>
mov    0x2d97(%rip),%rdx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x10(%r14),%r14
test   %r14,%r14
je     1317 <getintflistener+0x197>
mov    0x8(%r14),%rdi
test   %rdi,%rdi
je     1250 <getintflistener+0xd0>
mov    (%rdi),%r13d
mov    (%r15),%eax
cmp    %ebx,%eax
jne    1275 <getintflistener+0xf5>
cmp    %eax,%r13d
jne    1250 <getintflistener+0xd0>
mov    (%rdx),%ecx
cmp    %ebx,%ecx
jne    1280 <getintflistener+0x100>
cmp    %ecx,%r13d
jne    1250 <getintflistener+0xd0>
mov    0x2d59(%rip),%rsi
cmp    %ebx,(%rsi)
jne    1295 <getintflistener+0x115>
cmp    %eax,%r13d
je     1295 <getintflistener+0x115>
cmp    %ecx,%r13d
jne    1250 <getintflistener+0xd0>
mov    0x2d24(%rip),%rax
mov    (%rax),%ecx
mov    0x2d23(%rip),%rax
mov    (%rax),%eax
sub    $0x8,%rsp
mov    $0x4,%esi
mov    %r12,%rdx
xor    %r8d,%r8d
xor    %r9d,%r9d
push   %rax
call   1050 <getnameinfo@plt>
add    $0x10,%rsp
test   %eax,%eax
js     1223 <getintflistener+0xa3>
mov    (%r14),%rsi
mov    -0x48(%rbp),%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
mov    0x2cf7(%rip),%rdx
jne    1250 <getintflistener+0xd0>
mov    %r12,%rdi
mov    -0x40(%rbp),%rsi
mov    %r13d,%edx
call   1040 <getaddrlistener@plt>
mov    0x2cdb(%rip),%rdx
test   %eax,%eax
js     1250 <getintflistener+0xd0>
mov    %eax,%r13d
mov    -0x30(%rbp),%rdi
call   1090 <freeifaddrs@plt>
mov    -0x38(%rbp),%r15
jmp    133c <getintflistener+0x1bc>
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%r15
jmp    1323 <getintflistener+0x1a3>
xor    %edi,%edi
call   1090 <freeifaddrs@plt>
lea    0xd18(%rip),%rdi
xor    %eax,%eax
call   10a0 <error@plt>
mov    $0xffffffff,%r13d
mov    %r15,%rsp
mov    %r13d,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.ifaddrs = type { i8*, %struct.TYPE_2__*, %struct.ifaddrs* }
%struct.TYPE_2__ = type { i32 }
@NI_MAXHOST = global i32 0
@.str = [4 x i8] c"any\00"
@.str.1 = [29 x i8] c"Failed to get interface info\00"
@AF_INET = global i32 0
@AF_INET6 = global i32 0
@AF_UNSPEC = global i32 0
@NI_NUMERICHOST = global i32 0
@.str.2 = [38 x i8] c"Failed to get interface name info: %s\00"
@.str.3 = [32 x i8] c"Failed to get interface address\00"
define i32 @getintflistener(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca %struct.ifaddrs*
%9 = alloca %struct.ifaddrs*
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%15 = load i32, i32* @NI_MAXHOST
%16 = zext i32 %15 to i64
%17 = call i8* @llvm.stacksave()
store i8* %17, i8** %10
%18 = alloca i8, i64 %16
store i64 %16, i64* %11
%19 = load i8*, i8** %5
%20 = call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %3
%23 = load i8*, i8** %6
%24 = load i32, i32* %7
%25 = call i32 @getaddrlistener(i8* null, i8* %23, i32 %24)
store i32 %25, i32* %4
store i32 1, i32* %14
br label %120
26: ; preds = %3
%27 = call i64 @getifaddrs(%struct.ifaddrs** %8)
%28 = icmp slt i64 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = call i32 @eerror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %4
store i32 1, i32* %14
br label %120
31: ; preds = %26
%32 = load %struct.ifaddrs*, %struct.ifaddrs** %8
store %struct.ifaddrs* %32, %struct.ifaddrs** %9
br label %33
33: ; preds = %112, %31
%34 = load %struct.ifaddrs*, %struct.ifaddrs** %9
%35 = icmp ne %struct.ifaddrs* %34, null
br i1 %35, label %36, label %116
36: ; preds = %33
%37 = load %struct.ifaddrs*, %struct.ifaddrs** %9
%38 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %37, i32 0, i32 1
%39 = load %struct.TYPE_2__*, %struct.TYPE_2__** %38
%40 = icmp eq %struct.TYPE_2__* %39, null
br i1 %40, label %41, label %42
41: ; preds = %36
br label %112
42: ; preds = %36
%43 = load %struct.ifaddrs*, %struct.ifaddrs** %9
%44 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %43, i32 0, i32 1
%45 = load %struct.TYPE_2__*, %struct.TYPE_2__** %44
%46 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %45, i32 0, i32 0
%47 = load i32, i32* %46
store i32 %47, i32* %12
%48 = load i32, i32* %7
%49 = load i32, i32* @AF_INET
%50 = icmp eq i32 %48, %49
br i1 %50, label %51, label %55
51: ; preds = %42
%52 = load i32, i32* %12
%53 = load i32, i32* @AF_INET
%54 = icmp ne i32 %52, %53
br i1 %54, label %75, label %55
55: ; preds = %51, %42
%56 = load i32, i32* %7
%57 = load i32, i32* @AF_INET6
%58 = icmp eq i32 %56, %57
br i1 %58, label %59, label %63
59: ; preds = %55
%60 = load i32, i32* %12
%61 = load i32, i32* @AF_INET6
%62 = icmp ne i32 %60, %61
br i1 %62, label %75, label %63
63: ; preds = %59, %55
%64 = load i32, i32* %7
%65 = load i32, i32* @AF_UNSPEC
%66 = icmp eq i32 %64, %65
br i1 %66, label %67, label %76
67: ; preds = %63
%68 = load i32, i32* %12
%69 = load i32, i32* @AF_INET
%70 = icmp ne i32 %68, %69
br i1 %70, label %71, label %76
71: ; preds = %67
%72 = load i32, i32* %12
%73 = load i32, i32* @AF_INET6
%74 = icmp ne i32 %72, %73
br i1 %74, label %75, label %76
75: ; preds = %71, %59, %51
br label %112
76: ; preds = %71, %67, %63
%77 = load %struct.ifaddrs*, %struct.ifaddrs** %9
%78 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %77, i32 0, i32 1
%79 = load %struct.TYPE_2__*, %struct.TYPE_2__** %78
%80 = load i32, i32* %12
%81 = load i32, i32* @AF_INET
%82 = icmp eq i32 %80, %81
%83 = zext i1 %82 to i64
%84 = select i1 %82, i64 4, i64 4
%85 = trunc i64 %84 to i32
%86 = load i32, i32* @NI_MAXHOST
%87 = load i32, i32* @NI_NUMERICHOST
%88 = call i32 @getnameinfo(%struct.TYPE_2__* %79, i32 %85, i8* %18, i32 %86, i32* null, i32 0, i32 %87)
store i32 %88, i32* %13
%89 = icmp slt i32 %88, 0
br i1 %89, label %90, label %94
90: ; preds = %76
%91 = load i32, i32* %13
%92 = call i32 @gai_strerror(i32 %91)
%93 = call i32 (i8*, ...) @error(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 %92)
br label %112
94: ; preds = %76
%95 = load i8*, i8** %5
%96 = load %struct.ifaddrs*, %struct.ifaddrs** %9
%97 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %96, i32 0, i32 0
%98 = load i8*, i8** %97
%99 = call i64 @strcmp(i8* %95, i8* %98)
%100 = icmp eq i64 %99, 0
br i1 %100, label %101, label %111
101: ; preds = %94
%102 = load i8*, i8** %6
%103 = load i32, i32* %12
%104 = call i32 @getaddrlistener(i8* %18, i8* %102, i32 %103)
store i32 %104, i32* %13
%105 = icmp slt i32 %104, 0
br i1 %105, label %106, label %107
106: ; preds = %101
br label %112
107: ; preds = %101
%108 = load %struct.ifaddrs*, %struct.ifaddrs** %8
%109 = call i32 @freeifaddrs(%struct.ifaddrs* %108)
%110 = load i32, i32* %13
store i32 %110, i32* %4
store i32 1, i32* %14
br label %120
111: ; preds = %94
br label %112
112: ; preds = %111, %106, %90, %75, %41
%113 = load %struct.ifaddrs*, %struct.ifaddrs** %9
%114 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %113, i32 0, i32 2
%115 = load %struct.ifaddrs*, %struct.ifaddrs** %114
store %struct.ifaddrs* %115, %struct.ifaddrs** %9
br label %33
116: ; preds = %33
%117 = load %struct.ifaddrs*, %struct.ifaddrs** %8
%118 = call i32 @freeifaddrs(%struct.ifaddrs* %117)
%119 = call i32 (i8*, ...) @error(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %4
store i32 1, i32* %14
br label %120
120: ; preds = %116, %107, %29, %22
%121 = load i8*, i8** %10
%122 = load i32, i32* %4
ret i32 %122
}

LLVM IR (-O2):
%struct.ifaddrs = type { i8*, %struct.TYPE_2__*, %struct.ifaddrs* }
%struct.TYPE_2__ = type { i32 }
@NI_MAXHOST = global i32 0
@.str = [4 x i8] c"any\00"
@.str.1 = [29 x i8] c"Failed to get interface info\00"
@AF_INET = global i32 0
@AF_INET6 = global i32 0
@AF_UNSPEC = global i32 0
@NI_NUMERICHOST = global i32 0
@.str.2 = [38 x i8] c"Failed to get interface name info: %s\00"
@.str.3 = [32 x i8] c"Failed to get interface address\00"
define i32 @getintflistener(i8* %0, i8* %1, i32 %2) {
%4 = alloca %struct.ifaddrs*
%5 = bitcast %struct.ifaddrs** %4 to i8*
%6 = load i32, i32* @NI_MAXHOST
%7 = zext i32 %6 to i64
%8 = tail call i8* @llvm.stacksave()
%9 = alloca i8, i64 %7
%10 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %3
%13 = tail call i32 @getaddrlistener(i8* null, i8* %1, i32 %2)
br label %73
14: ; preds = %3
%15 = call i64 @getifaddrs(%struct.ifaddrs** %4)
%16 = icmp slt i64 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = load %struct.ifaddrs*, %struct.ifaddrs** %4
%19 = icmp eq %struct.ifaddrs* %18, null
br i1 %19, label %69, label %22
20: ; preds = %14
%21 = call i32 @eerror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
br label %73
22: ; preds = %17, %63
%23 = phi %struct.ifaddrs* [ %65, %63 ], [ %18, %17 ]
%24 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %23, i64 0, i32 1
%25 = load %struct.TYPE_2__*, %struct.TYPE_2__** %24
%26 = icmp eq %struct.TYPE_2__* %25, null
br i1 %26, label %63, label %27
27: ; preds = %22
%28 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %25, i64 0, i32 0
%29 = load i32, i32* %28
%30 = load i32, i32* @AF_INET
%31 = icmp ne i32 %30, %2
%32 = icmp eq i32 %29, %30
%33 = select i1 %31, i1 true, i1 %32
br i1 %33, label %34, label %63
34: ; preds = %27
%35 = load i32, i32* @AF_INET6
%36 = icmp ne i32 %35, %2
%37 = icmp eq i32 %29, %35
%38 = select i1 %36, i1 true, i1 %37
br i1 %38, label %39, label %63
39: ; preds = %34
%40 = load i32, i32* @AF_UNSPEC
%41 = icmp ne i32 %40, %2
%42 = select i1 %41, i1 true, i1 %32
%43 = select i1 %42, i1 true, i1 %37
br i1 %43, label %44, label %63
44: ; preds = %39
%45 = load i32, i32* @NI_MAXHOST
%46 = load i32, i32* @NI_NUMERICHOST
%47 = call i32 @getnameinfo(%struct.TYPE_2__* %25, i32 4, i8* %9, i32 %45, i32* null, i32 0, i32 %46)
%48 = icmp slt i32 %47, 0
br i1 %48, label %49, label %52
49: ; preds = %44
%50 = call i32 @gai_strerror(i32 %47)
%51 = call i32 (i8*, ...) @error(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 %50)
br label %63
52: ; preds = %44
%53 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %23, i64 0, i32 0
%54 = load i8*, i8** %53
%55 = call i64 @strcmp(i8* %0, i8* %54)
%56 = icmp eq i64 %55, 0
br i1 %56, label %57, label %63
57: ; preds = %52
%58 = call i32 @getaddrlistener(i8* %9, i8* %1, i32 %29)
%59 = icmp slt i32 %58, 0
br i1 %59, label %63, label %60
60: ; preds = %57
%61 = load %struct.ifaddrs*, %struct.ifaddrs** %4
%62 = call i32 @freeifaddrs(%struct.ifaddrs* %61)
br label %73
63: ; preds = %39, %34, %27, %52, %57, %22, %49
%64 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %23, i64 0, i32 2
%65 = load %struct.ifaddrs*, %struct.ifaddrs** %64
%66 = icmp eq %struct.ifaddrs* %65, null
br i1 %66, label %67, label %22
67: ; preds = %63
%68 = load %struct.ifaddrs*, %struct.ifaddrs** %4
br label %69
69: ; preds = %67, %17
%70 = phi %struct.ifaddrs* [ %68, %67 ], [ null, %17 ]
%71 = call i32 @freeifaddrs(%struct.ifaddrs* %70)
%72 = call i32 (i8*, ...) @error(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
br label %73
73: ; preds = %69, %60, %20, %12
%74 = phi i32 [ %13, %12 ], [ -1, %20 ], [ %58, %60 ], [ -1, %69 ]
ret i32 %74
}