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

/* Variables and functions */
int /*<<< orphan*/ AF_UNSPEC;
int AI_NUMERICSERV;
int AI_PASSIVE;
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_REUSEADDR;
scalar_t__ bind(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ freeaddrinfo(struct addrinfo *);
char *gai_strerror(int);
int getaddrinfo(int /*<<< orphan*/ *, char *, struct addrinfo *,
                struct addrinfo **);
int listen(int, int);
int /*<<< orphan*/ memset(struct addrinfo *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
int setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, int *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, scalar_t__);
int /*<<< orphan*/ stderr;
int listen_socket(char *port) {
  int res;
  int skfd;
  int opt = 1;
  struct addrinfo hints, *result, *rp;
  memset(&hints, 0, sizeof(struct addrinfo));
  hints.ai_canonname = NULL;
  hints.ai_addr = NULL;
  hints.ai_next = NULL;
  hints.ai_family = AF_UNSPEC;
  hints.ai_socktype = SOCK_STREAM;
  hints.ai_protocol = 0;
  hints.ai_flags = AI_PASSIVE | AI_NUMERICSERV;
  res = getaddrinfo(NULL, port, &hints, &result);
  if (res != 0) {
    fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(res));
    exit(EXIT_FAILURE);
  }
  for (rp = result; rp != NULL; rp = rp->ai_next) {
    skfd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);
    if (skfd == -1) {
      continue;
    }
    if (setsockopt(skfd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) == -1) {
      perror("setsockopt");
      close(skfd);
    }
    if (bind(skfd, rp->ai_addr, rp->ai_addrlen) == 0) {
      printf("Bind success!\n");
      break;
    }
    close(skfd);
  }
  if (rp == NULL) {
    printf("Fail to find socket !\n");
    return -1;
  }
  if (listen(skfd, 10) == -1) {
    printf("Fail to listen !\n");
    close(skfd);
    return -1;
  }
  freeaddrinfo(result);
  return skfd;
}


x86 assembly (clang, -O0):
<listen_socket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x1,-0x1c(%rbp)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1060 <memset@plt>
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x48(%rbp)
movq   $0x0,-0x30(%rbp)
mov    0x2dbe(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    0x2d9a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
mov    0x2da6(%rip),%rax
mov    (%rax),%eax
mov    0x2dbd(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x50(%rbp)
mov    -0x10(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
lea    -0x50(%rbp),%rdx
lea    -0x58(%rbp),%rcx
call   10d0 <getaddrinfo@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1296 <listen_socket+0xc6>
mov    0x2d57(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x64(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <gai_strerror@plt>
mov    -0x64(%rbp),%edi
mov    %rax,%rdx
lea    0xd7d(%rip),%rsi
call   1080 <fprintf@plt>
mov    0x2d21(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
mov    -0x58(%rbp),%rax
mov    %rax,-0x60(%rbp)
cmpq   $0x0,-0x60(%rbp)
je     1362 <listen_socket+0x192>
mov    -0x60(%rbp),%rax
mov    0x1c(%rax),%edi
mov    -0x60(%rbp),%rax
mov    0x18(%rax),%esi
mov    -0x60(%rbp),%rax
mov    0x10(%rax),%rdx
call   10f0 <socket@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
jne    12d6 <listen_socket+0x106>
jmp    1351 <listen_socket+0x181>
mov    -0x18(%rbp),%edi
mov    0x2d00(%rip),%rax
mov    (%rax),%esi
mov    0x2cbf(%rip),%rax
mov    (%rax),%edx
lea    -0x1c(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
cmp    $0xffffffff,%eax
jne    1317 <listen_socket+0x147>
lea    0xd07(%rip),%rdi
call   10b0 <perror@plt>
mov    -0x18(%rbp),%edi
call   1070 <close@plt>
mov    -0x18(%rbp),%edi
mov    -0x60(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x60(%rbp),%rax
mov    0x4(%rax),%edx
call   10a0 <bind@plt>
cmp    $0x0,%rax
jne    1349 <listen_socket+0x179>
lea    0xcdd(%rip),%rdi
call   1040 <printf@plt>
jmp    1362 <listen_socket+0x192>
mov    -0x18(%rbp),%edi
call   1070 <close@plt>
mov    -0x60(%rbp),%rax
mov    0x20(%rax),%rax
mov    %rax,-0x60(%rbp)
jmp    129e <listen_socket+0xce>
cmpq   $0x0,-0x60(%rbp)
jne    1385 <listen_socket+0x1b5>
lea    0xcb7(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13ca <listen_socket+0x1fa>
mov    -0x18(%rbp),%edi
mov    $0xa,%esi
call   1090 <listen@plt>
cmp    $0xffffffff,%eax
jne    13bb <listen_socket+0x1eb>
lea    0xca0(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%edi
call   1070 <close@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13ca <listen_socket+0x1fa>
mov    -0x58(%rbp),%rdi
call   10e0 <freeaddrinfo@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<listen_socket>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rdi,%rbx
movl   $0x1,0xc(%rsp)
lea    0x18(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1060 <memset@plt>
xorps  %xmm0,%xmm0
movups %xmm0,0x20(%rsp)
movups %xmm0,0x38(%rsp)
mov    0x2dbf(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x34(%rsp)
mov    0x2d9a(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x30(%rsp)
mov    0x2dad(%rip),%rax
mov    0x2dc6(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    %ecx,0x18(%rsp)
lea    0x10(%rsp),%rcx
xor    %edi,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   10d0 <getaddrinfo@plt>
test   %eax,%eax
jne    1349 <listen_socket+0x179>
mov    0x10(%rsp),%rbx
test   %rbx,%rbx
je     12e9 <listen_socket+0x119>
mov    0x2d77(%rip),%r12
mov    0x2d38(%rip),%r13
lea    0xc(%rsp),%r14
lea    0xd95(%rip),%r15
jmp    1289 <listen_socket+0xb9>
xchg   %ax,%ax
mov    0x20(%rbx),%rbx
test   %rbx,%rbx
je     12e9 <listen_socket+0x119>
mov    0x1c(%rbx),%edi
mov    0x18(%rbx),%esi
mov    0x10(%rbx),%rdx
call   10f0 <socket@plt>
cmp    $0xffffffff,%eax
je     1280 <listen_socket+0xb0>
mov    %eax,%ebp
mov    (%r12),%esi
mov    0x0(%r13),%edx
mov    %eax,%edi
mov    %r14,%rcx
mov    $0x4,%r8d
call   1040 <setsockopt@plt>
cmp    $0xffffffff,%eax
je     12d8 <listen_socket+0x108>
mov    0x8(%rbx),%rsi
mov    0x4(%rbx),%edx
mov    %ebp,%edi
call   10a0 <bind@plt>
test   %rax,%rax
je     130b <listen_socket+0x13b>
mov    %ebp,%edi
call   1070 <close@plt>
jmp    1280 <listen_socket+0xb0>
mov    %r15,%rdi
call   10b0 <perror@plt>
mov    %ebp,%edi
call   1070 <close@plt>
jmp    12bc <listen_socket+0xec>
lea    0xd3d(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd31(%rip),%rdi
call   1030 <puts@plt>
mov    %ebp,%edi
mov    $0xa,%esi
call   1090 <listen@plt>
cmp    $0xffffffff,%eax
je     1334 <listen_socket+0x164>
mov    0x10(%rsp),%rdi
call   10e0 <freeaddrinfo@plt>
jmp    12fa <listen_socket+0x12a>
lea    0xce1(%rip),%rdi
call   1030 <puts@plt>
mov    %ebp,%edi
call   1070 <close@plt>
jmp    12f5 <listen_socket+0x125>
mov    0x2c70(%rip),%rcx
mov    (%rcx),%ebx
mov    %eax,%edi
call   1050 <gai_strerror@plt>
lea    0xca0(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1080 <fprintf@plt>
mov    0x2c3f(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>

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

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