#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*/ EXIT_FAILURE;
int /*<<< orphan*/ LOG_EMERG;
int /*<<< orphan*/ LOG_ERR;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_REUSEADDR;
int bind(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ freeaddrinfo(struct addrinfo *);
int /*<<< orphan*/ 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 setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, int const *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, ...);
int tcp_server_init(char *port) {
  struct addrinfo hints, *servinfo, *p;
  const int yes = 1;
  int sockfd;
  int rc;
  memset(&hints, 0, sizeof(hints));
  hints.ai_family = AF_UNSPEC;
  hints.ai_socktype = SOCK_STREAM;
  hints.ai_flags = AI_PASSIVE;
  if ((rc = getaddrinfo(NULL, port, &hints, &servinfo))) {
    syslog(LOG_EMERG, "getaddrinfo: %s\n", gai_strerror(rc));
    exit(EXIT_FAILURE);
  }
  for (p = servinfo; p; p = p->ai_next) {
    sockfd = socket(p->ai_family, p->ai_socktype, p->ai_protocol);
    if (sockfd == -1) {
      syslog(LOG_ERR, "socket: %s\n", strerror(errno));
      continue;
    }
    if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) == -1) {
      syslog(LOG_EMERG, "setsockopt: %s\n", strerror(errno));
      exit(EXIT_FAILURE);
    }
    if (bind(sockfd, p->ai_addr, p->ai_addrlen) == -1) {
      close(sockfd);
      syslog(LOG_ERR, "bind: %s\n", strerror(errno));
      continue;
    }
    break;
  }
  if (!p) {
    fprintf(stderr, "tcpserver: failed to bind\n");
    exit(EXIT_FAILURE);
  }
  freeaddrinfo(servinfo);
  if (listen(sockfd, 10) == -1) {
    syslog(LOG_EMERG, "failed to bind\n");
    exit(EXIT_FAILURE);
  }
  return sockfd;
}


x86 assembly (clang, -O0):
<tcp_server_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0x44(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
mov    0x2dde(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    0x2db2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    0x2dce(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
lea    -0x30(%rbp),%rdx
lea    -0x38(%rbp),%rcx
call   10c0 <getaddrinfo@plt>
mov    %eax,-0x4c(%rbp)
cmp    $0x0,%eax
je     126d <tcp_server_init+0x9d>
mov    0x2d91(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x50(%rbp)
mov    -0x4c(%rbp),%edi
call   1040 <gai_strerror@plt>
mov    -0x50(%rbp),%edi
mov    %eax,%edx
lea    0xda8(%rip),%rsi
mov    $0x0,%al
call   1080 <syslog@plt>
mov    0x2d42(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x38(%rbp),%rax
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
je     13af <tcp_server_init+0x1df>
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   10f0 <socket@plt>
mov    %eax,-0x48(%rbp)
cmpl   $0xffffffff,-0x48(%rbp)
jne    12d9 <tcp_server_init+0x109>
mov    0x2ce2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x54(%rbp)
mov    0x2cf6(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x54(%rbp),%edi
mov    %eax,%edx
lea    0xd44(%rip),%rsi
mov    $0x0,%al
call   1080 <syslog@plt>
jmp    139e <tcp_server_init+0x1ce>
mov    -0x48(%rbp),%edi
mov    0x2d05(%rip),%rax
mov    (%rax),%esi
mov    0x2cb4(%rip),%rax
mov    (%rax),%edx
lea    -0x44(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
cmp    $0xffffffff,%eax
jne    1341 <tcp_server_init+0x171>
mov    0x2cc3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x58(%rbp)
mov    0x2c97(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x58(%rbp),%edi
mov    %eax,%edx
lea    0xcf1(%rip),%rsi
mov    $0x0,%al
call   1080 <syslog@plt>
mov    0x2c6e(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x48(%rbp),%edi
mov    -0x40(%rbp),%rax
mov    0x4(%rax),%esi
mov    -0x40(%rbp),%rax
mov    (%rax),%edx
call   10a0 <bind@plt>
cmp    $0xffffffff,%eax
jne    1399 <tcp_server_init+0x1c9>
mov    -0x48(%rbp),%edi
call   1060 <close@plt>
mov    0x2c22(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x5c(%rbp)
mov    0x2c36(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x5c(%rbp),%edi
mov    %eax,%edx
lea    0xca0(%rip),%rsi
mov    $0x0,%al
call   1080 <syslog@plt>
jmp    139e <tcp_server_init+0x1ce>
jmp    13af <tcp_server_init+0x1df>
mov    -0x40(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x40(%rbp)
jmp    1275 <tcp_server_init+0xa5>
cmpq   $0x0,-0x40(%rbp)
jne    13dd <tcp_server_init+0x20d>
mov    0x2bff(%rip),%rax
mov    (%rax),%edi
lea    0xc6d(%rip),%rsi
call   1070 <fprintf@plt>
mov    0x2bd2(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x38(%rbp),%rdi
call   10e0 <freeaddrinfo@plt>
mov    -0x48(%rbp),%edi
mov    $0xa,%esi
call   1090 <listen@plt>
cmp    $0xffffffff,%eax
jne    1421 <tcp_server_init+0x251>
mov    0x2bcd(%rip),%rax
mov    (%rax),%edi
lea    0xc36(%rip),%rsi
mov    $0x0,%al
call   1080 <syslog@plt>
mov    0x2b8e(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x48(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tcp_server_init>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rdi,%rbx
movl   $0x1,0x4(%rsp)
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
mov    0x2dd4(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x20(%rsp)
mov    0x2da7(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x1c(%rsp)
mov    0x2dc2(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x30(%rsp)
lea    0x8(%rsp),%rcx
xor    %edi,%edi
mov    %rbx,%rsi
mov    %rbp,%rdx
call   10c0 <getaddrinfo@plt>
test   %eax,%eax
jne    1379 <tcp_server_init+0x1a9>
mov    0x8(%rsp),%rbp
test   %rbp,%rbp
je     1330 <tcp_server_init+0x160>
lea    0xdbe(%rip),%r13
mov    0x2d36(%rip),%r14
mov    0x2d4f(%rip),%r12
jmp    1298 <tcp_server_init+0xc8>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%r14),%r15d
mov    (%r12),%edi
call   10d0 <strerror@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1080 <syslog@plt>
mov    0x18(%rbp),%rbp
test   %rbp,%rbp
je     1330 <tcp_server_init+0x160>
mov    0x10(%rbp),%edi
mov    0x8(%rbp),%edx
mov    0xc(%rbp),%esi
call   10f0 <socket@plt>
mov    %r13,%rbx
cmp    $0xffffffff,%eax
je     1270 <tcp_server_init+0xa0>
mov    %eax,%r15d
mov    0x2d30(%rip),%rax
mov    (%rax),%esi
mov    0x2cdf(%rip),%rax
mov    (%rax),%edx
mov    %r15d,%edi
lea    0x4(%rsp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
cmp    $0xffffffff,%eax
je     1347 <tcp_server_init+0x177>
mov    0x0(%rbp),%edx
mov    0x4(%rbp),%esi
mov    %r15d,%edi
call   10a0 <bind@plt>
cmp    $0xffffffff,%eax
jne    1302 <tcp_server_init+0x132>
mov    %r15d,%edi
call   1060 <close@plt>
lea    0xd30(%rip),%rbx
jmp    1270 <tcp_server_init+0xa0>
mov    0x8(%rsp),%rdi
call   10e0 <freeaddrinfo@plt>
mov    %r15d,%edi
mov    $0xa,%esi
call   1090 <listen@plt>
cmp    $0xffffffff,%eax
je     1392 <tcp_server_init+0x1c2>
mov    %r15d,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c89(%rip),%rax
mov    (%rax),%edi
lea    0xcf7(%rip),%rsi
call   1070 <fprintf@plt>
jmp    136b <tcp_server_init+0x19b>
mov    0x2c82(%rip),%rax
mov    (%rax),%ebx
mov    (%r12),%edi
call   10d0 <strerror@plt>
lea    0xcbd(%rip),%rsi
mov    %ebx,%edi
mov    %eax,%edx
xor    %eax,%eax
call   1080 <syslog@plt>
mov    0x2c36(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    0x2c50(%rip),%rcx
mov    (%rcx),%ebx
mov    %eax,%edi
call   1040 <gai_strerror@plt>
lea    0xc70(%rip),%rsi
jmp    1360 <tcp_server_init+0x190>
mov    0x2c37(%rip),%rax
mov    (%rax),%edi
lea    0xca0(%rip),%rsi
xor    %eax,%eax
call   1080 <syslog@plt>
jmp    136b <tcp_server_init+0x19b>

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

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