#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 hostent {
  char *h_name;
};
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;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_REUSEADDR;
int acceptConnections(int, char *);
int bind(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ freeaddrinfo(struct addrinfo *);
int getaddrinfo(int /*<<< orphan*/ *, char *, struct addrinfo *,
                struct addrinfo **);
struct hostent *gethostbyname(char *);
int /*<<< orphan*/ gethostname(char *, int);
int listen(int, int);
scalar_t__ malloc(int);
int /*<<< orphan*/ memset(struct addrinfo *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ report_errno(char *);
int setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, int *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int main() {
  struct addrinfo hints, *server_info_results, *server_info;
  int serverfd = -1;
  char *hostname = (char *)malloc(1024);
  memset(&hints, 0, sizeof(hints));
  hints.ai_family = AF_UNSPEC;
  hints.ai_socktype = SOCK_STREAM;
  hints.ai_flags = AI_PASSIVE;
  int getinfo_result = getaddrinfo(NULL, "8080", &hints, &server_info_results);
  if (getinfo_result == -1) {
    char *message = "Error getting local server information. Errno: %d";
    report_errno(message);
  }
  for (server_info = server_info_results; server_info != NULL;
       server_info = server_info->ai_next) {
    if ((serverfd = socket(server_info->ai_family, server_info->ai_socktype,
                           server_info->ai_protocol)) == -1) {
      continue;
    }
    int set_sock_opt = 1;
    if (setsockopt(serverfd, SOL_SOCKET, SO_REUSEADDR, &set_sock_opt,
                   sizeof(int)) == -1) {
      continue;
    }
    if (bind(serverfd, server_info->ai_addr, server_info->ai_addrlen) == -1) {
      fprintf(stderr, "Error binding!\n");
      continue;
    }
    break;
  }
  if (server_info == NULL) {
    printf("We found no valid socket to bind to.\n");
    return 1;
  }
  gethostname(hostname, 1024);
  struct hostent hostname_data = *gethostbyname(hostname);
  hostname = hostname_data.h_name;
  freeaddrinfo(server_info);
  int listen_result = listen(serverfd, 10);
  if (listen_result == -1) {
    char *message = "Had an error listening! Errno code: %d.\n";
    report_errno(message);
  }
  while (1) {
    if (acceptConnections(serverfd, hostname) == -1) {
      fprintf(stderr, "We got ourselves an error accepting "
                      "connections! Aborting all plans.\n");
      break;
    }
  }
  close(serverfd);
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0x44(%rbp)
mov    $0x400,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x50(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
mov    0x2daa(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    0x2d86(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    0x2d9a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xdaa(%rip),%rsi
lea    -0x30(%rbp),%rdx
lea    -0x38(%rbp),%rcx
call   10f0 <getaddrinfo@plt>
mov    %eax,-0x54(%rbp)
cmpl   $0xffffffff,-0x54(%rbp)
jne    1284 <main+0x94>
lea    0xd8e(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rdi
call   10c0 <report_errno@plt>
mov    -0x38(%rbp),%rax
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
je     1349 <main+0x159>
mov    -0x40(%rbp),%rax
mov    0x10(%rax),%edi
mov    -0x40(%rbp),%rax
mov    0xc(%rax),%esi
mov    -0x40(%rbp),%rax
mov    0x8(%rax),%edx
call   1110 <socket@plt>
mov    %eax,-0x44(%rbp)
cmp    $0xffffffff,%eax
jne    12c2 <main+0xd2>
jmp    1338 <main+0x148>
movl   $0x1,-0x64(%rbp)
mov    -0x44(%rbp),%edi
mov    0x2d15(%rip),%rax
mov    (%rax),%esi
mov    0x2cdc(%rip),%rax
mov    (%rax),%edx
lea    -0x64(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
cmp    $0xffffffff,%eax
jne    12fb <main+0x10b>
jmp    1338 <main+0x148>
mov    -0x44(%rbp),%edi
mov    -0x40(%rbp),%rax
mov    0x4(%rax),%esi
mov    -0x40(%rbp),%rax
mov    (%rax),%edx
call   10d0 <bind@plt>
cmp    $0xffffffff,%eax
jne    1333 <main+0x143>
mov    0x2ca8(%rip),%rax
mov    (%rax),%edi
lea    0xd0e(%rip),%rsi
call   1080 <fprintf@plt>
jmp    1338 <main+0x148>
jmp    1349 <main+0x159>
mov    -0x40(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x40(%rbp)
jmp    128c <main+0x9c>
cmpq   $0x0,-0x40(%rbp)
jne    136c <main+0x17c>
lea    0xcec(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1411 <main+0x221>
mov    -0x50(%rbp),%rdi
mov    $0x400,%esi
call   10e0 <gethostname@plt>
mov    -0x50(%rbp),%rdi
call   1070 <gethostbyname@plt>
mov    (%rax),%rax
mov    %rax,-0x70(%rbp)
mov    -0x70(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x40(%rbp),%rdi
call   1100 <freeaddrinfo@plt>
mov    -0x44(%rbp),%edi
mov    $0xa,%esi
call   10b0 <listen@plt>
mov    %eax,-0x74(%rbp)
cmpl   $0xffffffff,-0x74(%rbp)
jne    13c9 <main+0x1d9>
lea    0xcb1(%rip),%rax
mov    %rax,-0x80(%rbp)
mov    -0x80(%rbp),%rdi
call   10c0 <report_errno@plt>
jmp    13ce <main+0x1de>
mov    -0x44(%rbp),%edi
mov    -0x50(%rbp),%rsi
call   1090 <acceptConnections@plt>
cmp    $0xffffffff,%eax
jne    13fd <main+0x20d>
mov    0x2bde(%rip),%rax
mov    (%rax),%edi
lea    0xca3(%rip),%rsi
call   1080 <fprintf@plt>
jmp    1402 <main+0x212>
jmp    13ce <main+0x1de>
mov    -0x44(%rbp),%edi
call   1060 <close@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    $0x400,%edi
call   10a0 <malloc@plt>
mov    %rax,0x10(%rsp)
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
mov    0x2db0(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x30(%rsp)
mov    0x2d8b(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x2c(%rsp)
mov    0x2d9e(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x40(%rsp)
lea    0xdb1(%rip),%rsi
lea    0x18(%rsp),%rcx
xor    %edi,%edi
mov    %rbx,%rdx
call   10f0 <getaddrinfo@plt>
cmp    $0xffffffff,%eax
jne    126f <main+0x7f>
lea    0xd9b(%rip),%rdi
call   10c0 <report_errno@plt>
mov    0x18(%rsp),%rbx
test   %rbx,%rbx
je     137d <main+0x18d>
mov    0x2d64(%rip),%r14
mov    0x2d2d(%rip),%r13
lea    0xc(%rsp),%r15
lea    0xda0(%rip),%r12
jmp    12be <main+0xce>
nopl   0x0(%rax)
mov    0x2d21(%rip),%rax
mov    (%rax),%edi
mov    %r12,%rsi
call   1080 <fprintf@plt>
mov    0x18(%rbx),%rbx
test   %rbx,%rbx
je     137d <main+0x18d>
mov    0x10(%rbx),%edi
mov    0x8(%rbx),%edx
mov    0xc(%rbx),%esi
call   1110 <socket@plt>
cmp    $0xffffffff,%eax
je     12b1 <main+0xc1>
mov    %eax,%ebp
movl   $0x1,0xc(%rsp)
mov    (%r14),%esi
mov    0x0(%r13),%edx
mov    %eax,%edi
mov    %r15,%rcx
mov    $0x4,%r8d
call   1040 <setsockopt@plt>
cmp    $0xffffffff,%eax
je     12b1 <main+0xc1>
mov    (%rbx),%edx
mov    0x4(%rbx),%esi
mov    %ebp,%edi
call   10d0 <bind@plt>
cmp    $0xffffffff,%eax
je     12a0 <main+0xb0>
mov    0x10(%rsp),%r14
mov    %r14,%rdi
mov    $0x400,%esi
call   10e0 <gethostname@plt>
mov    %r14,%rdi
call   1070 <gethostbyname@plt>
mov    (%rax),%r14
mov    %rbx,%rdi
call   1100 <freeaddrinfo@plt>
mov    %ebp,%edi
mov    $0xa,%esi
call   10b0 <listen@plt>
cmp    $0xffffffff,%eax
jne    1350 <main+0x160>
lea    0xd02(%rip),%rdi
call   10c0 <report_errno@plt>
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %r14,%rsi
call   1090 <acceptConnections@plt>
cmp    $0xffffffff,%eax
jne    1350 <main+0x160>
mov    0x2c62(%rip),%rax
mov    (%rax),%edi
lea    0xd01(%rip),%rsi
call   1080 <fprintf@plt>
mov    %ebp,%edi
call   1060 <close@plt>
jmp    1389 <main+0x199>
lea    0xd32(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.addrinfo = type { i32, i32, i32, i32, i32, %struct.addrinfo*, i32 }
%struct.hostent = type { i8* }
@AF_UNSPEC = global i32 0
@SOCK_STREAM = global i32 0
@AI_PASSIVE = global i32 0
@.str = [5 x i8] c"8080\00"
@.str.1 = [50 x i8] c"Error getting local server information. Errno: %d\00"
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@stderr = global i32 0
@.str.2 = [16 x i8] c"Error binding!\0A\00"
@.str.3 = [38 x i8] c"We found no valid socket to bind to.\0A\00"
@.str.4 = [41 x i8] c"Had an error listening! Errno code: %d.\0A\00"
@.str.5 = [70 x i8] c"We got ourselves an error accepting connections! Aborting all plans.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.addrinfo
%3 = alloca %struct.addrinfo*
%4 = alloca %struct.addrinfo*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca %struct.hostent
%11 = alloca i32
%12 = alloca i8*
store i32 0, i32* %1
store i32 -1, i32* %5
%13 = call i64 @malloc(i32 1024)
%14 = inttoptr i64 %13 to i8*
store i8* %14, i8** %6
%15 = call i32 @memset(%struct.addrinfo* %2, i32 0, i32 40)
%16 = load i32, i32* @AF_UNSPEC
%17 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %2, i32 0, i32 4
store i32 %16, i32* %17
%18 = load i32, i32* @SOCK_STREAM
%19 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %2, i32 0, i32 3
store i32 %18, i32* %19
%20 = load i32, i32* @AI_PASSIVE
%21 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %2, i32 0, i32 6
store i32 %20, i32* %21
%22 = call i32 @getaddrinfo(i32* null, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %struct.addrinfo* %2, %struct.addrinfo** %3)
store i32 %22, i32* %7
%23 = load i32, i32* %7
%24 = icmp eq i32 %23, -1
br i1 %24, label %25, label %28
25: ; preds = %0
store i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0), i8** %8
%26 = load i8*, i8** %8
%27 = call i32 @report_errno(i8* %26)
br label %28
28: ; preds = %25, %0
%29 = load %struct.addrinfo*, %struct.addrinfo** %3
store %struct.addrinfo* %29, %struct.addrinfo** %4
br label %30
30: ; preds = %67, %28
%31 = load %struct.addrinfo*, %struct.addrinfo** %4
%32 = icmp ne %struct.addrinfo* %31, null
br i1 %32, label %33, label %71
33: ; preds = %30
%34 = load %struct.addrinfo*, %struct.addrinfo** %4
%35 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %34, i32 0, i32 4
%36 = load i32, i32* %35
%37 = load %struct.addrinfo*, %struct.addrinfo** %4
%38 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %37, i32 0, i32 3
%39 = load i32, i32* %38
%40 = load %struct.addrinfo*, %struct.addrinfo** %4
%41 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %40, i32 0, i32 2
%42 = load i32, i32* %41
%43 = call i32 @socket(i32 %36, i32 %39, i32 %42)
store i32 %43, i32* %5
%44 = icmp eq i32 %43, -1
br i1 %44, label %45, label %46
45: ; preds = %33
br label %67
46: ; preds = %33
store i32 1, i32* %9
%47 = load i32, i32* %5
%48 = load i32, i32* @SOL_SOCKET
%49 = load i32, i32* @SO_REUSEADDR
%50 = call i32 @setsockopt(i32 %47, i32 %48, i32 %49, i32* %9, i32 4)
%51 = icmp eq i32 %50, -1
br i1 %51, label %52, label %53
52: ; preds = %46
br label %67
53: ; preds = %46
%54 = load i32, i32* %5
%55 = load %struct.addrinfo*, %struct.addrinfo** %4
%56 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %55, i32 0, i32 1
%57 = load i32, i32* %56
%58 = load %struct.addrinfo*, %struct.addrinfo** %4
%59 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %58, i32 0, i32 0
%60 = load i32, i32* %59
%61 = call i32 @bind(i32 %54, i32 %57, i32 %60)
%62 = icmp eq i32 %61, -1
br i1 %62, label %63, label %66
63: ; preds = %53
%64 = load i32, i32* @stderr
%65 = call i32 @fprintf(i32 %64, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %67
66: ; preds = %53
br label %71
67: ; preds = %63, %52, %45
%68 = load %struct.addrinfo*, %struct.addrinfo** %4
%69 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %68, i32 0, i32 5
%70 = load %struct.addrinfo*, %struct.addrinfo** %69
store %struct.addrinfo* %70, %struct.addrinfo** %4
br label %30
71: ; preds = %66, %30
%72 = load %struct.addrinfo*, %struct.addrinfo** %4
%73 = icmp eq %struct.addrinfo* %72, null
br i1 %73, label %74, label %76
74: ; preds = %71
%75 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %1
br label %107
76: ; preds = %71
%77 = load i8*, i8** %6
%78 = call i32 @gethostname(i8* %77, i32 1024)
%79 = load i8*, i8** %6
%80 = call %struct.hostent* @gethostbyname(i8* %79)
%81 = bitcast %struct.hostent* %10 to i8*
%82 = bitcast %struct.hostent* %80 to i8*
%83 = getelementptr inbounds %struct.hostent, %struct.hostent* %10, i32 0, i32 0
%84 = load i8*, i8** %83
store i8* %84, i8** %6
%85 = load %struct.addrinfo*, %struct.addrinfo** %4
%86 = call i32 @freeaddrinfo(%struct.addrinfo* %85)
%87 = load i32, i32* %5
%88 = call i32 @listen(i32 %87, i32 10)
store i32 %88, i32* %11
%89 = load i32, i32* %11
%90 = icmp eq i32 %89, -1
br i1 %90, label %91, label %94
91: ; preds = %76
store i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), i8** %12
%92 = load i8*, i8** %12
%93 = call i32 @report_errno(i8* %92)
br label %94
94: ; preds = %91, %76
br label %95
95: ; preds = %94, %103
%96 = load i32, i32* %5
%97 = load i8*, i8** %6
%98 = call i32 @acceptConnections(i32 %96, i8* %97)
%99 = icmp eq i32 %98, -1
br i1 %99, label %100, label %103
100: ; preds = %95
%101 = load i32, i32* @stderr
%102 = call i32 @fprintf(i32 %101, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.5, i64 0, i64 0))
br label %104
103: ; preds = %95
br label %95
104: ; preds = %100
%105 = load i32, i32* %5
%106 = call i32 @close(i32 %105)
store i32 1, i32* %1
br label %107
107: ; preds = %104, %74
%108 = load i32, i32* %1
ret i32 %108
}

LLVM IR (-O2):
%struct.addrinfo = type { i32, i32, i32, i32, i32, %struct.addrinfo*, i32 }
%struct.hostent = type { i8* }
@AF_UNSPEC = global i32 0
@SOCK_STREAM = global i32 0
@AI_PASSIVE = global i32 0
@.str = [5 x i8] c"8080\00"
@.str.1 = [50 x i8] c"Error getting local server information. Errno: %d\00"
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@stderr = global i32 0
@.str.2 = [16 x i8] c"Error binding!\0A\00"
@.str.4 = [41 x i8] c"Had an error listening! Errno code: %d.\0A\00"
@.str.5 = [70 x i8] c"We got ourselves an error accepting connections! Aborting all plans.\0A\00"
@str = [37 x i8] c"We found no valid socket to bind to.\00"
define i32 @main() {
%1 = alloca %struct.addrinfo
%2 = alloca %struct.addrinfo*
%3 = alloca i32
%4 = bitcast %struct.addrinfo* %1 to i8*
%5 = bitcast %struct.addrinfo** %2 to i8*
%6 = tail call i64 @malloc(i32 1024)
%7 = inttoptr i64 %6 to i8*
%8 = call i32 @memset(%struct.addrinfo* %1, i32 0, i32 40)
%9 = load i32, i32* @AF_UNSPEC
%10 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %1, i64 0, i32 4
store i32 %9, i32* %10
%11 = load i32, i32* @SOCK_STREAM
%12 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %1, i64 0, i32 3
store i32 %11, i32* %12
%13 = load i32, i32* @AI_PASSIVE
%14 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %1, i64 0, i32 6
store i32 %13, i32* %14
%15 = call i32 @getaddrinfo(i32* null, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %struct.addrinfo* %1, %struct.addrinfo** %2)
%16 = icmp eq i32 %15, -1
br i1 %16, label %17, label %19
17: ; preds = %0
%18 = call i32 @report_errno(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0))
br label %19
19: ; preds = %17, %0
%20 = load %struct.addrinfo*, %struct.addrinfo** %2
%21 = icmp eq %struct.addrinfo* %20, null
br i1 %21, label %54, label %22
22: ; preds = %19
%23 = bitcast i32* %3 to i8*
br label %24
24: ; preds = %22, %50
%25 = phi %struct.addrinfo* [ %20, %22 ], [ %52, %50 ]
%26 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %25, i64 0, i32 4
%27 = load i32, i32* %26
%28 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %25, i64 0, i32 3
%29 = load i32, i32* %28
%30 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %25, i64 0, i32 2
%31 = load i32, i32* %30
%32 = call i32 @socket(i32 %27, i32 %29, i32 %31)
%33 = icmp eq i32 %32, -1
br i1 %33, label %50, label %34
34: ; preds = %24
store i32 1, i32* %3
%35 = load i32, i32* @SOL_SOCKET
%36 = load i32, i32* @SO_REUSEADDR
%37 = call i32 @setsockopt(i32 %32, i32 %35, i32 %36, i32* %3, i32 4)
%38 = icmp eq i32 %37, -1
br i1 %38, label %49, label %39
39: ; preds = %34
%40 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %25, i64 0, i32 1
%41 = load i32, i32* %40
%42 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %25, i64 0, i32 0
%43 = load i32, i32* %42
%44 = call i32 @bind(i32 %32, i32 %41, i32 %43)
%45 = icmp eq i32 %44, -1
br i1 %45, label %46, label %56
46: ; preds = %39
%47 = load i32, i32* @stderr
%48 = call i32 @fprintf(i32 %47, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %49
49: ; preds = %46, %34
br label %50
50: ; preds = %49, %24
%51 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %25, i64 0, i32 5
%52 = load %struct.addrinfo*, %struct.addrinfo** %51
%53 = icmp eq %struct.addrinfo* %52, null
br i1 %53, label %54, label %24
54: ; preds = %50, %19
%55 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
br label %74
56: ; preds = %39
%57 = call i32 @gethostname(i8* %7, i32 1024)
%58 = call %struct.hostent* @gethostbyname(i8* %7)
%59 = getelementptr inbounds %struct.hostent, %struct.hostent* %58, i64 0, i32 0
%60 = load i8*, i8** %59
%61 = call i32 @freeaddrinfo(%struct.addrinfo* %25)
%62 = call i32 @listen(i32 %32, i32 10)
%63 = icmp eq i32 %62, -1
br i1 %63, label %64, label %66
64: ; preds = %56
%65 = call i32 @report_errno(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0))
br label %66
66: ; preds = %64, %56
br label %67
67: ; preds = %66, %67
%68 = call i32 @acceptConnections(i32 %32, i8* %60)
%69 = icmp eq i32 %68, -1
br i1 %69, label %70, label %67
70: ; preds = %67
%71 = load i32, i32* @stderr
%72 = call i32 @fprintf(i32 %71, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.5, i64 0, i64 0))
%73 = call i32 @close(i32 %32)
br label %74
74: ; preds = %70, %54
ret i32 1
}