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

/* Variables and functions */
int /*<<< orphan*/ AF_UNSPEC;
int /*<<< orphan*/ AI_PASSIVE;
int /*<<< orphan*/ SOCK_STREAM;
scalar_t__ bind(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ freeaddrinfo(struct addrinfo *);
int /*<<< orphan*/ gai_strerror(int);
int getaddrinfo(char *, char *, struct addrinfo *, struct addrinfo **);
scalar_t__ listen(int, int);
int /*<<< orphan*/ memset(struct addrinfo *, int /*<<< orphan*/, int);
scalar_t__ set_reuseaddr(char *, int, int);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ socket_error(char *, char *, ...);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
int tcp_server_serve(char *err, char *addr, int port, int backlog) {
  int sfd, rv;
  char s_port[sizeof("65535")];
  struct addrinfo hints, *servinfo, *p;
  snprintf(s_port, 6, "%d", port);
  memset(&hints, 0, sizeof(hints));
  hints.ai_family = AF_UNSPEC;
  hints.ai_socktype = SOCK_STREAM;
  hints.ai_flags = AI_PASSIVE;
  if ((rv = getaddrinfo(addr, s_port, &hints, &servinfo)) != 0) {
    socket_error(err, "%s", gai_strerror(rv));
    return -1;
  }
  for (p = servinfo; p != NULL; p = p->ai_next) {
    if ((sfd = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) == -1) {
      continue;
    }
    if (set_reuseaddr(err, sfd, 1) != 0) {
      goto error;
    }
    if (bind(sfd, p->ai_addr, p->ai_addrlen) != 0) {
      socket_error(err, "bind: %s", strerror(errno));
      close(sfd);
      goto error;
    }
    if (listen(sfd, backlog) != 0) {
      socket_error(err, "listen: %s", strerror(errno));
      close(sfd);
      goto error;
    }
    goto end;
  }
  if (p == NULL) {
    socket_error(err, "unable to bind socket");
    goto error;
  }
error:
  sfd = -1;
end:
  freeaddrinfo(servinfo);
  return sfd;
}


x86 assembly (clang, -O0):
<tcp_server_serve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
lea    -0x2e(%rbp),%rdi
mov    -0x1c(%rbp),%ecx
mov    $0x6,%esi
lea    0xe14(%rip),%rdx
call   1040 <snprintf@plt>
lea    -0x58(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1060 <memset@plt>
mov    0x2dd8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    0x2dbc(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
mov    0x2dc8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x2e(%rbp),%rsi
lea    -0x58(%rbp),%rdx
lea    -0x60(%rbp),%rcx
call   10a0 <getaddrinfo@plt>
mov    %eax,-0x28(%rbp)
cmp    $0x0,%eax
je     1276 <tcp_server_serve+0xb6>
mov    -0x10(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x28(%rbp),%edi
call   1050 <gai_strerror@plt>
mov    -0x70(%rbp),%rdi
mov    %eax,%edx
lea    0xda6(%rip),%rsi
mov    $0x0,%al
call   1030 <socket_error@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13c9 <tcp_server_serve+0x209>
mov    -0x60(%rbp),%rax
mov    %rax,-0x68(%rbp)
cmpq   $0x0,-0x68(%rbp)
je     138c <tcp_server_serve+0x1cc>
mov    -0x68(%rbp),%rax
mov    0x10(%rax),%edi
mov    -0x68(%rbp),%rax
mov    0xc(%rax),%esi
mov    -0x68(%rbp),%rax
mov    0x8(%rax),%edx
call   10e0 <socket@plt>
mov    %eax,-0x24(%rbp)
cmp    $0xffffffff,%eax
jne    12b4 <tcp_server_serve+0xf4>
jmp    137b <tcp_server_serve+0x1bb>
mov    -0x10(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    $0x1,%edx
call   10c0 <set_reuseaddr@plt>
cmp    $0x0,%rax
je     12d4 <tcp_server_serve+0x114>
jmp    13b3 <tcp_server_serve+0x1f3>
mov    -0x24(%rbp),%edi
mov    -0x68(%rbp),%rax
mov    0x4(%rax),%esi
mov    -0x68(%rbp),%rax
mov    (%rax),%edx
call   1090 <bind@plt>
cmp    $0x0,%rax
je     132a <tcp_server_serve+0x16a>
mov    -0x10(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    0x2cc6(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x78(%rbp),%rdi
mov    %eax,%edx
lea    0xced(%rip),%rsi
mov    $0x0,%al
call   1030 <socket_error@plt>
mov    -0x24(%rbp),%edi
call   1070 <close@plt>
jmp    13b3 <tcp_server_serve+0x1f3>
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1080 <listen@plt>
cmp    $0x0,%rax
je     1376 <tcp_server_serve+0x1b6>
mov    -0x10(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    0x2c7a(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x80(%rbp),%rdi
mov    %eax,%edx
lea    0xcaa(%rip),%rsi
mov    $0x0,%al
call   1030 <socket_error@plt>
mov    -0x24(%rbp),%edi
call   1070 <close@plt>
jmp    13b3 <tcp_server_serve+0x1f3>
jmp    13ba <tcp_server_serve+0x1fa>
mov    -0x68(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x68(%rbp)
jmp    127e <tcp_server_serve+0xbe>
cmpq   $0x0,-0x68(%rbp)
jne    13ae <tcp_server_serve+0x1ee>
mov    -0x10(%rbp),%rdi
lea    0xc75(%rip),%rsi
mov    $0x0,%al
call   1030 <socket_error@plt>
jmp    13b3 <tcp_server_serve+0x1f3>
jmp    13b3 <tcp_server_serve+0x1f3>
movl   $0xffffffff,-0x24(%rbp)
mov    -0x60(%rbp),%rdi
call   10d0 <freeaddrinfo@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tcp_server_serve>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x40,%rsp
mov    %ecx,%r14d
mov    %edx,%ecx
mov    %rsi,%rbx
mov    %rdi,%r15
lea    0xe22(%rip),%rdx
lea    0x12(%rsp),%r12
mov    %r12,%rdi
mov    $0x6,%esi
call   1040 <snprintf@plt>
lea    0x18(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1060 <memset@plt>
mov    0x2dd5(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x28(%rsp)
mov    0x2db8(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x24(%rsp)
mov    0x2dc3(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x38(%rsp)
lea    0x8(%rsp),%rcx
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %rbp,%rdx
call   10a0 <getaddrinfo@plt>
test   %eax,%eax
je     1267 <tcp_server_serve+0xa7>
mov    %eax,%edi
call   1050 <gai_strerror@plt>
lea    0xdb9(%rip),%rsi
mov    %r15,%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <socket_error@plt>
mov    $0xffffffff,%r12d
jmp    133a <tcp_server_serve+0x17a>
mov    0x8(%rsp),%rbx
test   %rbx,%rbx
je     129c <tcp_server_serve+0xdc>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x10(%rbx),%edi
mov    0x8(%rbx),%edx
mov    0xc(%rbx),%esi
call   10e0 <socket@plt>
cmp    $0xffffffff,%eax
jne    12b5 <tcp_server_serve+0xf5>
mov    0x18(%rbx),%rbx
test   %rbx,%rbx
jne    1280 <tcp_server_serve+0xc0>
lea    0xd74(%rip),%rsi
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <socket_error@plt>
mov    $0xffffffff,%r12d
jmp    1330 <tcp_server_serve+0x170>
mov    %eax,%ebp
mov    %r15,%rdi
mov    %eax,%esi
mov    $0x1,%edx
call   10c0 <set_reuseaddr@plt>
mov    $0xffffffff,%r12d
test   %rax,%rax
jne    1330 <tcp_server_serve+0x170>
mov    (%rbx),%edx
mov    0x4(%rbx),%esi
mov    %ebp,%edi
call   1090 <bind@plt>
test   %rax,%rax
je     12f9 <tcp_server_serve+0x139>
mov    0x2cdf(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
lea    0xd0c(%rip),%rsi
jmp    131d <tcp_server_serve+0x15d>
mov    %ebp,%edi
mov    %r14d,%esi
call   1080 <listen@plt>
test   %rax,%rax
je     134a <tcp_server_serve+0x18a>
mov    0x2cb9(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
lea    0xcef(%rip),%rsi
mov    %r15,%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <socket_error@plt>
mov    %ebp,%edi
call   1070 <close@plt>
mov    0x8(%rsp),%rdi
call   10d0 <freeaddrinfo@plt>
mov    %r12d,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %ebp,%r12d
jmp    1330 <tcp_server_serve+0x170>

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

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