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

/* Variables and functions */
int /*<<< orphan*/ AF_UNSPEC;
int /*<<< orphan*/ AI_PASSIVE;
int /*<<< orphan*/ EXIT_FAILURE;
int LOG_DAEMON;
int LOG_INFO;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_REUSEADDR;
scalar_t__ bind(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ bzero(struct addrinfo *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ freeaddrinfo(struct addrinfo *);
int /*<<< orphan*/ gai_strerror(int);
int getaddrinfo(char const *, char const *, struct addrinfo *,
                struct addrinfo **);
scalar_t__ listen(int, int);
scalar_t__ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, char *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ syslog(int, char *, ...);
int tcp_listen(const char *host, const char *serv, socklen_t *p_addrlen) {
  int listenfd, n, len;
  const int on = 1;
  struct addrinfo hints, *res, *p_res;
  bzero(&hints, sizeof(hints));
  hints.ai_flags = AI_PASSIVE;
  hints.ai_family = AF_UNSPEC;
  hints.ai_socktype = SOCK_STREAM;
  if (0 != (n = getaddrinfo(host, serv, &hints, &res))) {
    syslog(LOG_INFO | LOG_DAEMON, "%s error for %s, %s : %s.\n", host, serv,
           gai_strerror(n));
    exit(EXIT_FAILURE);
  }
  p_res = res;
  while (NULL != res) {
    listenfd = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
    if (listenfd < 0) {
      continue;
    }
    if (setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, (char *)&on,
                   sizeof(on)) < 0) {
      syslog(LOG_INFO | LOG_DAEMON, "setsockopt");
      exit(EXIT_FAILURE);
    }
    if (0 == bind(listenfd, res->ai_addr, res->ai_addrlen)) {
      break;
    }
    close(listenfd);
    res = res->ai_next;
  }
  if (listen(listenfd, 10) < 0) {
    syslog(LOG_INFO | LOG_DAEMON, "listen");
    exit(EXIT_FAILURE);
  }
  if (NULL != p_addrlen) {
    *p_addrlen = res->ai_addrlen;
  }
  freeaddrinfo(p_res);
  return listenfd;
}


x86 assembly (clang, -O0):
<tcp_listen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x1,-0x28(%rbp)
lea    -0x50(%rbp),%rdi
mov    $0x28,%esi
call   1090 <bzero@plt>
mov    0x2dfd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    0x2de1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    0x2dc5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x50(%rbp),%rdx
lea    -0x58(%rbp),%rcx
call   10b0 <getaddrinfo@plt>
mov    %eax,%ecx
mov    %ecx,-0x20(%rbp)
xor    %eax,%eax
cmp    %ecx,%eax
je     127b <tcp_listen+0xcb>
mov    0x2d7d(%rip),%rax
mov    (%rax),%eax
mov    0x2da4(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x74(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x20(%rbp),%edi
call   1040 <gai_strerror@plt>
mov    -0x74(%rbp),%edi
mov    -0x70(%rbp),%rdx
mov    -0x68(%rbp),%rcx
mov    %eax,%r8d
lea    0xd9a(%rip),%rsi
mov    $0x0,%al
call   1060 <syslog@plt>
mov    0x2d44(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    -0x58(%rbp),%rax
mov    %rax,-0x60(%rbp)
xor    %eax,%eax
cmp    -0x58(%rbp),%rax
je     1358 <tcp_listen+0x1a8>
mov    -0x58(%rbp),%rax
mov    0x1c(%rax),%edi
mov    -0x58(%rbp),%rax
mov    0x18(%rax),%esi
mov    -0x58(%rbp),%rax
mov    0x14(%rax),%edx
call   10d0 <socket@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    12bb <tcp_listen+0x10b>
jmp    1283 <tcp_listen+0xd3>
mov    -0x1c(%rbp),%edi
mov    0x2d23(%rip),%rax
mov    (%rax),%esi
mov    0x2ce2(%rip),%rax
mov    (%rax),%edx
lea    -0x28(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
cmp    $0x0,%rax
jge    1317 <tcp_listen+0x167>
mov    0x2cb8(%rip),%rax
mov    (%rax),%edi
mov    0x2cdf(%rip),%rax
or     (%rax),%edi
lea    0xd19(%rip),%rsi
mov    $0x0,%al
call   1060 <syslog@plt>
mov    0x2ca8(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    -0x1c(%rbp),%edi
mov    -0x58(%rbp),%rax
mov    0x10(%rax),%esi
mov    -0x58(%rbp),%rax
mov    (%rax),%edx
call   1080 <bind@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    133f <tcp_listen+0x18f>
jmp    1358 <tcp_listen+0x1a8>
mov    -0x1c(%rbp),%edi
call   1050 <close@plt>
mov    -0x58(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x58(%rbp)
jmp    1283 <tcp_listen+0xd3>
mov    -0x1c(%rbp),%edi
mov    $0xa,%esi
call   1070 <listen@plt>
cmp    $0x0,%rax
jge    139d <tcp_listen+0x1ed>
mov    0x2c32(%rip),%rax
mov    (%rax),%edi
mov    0x2c59(%rip),%rax
or     (%rax),%edi
lea    0xc9e(%rip),%rsi
mov    $0x0,%al
call   1060 <syslog@plt>
mov    0x2c22(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
xor    %eax,%eax
cmp    -0x18(%rbp),%rax
je     13b5 <tcp_listen+0x205>
mov    -0x58(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x60(%rbp),%rdi
call   10c0 <freeaddrinfo@plt>
mov    -0x1c(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tcp_listen>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbp
movl   $0x1,0xc(%rsp)
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x28,%esi
call   1090 <bzero@plt>
mov    0x2df8(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x30(%rsp)
mov    0x2ddb(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x2c(%rsp)
mov    0x2dbe(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x28(%rsp)
mov    %rsp,%rcx
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   10b0 <getaddrinfo@plt>
test   %eax,%eax
jne    1323 <tcp_listen+0x173>
mov    (%rsp),%r15
test   %r15,%r15
je     12b9 <tcp_listen+0x109>
mov    0x2db3(%rip),%r12
mov    0x2d74(%rip),%r13
lea    0xc(%rsp),%rbx
mov    %r15,%rax
jmp    1259 <tcp_listen+0xa9>
cs nopw 0x0(%rax,%rax,1)
mov    (%rsp),%rax
test   %rax,%rax
je     12b9 <tcp_listen+0x109>
mov    0x1c(%rax),%edi
mov    0x14(%rax),%edx
mov    0x18(%rax),%esi
call   10d0 <socket@plt>
mov    %eax,%ebp
test   %eax,%eax
js     1250 <tcp_listen+0xa0>
mov    (%r12),%esi
mov    0x0(%r13),%edx
mov    %ebp,%edi
mov    %rbx,%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
test   %rax,%rax
js     12f5 <tcp_listen+0x145>
mov    (%rsp),%rax
mov    (%rax),%edx
mov    0x10(%rax),%esi
mov    %ebp,%edi
call   1080 <bind@plt>
test   %rax,%rax
je     12b9 <tcp_listen+0x109>
mov    %ebp,%edi
call   1050 <close@plt>
mov    (%rsp),%rax
mov    0x8(%rax),%rax
mov    %rax,(%rsp)
test   %rax,%rax
jne    1259 <tcp_listen+0xa9>
jmp    12b9 <tcp_listen+0x109>
mov    %ebp,%edi
mov    $0xa,%esi
call   1070 <listen@plt>
test   %rax,%rax
js     1357 <tcp_listen+0x1a7>
test   %r14,%r14
je     12dc <tcp_listen+0x12c>
mov    (%rsp),%rax
mov    (%rax),%eax
mov    %eax,(%r14)
mov    %r15,%rdi
call   10c0 <freeaddrinfo@plt>
mov    %ebp,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2cac(%rip),%rax
mov    0x2cd5(%rip),%rcx
mov    (%rcx),%edi
or     (%rax),%edi
lea    0xd0d(%rip),%rsi
xor    %eax,%eax
call   1060 <syslog@plt>
mov    0x2c9c(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    0x2c7e(%rip),%rcx
mov    0x2ca7(%rip),%rdx
mov    (%rdx),%ebx
or     (%rcx),%ebx
mov    %eax,%edi
call   1040 <gai_strerror@plt>
lea    0xcbd(%rip),%rsi
mov    %ebx,%edi
mov    %rbp,%rdx
mov    %r15,%rcx
mov    %eax,%r8d
xor    %eax,%eax
call   1060 <syslog@plt>
jmp    1315 <tcp_listen+0x165>
mov    0x2c4a(%rip),%rax
mov    0x2c73(%rip),%rcx
mov    (%rcx),%edi
or     (%rax),%edi
lea    0xcb6(%rip),%rsi
jmp    130e <tcp_listen+0x15e>

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

LLVM IR (-O2):
%struct.addrinfo = type { i32, %struct.addrinfo*, i32, i32, i32, i32, i32 }
@AI_PASSIVE = global i32 0
@AF_UNSPEC = global i32 0
@SOCK_STREAM = global i32 0
@LOG_INFO = global i32 0
@LOG_DAEMON = global i32 0
@.str = [27 x i8] c"%s error for %s, %s : %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 = [7 x i8] c"listen\00"
define i32 @tcp_listen(i8* %0, i8* %1, i32* writeonly %2) {
%4 = alloca i32
%5 = alloca %struct.addrinfo
%6 = alloca %struct.addrinfo*
%7 = bitcast i32* %4 to i8*
store i32 1, i32* %4
%8 = bitcast %struct.addrinfo* %5 to i8*
%9 = bitcast %struct.addrinfo** %6 to i8*
%10 = call i32 @bzero(%struct.addrinfo* %5, i32 40)
%11 = load i32, i32* @AI_PASSIVE
%12 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %5, i64 0, i32 6
store i32 %11, i32* %12
%13 = load i32, i32* @AF_UNSPEC
%14 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %5, i64 0, i32 5
store i32 %13, i32* %14
%15 = load i32, i32* @SOCK_STREAM
%16 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %5, i64 0, i32 4
store i32 %15, i32* %16
%17 = call i32 @getaddrinfo(i8* %0, i8* %1, %struct.addrinfo* %5, %struct.addrinfo** %6)
%18 = icmp eq i32 %17, 0
br i1 %18, label %27, label %19
19: ; preds = %3
%20 = load i32, i32* @LOG_INFO
%21 = load i32, i32* @LOG_DAEMON
%22 = or i32 %21, %20
%23 = call i32 @gai_strerror(i32 %17)
%24 = call i32 (i32, i8*, ...) @syslog(i32 %22, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1, i32 %23)
%25 = load i32, i32* @EXIT_FAILURE
%26 = call i32 @exit(i32 %25)
unreachable
27: ; preds = %3
%28 = load %struct.addrinfo*, %struct.addrinfo** %6
%29 = icmp eq %struct.addrinfo* %28, null
br i1 %29, label %70, label %32
30: ; preds = %32
%31 = load %struct.addrinfo*, %struct.addrinfo** %6
br label %67
32: ; preds = %27, %67
%33 = phi %struct.addrinfo* [ %68, %67 ], [ %28, %27 ]
%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 i32, i32* %38
%40 = call i32 @socket(i32 %35, i32 %37, i32 %39)
%41 = icmp slt i32 %40, 0
br i1 %41, label %30, label %42
42: ; preds = %32
%43 = load i32, i32* @SOL_SOCKET
%44 = load i32, i32* @SO_REUSEADDR
%45 = call i64 @setsockopt(i32 %40, i32 %43, i32 %44, i8* %7, i32 4)
%46 = icmp slt i64 %45, 0
br i1 %46, label %47, label %54
47: ; preds = %42
%48 = load i32, i32* @LOG_INFO
%49 = load i32, i32* @LOG_DAEMON
%50 = or i32 %49, %48
%51 = call i32 (i32, i8*, ...) @syslog(i32 %50, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%52 = load i32, i32* @EXIT_FAILURE
%53 = call i32 @exit(i32 %52)
unreachable
54: ; preds = %42
%55 = load %struct.addrinfo*, %struct.addrinfo** %6
%56 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %55, i64 0, i32 2
%57 = load i32, i32* %56
%58 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %55, i64 0, i32 0
%59 = load i32, i32* %58
%60 = call i64 @bind(i32 %40, i32 %57, i32 %59)
%61 = icmp eq i64 %60, 0
br i1 %61, label %70, label %62
62: ; preds = %54
%63 = call i32 @close(i32 %40)
%64 = load %struct.addrinfo*, %struct.addrinfo** %6
%65 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %64, i64 0, i32 1
%66 = load %struct.addrinfo*, %struct.addrinfo** %65
store %struct.addrinfo* %66, %struct.addrinfo** %6
br label %67
67: ; preds = %62, %30
%68 = phi %struct.addrinfo* [ %31, %30 ], [ %66, %62 ]
%69 = icmp eq %struct.addrinfo* %68, null
br i1 %69, label %70, label %32
70: ; preds = %67, %54, %27
%71 = phi i32 [ undef, %27 ], [ %40, %54 ], [ %40, %67 ]
%72 = call i64 @listen(i32 %71, i32 10)
%73 = icmp slt i64 %72, 0
br i1 %73, label %74, label %81
74: ; preds = %70
%75 = load i32, i32* @LOG_INFO
%76 = load i32, i32* @LOG_DAEMON
%77 = or i32 %76, %75
%78 = call i32 (i32, i8*, ...) @syslog(i32 %77, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%79 = load i32, i32* @EXIT_FAILURE
%80 = call i32 @exit(i32 %79)
unreachable
81: ; preds = %70
%82 = icmp eq i32* %2, null
br i1 %82, label %87, label %83
83: ; preds = %81
%84 = load %struct.addrinfo*, %struct.addrinfo** %6
%85 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %84, i64 0, i32 0
%86 = load i32, i32* %85
store i32 %86, i32* %2
br label %87
87: ; preds = %83, %81
%88 = call i32 @freeaddrinfo(%struct.addrinfo* %28)
ret i32 %71
}