#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_in6 {
  int sin6_port;
  int /*<<< orphan*/ sin6_addr;
};
struct sockaddr_in {
  int sin_port;
  int /*<<< orphan*/ sin_addr;
};
struct addrinfo {
  scalar_t__ ai_family;
  scalar_t__ ai_addr;
  struct addrinfo *ai_next;
  int /*<<< orphan*/ ai_flags;
};
typedef int /*<<< orphan*/ hints;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
scalar_t__ AF_INET;
scalar_t__ AF_INET6;
scalar_t__ AF_UNSPEC;
int /*<<< orphan*/ AI_PASSIVE;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, char *,
                           char *);
int /*<<< orphan*/ freeaddrinfo(struct addrinfo *);
char *gai_strerror(int);
int getaddrinfo(char *, char *, struct addrinfo *, struct addrinfo **);
char *inet_ntoa(int /*<<< orphan*/);
char *inet_ntop(scalar_t__, int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ memset(struct addrinfo *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, char *, char *, int, char *);
int /*<<< orphan*/ stderr;
int _getaddrinfo(char const *progname) {
  int ret = 0;
  struct addrinfo hints;
  struct addrinfo *ai;
  int res;
  struct addrinfo *p;
  struct sockaddr_in *sin;
  struct sockaddr_in6 *sin6;
  char buf[32];
  memset(&hints, 0, sizeof(hints));
  hints.ai_family = AF_UNSPEC;
  hints.ai_flags = AI_PASSIVE;
  if ((res = getaddrinfo("localhost", "http", &hints, &ai)) != 0) {
    fprintf(stderr, "%s: %s: %s\n", progname, "getaddrinfo", gai_strerror(res));
    return 1;
  }
  for (p = ai; p != NULL; p = p->ai_next)
    if (p->ai_family == AF_INET) {
      sin = (struct sockaddr_in *)p->ai_addr;
      if (sin->sin_port != 80)
        ret = 1;
      printf("%s: %s:%u%s\n", "localhost", inet_ntoa(sin->sin_addr),
             sin->sin_port, (ret == 0) ? "" : " (WRONG)");
    } else if (p->ai_family == AF_INET6) {
      sin6 = (struct sockaddr_in6 *)p->ai_addr;
      if (sin6->sin6_port != 80)
        ret = 1;
      printf("%s: %s:%u%s\n", "localhost",
             inet_ntop(p->ai_family, &sin6->sin6_addr, buf, sizeof(buf)),
             sin6->sin6_port, (ret == 0) ? "" : " (WRONG)");
    }
  freeaddrinfo(ai);
  return ret;
}


x86 assembly (clang, -O0):
<_getaddrinfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    -0x38(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1070 <memset@plt>
mov    0x2e2b(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
mov    0x2e2d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
lea    0xe39(%rip),%rdi
lea    0xe3c(%rip),%rsi
lea    -0x38(%rbp),%rdx
lea    -0x40(%rbp),%rcx
call   1090 <getaddrinfo@plt>
mov    %eax,-0x44(%rbp)
cmp    $0x0,%eax
je     1238 <_getaddrinfo+0xb8>
mov    0x2dd2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x44(%rbp),%edi
call   1060 <gai_strerror@plt>
mov    -0x8c(%rbp),%edi
mov    -0x88(%rbp),%rdx
mov    %rax,%r8
lea    0xdef(%rip),%rsi
lea    0xdf4(%rip),%rcx
call   1080 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1379 <_getaddrinfo+0x1f9>
mov    -0x40(%rbp),%rax
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x50(%rbp)
je     136a <_getaddrinfo+0x1ea>
mov    -0x50(%rbp),%rax
mov    (%rax),%rax
mov    0x2d87(%rip),%rcx
cmp    (%rcx),%rax
jne    12c7 <_getaddrinfo+0x147>
mov    -0x50(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rax
cmpl   $0x50,(%rax)
je     1282 <_getaddrinfo+0x102>
movl   $0x1,-0x14(%rbp)
mov    -0x58(%rbp),%rax
mov    0x4(%rax),%edi
call   1040 <inet_ntoa@plt>
mov    %rax,%rdx
mov    -0x58(%rbp),%rax
mov    (%rax),%ecx
mov    -0x14(%rbp),%esi
lea    0xd93(%rip),%r8
lea    0xd72(%rip),%rax
cmp    $0x0,%esi
cmove  %rax,%r8
lea    0xd71(%rip),%rdi
lea    0xd43(%rip),%rsi
call   1050 <printf@plt>
jmp    1354 <_getaddrinfo+0x1d4>
mov    -0x50(%rbp),%rax
mov    (%rax),%rax
mov    0x2cfb(%rip),%rcx
cmp    (%rcx),%rax
jne    134f <_getaddrinfo+0x1cf>
mov    -0x50(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rax
cmpl   $0x50,(%rax)
je     12fe <_getaddrinfo+0x17e>
movl   $0x1,-0x14(%rbp)
mov    -0x50(%rbp),%rax
mov    (%rax),%rdi
mov    -0x60(%rbp),%rsi
add    $0x4,%rsi
lea    -0x80(%rbp),%rdx
mov    $0x20,%ecx
call   1030 <inet_ntop@plt>
mov    %rax,%rdx
mov    -0x60(%rbp),%rax
mov    (%rax),%ecx
mov    -0x14(%rbp),%esi
lea    0xd06(%rip),%r8
lea    0xce5(%rip),%rax
cmp    $0x0,%esi
cmove  %rax,%r8
lea    0xce4(%rip),%rdi
lea    0xcb6(%rip),%rsi
call   1050 <printf@plt>
jmp    1354 <_getaddrinfo+0x1d4>
jmp    1359 <_getaddrinfo+0x1d9>
mov    -0x50(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x50(%rbp)
jmp    1240 <_getaddrinfo+0xc0>
mov    -0x40(%rbp),%rdi
call   10a0 <freeaddrinfo@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_getaddrinfo>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rdi,%r14
lea    0x10(%rsp),%r15
xor    %r13d,%r13d
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1070 <memset@plt>
mov    0x2e29(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x10(%rsp)
mov    0x2e2a(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x28(%rsp)
lea    0xe35(%rip),%rdi
lea    0xe38(%rip),%rsi
lea    0x8(%rsp),%rcx
mov    %r15,%rdx
call   1090 <getaddrinfo@plt>
test   %eax,%eax
je     1219 <_getaddrinfo+0x99>
mov    0x2dd6(%rip),%rcx
mov    (%rcx),%ebx
mov    %eax,%edi
call   1060 <gai_strerror@plt>
lea    0xe15(%rip),%rsi
lea    0xe1a(%rip),%rcx
mov    %ebx,%edi
mov    %r14,%rdx
mov    %rax,%r8
call   1080 <fprintf@plt>
mov    $0x1,%r13d
jmp    12e7 <_getaddrinfo+0x167>
mov    0x8(%rsp),%rbx
test   %rbx,%rbx
je     12e0 <_getaddrinfo+0x160>
xor    %r13d,%r13d
mov    0x2daf(%rip),%rbp
lea    0xdef(%rip),%r14
lea    0xdc1(%rip),%r15
jmp    129c <_getaddrinfo+0x11c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x8(%rbx),%r12
mov    0x4(%r12),%edi
cmpl   $0x50,(%r12)
mov    $0x1,%eax
cmovne %eax,%r13d
call   1040 <inet_ntoa@plt>
mov    (%r12),%ecx
test   %r13d,%r13d
lea    0xdba(%rip),%r8
lea    0xd99(%rip),%rdx
cmove  %rdx,%r8
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rax,%rdx
call   1050 <printf@plt>
mov    0x10(%rbx),%rbx
test   %rbx,%rbx
je     12d9 <_getaddrinfo+0x159>
mov    (%rbx),%rdi
cmp    0x0(%rbp),%rdi
je     1250 <_getaddrinfo+0xd0>
mov    0x2d24(%rip),%rax
cmp    (%rax),%rdi
jne    1293 <_getaddrinfo+0x113>
mov    0x8(%rbx),%r12
cmpl   $0x50,(%r12)
mov    $0x1,%eax
cmovne %eax,%r13d
lea    0x4(%r12),%rsi
lea    0x30(%rsp),%rdx
mov    $0x20,%ecx
call   1030 <inet_ntop@plt>
jmp    126c <_getaddrinfo+0xec>
mov    0x8(%rsp),%rdi
jmp    12e2 <_getaddrinfo+0x162>
xor    %edi,%edi
call   10a0 <freeaddrinfo@plt>
mov    %r13d,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.addrinfo = type { i64, i64, %struct.addrinfo*, i32 }
%struct.sockaddr_in = type { i32, i32 }
%struct.sockaddr_in6 = type { i32, i32 }
@AF_UNSPEC = global i64 0
@AI_PASSIVE = global i32 0
@.str = [10 x i8] c"localhost\00"
@.str.1 = [5 x i8] c"http\00"
@stderr = global i32 0
@.str.2 = [12 x i8] c"%s: %s: %s\0A\00"
@.str.3 = [12 x i8] c"getaddrinfo\00"
@AF_INET = global i64 0
@.str.4 = [13 x i8] c"%s: %s:%u%s\0A\00"
@.str.5 = [1 x i8] zeroinitializer
@.str.6 = [9 x i8] c" (WRONG)\00"
@AF_INET6 = global i64 0
define i32 @_getaddrinfo(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca %struct.addrinfo
%6 = alloca %struct.addrinfo*
%7 = alloca i32
%8 = alloca %struct.addrinfo*
%9 = alloca %struct.sockaddr_in*
%10 = alloca %struct.sockaddr_in6*
%11 = alloca [32 x i8]
store i8* %0, i8** %3
store i32 0, i32* %4
%12 = call i32 @memset(%struct.addrinfo* %5, i32 0, i32 32)
%13 = load i64, i64* @AF_UNSPEC
%14 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %5, i32 0, i32 0
store i64 %13, i64* %14
%15 = load i32, i32* @AI_PASSIVE
%16 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %5, i32 0, i32 3
store i32 %15, i32* %16
%17 = call i32 @getaddrinfo(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), %struct.addrinfo* %5, %struct.addrinfo** %6)
store i32 %17, i32* %7
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %25
19: ; preds = %1
%20 = load i32, i32* @stderr
%21 = load i8*, i8** %3
%22 = load i32, i32* %7
%23 = call i8* @gai_strerror(i32 %22)
%24 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %21, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* %23)
store i32 1, i32* %2
br label %101
25: ; preds = %1
%26 = load %struct.addrinfo*, %struct.addrinfo** %6
store %struct.addrinfo* %26, %struct.addrinfo** %8
br label %27
27: ; preds = %93, %25
%28 = load %struct.addrinfo*, %struct.addrinfo** %8
%29 = icmp ne %struct.addrinfo* %28, null
br i1 %29, label %30, label %97
30: ; preds = %27
%31 = load %struct.addrinfo*, %struct.addrinfo** %8
%32 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %31, i32 0, i32 0
%33 = load i64, i64* %32
%34 = load i64, i64* @AF_INET
%35 = icmp eq i64 %33, %34
br i1 %35, label %36, label %59
36: ; preds = %30
%37 = load %struct.addrinfo*, %struct.addrinfo** %8
%38 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %37, i32 0, i32 1
%39 = load i64, i64* %38
%40 = inttoptr i64 %39 to %struct.sockaddr_in*
store %struct.sockaddr_in* %40, %struct.sockaddr_in** %9
%41 = load %struct.sockaddr_in*, %struct.sockaddr_in** %9
%42 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %41, i32 0, i32 0
%43 = load i32, i32* %42
%44 = icmp ne i32 %43, 80
br i1 %44, label %45, label %46
45: ; preds = %36
store i32 1, i32* %4
br label %46
46: ; preds = %45, %36
%47 = load %struct.sockaddr_in*, %struct.sockaddr_in** %9
%48 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %47, i32 0, i32 1
%49 = load i32, i32* %48
%50 = call i8* @inet_ntoa(i32 %49)
%51 = load %struct.sockaddr_in*, %struct.sockaddr_in** %9
%52 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %51, i32 0, i32 0
%53 = load i32, i32* %52
%54 = load i32, i32* %4
%55 = icmp eq i32 %54, 0
%56 = zext i1 %55 to i64
%57 = select i1 %55, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0)
%58 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %50, i32 %53, i8* %57)
br label %92
59: ; preds = %30
%60 = load %struct.addrinfo*, %struct.addrinfo** %8
%61 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %60, i32 0, i32 0
%62 = load i64, i64* %61
%63 = load i64, i64* @AF_INET6
%64 = icmp eq i64 %62, %63
br i1 %64, label %65, label %91
65: ; preds = %59
%66 = load %struct.addrinfo*, %struct.addrinfo** %8
%67 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %66, i32 0, i32 1
%68 = load i64, i64* %67
%69 = inttoptr i64 %68 to %struct.sockaddr_in6*
store %struct.sockaddr_in6* %69, %struct.sockaddr_in6** %10
%70 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %10
%71 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %70, i32 0, i32 0
%72 = load i32, i32* %71
%73 = icmp ne i32 %72, 80
br i1 %73, label %74, label %75
74: ; preds = %65
store i32 1, i32* %4
br label %75
75: ; preds = %74, %65
%76 = load %struct.addrinfo*, %struct.addrinfo** %8
%77 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %76, i32 0, i32 0
%78 = load i64, i64* %77
%79 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %10
%80 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %79, i32 0, i32 1
%81 = getelementptr inbounds [32 x i8], [32 x i8]* %11, i64 0, i64 0
%82 = call i8* @inet_ntop(i64 %78, i32* %80, i8* %81, i32 32)
%83 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %10
%84 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %83, i32 0, i32 0
%85 = load i32, i32* %84
%86 = load i32, i32* %4
%87 = icmp eq i32 %86, 0
%88 = zext i1 %87 to i64
%89 = select i1 %87, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0)
%90 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %82, i32 %85, i8* %89)
br label %91
91: ; preds = %75, %59
br label %92
92: ; preds = %91, %46
br label %93
93: ; preds = %92
%94 = load %struct.addrinfo*, %struct.addrinfo** %8
%95 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %94, i32 0, i32 2
%96 = load %struct.addrinfo*, %struct.addrinfo** %95
store %struct.addrinfo* %96, %struct.addrinfo** %8
br label %27
97: ; preds = %27
%98 = load %struct.addrinfo*, %struct.addrinfo** %6
%99 = call i32 @freeaddrinfo(%struct.addrinfo* %98)
%100 = load i32, i32* %4
store i32 %100, i32* %2
br label %101
101: ; preds = %97, %19
%102 = load i32, i32* %2
ret i32 %102
}

LLVM IR (-O2):
%struct.addrinfo = type { i64, i64, %struct.addrinfo*, i32 }
%struct.sockaddr_in = type { i32, i32 }
%struct.sockaddr_in6 = type { i32, i32 }
@AF_UNSPEC = global i64 0
@AI_PASSIVE = global i32 0
@.str = [10 x i8] c"localhost\00"
@.str.1 = [5 x i8] c"http\00"
@stderr = global i32 0
@.str.2 = [12 x i8] c"%s: %s: %s\0A\00"
@.str.3 = [12 x i8] c"getaddrinfo\00"
@AF_INET = global i64 0
@.str.4 = [13 x i8] c"%s: %s:%u%s\0A\00"
@.str.5 = [1 x i8] zeroinitializer
@.str.6 = [9 x i8] c" (WRONG)\00"
@AF_INET6 = global i64 0
define i32 @_getaddrinfo(i8* %0) {
%2 = alloca %struct.addrinfo
%3 = alloca %struct.addrinfo*
%4 = alloca [32 x i8]
%5 = bitcast %struct.addrinfo* %2 to i8*
%6 = bitcast %struct.addrinfo** %3 to i8*
%7 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%8 = call i32 @memset(%struct.addrinfo* %2, i32 0, i32 32)
%9 = load i64, i64* @AF_UNSPEC
%10 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %2, i64 0, i32 0
store i64 %9, i64* %10
%11 = load i32, i32* @AI_PASSIVE
%12 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %2, i64 0, i32 3
store i32 %11, i32* %12
%13 = call i32 @getaddrinfo(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), %struct.addrinfo* %2, %struct.addrinfo** %3)
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %1
%16 = load %struct.addrinfo*, %struct.addrinfo** %3
%17 = icmp eq %struct.addrinfo* %16, null
br i1 %17, label %68, label %22
18: ; preds = %1
%19 = load i32, i32* @stderr
%20 = call i8* @gai_strerror(i32 %13)
%21 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* %20)
br label %72
22: ; preds = %15, %61
%23 = phi %struct.addrinfo* [ %64, %61 ], [ %16, %15 ]
%24 = phi i32 [ %62, %61 ], [ 0, %15 ]
%25 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %23, i64 0, i32 0
%26 = load i64, i64* %25
%27 = load i64, i64* @AF_INET
%28 = icmp eq i64 %26, %27
br i1 %28, label %29, label %40
29: ; preds = %22
%30 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %23, i64 0, i32 1
%31 = load i64, i64* %30
%32 = inttoptr i64 %31 to %struct.sockaddr_in*
%33 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %32, i64 0, i32 0
%34 = load i32, i32* %33
%35 = icmp eq i32 %34, 80
%36 = select i1 %35, i32 %24, i32 1
%37 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %32, i64 0, i32 1
%38 = load i32, i32* %37
%39 = call i8* @inet_ntoa(i32 %38)
br label %53
40: ; preds = %22
%41 = load i64, i64* @AF_INET6
%42 = icmp eq i64 %26, %41
br i1 %42, label %43, label %61
43: ; preds = %40
%44 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %23, i64 0, i32 1
%45 = load i64, i64* %44
%46 = inttoptr i64 %45 to %struct.sockaddr_in6*
%47 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %46, i64 0, i32 0
%48 = load i32, i32* %47
%49 = icmp eq i32 %48, 80
%50 = select i1 %49, i32 %24, i32 1
%51 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %46, i64 0, i32 1
%52 = call i8* @inet_ntop(i64 %26, i32* %51, i8* %7, i32 32)
br label %53
53: ; preds = %43, %29
%54 = phi i32* [ %33, %29 ], [ %47, %43 ]
%55 = phi i32 [ %36, %29 ], [ %50, %43 ]
%56 = phi i8* [ %39, %29 ], [ %52, %43 ]
%57 = load i32, i32* %54
%58 = icmp eq i32 %55, 0
%59 = select i1 %58, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0)
%60 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %56, i32 %57, i8* %59)
br label %61
61: ; preds = %53, %40
%62 = phi i32 [ %24, %40 ], [ %55, %53 ]
%63 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %23, i64 0, i32 2
%64 = load %struct.addrinfo*, %struct.addrinfo** %63
%65 = icmp eq %struct.addrinfo* %64, null
br i1 %65, label %66, label %22
66: ; preds = %61
%67 = load %struct.addrinfo*, %struct.addrinfo** %3
br label %68
68: ; preds = %66, %15
%69 = phi %struct.addrinfo* [ null, %15 ], [ %67, %66 ]
%70 = phi i32 [ 0, %15 ], [ %62, %66 ]
%71 = call i32 @freeaddrinfo(%struct.addrinfo* %69)
br label %72
72: ; preds = %68, %18
%73 = phi i32 [ 1, %18 ], [ %70, %68 ]
ret i32 %73
}