#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 {
  int dummy;
};
struct addrinfo {
  struct sockaddr *ai_addr;
  int /*<<< orphan*/ ai_addrlen;
  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_INET;
int /*<<< orphan*/ AI_PASSIVE;
int /*<<< orphan*/ SOCK_DGRAM;
int bind(int, struct sockaddr *, int /*<<< orphan*/);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ freeaddrinfo(struct addrinfo *);
char *gai_strerror(int);
int getaddrinfo(char *, char *, struct addrinfo *, struct addrinfo **);
int /*<<< orphan*/ memset(struct addrinfo *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int get_addr_sock(struct sockaddr *addr, int *sock, char *serverip,
                  char *server_port) {
  if (addr == NULL) {
    fprintf(stderr, "[get_addr_port]: addr was NULL\n");
    return -1;
  } else if (sock == NULL) {
    fprintf(stderr, "[get_addr_port]: port was NULL\n");
    return -1;
  }
  struct addrinfo hints;
  struct addrinfo *server_info;
  memset(&hints, 0, sizeof(hints));
  hints.ai_family = AF_INET;
  hints.ai_socktype = SOCK_DGRAM;
  if (serverip == NULL) {
    hints.ai_flags = AI_PASSIVE;
  }
  int err = getaddrinfo(serverip, server_port, &hints, &server_info);
  if (err != 0) {
    fprintf(stderr, "[get_addr_port]: getaddrinfo: %s\n", gai_strerror(err));
    return -1;
  }
  struct addrinfo *p;
  for (p = server_info; p != NULL; p = p->ai_next) {
    if ((*sock = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) == -1) {
      perror("[get_addr_port]: sender: socket");
      continue;
    }
    if (serverip == NULL) {
      if (bind(*sock, p->ai_addr, p->ai_addrlen) == -1) {
        close(*sock);
        perror("[get_addr_port]: bind");
        continue;
      }
    }
    break;
  }
  if (p == NULL) {
    fprintf(stderr, "[get_addr_port]: sender could not get socket\n");
    return -1;
  }
  *addr = *(p->ai_addr);
  freeaddrinfo(server_info);
  return 0;
}


x86 assembly (clang, -O0):
<get_addr_sock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11d6 <get_addr_sock+0x46>
mov    0x2e0e(%rip),%rax
mov    (%rax),%edi
lea    0xe3d(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    139c <get_addr_sock+0x20c>
cmpq   $0x0,-0x18(%rbp)
jne    1204 <get_addr_sock+0x74>
mov    0x2de0(%rip),%rax
mov    (%rax),%edi
lea    0xe2f(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    139c <get_addr_sock+0x20c>
jmp    1209 <get_addr_sock+0x79>
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
mov    0x2dc0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    0x2dac(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1248 <get_addr_sock+0xb8>
mov    0x2da5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
lea    -0x50(%rbp),%rdx
lea    -0x58(%rbp),%rcx
call   1090 <getaddrinfo@plt>
mov    %eax,-0x5c(%rbp)
cmpl   $0x0,-0x5c(%rbp)
je     129e <get_addr_sock+0x10e>
mov    0x2d57(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x5c(%rbp),%edi
call   1030 <gai_strerror@plt>
mov    -0x6c(%rbp),%edi
mov    %rax,%rdx
lea    0xdb5(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    139c <get_addr_sock+0x20c>
mov    -0x58(%rbp),%rax
mov    %rax,-0x68(%rbp)
cmpq   $0x0,-0x68(%rbp)
je     134f <get_addr_sock+0x1bf>
mov    -0x68(%rbp),%rax
mov    0x14(%rax),%edi
mov    -0x68(%rbp),%rax
mov    0x10(%rax),%esi
mov    -0x68(%rbp),%rax
mov    0xc(%rax),%edx
call   10b0 <socket@plt>
mov    -0x18(%rbp),%rcx
mov    %eax,(%rcx)
cmp    $0xffffffff,%eax
jne    12eb <get_addr_sock+0x15b>
lea    0xd81(%rip),%rdi
call   1080 <perror@plt>
jmp    133e <get_addr_sock+0x1ae>
cmpq   $0x0,-0x20(%rbp)
jne    1339 <get_addr_sock+0x1a9>
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
mov    -0x68(%rbp),%rax
mov    (%rax),%rsi
mov    -0x68(%rbp),%rax
mov    0x8(%rax),%edx
call   1070 <bind@plt>
cmp    $0xffffffff,%eax
jne    1334 <get_addr_sock+0x1a4>
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
call   1050 <close@plt>
lea    0xd58(%rip),%rdi
call   1080 <perror@plt>
jmp    133e <get_addr_sock+0x1ae>
jmp    1339 <get_addr_sock+0x1a9>
jmp    134f <get_addr_sock+0x1bf>
mov    -0x68(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x68(%rbp)
jmp    12a6 <get_addr_sock+0x116>
cmpq   $0x0,-0x68(%rbp)
jne    137d <get_addr_sock+0x1ed>
mov    0x2c67(%rip),%rax
mov    (%rax),%edi
lea    0xd2e(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    139c <get_addr_sock+0x20c>
mov    -0x10(%rbp),%rax
mov    -0x68(%rbp),%rcx
mov    (%rcx),%rcx
mov    (%rcx),%ecx
mov    %ecx,(%rax)
mov    -0x58(%rbp),%rdi
call   10a0 <freeaddrinfo@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_addr_sock>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
test   %rdi,%rdi
je     123a <get_addr_sock+0xaa>
mov    %rsi,%r15
test   %rsi,%rsi
je     124f <get_addr_sock+0xbf>
mov    %rcx,%rbx
mov    %rdx,%r14
mov    %rdi,%r12
lea    0x10(%rsp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
mov    0x2e0c(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x24(%rsp)
mov    0x2df7(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x20(%rsp)
test   %r14,%r14
jne    11f9 <get_addr_sock+0x69>
mov    0x2df5(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x30(%rsp)
lea    0x10(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1090 <getaddrinfo@plt>
test   %eax,%eax
je     1261 <get_addr_sock+0xd1>
mov    0x2daf(%rip),%rcx
mov    (%rcx),%ebx
mov    %eax,%edi
call   1030 <gai_strerror@plt>
lea    0xe17(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
jmp    12d9 <get_addr_sock+0x149>
mov    0x2d87(%rip),%rax
mov    (%rax),%edi
lea    0xdb6(%rip),%rsi
jmp    12d2 <get_addr_sock+0x142>
mov    0x2d72(%rip),%rax
mov    (%rax),%edi
lea    0xdc1(%rip),%rsi
jmp    12d2 <get_addr_sock+0x142>
mov    0x8(%rsp),%rbx
test   %rbx,%rbx
je     12c2 <get_addr_sock+0x132>
lea    0xdf0(%rip),%r13
lea    0xe09(%rip),%rbp
mov    0x14(%rbx),%edi
mov    0xc(%rbx),%edx
mov    0x10(%rbx),%esi
call   10b0 <socket@plt>
mov    %eax,(%r15)
mov    %r13,%rdi
cmp    $0xffffffff,%eax
je     12b4 <get_addr_sock+0x124>
test   %r14,%r14
jne    12ed <get_addr_sock+0x15d>
mov    (%rbx),%rsi
mov    0x8(%rbx),%edx
mov    %eax,%edi
call   1070 <bind@plt>
cmp    $0xffffffff,%eax
jne    12ed <get_addr_sock+0x15d>
mov    (%r15),%edi
call   1050 <close@plt>
mov    %rbp,%rdi
call   1080 <perror@plt>
mov    0x18(%rbx),%rbx
test   %rbx,%rbx
jne    1279 <get_addr_sock+0xe9>
mov    0x2cff(%rip),%rax
mov    (%rax),%edi
lea    0xdc6(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%rbx),%rax
mov    (%rax),%eax
mov    %eax,(%r12)
mov    0x8(%rsp),%rdi
call   10a0 <freeaddrinfo@plt>
xor    %eax,%eax
jmp    12de <get_addr_sock+0x14e>

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

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
%struct.addrinfo = type { %struct.sockaddr*, i32, i32, i32, i32, %struct.addrinfo*, i32 }
@stderr = global i32 0
@.str = [32 x i8] c"[get_addr_port]: addr was NULL\0A\00"
@.str.1 = [32 x i8] c"[get_addr_port]: port was NULL\0A\00"
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@AI_PASSIVE = global i32 0
@.str.2 = [34 x i8] c"[get_addr_port]: getaddrinfo: %s\0A\00"
@.str.3 = [32 x i8] c"[get_addr_port]: sender: socket\00"
@.str.4 = [22 x i8] c"[get_addr_port]: bind\00"
@.str.5 = [46 x i8] c"[get_addr_port]: sender could not get socket\0A\00"
define i32 @get_addr_sock(%struct.sockaddr* writeonly %0, i32* %1, i8* %2, i8* %3) {
%5 = alloca %struct.addrinfo
%6 = alloca %struct.addrinfo*
%7 = icmp eq %struct.sockaddr* %0, null
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = load i32, i32* @stderr
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %77
11: ; preds = %4
%12 = icmp eq i32* %1, null
br i1 %12, label %13, label %16
13: ; preds = %11
%14 = load i32, i32* @stderr
%15 = tail call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
br label %77
16: ; preds = %11
%17 = bitcast %struct.addrinfo* %5 to i8*
%18 = bitcast %struct.addrinfo** %6 to i8*
%19 = call i32 @memset(%struct.addrinfo* %5, i32 0, i32 40)
%20 = load i32, i32* @AF_INET
%21 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %5, i64 0, i32 4
store i32 %20, i32* %21
%22 = load i32, i32* @SOCK_DGRAM
%23 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %5, i64 0, i32 3
store i32 %22, i32* %23
%24 = icmp eq i8* %2, null
br i1 %24, label %25, label %28
25: ; preds = %16
%26 = load i32, i32* @AI_PASSIVE
%27 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %5, i64 0, i32 6
store i32 %26, i32* %27
br label %28
28: ; preds = %25, %16
%29 = call i32 @getaddrinfo(i8* %2, i8* %3, %struct.addrinfo* %5, %struct.addrinfo** %6)
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %28
%32 = load %struct.addrinfo*, %struct.addrinfo** %6
%33 = icmp eq %struct.addrinfo* %32, null
br i1 %33, label %65, label %38
34: ; preds = %28
%35 = load i32, i32* @stderr
%36 = call i8* @gai_strerror(i32 %29)
%37 = call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* %36)
br label %75
38: ; preds = %31, %59
%39 = phi %struct.addrinfo* [ %63, %59 ], [ %32, %31 ]
%40 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %39, i64 0, i32 4
%41 = load i32, i32* %40
%42 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %39, i64 0, i32 3
%43 = load i32, i32* %42
%44 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %39, i64 0, i32 2
%45 = load i32, i32* %44
%46 = call i32 @socket(i32 %41, i32 %43, i32 %45)
store i32 %46, i32* %1
%47 = icmp eq i32 %46, -1
br i1 %47, label %59, label %48
48: ; preds = %38
br i1 %24, label %49, label %68
49: ; preds = %48
%50 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %39, i64 0, i32 0
%51 = load %struct.sockaddr*, %struct.sockaddr** %50
%52 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %39, i64 0, i32 1
%53 = load i32, i32* %52
%54 = call i32 @bind(i32 %46, %struct.sockaddr* %51, i32 %53)
%55 = icmp eq i32 %54, -1
br i1 %55, label %56, label %68
56: ; preds = %49
%57 = load i32, i32* %1
%58 = call i32 @close(i32 %57)
br label %59
59: ; preds = %38, %56
%60 = phi i8* [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), %56 ], [ getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), %38 ]
%61 = call i32 @perror(i8* %60)
%62 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %39, i64 0, i32 5
%63 = load %struct.addrinfo*, %struct.addrinfo** %62
%64 = icmp eq %struct.addrinfo* %63, null
br i1 %64, label %65, label %38
65: ; preds = %59, %31
%66 = load i32, i32* @stderr
%67 = call i32 (i32, i8*, ...) @fprintf(i32 %66, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.5, i64 0, i64 0))
br label %75
68: ; preds = %49, %48
%69 = bitcast %struct.addrinfo* %39 to i32**
%70 = load i32*, i32** %69
%71 = getelementptr %struct.sockaddr, %struct.sockaddr* %0, i64 0, i32 0
%72 = load i32, i32* %70
store i32 %72, i32* %71
%73 = load %struct.addrinfo*, %struct.addrinfo** %6
%74 = call i32 @freeaddrinfo(%struct.addrinfo* %73)
br label %75
75: ; preds = %65, %68, %34
%76 = phi i32 [ -1, %34 ], [ -1, %65 ], [ 0, %68 ]
br label %77
77: ; preds = %75, %13, %8
%78 = phi i32 [ -1, %8 ], [ -1, %13 ], [ %76, %75 ]
ret i32 %78
}