#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 /*<<< orphan*/ sin6_addr;
};
struct in_addr {
  int dummy;
};
struct sockaddr_in {
  struct in_addr sin_addr;
};
struct addrinfo {
  scalar_t__ ai_family;
  int /*<<< orphan*/ ai_addrlen;
  scalar_t__ ai_addr;
  struct addrinfo *ai_next;
  int /*<<< orphan*/ ai_flags;
  int /*<<< orphan*/ ai_socktype;
};
typedef int /*<<< orphan*/ ipstr;

/* Variables and functions */
scalar_t__ AF_INET;
scalar_t__ AF_UNSPEC;
int /*<<< orphan*/ AI_PASSIVE;
int INET_ADDRSTRLEN;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ bzero(struct addrinfo *, int);
scalar_t__ connect(int, scalar_t__, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ freeaddrinfo(struct addrinfo *);
char *gai_strerror(int);
int getaddrinfo(char *, char *, struct addrinfo *, struct addrinfo **);
int /*<<< orphan*/ inet_ntop(scalar_t__, struct in_addr *, char *, int);
int /*<<< orphan*/ puts(char *);
int socket(scalar_t__, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ stderr;
int net_util_connect(char *addr, int port) {
  int ret;
  struct addrinfo hints;
  struct addrinfo *servinfo;
  char str_port[6];
  sprintf(str_port, "%d", port);
  bzero(&hints, sizeof(struct addrinfo));
  hints.ai_family = AF_UNSPEC;
  hints.ai_socktype = SOCK_STREAM;
  hints.ai_flags = AI_PASSIVE;
  if ((ret = getaddrinfo(addr, str_port, &hints, &servinfo))) {
    fprintf(stderr, "Failed to resolve: %s\n", gai_strerror(ret));
    return -1;
  }
  struct addrinfo *p;
  char ipstr[INET_ADDRSTRLEN];
  for (p = servinfo; p != NULL; p = p->ai_next) {
    struct in_addr *addr;
    if (p->ai_family == AF_INET) {
      struct sockaddr_in *ipv4 = (struct sockaddr_in *)p->ai_addr;
      addr = &(ipv4->sin_addr);
    } else {
      struct sockaddr_in6 *ipv6 = (struct sockaddr_in6 *)p->ai_addr;
      addr = (struct in_addr *)&(ipv6->sin6_addr);
    }
    inet_ntop(p->ai_family, addr, ipstr, sizeof(ipstr));
    int sockfd = socket(p->ai_family, SOCK_STREAM, 0);
    if (sockfd != -1) {
      if (connect(sockfd, p->ai_addr, p->ai_addrlen) == 0) {
        freeaddrinfo(servinfo);
        return sockfd;
      }
    }
  }
  freeaddrinfo(servinfo);
  puts("Failed to connect.");
  return -1;
}


x86 assembly (clang, -O0):
<net_util_connect>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
lea    -0x4e(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xe40(%rip),%rsi
call   1080 <sprintf@plt>
lea    -0x40(%rbp),%rdi
mov    $0x28,%esi
call   1070 <bzero@plt>
mov    0x2dfe(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
mov    0x2dd8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    0x2df4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x4e(%rbp),%rsi
lea    -0x40(%rbp),%rdx
lea    -0x48(%rbp),%rcx
call   10a0 <getaddrinfo@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
je     1252 <net_util_connect+0xb2>
mov    0x2da7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8c(%rbp)
mov    -0x18(%rbp),%edi
call   1050 <gai_strerror@plt>
mov    -0x8c(%rbp),%edi
mov    %rax,%rdx
lea    0xdc2(%rip),%rsi
call   1060 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13b6 <net_util_connect+0x216>
mov    0x2d5f(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0xa0(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x60(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x98(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x68(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0x58(%rbp)
cmpq   $0x0,-0x58(%rbp)
je     1389 <net_util_connect+0x1e9>
mov    -0x58(%rbp),%rax
mov    (%rax),%rax
mov    0x2d37(%rip),%rcx
cmp    (%rcx),%rax
jne    12cb <net_util_connect+0x12b>
mov    -0x58(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x78(%rbp)
mov    -0x78(%rbp),%rax
mov    %rax,-0x70(%rbp)
jmp    12df <net_util_connect+0x13f>
mov    -0x58(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x80(%rbp)
mov    -0x80(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x98(%rbp),%rdx
mov    -0xa0(%rbp),%rax
mov    -0x58(%rbp),%rcx
mov    (%rcx),%rdi
mov    -0x70(%rbp),%rsi
mov    %eax,%ecx
call   1030 <inet_ntop@plt>
mov    -0x58(%rbp),%rax
mov    (%rax),%rdi
mov    0x2cb3(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10c0 <socket@plt>
mov    %eax,-0x84(%rbp)
cmpl   $0xffffffff,-0x84(%rbp)
je     1373 <net_util_connect+0x1d3>
mov    -0x84(%rbp),%edi
mov    -0x58(%rbp),%rax
mov    0x10(%rax),%rsi
mov    -0x58(%rbp),%rax
mov    0x8(%rax),%edx
call   1090 <connect@plt>
cmp    $0x0,%rax
jne    136e <net_util_connect+0x1ce>
mov    -0x48(%rbp),%rdi
call   10b0 <freeaddrinfo@plt>
mov    -0x84(%rbp),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x88(%rbp)
jmp    13af <net_util_connect+0x20f>
jmp    1373 <net_util_connect+0x1d3>
jmp    1378 <net_util_connect+0x1d8>
mov    -0x58(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x58(%rbp)
jmp    1290 <net_util_connect+0xf0>
mov    -0x48(%rbp),%rdi
call   10b0 <freeaddrinfo@plt>
lea    0xc81(%rip),%rdi
call   1040 <puts@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x88(%rbp)
mov    -0x60(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<net_util_connect>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %esi,%edx
mov    %rdi,%rbx
lea    0xe43(%rip),%rsi
lea    -0x3e(%rbp),%r14
mov    %r14,%rdi
call   1080 <sprintf@plt>
lea    -0x68(%rbp),%r15
mov    %r15,%rdi
mov    $0x28,%esi
call   1070 <bzero@plt>
mov    0x2dff(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x68(%rbp)
mov    0x2dd9(%rip),%r13
mov    0x0(%r13),%eax
mov    %eax,-0x44(%rbp)
mov    0x2deb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
lea    -0x30(%rbp),%rcx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   10a0 <getaddrinfo@plt>
test   %eax,%eax
je     1243 <net_util_connect+0xa3>
mov    0x2db1(%rip),%rcx
mov    (%rcx),%ebx
mov    %eax,%edi
call   1050 <gai_strerror@plt>
lea    0xdd4(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1060 <fprintf@plt>
mov    $0xffffffff,%ebx
jmp    12e3 <net_util_connect+0x143>
mov    %rsp,-0x38(%rbp)
mov    0x2d72(%rip),%rax
mov    (%rax),%r14d
mov    %rsp,%r15
lea    0xf(%r14),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
mov    -0x30(%rbp),%r12
test   %r12,%r12
jne    127a <net_util_connect+0xda>
xor    %edi,%edi
jmp    12c9 <net_util_connect+0x129>
nop
mov    0x18(%r12),%r12
test   %r12,%r12
je     12c5 <net_util_connect+0x125>
mov    (%r12),%rdi
mov    0x10(%r12),%rsi
mov    %r15,%rdx
mov    %r14d,%ecx
call   1030 <inet_ntop@plt>
mov    (%r12),%rdi
mov    0x0(%r13),%esi
xor    %edx,%edx
call   10c0 <socket@plt>
cmp    $0xffffffff,%eax
je     1270 <net_util_connect+0xd0>
mov    %eax,%ebx
mov    0x10(%r12),%rsi
mov    0x8(%r12),%edx
mov    %eax,%edi
call   1090 <connect@plt>
test   %rax,%rax
jne    1270 <net_util_connect+0xd0>
mov    -0x30(%rbp),%rdi
call   10b0 <freeaddrinfo@plt>
jmp    12df <net_util_connect+0x13f>
mov    -0x30(%rbp),%rdi
call   10b0 <freeaddrinfo@plt>
lea    0xd45(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%ebx
mov    -0x38(%rbp),%rsp
mov    %ebx,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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