#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_in6 {
  int /*<<< orphan*/ sin6_port;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
};
struct sockaddr {
  int dummy;
};
struct addrinfo {
  int ai_flags;
  int ai_socktype;
  int ai_family;
  scalar_t__ ai_addr;
  int /*<<< orphan*/ ai_addrlen;
  int /*<<< orphan*/ ai_protocol;
  struct addrinfo *ai_next;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ one;
typedef int /*<<< orphan*/ myaddr;
typedef int /*<<< orphan*/ hints;

/* Variables and functions */
#define AF_INET 129
#define AF_INET6 128
int AF_UNSPEC;
int AI_NUMERICHOST;
int AI_PASSIVE;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_REUSEADDR;
scalar_t__ bind(int, scalar_t__, int /*<<< orphan*/);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ error(int, int /*<<< orphan*/, char *);
scalar_t__ getaddrinfo(char *, char *, struct addrinfo *, struct addrinfo **);
int /*<<< orphan*/ getsockname(int, struct sockaddr *, int *);
int /*<<< orphan*/ memset(struct addrinfo *, int /*<<< orphan*/, int);
int ntohs(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
scalar_t__ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, int const *,
                      int);
int socket(int, int, int /*<<< orphan*/);
char *strdup(char *);
char *strsep(char **, char *);
int inetsock(char *portname, int style) {
  char *hostname;
  int numerichost, sock;
  struct addrinfo *addr, hints;
  if (!(portname = strdup(portname)))
    error(1, errno, "strdup");
  if (*portname == '[') {
    int depth;
    hostname = ++portname;
    numerichost = 1;
    for (depth = 1; *portname != ']' || --depth > 0; portname++)
      if (*portname == '\0')
        error(1, 0, "Port specification contains unbalanced '['");
      else if (*portname == '[')
        depth++;
    *portname++ = '\0';
    if (*portname == ':')
      *portname++ = '\0';
    else
      error(1, 0,
            "Port specification must be in form PORT, HOSTNAME:PORT or "
            "[IP]:PORT");
  } else {
    hostname = strsep(&portname, ":");
    numerichost = 0;
    if (!portname) {
      portname = hostname;
      hostname = NULL;
    }
  }
  if (hostname && hostname[0] == '\0')
    hostname = NULL;
  if (portname[0] == '\0')
    error(1, 0,
          "Port specification must be in form PORT, HOSTNAME:PORT or "
          "[IP]:PORT");
  memset(&hints, 0, sizeof(hints));
  hints.ai_flags = AI_PASSIVE | (numerichost ? AI_NUMERICHOST : 0);
  hints.ai_socktype = style;
  hints.ai_family = AF_UNSPEC;
  if (getaddrinfo(hostname, portname, &hints, &addr) < 0 || !addr)
    error(1, 0, "Host address or port does not exist");
  for (sock = -1; addr != NULL; addr = addr->ai_next) {
    sock = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol);
    if (sock >= 0) {
      static const int one = 1;
      if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)) < 0)
        error(1, errno, "setsockopt");
      if (bind(sock, addr->ai_addr, addr->ai_addrlen) == 0) {
        switch (addr->ai_family) {
        case AF_INET:
          if (ntohs(((struct sockaddr_in *)addr->ai_addr)->sin_port) == 0) {
            struct sockaddr_in myaddr;
            socklen_t addrsize = sizeof(myaddr);
            if (getsockname(sock, (struct sockaddr *)&myaddr, &addrsize) == 0)
              printf("%d\n", ntohs(myaddr.sin_port));
          }
          break;
        case AF_INET6:
          if (ntohs(((struct sockaddr_in6 *)addr->ai_addr)->sin6_port) == 0) {
            struct sockaddr_in6 myaddr;
            socklen_t addrsize = sizeof(myaddr);
            if (getsockname(sock, (struct sockaddr *)&myaddr, &addrsize) == 0)
              printf("%d\n", ntohs(myaddr.sin6_port));
          }
          break;
        }
        break;
      }
      close(sock);
      sock = -1;
    }
  }
  if (sock < 0)
    error(1, errno, "creating socket");
  return sock;
}


x86 assembly (clang, -O0):
<inetsock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   10d0 <strdup@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
jne    1203 <inetsock+0x43>
mov    0x2dd0(%rip),%rax
mov    (%rax),%esi
mov    $0x1,%edi
lea    0xe02(%rip),%rdx
call   10a0 <error@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5b,%eax
jne    1315 <inetsock+0x155>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    %rax,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
movl   $0x1,-0x54(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x5d,%ecx
mov    %al,-0x65(%rbp)
jne    1258 <inetsock+0x98>
mov    -0x54(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x54(%rbp)
cmp    $0x0,%eax
setg   %al
mov    %al,-0x65(%rbp)
mov    -0x65(%rbp),%al
test   $0x1,%al
jne    1268 <inetsock+0xa8>
jmp    12c4 <inetsock+0x104>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1290 <inetsock+0xd0>
mov    $0x1,%edi
xor    %esi,%esi
lea    0xd81(%rip),%rdx
call   10a0 <error@plt>
jmp    12ae <inetsock+0xee>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5b,%eax
jne    12a9 <inetsock+0xe9>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    12ae <inetsock+0xee>
jmp    12b3 <inetsock+0xf3>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1231 <inetsock+0x71>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
jne    12fd <inetsock+0x13d>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movb   $0x0,(%rax)
jmp    1310 <inetsock+0x150>
mov    $0x1,%edi
xor    %esi,%esi
lea    0xd27(%rip),%rdx
call   10a0 <error@plt>
jmp    1350 <inetsock+0x190>
lea    -0x8(%rbp),%rdi
lea    0xd56(%rip),%rsi
call   1070 <strsep@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    134b <inetsock+0x18b>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
movq   $0x0,-0x18(%rbp)
jmp    1350 <inetsock+0x190>
cmpq   $0x0,-0x18(%rbp)
je     1373 <inetsock+0x1b3>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1373 <inetsock+0x1b3>
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1396 <inetsock+0x1d6>
mov    $0x1,%edi
xor    %esi,%esi
lea    0xca1(%rip),%rdx
call   10a0 <error@plt>
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
mov    0x2c33(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x6c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     13cd <inetsock+0x20d>
mov    0x2c0d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x70(%rbp)
jmp    13d7 <inetsock+0x217>
xor    %eax,%eax
mov    %eax,-0x70(%rbp)
jmp    13d7 <inetsock+0x217>
mov    -0x6c(%rbp),%eax
mov    -0x70(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x50(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    0x2be9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
lea    -0x50(%rbp),%rdx
lea    -0x28(%rbp),%rcx
call   10c0 <getaddrinfo@plt>
cmp    $0x0,%rax
jl     141e <inetsock+0x25e>
cmpq   $0x0,-0x28(%rbp)
jne    1431 <inetsock+0x271>
mov    $0x1,%edi
xor    %esi,%esi
lea    0xc4c(%rip),%rdx
call   10a0 <error@plt>
movl   $0xffffffff,-0x20(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     15dd <inetsock+0x41d>
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%edi
mov    -0x28(%rbp),%rax
mov    0x4(%rax),%esi
mov    -0x28(%rbp),%rax
mov    0x1c(%rax),%edx
call   10e0 <socket@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jl     15c7 <inetsock+0x407>
mov    -0x20(%rbp),%edi
mov    0x2b74(%rip),%rax
mov    (%rax),%esi
mov    0x2b3b(%rip),%rax
mov    (%rax),%edx
lea    0xc36(%rip),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
cmp    $0x0,%rax
jge    14b5 <inetsock+0x2f5>
mov    0x2b1e(%rip),%rax
mov    (%rax),%esi
mov    $0x1,%edi
lea    0xbec(%rip),%rdx
call   10a0 <error@plt>
mov    -0x20(%rbp),%edi
mov    -0x28(%rbp),%rax
mov    0x10(%rax),%rsi
mov    -0x28(%rbp),%rax
mov    0x18(%rax),%edx
call   1090 <bind@plt>
cmp    $0x0,%rax
jne    15b8 <inetsock+0x3f8>
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0x74(%rbp)
sub    $0x80,%eax
je     155b <inetsock+0x39b>
jmp    14f0 <inetsock+0x330>
mov    -0x74(%rbp),%eax
sub    $0x81,%eax
jne    15b3 <inetsock+0x3f3>
jmp    1503 <inetsock+0x343>
mov    -0x28(%rbp),%rax
mov    0x10(%rax),%rax
mov    (%rax),%edi
call   1080 <ntohs@plt>
cmp    $0x0,%eax
jne    1556 <inetsock+0x396>
movl   $0x4,-0x5c(%rbp)
mov    -0x20(%rbp),%edi
lea    -0x58(%rbp),%rsi
lea    -0x5c(%rbp),%rdx
call   10b0 <getsockname@plt>
cmp    $0x0,%eax
jne    1551 <inetsock+0x391>
mov    -0x58(%rbp),%edi
call   1080 <ntohs@plt>
mov    %eax,%esi
lea    0xb5b(%rip),%rdi
call   1040 <printf@plt>
jmp    1556 <inetsock+0x396>
jmp    15b3 <inetsock+0x3f3>
mov    -0x28(%rbp),%rax
mov    0x10(%rax),%rax
mov    (%rax),%edi
call   1080 <ntohs@plt>
cmp    $0x0,%eax
jne    15ae <inetsock+0x3ee>
movl   $0x4,-0x64(%rbp)
mov    -0x20(%rbp),%edi
lea    -0x60(%rbp),%rsi
lea    -0x64(%rbp),%rdx
call   10b0 <getsockname@plt>
cmp    $0x0,%eax
jne    15a9 <inetsock+0x3e9>
mov    -0x60(%rbp),%edi
call   1080 <ntohs@plt>
mov    %eax,%esi
lea    0xb03(%rip),%rdi
call   1040 <printf@plt>
jmp    15ae <inetsock+0x3ee>
jmp    15b3 <inetsock+0x3f3>
jmp    15dd <inetsock+0x41d>
mov    -0x20(%rbp),%edi
call   1060 <close@plt>
movl   $0xffffffff,-0x20(%rbp)
jmp    15cc <inetsock+0x40c>
mov    -0x28(%rbp),%rax
mov    0x20(%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    1438 <inetsock+0x278>
cmpl   $0x0,-0x20(%rbp)
jge    1601 <inetsock+0x441>
mov    0x29d2(%rip),%rax
mov    (%rax),%esi
mov    $0x1,%edi
lea    0xaaf(%rip),%rdx
call   10a0 <error@plt>
mov    -0x20(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inetsock>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %esi,%r14d
call   10d0 <strdup@plt>
mov    %rax,%rbx
mov    %rax,0x18(%rsp)
test   %rax,%rax
je     1286 <inetsock+0xc6>
cmpb   $0x5b,(%rbx)
jne    12a9 <inetsock+0xe9>
lea    0x1(%rbx),%r15
add    $0x3,%rbx
mov    $0x1,%ebp
lea    0xe03(%rip),%r12
jmp    1214 <inetsock+0x54>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rbx
movzbl -0x2(%rbx),%eax
test   %al,%al
je     1240 <inetsock+0x80>
cmp    $0x5b,%al
je     1260 <inetsock+0xa0>
cmp    $0x5d,%al
jne    1210 <inetsock+0x50>
cmp    $0x1,%ebp
jle    1265 <inetsock+0xa5>
add    $0xffffffff,%ebp
add    $0x1,%rbx
jmp    1214 <inetsock+0x54>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x1,%edi
xor    %esi,%esi
mov    %r12,%rdx
call   10a0 <error@plt>
add    $0x1,%rbx
jmp    1214 <inetsock+0x54>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%ebp
jmp    1210 <inetsock+0x50>
lea    -0x1(%rbx),%rbp
mov    %rbp,0x18(%rsp)
movb   $0x0,-0x2(%rbx)
cmpb   $0x3a,-0x1(%rbx)
jne    12d7 <inetsock+0x117>
mov    %rbx,0x18(%rsp)
movb   $0x0,-0x1(%rbx)
xor    %r12d,%r12d
jmp    12f0 <inetsock+0x130>
mov    0x2d33(%rip),%rax
mov    (%rax),%esi
lea    0xd6a(%rip),%rdx
mov    $0x1,%edi
call   10a0 <error@plt>
cmpb   $0x5b,(%rbx)
je     11f0 <inetsock+0x30>
lea    0xdc6(%rip),%rsi
lea    0x18(%rsp),%rdi
call   1070 <strsep@plt>
mov    %rax,%r15
mov    0x18(%rsp),%rbx
test   %rbx,%rbx
je     14ab <inetsock+0x2eb>
mov    $0x1,%r12b
test   %r15,%r15
jne    12f0 <inetsock+0x130>
xor    %ebp,%ebp
jmp    12fa <inetsock+0x13a>
lea    0xd54(%rip),%rdx
xor    %r12d,%r12d
mov    $0x1,%edi
xor    %esi,%esi
call   10a0 <error@plt>
mov    %rbp,%rbx
xor    %ebp,%ebp
cmpb   $0x0,(%r15)
cmovne %r15,%rbp
mov    %rbx,%r15
cmpb   $0x0,(%r15)
jne    1316 <inetsock+0x156>
lea    0xd28(%rip),%rdx
mov    $0x1,%edi
xor    %esi,%esi
call   10a0 <error@plt>
lea    0x20(%rsp),%r15
xor    %ebx,%ebx
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
mov    0x2cad(%rip),%rax
test   %r12b,%r12b
jne    1341 <inetsock+0x181>
mov    0x2c91(%rip),%rcx
mov    (%rcx),%ebx
or     (%rax),%ebx
mov    %ebx,0x20(%rsp)
mov    %r14d,0x24(%rsp)
mov    0x2c85(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x28(%rsp)
mov    0x18(%rsp),%rsi
lea    0x10(%rsp),%rcx
mov    %rbp,%rdi
mov    %r15,%rdx
call   10c0 <getaddrinfo@plt>
test   %rax,%rax
js     137d <inetsock+0x1bd>
mov    0x10(%rsp),%rax
test   %rax,%rax
jne    139e <inetsock+0x1de>
lea    0xcf4(%rip),%rdx
mov    $0x1,%edi
xor    %esi,%esi
call   10a0 <error@plt>
mov    0x10(%rsp),%rax
test   %rax,%rax
je     14c4 <inetsock+0x304>
mov    0x2c43(%rip),%r15
mov    0x2c0c(%rip),%r12
lea    0xd09(%rip),%rbp
mov    0x2c06(%rip),%r13
lea    0xcdb(%rip),%r14
jmp    140b <inetsock+0x24b>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x10(%rsp),%rax
mov    0x10(%rax),%rsi
mov    0x18(%rax),%edx
mov    %ebx,%edi
call   1090 <bind@plt>
test   %rax,%rax
je     144e <inetsock+0x28e>
mov    %ebx,%edi
call   1060 <close@plt>
mov    $0xffffffff,%ebx
mov    0x10(%rsp),%rax
mov    0x20(%rax),%rax
mov    %rax,0x10(%rsp)
test   %rax,%rax
je     14c9 <inetsock+0x309>
mov    0x4(%rax),%esi
mov    0x8(%rax),%edi
mov    0x1c(%rax),%edx
call   10e0 <socket@plt>
mov    %eax,%ebx
test   %eax,%eax
js     13f4 <inetsock+0x234>
mov    (%r15),%esi
mov    (%r12),%edx
mov    %ebx,%edi
mov    %rbp,%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
test   %rax,%rax
jns    13d0 <inetsock+0x210>
mov    0x0(%r13),%esi
mov    $0x1,%edi
mov    %r14,%rdx
call   10a0 <error@plt>
jmp    13d0 <inetsock+0x210>
mov    0x10(%rsp),%rax
mov    0x8(%rax),%ecx
cmp    $0x80,%ecx
je     1466 <inetsock+0x2a6>
cmp    $0x81,%ecx
jne    14e3 <inetsock+0x323>
mov    0x10(%rax),%rax
mov    (%rax),%edi
call   1080 <ntohs@plt>
test   %eax,%eax
jne    14e3 <inetsock+0x323>
movl   $0x4,0xc(%rsp)
lea    0x8(%rsp),%rsi
lea    0xc(%rsp),%rdx
mov    %ebx,%edi
call   10b0 <getsockname@plt>
test   %eax,%eax
jne    14e3 <inetsock+0x323>
mov    0x8(%rsp),%edi
call   1080 <ntohs@plt>
lea    0xc05(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
jmp    14e3 <inetsock+0x323>
mov    %r15,0x18(%rsp)
mov    $0x1,%r12b
xor    %ebp,%ebp
cmpb   $0x0,(%r15)
jne    1316 <inetsock+0x156>
jmp    1303 <inetsock+0x143>
mov    $0xffffffff,%ebx
mov    0x2af0(%rip),%rax
mov    (%rax),%esi
lea    0xbd2(%rip),%rdx
mov    $0x1,%edi
call   10a0 <error@plt>
mov    %ebx,%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, i64, i32, i32, %struct.addrinfo* }
%struct.sockaddr_in = type { i32 }
%struct.sockaddr_in6 = type { i32 }
%struct.sockaddr = type { i32 }
@errno = global i32 0
@.str = [7 x i8] c"strdup\00"
@.str.1 = [43 x i8] c"Port specification contains unbalanced '['\00"
@.str.2 = [68 x i8] c"Port specification must be in form PORT, HOSTNAME:PORT or [IP]:PORT\00"
@.str.3 = [2 x i8] c":\00"
@AI_PASSIVE = global i32 0
@AI_NUMERICHOST = global i32 0
@AF_UNSPEC = global i32 0
@.str.4 = [36 x i8] c"Host address or port does not exist\00"
@inetsock.one = internal constant i32 1
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str.5 = [11 x i8] c"setsockopt\00"
@.str.6 = [4 x i8] c"%d\0A\00"
@.str.7 = [16 x i8] c"creating socket\00"
define i32 @inetsock(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.addrinfo*
%9 = alloca %struct.addrinfo
%10 = alloca i32
%11 = alloca %struct.sockaddr_in
%12 = alloca i32
%13 = alloca %struct.sockaddr_in6
%14 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%15 = load i8*, i8** %3
%16 = call i8* @strdup(i8* %15)
store i8* %16, i8** %3
%17 = icmp ne i8* %16, null
br i1 %17, label %21, label %18
18: ; preds = %2
%19 = load i32, i32* @errno
%20 = call i32 @error(i32 1, i32 %19, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %21
21: ; preds = %18, %2
%22 = load i8*, i8** %3
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 91
br i1 %25, label %26, label %73
26: ; preds = %21
%27 = load i8*, i8** %3
%28 = getelementptr inbounds i8, i8* %27, i32 1
store i8* %28, i8** %3
store i8* %28, i8** %5
store i32 1, i32* %6
store i32 1, i32* %10
br label %29
29: ; preds = %57, %26
%30 = load i8*, i8** %3
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp ne i32 %32, 93
br i1 %33, label %38, label %34
34: ; preds = %29
%35 = load i32, i32* %10
%36 = add nsw i32 %35, -1
store i32 %36, i32* %10
%37 = icmp sgt i32 %36, 0
br label %38
38: ; preds = %34, %29
%39 = phi i1 [ true, %29 ], [ %37, %34 ]
br i1 %39, label %40, label %60
40: ; preds = %38
%41 = load i8*, i8** %3
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 0
br i1 %44, label %45, label %47
45: ; preds = %40
%46 = call i32 @error(i32 1, i32 0, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
br label %56
47: ; preds = %40
%48 = load i8*, i8** %3
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = icmp eq i32 %50, 91
br i1 %51, label %52, label %55
52: ; preds = %47
%53 = load i32, i32* %10
%54 = add nsw i32 %53, 1
store i32 %54, i32* %10
br label %55
55: ; preds = %52, %47
br label %56
56: ; preds = %55, %45
br label %57
57: ; preds = %56
%58 = load i8*, i8** %3
%59 = getelementptr inbounds i8, i8* %58, i32 1
store i8* %59, i8** %3
br label %29
60: ; preds = %38
%61 = load i8*, i8** %3
%62 = getelementptr inbounds i8, i8* %61, i32 1
store i8* %62, i8** %3
store i8 0, i8* %61
%63 = load i8*, i8** %3
%64 = load i8, i8* %63
%65 = sext i8 %64 to i32
%66 = icmp eq i32 %65, 58
br i1 %66, label %67, label %70
67: ; preds = %60
%68 = load i8*, i8** %3
%69 = getelementptr inbounds i8, i8* %68, i32 1
store i8* %69, i8** %3
store i8 0, i8* %68
br label %72
70: ; preds = %60
%71 = call i32 @error(i32 1, i32 0, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.2, i64 0, i64 0))
br label %72
72: ; preds = %70, %67
br label %80
73: ; preds = %21
%74 = call i8* @strsep(i8** %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i8* %74, i8** %5
store i32 0, i32* %6
%75 = load i8*, i8** %3
%76 = icmp ne i8* %75, null
br i1 %76, label %79, label %77
77: ; preds = %73
%78 = load i8*, i8** %5
store i8* %78, i8** %3
store i8* null, i8** %5
br label %79
79: ; preds = %77, %73
br label %80
80: ; preds = %79, %72
%81 = load i8*, i8** %5
%82 = icmp ne i8* %81, null
br i1 %82, label %83, label %90
83: ; preds = %80
%84 = load i8*, i8** %5
%85 = getelementptr inbounds i8, i8* %84, i64 0
%86 = load i8, i8* %85
%87 = sext i8 %86 to i32
%88 = icmp eq i32 %87, 0
br i1 %88, label %89, label %90
89: ; preds = %83
store i8* null, i8** %5
br label %90
90: ; preds = %89, %83, %80
%91 = load i8*, i8** %3
%92 = getelementptr inbounds i8, i8* %91, i64 0
%93 = load i8, i8* %92
%94 = sext i8 %93 to i32
%95 = icmp eq i32 %94, 0
br i1 %95, label %96, label %98
96: ; preds = %90
%97 = call i32 @error(i32 1, i32 0, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.2, i64 0, i64 0))
br label %98
98: ; preds = %96, %90
%99 = call i32 @memset(%struct.addrinfo* %9, i32 0, i32 40)
%100 = load i32, i32* @AI_PASSIVE
%101 = load i32, i32* %6
%102 = icmp ne i32 %101, 0
br i1 %102, label %103, label %105
103: ; preds = %98
%104 = load i32, i32* @AI_NUMERICHOST
br label %106
105: ; preds = %98
br label %106
106: ; preds = %105, %103
%107 = phi i32 [ %104, %103 ], [ 0, %105 ]
%108 = or i32 %100, %107
%109 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %9, i32 0, i32 0
store i32 %108, i32* %109
%110 = load i32, i32* %4
%111 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %9, i32 0, i32 1
store i32 %110, i32* %111
%112 = load i32, i32* @AF_UNSPEC
%113 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %9, i32 0, i32 2
store i32 %112, i32* %113
%114 = load i8*, i8** %5
%115 = load i8*, i8** %3
%116 = call i64 @getaddrinfo(i8* %114, i8* %115, %struct.addrinfo* %9, %struct.addrinfo** %8)
%117 = icmp slt i64 %116, 0
br i1 %117, label %121, label %118
118: ; preds = %106
%119 = load %struct.addrinfo*, %struct.addrinfo** %8
%120 = icmp ne %struct.addrinfo* %119, null
br i1 %120, label %123, label %121
121: ; preds = %118, %106
%122 = call i32 @error(i32 1, i32 0, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
br label %123
123: ; preds = %121, %118
store i32 -1, i32* %7
br label %124
124: ; preds = %210, %123
%125 = load %struct.addrinfo*, %struct.addrinfo** %8
%126 = icmp ne %struct.addrinfo* %125, null
br i1 %126, label %127, label %214
127: ; preds = %124
%128 = load %struct.addrinfo*, %struct.addrinfo** %8
%129 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %128, i32 0, i32 2
%130 = load i32, i32* %129
%131 = load %struct.addrinfo*, %struct.addrinfo** %8
%132 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %131, i32 0, i32 1
%133 = load i32, i32* %132
%134 = load %struct.addrinfo*, %struct.addrinfo** %8
%135 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %134, i32 0, i32 5
%136 = load i32, i32* %135
%137 = call i32 @socket(i32 %130, i32 %133, i32 %136)
store i32 %137, i32* %7
%138 = load i32, i32* %7
%139 = icmp sge i32 %138, 0
br i1 %139, label %140, label %209
140: ; preds = %127
%141 = load i32, i32* %7
%142 = load i32, i32* @SOL_SOCKET
%143 = load i32, i32* @SO_REUSEADDR
%144 = call i64 @setsockopt(i32 %141, i32 %142, i32 %143, i32* @inetsock.one, i32 4)
%145 = icmp slt i64 %144, 0
br i1 %145, label %146, label %149
146: ; preds = %140
%147 = load i32, i32* @errno
%148 = call i32 @error(i32 1, i32 %147, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
br label %149
149: ; preds = %146, %140
%150 = load i32, i32* %7
%151 = load %struct.addrinfo*, %struct.addrinfo** %8
%152 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %151, i32 0, i32 3
%153 = load i64, i64* %152
%154 = load %struct.addrinfo*, %struct.addrinfo** %8
%155 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %154, i32 0, i32 4
%156 = load i32, i32* %155
%157 = call i64 @bind(i32 %150, i64 %153, i32 %156)
%158 = icmp eq i64 %157, 0
br i1 %158, label %159, label %206
159: ; preds = %149
%160 = load %struct.addrinfo*, %struct.addrinfo** %8
%161 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %160, i32 0, i32 2
%162 = load i32, i32* %161
switch i32 %162, label %205 [
i32 129, label %163
i32 128, label %184
]
163: ; preds = %159
%164 = load %struct.addrinfo*, %struct.addrinfo** %8
%165 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %164, i32 0, i32 3
%166 = load i64, i64* %165
%167 = inttoptr i64 %166 to %struct.sockaddr_in*
%168 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %167, i32 0, i32 0
%169 = load i32, i32* %168
%170 = call i32 @ntohs(i32 %169)
%171 = icmp eq i32 %170, 0
br i1 %171, label %172, label %183
172: ; preds = %163
store i32 4, i32* %12
%173 = load i32, i32* %7
%174 = bitcast %struct.sockaddr_in* %11 to %struct.sockaddr*
%175 = call i32 @getsockname(i32 %173, %struct.sockaddr* %174, i32* %12)
%176 = icmp eq i32 %175, 0
br i1 %176, label %177, label %182
177: ; preds = %172
%178 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 0
%179 = load i32, i32* %178
%180 = call i32 @ntohs(i32 %179)
%181 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %180)
br label %182
182: ; preds = %177, %172
br label %183
183: ; preds = %182, %163
br label %205
184: ; preds = %159
%185 = load %struct.addrinfo*, %struct.addrinfo** %8
%186 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %185, i32 0, i32 3
%187 = load i64, i64* %186
%188 = inttoptr i64 %187 to %struct.sockaddr_in6*
%189 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %188, i32 0, i32 0
%190 = load i32, i32* %189
%191 = call i32 @ntohs(i32 %190)
%192 = icmp eq i32 %191, 0
br i1 %192, label %193, label %204
193: ; preds = %184
store i32 4, i32* %14
%194 = load i32, i32* %7
%195 = bitcast %struct.sockaddr_in6* %13 to %struct.sockaddr*
%196 = call i32 @getsockname(i32 %194, %struct.sockaddr* %195, i32* %14)
%197 = icmp eq i32 %196, 0
br i1 %197, label %198, label %203
198: ; preds = %193
%199 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %13, i32 0, i32 0
%200 = load i32, i32* %199
%201 = call i32 @ntohs(i32 %200)
%202 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %201)
br label %203
203: ; preds = %198, %193
br label %204
204: ; preds = %203, %184
br label %205
205: ; preds = %159, %204, %183
br label %214
206: ; preds = %149
%207 = load i32, i32* %7
%208 = call i32 @close(i32 %207)
store i32 -1, i32* %7
br label %209
209: ; preds = %206, %127
br label %210
210: ; preds = %209
%211 = load %struct.addrinfo*, %struct.addrinfo** %8
%212 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %211, i32 0, i32 6
%213 = load %struct.addrinfo*, %struct.addrinfo** %212
store %struct.addrinfo* %213, %struct.addrinfo** %8
br label %124
214: ; preds = %205, %124
%215 = load i32, i32* %7
%216 = icmp slt i32 %215, 0
br i1 %216, label %217, label %220
217: ; preds = %214
%218 = load i32, i32* @errno
%219 = call i32 @error(i32 1, i32 %218, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
br label %220
220: ; preds = %217, %214
%221 = load i32, i32* %7
ret i32 %221
}

LLVM IR (-O2):
%struct.addrinfo = type { i32, i32, i32, i64, i32, i32, %struct.addrinfo* }
%struct.sockaddr_in = type { i32 }
%struct.sockaddr_in6 = type { i32 }
%struct.sockaddr = type { i32 }
@errno = global i32 0
@.str = [7 x i8] c"strdup\00"
@.str.1 = [43 x i8] c"Port specification contains unbalanced '['\00"
@.str.2 = [68 x i8] c"Port specification must be in form PORT, HOSTNAME:PORT or [IP]:PORT\00"
@.str.3 = [2 x i8] c":\00"
@AI_PASSIVE = global i32 0
@AI_NUMERICHOST = global i32 0
@AF_UNSPEC = global i32 0
@.str.4 = [36 x i8] c"Host address or port does not exist\00"
@inetsock.one = internal constant i32 1
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str.5 = [11 x i8] c"setsockopt\00"
@.str.6 = [4 x i8] c"%d\0A\00"
@.str.7 = [16 x i8] c"creating socket\00"
define i32 @inetsock(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca %struct.addrinfo*
%5 = alloca %struct.addrinfo
%6 = alloca %struct.sockaddr_in
%7 = alloca i32
%8 = alloca %struct.sockaddr_in6
%9 = alloca i32
%10 = bitcast %struct.addrinfo** %4 to i8*
%11 = bitcast %struct.addrinfo* %5 to i8*
%12 = tail call i8* @strdup(i8* %0)
store i8* %12, i8** %3
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = load i32, i32* @errno
%16 = tail call i32 @error(i32 1, i32 %15, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %17
17: ; preds = %14, %2
%18 = load i8, i8* %12
%19 = icmp eq i8 %18, 91
br i1 %19, label %20, label %44
20: ; preds = %17
%21 = getelementptr inbounds i8, i8* %12, i64 1
br label %22
22: ; preds = %33, %20
%23 = phi i8* [ %21, %20 ], [ %35, %33 ]
%24 = phi i32 [ 1, %20 ], [ %34, %33 ]
%25 = load i8, i8* %23
switch i8 %25, label %33 [
i8 93, label %26
i8 0, label %29
i8 91, label %31
]
26: ; preds = %22
%27 = add nsw i32 %24, -1
%28 = icmp sgt i32 %24, 1
br i1 %28, label %33, label %36
29: ; preds = %22
%30 = tail call i32 @error(i32 1, i32 0, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
br label %33
31: ; preds = %22
%32 = add nsw i32 %24, 1
br label %33
33: ; preds = %22, %26, %29, %31
%34 = phi i32 [ %24, %29 ], [ %32, %31 ], [ %27, %26 ], [ %24, %22 ]
%35 = getelementptr inbounds i8, i8* %23, i64 1
br label %22
36: ; preds = %26
%37 = getelementptr inbounds i8, i8* %23, i64 1
store i8* %37, i8** %3
store i8 0, i8* %23
%38 = load i8, i8* %37
%39 = icmp eq i8 %38, 58
br i1 %39, label %40, label %42
40: ; preds = %36
%41 = getelementptr inbounds i8, i8* %23, i64 2
store i8* %41, i8** %3
store i8 0, i8* %37
br label %51
42: ; preds = %36
%43 = tail call i32 @error(i32 1, i32 0, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.2, i64 0, i64 0))
br label %51
44: ; preds = %17
%45 = call i8* @strsep(i8** %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%46 = load i8*, i8** %3
%47 = icmp eq i8* %46, null
br i1 %47, label %48, label %49
48: ; preds = %44
store i8* %45, i8** %3
br label %58
49: ; preds = %44
%50 = icmp eq i8* %45, null
br i1 %50, label %58, label %51
51: ; preds = %40, %42, %49
%52 = phi i8* [ %46, %49 ], [ %37, %42 ], [ %41, %40 ]
%53 = phi i1 [ true, %49 ], [ false, %42 ], [ false, %40 ]
%54 = phi i8* [ %45, %49 ], [ %21, %42 ], [ %21, %40 ]
%55 = load i8, i8* %54
%56 = icmp eq i8 %55, 0
%57 = select i1 %56, i8* null, i8* %54
br label %58
58: ; preds = %48, %51, %49
%59 = phi i8* [ %52, %51 ], [ %46, %49 ], [ %45, %48 ]
%60 = phi i1 [ %53, %51 ], [ true, %49 ], [ true, %48 ]
%61 = phi i8* [ %57, %51 ], [ null, %49 ], [ null, %48 ]
%62 = load i8, i8* %59
%63 = icmp eq i8 %62, 0
br i1 %63, label %64, label %66
64: ; preds = %58
%65 = call i32 @error(i32 1, i32 0, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.2, i64 0, i64 0))
br label %66
66: ; preds = %64, %58
%67 = call i32 @memset(%struct.addrinfo* %5, i32 0, i32 40)
%68 = load i32, i32* @AI_PASSIVE
%69 = load i32, i32* @AI_NUMERICHOST
%70 = select i1 %60, i32 0, i32 %69
%71 = or i32 %70, %68
%72 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %5, i64 0, i32 0
store i32 %71, i32* %72
%73 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %5, i64 0, i32 1
store i32 %1, i32* %73
%74 = load i32, i32* @AF_UNSPEC
%75 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %5, i64 0, i32 2
store i32 %74, i32* %75
%76 = load i8*, i8** %3
%77 = call i64 @getaddrinfo(i8* %61, i8* %76, %struct.addrinfo* %5, %struct.addrinfo** %4)
%78 = icmp sgt i64 %77, -1
%79 = load %struct.addrinfo*, %struct.addrinfo** %4
%80 = icmp ne %struct.addrinfo* %79, null
%81 = select i1 %78, i1 %80, i1 false
br i1 %81, label %86, label %82
82: ; preds = %66
%83 = call i32 @error(i32 1, i32 0, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
%84 = load %struct.addrinfo*, %struct.addrinfo** %4
%85 = icmp eq %struct.addrinfo* %84, null
br i1 %85, label %166, label %86
86: ; preds = %66, %82
%87 = phi %struct.addrinfo* [ %79, %66 ], [ %84, %82 ]
br label %88
88: ; preds = %86, %160
%89 = phi %struct.addrinfo* [ %164, %160 ], [ %87, %86 ]
%90 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %89, i64 0, i32 2
%91 = load i32, i32* %90
%92 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %89, i64 0, i32 1
%93 = load i32, i32* %92
%94 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %89, i64 0, i32 5
%95 = load i32, i32* %94
%96 = call i32 @socket(i32 %91, i32 %93, i32 %95)
%97 = icmp sgt i32 %96, -1
br i1 %97, label %98, label %160
98: ; preds = %88
%99 = load i32, i32* @SOL_SOCKET
%100 = load i32, i32* @SO_REUSEADDR
%101 = call i64 @setsockopt(i32 %96, i32 %99, i32 %100, i32* @inetsock.one, i32 4)
%102 = icmp slt i64 %101, 0
br i1 %102, label %103, label %106
103: ; preds = %98
%104 = load i32, i32* @errno
%105 = call i32 @error(i32 1, i32 %104, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
br label %106
106: ; preds = %103, %98
%107 = load %struct.addrinfo*, %struct.addrinfo** %4
%108 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %107, i64 0, i32 3
%109 = load i64, i64* %108
%110 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %107, i64 0, i32 4
%111 = load i32, i32* %110
%112 = call i64 @bind(i32 %96, i64 %109, i32 %111)
%113 = icmp eq i64 %112, 0
br i1 %113, label %114, label %158
114: ; preds = %106
%115 = load %struct.addrinfo*, %struct.addrinfo** %4
%116 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %115, i64 0, i32 2
%117 = load i32, i32* %116
switch i32 %117, label %170 [
i32 129, label %118
i32 128, label %138
]
118: ; preds = %114
%119 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %115, i64 0, i32 3
%120 = load i64, i64* %119
%121 = inttoptr i64 %120 to %struct.sockaddr_in*
%122 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %121, i64 0, i32 0
%123 = load i32, i32* %122
%124 = call i32 @ntohs(i32 %123)
%125 = icmp eq i32 %124, 0
br i1 %125, label %126, label %170
126: ; preds = %118
%127 = bitcast %struct.sockaddr_in* %6 to i8*
%128 = bitcast i32* %7 to i8*
store i32 4, i32* %7
%129 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr*
%130 = call i32 @getsockname(i32 %96, %struct.sockaddr* %129, i32* %7)
%131 = icmp eq i32 %130, 0
br i1 %131, label %132, label %137
132: ; preds = %126
%133 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i64 0, i32 0
%134 = load i32, i32* %133
%135 = call i32 @ntohs(i32 %134)
%136 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %135)
br label %137
137: ; preds = %132, %126
br label %170
138: ; preds = %114
%139 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %115, i64 0, i32 3
%140 = load i64, i64* %139
%141 = inttoptr i64 %140 to %struct.sockaddr_in6*
%142 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %141, i64 0, i32 0
%143 = load i32, i32* %142
%144 = call i32 @ntohs(i32 %143)
%145 = icmp eq i32 %144, 0
br i1 %145, label %146, label %170
146: ; preds = %138
%147 = bitcast %struct.sockaddr_in6* %8 to i8*
%148 = bitcast i32* %9 to i8*
store i32 4, i32* %9
%149 = bitcast %struct.sockaddr_in6* %8 to %struct.sockaddr*
%150 = call i32 @getsockname(i32 %96, %struct.sockaddr* %149, i32* %9)
%151 = icmp eq i32 %150, 0
br i1 %151, label %152, label %157
152: ; preds = %146
%153 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %8, i64 0, i32 0
%154 = load i32, i32* %153
%155 = call i32 @ntohs(i32 %154)
%156 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %155)
br label %157
157: ; preds = %152, %146
br label %170
158: ; preds = %106
%159 = call i32 @close(i32 %96)
br label %160
160: ; preds = %88, %158
%161 = phi i32 [ -1, %158 ], [ %96, %88 ]
%162 = load %struct.addrinfo*, %struct.addrinfo** %4
%163 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %162, i64 0, i32 6
%164 = load %struct.addrinfo*, %struct.addrinfo** %163
store %struct.addrinfo* %164, %struct.addrinfo** %4
%165 = icmp eq %struct.addrinfo* %164, null
br i1 %165, label %166, label %88
166: ; preds = %160, %82
%167 = phi i32 [ -1, %82 ], [ %161, %160 ]
%168 = load i32, i32* @errno
%169 = call i32 @error(i32 1, i32 %168, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
br label %170
170: ; preds = %118, %137, %138, %157, %114, %166
%171 = phi i32 [ %167, %166 ], [ %96, %114 ], [ %96, %157 ], [ %96, %138 ], [ %96, %137 ], [ %96, %118 ]
ret i32 %171
}