#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 timeval {
  int member_0;
  int /*<<< orphan*/ member_1;
};
struct addrinfo {
  int /*<<< orphan*/ ai_addrlen;
  int /*<<< orphan*/ ai_addr;
  int /*<<< orphan*/ ai_protocol;
  void *ai_socktype;
  int /*<<< orphan*/ ai_family;
};
typedef int /*<<< orphan*/ socktimeout;
typedef int /*<<< orphan*/ hints;
typedef int /*<<< orphan*/ fd_set;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
scalar_t__ EINPROGRESS;
int /*<<< orphan*/ FD_SET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_ZERO(int /*<<< orphan*/ *);
int /*<<< orphan*/ F_GETFL;
int /*<<< orphan*/ F_SETFL;
int /*<<< orphan*/ IPPROTO_TCP;
int /*<<< orphan*/ Log(int, char *, ...);
int O_NONBLOCK;
int SOCK_NONBLOCK;
void *SOCK_STREAM;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_SNDTIMEO;
int /*<<< orphan*/ close(int);
scalar_t__ connect(int, int /*<<< orphan*/, int /*<<< orphan*/);
scalar_t__ errno;
scalar_t__ fcntl(int, int /*<<< orphan*/, int);
int /*<<< orphan*/ freeaddrinfo(struct addrinfo *);
scalar_t__ getaddrinfo(char *, char *, struct addrinfo *, struct addrinfo **);
int /*<<< orphan*/ memset(struct addrinfo *, int /*<<< orphan*/, int);
int select(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
           int /*<<< orphan*/ *, struct timeval *);
scalar_t__ send(int, char *, int /*<<< orphan*/, int /*<<< orphan*/);
scalar_t__ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, void *, int);
int socket(int /*<<< orphan*/, int, int /*<<< orphan*/);
int /*<<< orphan*/ strerror(scalar_t__);
int /*<<< orphan*/ strlen(char *);
int connect_to_whois_server(void) {
  struct addrinfo hints, *result;
  int fd;
  int flags;
  struct timeval socktimeout = {5, 0};
  char *server = "whois.cymru.com";
  char *port = "43";
  Log(7, "Connecting to whois server");
  memset(&hints, 0, sizeof(hints));
  hints.ai_family = AF_INET;
  hints.ai_socktype = SOCK_STREAM;
  hints.ai_protocol = IPPROTO_TCP;
  if (getaddrinfo(server, port, &hints, &result) < 0) {
    Log(4, "getaddrinfo() failed for whois server: %s", strerror(errno));
    return -2;
  }
  flags = SOCK_STREAM;
  flags |= SOCK_NONBLOCK;
  if ((fd = socket(AF_INET, flags, IPPROTO_TCP)) < 0) {
    Log(4, "Failed to create socket for whois server: %s", strerror(errno));
    freeaddrinfo(result);
    return -2;
  }
  if (setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, (void *)&socktimeout,
                 sizeof(socktimeout)) < 0) {
    Log(4, "Failed to set send timeout on whois socket: %s", strerror(errno));
    freeaddrinfo(result);
    return -2;
  }
  if (connect(fd, result->ai_addr, result->ai_addrlen) < 0) {
    if (errno == EINPROGRESS) {
      struct timeval timeout = {10, 0};
      fd_set writeset;
      int ready;
      FD_ZERO(&writeset);
      FD_SET(fd, &writeset);
      ready = select(fd + 1, NULL, &writeset, NULL, &timeout);
      if (ready <= 0) {
        if (ready < 0) {
          Log(4, "Error connecting to whois server: %s", strerror(errno));
        } else {
          Log(4, "Timeout connecting to whois server");
        }
        close(fd);
        freeaddrinfo(result);
        return -2;
      }
      Log(7, "Connected to whois server OK");
    } else {
      Log(4, "Failed to connect socket for whois server: %s", strerror(errno));
      close(fd);
      freeaddrinfo(result);
      return -2;
    }
  }
  freeaddrinfo(result);
  if ((flags = fcntl(fd, F_GETFL, NULL)) < 0) {
    Log(4, "Failed to get flags for whois socket");
    close(fd);
    return -2;
  }
  flags &= (~O_NONBLOCK);
  if ((fcntl(fd, F_SETFL, flags)) < 0) {
    Log(4, "Failed to get flags for whois socket: %s", strerror(errno));
    close(fd);
    return -2;
  }
  if (send(fd, "begin\n", strlen("begin\n"), 0) < 0) {
    Log(4, "Failed to send header to whois server: %s", strerror(errno));
    close(fd);
    return -2;
  }
  if (send(fd, "noheader\n", strlen("noheader\n"), 0) < 0) {
    Log(4, "Failed to send header to whois server: %s", strerror(errno));
    close(fd);
    return -2;
  }
  if (send(fd, "noasname\n", strlen("noasname\n"), 0) < 0) {
    Log(4, "Failed to send header to whois server: %s", strerror(errno));
    close(fd);
    return -2;
  }
  return fd;
}


x86 assembly (clang, -O0):
<connect_to_whois_server>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    0xe01(%rip),%rax
mov    %rax,-0x40(%rbp)
lea    0xe06(%rip),%rax
mov    %rax,-0x48(%rbp)
lea    0xe0b(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    $0x7,%edi
lea    0xdfe(%rip),%rsi
mov    $0x0,%al
call   10b0 <Log@plt>
lea    -0x28(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1070 <memset@plt>
mov    0x2d95(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    0x2d51(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    0x2d63(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x48(%rbp),%rdi
mov    -0x50(%rbp),%rsi
lea    -0x28(%rbp),%rdx
lea    -0x30(%rbp),%rcx
call   10d0 <getaddrinfo@plt>
cmp    $0x0,%rax
jge    12b1 <connect_to_whois_server+0xc1>
mov    0x2d10(%rip),%rax
mov    (%rax),%rdi
call   10e0 <strerror@plt>
mov    %eax,%edx
mov    $0x4,%edi
lea    0xda0(%rip),%rsi
mov    $0x0,%al
call   10b0 <Log@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    16c6 <connect_to_whois_server+0x4d6>
mov    0x2ce8(%rip),%rax
mov    (%rax),%rax
mov    %eax,-0x38(%rbp)
mov    0x2ceb(%rip),%rax
mov    (%rax),%eax
or     -0x38(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    0x2d04(%rip),%rax
mov    (%rax),%edi
mov    -0x38(%rbp),%esi
mov    0x2ce0(%rip),%rax
mov    (%rax),%edx
call   1110 <socket@plt>
mov    %eax,-0x34(%rbp)
cmp    $0x0,%eax
jge    132c <connect_to_whois_server+0x13c>
mov    0x2c9e(%rip),%rax
mov    (%rax),%rdi
call   10e0 <strerror@plt>
mov    %eax,%edx
mov    $0x4,%edi
lea    0xd58(%rip),%rsi
mov    $0x0,%al
call   10b0 <Log@plt>
mov    -0x30(%rbp),%rdi
call   1100 <freeaddrinfo@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    16c6 <connect_to_whois_server+0x4d6>
mov    -0x34(%rbp),%edi
mov    0x2caa(%rip),%rax
mov    (%rax),%esi
mov    0x2cb1(%rip),%rax
mov    (%rax),%edx
lea    -0x40(%rbp),%rcx
mov    $0x8,%r8d
call   1030 <setsockopt@plt>
cmp    $0x0,%rax
jge    1393 <connect_to_whois_server+0x1a3>
mov    0x2c37(%rip),%rax
mov    (%rax),%rdi
call   10e0 <strerror@plt>
mov    %eax,%edx
mov    $0x4,%edi
lea    0xd1e(%rip),%rsi
mov    $0x0,%al
call   10b0 <Log@plt>
mov    -0x30(%rbp),%rdi
call   1100 <freeaddrinfo@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    16c6 <connect_to_whois_server+0x4d6>
mov    -0x34(%rbp),%edi
mov    -0x30(%rbp),%rax
mov    0x4(%rax),%esi
mov    -0x30(%rbp),%rax
mov    (%rax),%edx
call   10c0 <connect@plt>
cmp    $0x0,%rax
jge    14d4 <connect_to_whois_server+0x2e4>
mov    0x2bdf(%rip),%rax
mov    (%rax),%rax
mov    0x2c05(%rip),%rcx
cmp    (%rcx),%rax
jne    148e <connect_to_whois_server+0x29e>
mov    0xc35(%rip),%rax
mov    %rax,-0x58(%rbp)
lea    -0x5c(%rbp),%rdi
call   1090 <FD_ZERO@plt>
mov    -0x34(%rbp),%edi
lea    -0x5c(%rbp),%rsi
call   10f0 <FD_SET@plt>
mov    -0x34(%rbp),%edi
add    $0x1,%edi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x5c(%rbp),%rdx
lea    -0x58(%rbp),%r8
mov    %rcx,%rsi
call   10a0 <select@plt>
mov    %eax,-0x60(%rbp)
cmpl   $0x0,-0x60(%rbp)
jg     1476 <connect_to_whois_server+0x286>
cmpl   $0x0,-0x60(%rbp)
jge    1446 <connect_to_whois_server+0x256>
mov    0x2b74(%rip),%rax
mov    (%rax),%rdi
call   10e0 <strerror@plt>
mov    %eax,%edx
mov    $0x4,%edi
lea    0xc8a(%rip),%rsi
mov    $0x0,%al
call   10b0 <Log@plt>
jmp    1459 <connect_to_whois_server+0x269>
mov    $0x4,%edi
lea    0xc97(%rip),%rsi
mov    $0x0,%al
call   10b0 <Log@plt>
mov    -0x34(%rbp),%edi
call   1080 <close@plt>
mov    -0x30(%rbp),%rdi
call   1100 <freeaddrinfo@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    16c6 <connect_to_whois_server+0x4d6>
mov    $0x7,%edi
lea    0xc8a(%rip),%rsi
mov    $0x0,%al
call   10b0 <Log@plt>
jmp    14cf <connect_to_whois_server+0x2df>
mov    0x2b03(%rip),%rax
mov    (%rax),%rdi
call   10e0 <strerror@plt>
mov    %eax,%edx
mov    $0x4,%edi
lea    0xc7e(%rip),%rsi
mov    $0x0,%al
call   10b0 <Log@plt>
mov    -0x34(%rbp),%edi
call   1080 <close@plt>
mov    -0x30(%rbp),%rdi
call   1100 <freeaddrinfo@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    16c6 <connect_to_whois_server+0x4d6>
jmp    14d4 <connect_to_whois_server+0x2e4>
mov    -0x30(%rbp),%rdi
call   1100 <freeaddrinfo@plt>
mov    -0x34(%rbp),%edi
mov    0x2aa9(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1040 <fcntl@plt>
mov    %eax,-0x38(%rbp)
cmp    $0x0,%eax
jge    1523 <connect_to_whois_server+0x333>
mov    $0x4,%edi
lea    0xc4f(%rip),%rsi
mov    $0x0,%al
call   10b0 <Log@plt>
mov    -0x34(%rbp),%edi
call   1080 <close@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    16c6 <connect_to_whois_server+0x4d6>
mov    0x2aa6(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x38(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%edi
mov    0x2a69(%rip),%rax
mov    (%rax),%esi
mov    -0x38(%rbp),%edx
call   1040 <fcntl@plt>
cmp    $0x0,%rax
jge    158b <connect_to_whois_server+0x39b>
mov    0x2a3e(%rip),%rax
mov    (%rax),%rdi
call   10e0 <strerror@plt>
mov    %eax,%edx
mov    $0x4,%edi
lea    0xc0c(%rip),%rsi
mov    $0x0,%al
call   10b0 <Log@plt>
mov    -0x34(%rbp),%edi
call   1080 <close@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    16c6 <connect_to_whois_server+0x4d6>
mov    -0x34(%rbp),%eax
mov    %eax,-0x64(%rbp)
lea    0xc0d(%rip),%rdi
call   1050 <strlen@plt>
mov    -0x64(%rbp),%edi
mov    %eax,%edx
lea    0xbfc(%rip),%rsi
xor    %ecx,%ecx
call   1060 <send@plt>
cmp    $0x0,%rax
jge    15f2 <connect_to_whois_server+0x402>
mov    0x29d7(%rip),%rax
mov    (%rax),%rdi
call   10e0 <strerror@plt>
mov    %eax,%edx
mov    $0x4,%edi
lea    0xbd5(%rip),%rsi
mov    $0x0,%al
call   10b0 <Log@plt>
mov    -0x34(%rbp),%edi
call   1080 <close@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    16c6 <connect_to_whois_server+0x4d6>
mov    -0x34(%rbp),%eax
mov    %eax,-0x68(%rbp)
lea    0xbd7(%rip),%rdi
call   1050 <strlen@plt>
mov    -0x68(%rbp),%edi
mov    %eax,%edx
lea    0xbc6(%rip),%rsi
xor    %ecx,%ecx
call   1060 <send@plt>
cmp    $0x0,%rax
jge    1659 <connect_to_whois_server+0x469>
mov    0x2970(%rip),%rax
mov    (%rax),%rdi
call   10e0 <strerror@plt>
mov    %eax,%edx
mov    $0x4,%edi
lea    0xb6e(%rip),%rsi
mov    $0x0,%al
call   10b0 <Log@plt>
mov    -0x34(%rbp),%edi
call   1080 <close@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    16c6 <connect_to_whois_server+0x4d6>
mov    -0x34(%rbp),%eax
mov    %eax,-0x6c(%rbp)
lea    0xb7a(%rip),%rdi
call   1050 <strlen@plt>
mov    -0x6c(%rbp),%edi
mov    %eax,%edx
lea    0xb69(%rip),%rsi
xor    %ecx,%ecx
call   1060 <send@plt>
cmp    $0x0,%rax
jge    16c0 <connect_to_whois_server+0x4d0>
mov    0x2909(%rip),%rax
mov    (%rax),%rdi
call   10e0 <strerror@plt>
mov    %eax,%edx
mov    $0x4,%edi
lea    0xb07(%rip),%rsi
mov    $0x0,%al
call   10b0 <Log@plt>
mov    -0x34(%rbp),%edi
call   1080 <close@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    16c6 <connect_to_whois_server+0x4d6>
mov    -0x34(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<connect_to_whois_server>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x48,%rsp
movq   $0x5,0x18(%rsp)
lea    0xe08(%rip),%rsi
mov    $0x7,%edi
xor    %eax,%eax
call   10b0 <Log@plt>
lea    0x28(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1070 <memset@plt>
mov    0x2da6(%rip),%r14
mov    (%r14),%eax
mov    %eax,0x40(%rsp)
mov    0x2d60(%rip),%r15
mov    (%r15),%rax
mov    %rax,0x38(%rsp)
mov    0x2d71(%rip),%r12
mov    (%r12),%eax
mov    %eax,0x30(%rsp)
lea    0xda2(%rip),%rdi
lea    0xdab(%rip),%rsi
lea    0x8(%rsp),%rcx
mov    %rbx,%rdx
call   10d0 <getaddrinfo@plt>
test   %rax,%rax
js     13b3 <connect_to_whois_server+0x1c3>
mov    0x2d2e(%rip),%rax
mov    (%rax),%esi
or     (%r15),%esi
mov    (%r14),%edi
mov    (%r12),%edx
call   1110 <socket@plt>
test   %eax,%eax
js     13dc <connect_to_whois_server+0x1ec>
mov    %eax,%ebx
mov    0x2d3c(%rip),%rax
mov    (%rax),%esi
mov    0x2d43(%rip),%rax
mov    (%rax),%edx
lea    0x18(%rsp),%rcx
mov    %ebx,%edi
mov    $0x8,%r8d
call   1030 <setsockopt@plt>
test   %rax,%rax
js     13f4 <connect_to_whois_server+0x204>
mov    0x8(%rsp),%rax
mov    (%rax),%edx
mov    0x4(%rax),%esi
mov    %ebx,%edi
call   10c0 <connect@plt>
test   %rax,%rax
js     1427 <connect_to_whois_server+0x237>
mov    0x8(%rsp),%rdi
call   1100 <freeaddrinfo@plt>
mov    0x2c9b(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
xor    %edx,%edx
call   1040 <fcntl@plt>
test   %eax,%eax
js     1493 <connect_to_whois_server+0x2a3>
mov    0x2cc1(%rip),%rcx
mov    (%rcx),%edx
not    %edx
and    %eax,%edx
mov    0x2c8c(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
call   1040 <fcntl@plt>
test   %rax,%rax
js     14ce <connect_to_whois_server+0x2de>
lea    0xe60(%rip),%r14
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
test   %rax,%rax
js     1398 <connect_to_whois_server+0x1a8>
lea    0xe6f(%rip),%r14
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
test   %rax,%rax
js     1398 <connect_to_whois_server+0x1a8>
lea    0xe57(%rip),%r14
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
test   %rax,%rax
jns    14fe <connect_to_whois_server+0x30e>
mov    0x2bf9(%rip),%rax
mov    (%rax),%rdi
call   10e0 <strerror@plt>
lea    0xdee(%rip),%rsi
jmp    14e4 <connect_to_whois_server+0x2f4>
mov    0x2bde(%rip),%rax
mov    (%rax),%rdi
call   10e0 <strerror@plt>
lea    0xc65(%rip),%rsi
mov    $0x4,%edi
mov    %eax,%edx
xor    %eax,%eax
call   10b0 <Log@plt>
jmp    14f9 <connect_to_whois_server+0x309>
mov    0x2bb5(%rip),%rax
mov    (%rax),%rdi
call   10e0 <strerror@plt>
lea    0xc66(%rip),%rsi
jmp    140a <connect_to_whois_server+0x21a>
mov    0x2b9d(%rip),%rax
mov    (%rax),%rdi
call   10e0 <strerror@plt>
lea    0xc7b(%rip),%rsi
mov    $0x4,%edi
mov    %eax,%edx
xor    %eax,%eax
call   10b0 <Log@plt>
mov    0x8(%rsp),%rdi
call   1100 <freeaddrinfo@plt>
jmp    14f9 <connect_to_whois_server+0x309>
mov    0x2b6a(%rip),%r15
mov    (%r15),%rdi
mov    0x2b90(%rip),%rax
cmp    (%rax),%rdi
jne    14a8 <connect_to_whois_server+0x2b8>
movq   $0xa,0x10(%rsp)
lea    0x24(%rsp),%r14
mov    %r14,%rdi
call   1090 <FD_ZERO@plt>
mov    %ebx,%edi
mov    %r14,%rsi
call   10f0 <FD_SET@plt>
mov    %ebx,%edi
add    $0x1,%edi
lea    0x10(%rsp),%r8
xor    %esi,%esi
mov    %r14,%rdx
xor    %ecx,%ecx
call   10a0 <select@plt>
test   %eax,%eax
jle    150c <connect_to_whois_server+0x31c>
lea    0xc7a(%rip),%rsi
mov    $0x7,%edi
xor    %eax,%eax
call   10b0 <Log@plt>
jmp    12e4 <connect_to_whois_server+0xf4>
lea    0xcad(%rip),%rsi
mov    $0x4,%edi
xor    %eax,%eax
call   10b0 <Log@plt>
jmp    14f2 <connect_to_whois_server+0x302>
call   10e0 <strerror@plt>
lea    0xc65(%rip),%rsi
mov    $0x4,%edi
mov    %eax,%edx
xor    %eax,%eax
call   10b0 <Log@plt>
mov    %ebx,%edi
call   1080 <close@plt>
jmp    1418 <connect_to_whois_server+0x228>
mov    0x2ac3(%rip),%rax
mov    (%rax),%rdi
call   10e0 <strerror@plt>
lea    0xc88(%rip),%rsi
mov    $0x4,%edi
mov    %eax,%edx
xor    %eax,%eax
call   10b0 <Log@plt>
mov    %ebx,%edi
call   1080 <close@plt>
mov    $0xfffffffe,%ebx
mov    %ebx,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
js     1523 <connect_to_whois_server+0x333>
lea    0xbc4(%rip),%rsi
mov    $0x4,%edi
xor    %eax,%eax
call   10b0 <Log@plt>
jmp    14c2 <connect_to_whois_server+0x2d2>
mov    (%r15),%rdi
call   10e0 <strerror@plt>
lea    0xb82(%rip),%rsi
jmp    14b4 <connect_to_whois_server+0x2c4>

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
%struct.addrinfo = type { i32, i32, i32, i8*, i32 }
@__const.connect_to_whois_server.socktimeout = %struct.timeval { i32 5, i32 0 }
@.str = [16 x i8] c"whois.cymru.com\00"
@.str.1 = [3 x i8] c"43\00"
@.str.2 = [27 x i8] c"Connecting to whois server\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i8* null
@IPPROTO_TCP = global i32 0
@.str.3 = [42 x i8] c"getaddrinfo() failed for whois server: %s\00"
@errno = global i64 0
@SOCK_NONBLOCK = global i32 0
@.str.4 = [45 x i8] c"Failed to create socket for whois server: %s\00"
@SOL_SOCKET = global i32 0
@SO_SNDTIMEO = global i32 0
@.str.5 = [47 x i8] c"Failed to set send timeout on whois socket: %s\00"
@EINPROGRESS = global i64 0
@__const.connect_to_whois_server.timeout = %struct.timeval { i32 10, i32 0 }
@.str.6 = [37 x i8] c"Error connecting to whois server: %s\00"
@.str.7 = [35 x i8] c"Timeout connecting to whois server\00"
@.str.8 = [29 x i8] c"Connected to whois server OK\00"
@.str.9 = [46 x i8] c"Failed to connect socket for whois server: %s\00"
@F_GETFL = global i32 0
@.str.10 = [37 x i8] c"Failed to get flags for whois socket\00"
@O_NONBLOCK = global i32 0
@F_SETFL = global i32 0
@.str.11 = [41 x i8] c"Failed to get flags for whois socket: %s\00"
@.str.12 = [7 x i8] c"begin\0A\00"
@.str.13 = [42 x i8] c"Failed to send header to whois server: %s\00"
@.str.14 = [10 x i8] c"noheader\0A\00"
@.str.15 = [10 x i8] c"noasname\0A\00"
define i32 @connect_to_whois_server() {
%1 = alloca i32
%2 = alloca %struct.addrinfo
%3 = alloca %struct.addrinfo*
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.timeval
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca %struct.timeval
%10 = alloca i32
%11 = alloca i32
%12 = bitcast %struct.timeval* %6 to i8*
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8** %7
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %8
%13 = call i32 (i32, i8*, ...) @Log(i32 7, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 @memset(%struct.addrinfo* %2, i32 0, i32 32)
%15 = load i32, i32* @AF_INET
%16 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %2, i32 0, i32 4
store i32 %15, i32* %16
%17 = load i8*, i8** @SOCK_STREAM
%18 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %2, i32 0, i32 3
store i8* %17, i8** %18
%19 = load i32, i32* @IPPROTO_TCP
%20 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %2, i32 0, i32 2
store i32 %19, i32* %20
%21 = load i8*, i8** %7
%22 = load i8*, i8** %8
%23 = call i64 @getaddrinfo(i8* %21, i8* %22, %struct.addrinfo* %2, %struct.addrinfo** %3)
%24 = icmp slt i64 %23, 0
br i1 %24, label %25, label %29
25: ; preds = %0
%26 = load i64, i64* @errno
%27 = call i32 @strerror(i64 %26)
%28 = call i32 (i32, i8*, ...) @Log(i32 4, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i32 %27)
store i32 -2, i32* %1
br label %171
29: ; preds = %0
%30 = load i8*, i8** @SOCK_STREAM
%31 = ptrtoint i8* %30 to i32
store i32 %31, i32* %5
%32 = load i32, i32* @SOCK_NONBLOCK
%33 = load i32, i32* %5
%34 = or i32 %33, %32
store i32 %34, i32* %5
%35 = load i32, i32* @AF_INET
%36 = load i32, i32* %5
%37 = load i32, i32* @IPPROTO_TCP
%38 = call i32 @socket(i32 %35, i32 %36, i32 %37)
store i32 %38, i32* %4
%39 = icmp slt i32 %38, 0
br i1 %39, label %40, label %46
40: ; preds = %29
%41 = load i64, i64* @errno
%42 = call i32 @strerror(i64 %41)
%43 = call i32 (i32, i8*, ...) @Log(i32 4, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0), i32 %42)
%44 = load %struct.addrinfo*, %struct.addrinfo** %3
%45 = call i32 @freeaddrinfo(%struct.addrinfo* %44)
store i32 -2, i32* %1
br label %171
46: ; preds = %29
%47 = load i32, i32* %4
%48 = load i32, i32* @SOL_SOCKET
%49 = load i32, i32* @SO_SNDTIMEO
%50 = bitcast %struct.timeval* %6 to i8*
%51 = call i64 @setsockopt(i32 %47, i32 %48, i32 %49, i8* %50, i32 8)
%52 = icmp slt i64 %51, 0
br i1 %52, label %53, label %59
53: ; preds = %46
%54 = load i64, i64* @errno
%55 = call i32 @strerror(i64 %54)
%56 = call i32 (i32, i8*, ...) @Log(i32 4, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.5, i64 0, i64 0), i32 %55)
%57 = load %struct.addrinfo*, %struct.addrinfo** %3
%58 = call i32 @freeaddrinfo(%struct.addrinfo* %57)
store i32 -2, i32* %1
br label %171
59: ; preds = %46
%60 = load i32, i32* %4
%61 = load %struct.addrinfo*, %struct.addrinfo** %3
%62 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %61, i32 0, i32 1
%63 = load i32, i32* %62
%64 = load %struct.addrinfo*, %struct.addrinfo** %3
%65 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %64, i32 0, i32 0
%66 = load i32, i32* %65
%67 = call i64 @connect(i32 %60, i32 %63, i32 %66)
%68 = icmp slt i64 %67, 0
br i1 %68, label %69, label %108
69: ; preds = %59
%70 = load i64, i64* @errno
%71 = load i64, i64* @EINPROGRESS
%72 = icmp eq i64 %70, %71
br i1 %72, label %73, label %99
73: ; preds = %69
%74 = bitcast %struct.timeval* %9 to i8*
%75 = call i32 @FD_ZERO(i32* %10)
%76 = load i32, i32* %4
%77 = call i32 @FD_SET(i32 %76, i32* %10)
%78 = load i32, i32* %4
%79 = add nsw i32 %78, 1
%80 = call i32 @select(i32 %79, i32* null, i32* %10, i32* null, %struct.timeval* %9)
store i32 %80, i32* %11
%81 = load i32, i32* %11
%82 = icmp sle i32 %81, 0
br i1 %82, label %83, label %97
83: ; preds = %73
%84 = load i32, i32* %11
%85 = icmp slt i32 %84, 0
br i1 %85, label %86, label %90
86: ; preds = %83
%87 = load i64, i64* @errno
%88 = call i32 @strerror(i64 %87)
%89 = call i32 (i32, i8*, ...) @Log(i32 4, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0), i32 %88)
br label %92
90: ; preds = %83
%91 = call i32 (i32, i8*, ...) @Log(i32 4, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0))
br label %92
92: ; preds = %90, %86
%93 = load i32, i32* %4
%94 = call i32 @close(i32 %93)
%95 = load %struct.addrinfo*, %struct.addrinfo** %3
%96 = call i32 @freeaddrinfo(%struct.addrinfo* %95)
store i32 -2, i32* %1
br label %171
97: ; preds = %73
%98 = call i32 (i32, i8*, ...) @Log(i32 7, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0))
br label %107
99: ; preds = %69
%100 = load i64, i64* @errno
%101 = call i32 @strerror(i64 %100)
%102 = call i32 (i32, i8*, ...) @Log(i32 4, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.9, i64 0, i64 0), i32 %101)
%103 = load i32, i32* %4
%104 = call i32 @close(i32 %103)
%105 = load %struct.addrinfo*, %struct.addrinfo** %3
%106 = call i32 @freeaddrinfo(%struct.addrinfo* %105)
store i32 -2, i32* %1
br label %171
107: ; preds = %97
br label %108
108: ; preds = %107, %59
%109 = load %struct.addrinfo*, %struct.addrinfo** %3
%110 = call i32 @freeaddrinfo(%struct.addrinfo* %109)
%111 = load i32, i32* %4
%112 = load i32, i32* @F_GETFL
%113 = call i64 @fcntl(i32 %111, i32 %112, i32 0)
%114 = trunc i64 %113 to i32
store i32 %114, i32* %5
%115 = icmp slt i32 %114, 0
br i1 %115, label %116, label %120
116: ; preds = %108
%117 = call i32 (i32, i8*, ...) @Log(i32 4, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.10, i64 0, i64 0))
%118 = load i32, i32* %4
%119 = call i32 @close(i32 %118)
store i32 -2, i32* %1
br label %171
120: ; preds = %108
%121 = load i32, i32* @O_NONBLOCK
%122 = xor i32 %121, -1
%123 = load i32, i32* %5
%124 = and i32 %123, %122
store i32 %124, i32* %5
%125 = load i32, i32* %4
%126 = load i32, i32* @F_SETFL
%127 = load i32, i32* %5
%128 = call i64 @fcntl(i32 %125, i32 %126, i32 %127)
%129 = icmp slt i64 %128, 0
br i1 %129, label %130, label %136
130: ; preds = %120
%131 = load i64, i64* @errno
%132 = call i32 @strerror(i64 %131)
%133 = call i32 (i32, i8*, ...) @Log(i32 4, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.11, i64 0, i64 0), i32 %132)
%134 = load i32, i32* %4
%135 = call i32 @close(i32 %134)
store i32 -2, i32* %1
br label %171
136: ; preds = %120
%137 = load i32, i32* %4
%138 = call i32 @strlen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0))
%139 = call i64 @send(i32 %137, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i32 %138, i32 0)
%140 = icmp slt i64 %139, 0
br i1 %140, label %141, label %147
141: ; preds = %136
%142 = load i64, i64* @errno
%143 = call i32 @strerror(i64 %142)
%144 = call i32 (i32, i8*, ...) @Log(i32 4, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.13, i64 0, i64 0), i32 %143)
%145 = load i32, i32* %4
%146 = call i32 @close(i32 %145)
store i32 -2, i32* %1
br label %171
147: ; preds = %136
%148 = load i32, i32* %4
%149 = call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.14, i64 0, i64 0))
%150 = call i64 @send(i32 %148, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.14, i64 0, i64 0), i32 %149, i32 0)
%151 = icmp slt i64 %150, 0
br i1 %151, label %152, label %158
152: ; preds = %147
%153 = load i64, i64* @errno
%154 = call i32 @strerror(i64 %153)
%155 = call i32 (i32, i8*, ...) @Log(i32 4, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.13, i64 0, i64 0), i32 %154)
%156 = load i32, i32* %4
%157 = call i32 @close(i32 %156)
store i32 -2, i32* %1
br label %171
158: ; preds = %147
%159 = load i32, i32* %4
%160 = call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.15, i64 0, i64 0))
%161 = call i64 @send(i32 %159, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.15, i64 0, i64 0), i32 %160, i32 0)
%162 = icmp slt i64 %161, 0
br i1 %162, label %163, label %169
163: ; preds = %158
%164 = load i64, i64* @errno
%165 = call i32 @strerror(i64 %164)
%166 = call i32 (i32, i8*, ...) @Log(i32 4, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.13, i64 0, i64 0), i32 %165)
%167 = load i32, i32* %4
%168 = call i32 @close(i32 %167)
store i32 -2, i32* %1
br label %171
169: ; preds = %158
%170 = load i32, i32* %4
store i32 %170, i32* %1
br label %171
171: ; preds = %169, %163, %152, %141, %130, %116, %99, %92, %53, %40, %25
%172 = load i32, i32* %1
ret i32 %172
}

LLVM IR (-O2):
%struct.addrinfo = type { i32, i32, i32, i8*, i32 }
%struct.timeval = type { i32, i32 }
@.str = [16 x i8] c"whois.cymru.com\00"
@.str.1 = [3 x i8] c"43\00"
@.str.2 = [27 x i8] c"Connecting to whois server\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i8* null
@IPPROTO_TCP = global i32 0
@.str.3 = [42 x i8] c"getaddrinfo() failed for whois server: %s\00"
@errno = global i64 0
@SOCK_NONBLOCK = global i32 0
@.str.4 = [45 x i8] c"Failed to create socket for whois server: %s\00"
@SOL_SOCKET = global i32 0
@SO_SNDTIMEO = global i32 0
@.str.5 = [47 x i8] c"Failed to set send timeout on whois socket: %s\00"
@EINPROGRESS = global i64 0
@.str.6 = [37 x i8] c"Error connecting to whois server: %s\00"
@.str.7 = [35 x i8] c"Timeout connecting to whois server\00"
@.str.8 = [29 x i8] c"Connected to whois server OK\00"
@.str.9 = [46 x i8] c"Failed to connect socket for whois server: %s\00"
@F_GETFL = global i32 0
@.str.10 = [37 x i8] c"Failed to get flags for whois socket\00"
@O_NONBLOCK = global i32 0
@F_SETFL = global i32 0
@.str.11 = [41 x i8] c"Failed to get flags for whois socket: %s\00"
@.str.12 = [7 x i8] c"begin\0A\00"
@.str.13 = [42 x i8] c"Failed to send header to whois server: %s\00"
@.str.14 = [10 x i8] c"noheader\0A\00"
@.str.15 = [10 x i8] c"noasname\0A\00"
define i32 @connect_to_whois_server() {
%1 = alloca %struct.addrinfo
%2 = alloca %struct.addrinfo*
%3 = alloca i64
%4 = alloca i64
%5 = bitcast i64* %4 to %struct.timeval*
%6 = alloca i32
%7 = bitcast %struct.addrinfo* %1 to i8*
%8 = bitcast %struct.addrinfo** %2 to i8*
%9 = bitcast i64* %3 to i8*
store i64 5, i64* %3
%10 = tail call i32 (i32, i8*, ...) @Log(i32 7, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @memset(%struct.addrinfo* %1, i32 0, i32 32)
%12 = load i32, i32* @AF_INET
%13 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %1, i64 0, i32 4
store i32 %12, i32* %13
%14 = load i8*, i8** @SOCK_STREAM
%15 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %1, i64 0, i32 3
store i8* %14, i8** %15
%16 = load i32, i32* @IPPROTO_TCP
%17 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %1, i64 0, i32 2
store i32 %16, i32* %17
%18 = call i64 @getaddrinfo(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %struct.addrinfo* %1, %struct.addrinfo** %2)
%19 = icmp slt i64 %18, 0
br i1 %19, label %20, label %24
20: ; preds = %0
%21 = load i64, i64* @errno
%22 = call i32 @strerror(i64 %21)
%23 = call i32 (i32, i8*, ...) @Log(i32 4, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i32 %22)
br label %140
24: ; preds = %0
%25 = load i8*, i8** @SOCK_STREAM
%26 = ptrtoint i8* %25 to i64
%27 = trunc i64 %26 to i32
%28 = load i32, i32* @SOCK_NONBLOCK
%29 = or i32 %28, %27
%30 = load i32, i32* @AF_INET
%31 = load i32, i32* @IPPROTO_TCP
%32 = call i32 @socket(i32 %30, i32 %29, i32 %31)
%33 = icmp slt i32 %32, 0
br i1 %33, label %34, label %40
34: ; preds = %24
%35 = load i64, i64* @errno
%36 = call i32 @strerror(i64 %35)
%37 = call i32 (i32, i8*, ...) @Log(i32 4, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0), i32 %36)
%38 = load %struct.addrinfo*, %struct.addrinfo** %2
%39 = call i32 @freeaddrinfo(%struct.addrinfo* %38)
br label %140
40: ; preds = %24
%41 = load i32, i32* @SOL_SOCKET
%42 = load i32, i32* @SO_SNDTIMEO
%43 = call i64 @setsockopt(i32 %32, i32 %41, i32 %42, i8* %9, i32 8)
%44 = icmp slt i64 %43, 0
br i1 %44, label %45, label %51
45: ; preds = %40
%46 = load i64, i64* @errno
%47 = call i32 @strerror(i64 %46)
%48 = call i32 (i32, i8*, ...) @Log(i32 4, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.5, i64 0, i64 0), i32 %47)
%49 = load %struct.addrinfo*, %struct.addrinfo** %2
%50 = call i32 @freeaddrinfo(%struct.addrinfo* %49)
br label %140
51: ; preds = %40
%52 = load %struct.addrinfo*, %struct.addrinfo** %2
%53 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %52, i64 0, i32 1
%54 = load i32, i32* %53
%55 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %52, i64 0, i32 0
%56 = load i32, i32* %55
%57 = call i64 @connect(i32 %32, i32 %54, i32 %56)
%58 = icmp slt i64 %57, 0
br i1 %58, label %59, label %91
59: ; preds = %51
%60 = load i64, i64* @errno
%61 = load i64, i64* @EINPROGRESS
%62 = icmp eq i64 %60, %61
br i1 %62, label %63, label %85
63: ; preds = %59
%64 = bitcast i64* %4 to i8*
store i64 10, i64* %4
%65 = bitcast i32* %6 to i8*
%66 = call i32 @FD_ZERO(i32* %6)
%67 = call i32 @FD_SET(i32 %32, i32* %6)
%68 = add nuw nsw i32 %32, 1
%69 = call i32 @select(i32 %68, i32* null, i32* %6, i32* null, %struct.timeval* %5)
%70 = icmp slt i32 %69, 1
br i1 %70, label %71, label %83
71: ; preds = %63
%72 = icmp slt i32 %69, 0
br i1 %72, label %73, label %77
73: ; preds = %71
%74 = load i64, i64* @errno
%75 = call i32 @strerror(i64 %74)
%76 = call i32 (i32, i8*, ...) @Log(i32 4, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0), i32 %75)
br label %79
77: ; preds = %71
%78 = call i32 (i32, i8*, ...) @Log(i32 4, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0))
br label %79
79: ; preds = %73, %77
%80 = call i32 @close(i32 %32)
%81 = load %struct.addrinfo*, %struct.addrinfo** %2
%82 = call i32 @freeaddrinfo(%struct.addrinfo* %81)
br label %140
83: ; preds = %63
%84 = call i32 (i32, i8*, ...) @Log(i32 7, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0))
br label %91
85: ; preds = %59
%86 = call i32 @strerror(i64 %60)
%87 = call i32 (i32, i8*, ...) @Log(i32 4, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.9, i64 0, i64 0), i32 %86)
%88 = call i32 @close(i32 %32)
%89 = load %struct.addrinfo*, %struct.addrinfo** %2
%90 = call i32 @freeaddrinfo(%struct.addrinfo* %89)
br label %140
91: ; preds = %83, %51
%92 = load %struct.addrinfo*, %struct.addrinfo** %2
%93 = call i32 @freeaddrinfo(%struct.addrinfo* %92)
%94 = load i32, i32* @F_GETFL
%95 = call i64 @fcntl(i32 %32, i32 %94, i32 0)
%96 = trunc i64 %95 to i32
%97 = icmp slt i32 %96, 0
br i1 %97, label %98, label %101
98: ; preds = %91
%99 = call i32 (i32, i8*, ...) @Log(i32 4, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.10, i64 0, i64 0))
%100 = call i32 @close(i32 %32)
br label %140
101: ; preds = %91
%102 = load i32, i32* @O_NONBLOCK
%103 = xor i32 %102, -1
%104 = and i32 %103, %96
%105 = load i32, i32* @F_SETFL
%106 = call i64 @fcntl(i32 %32, i32 %105, i32 %104)
%107 = icmp slt i64 %106, 0
br i1 %107, label %108, label %113
108: ; preds = %101
%109 = load i64, i64* @errno
%110 = call i32 @strerror(i64 %109)
%111 = call i32 (i32, i8*, ...) @Log(i32 4, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.11, i64 0, i64 0), i32 %110)
%112 = call i32 @close(i32 %32)
br label %140
113: ; preds = %101
%114 = call i32 @strlen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0))
%115 = call i64 @send(i32 %32, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i32 %114, i32 0)
%116 = icmp slt i64 %115, 0
br i1 %116, label %117, label %122
117: ; preds = %113
%118 = load i64, i64* @errno
%119 = call i32 @strerror(i64 %118)
%120 = call i32 (i32, i8*, ...) @Log(i32 4, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.13, i64 0, i64 0), i32 %119)
%121 = call i32 @close(i32 %32)
br label %140
122: ; preds = %113
%123 = call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.14, i64 0, i64 0))
%124 = call i64 @send(i32 %32, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.14, i64 0, i64 0), i32 %123, i32 0)
%125 = icmp slt i64 %124, 0
br i1 %125, label %126, label %131
126: ; preds = %122
%127 = load i64, i64* @errno
%128 = call i32 @strerror(i64 %127)
%129 = call i32 (i32, i8*, ...) @Log(i32 4, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.13, i64 0, i64 0), i32 %128)
%130 = call i32 @close(i32 %32)
br label %140
131: ; preds = %122
%132 = call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.15, i64 0, i64 0))
%133 = call i64 @send(i32 %32, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.15, i64 0, i64 0), i32 %132, i32 0)
%134 = icmp slt i64 %133, 0
br i1 %134, label %135, label %140
135: ; preds = %131
%136 = load i64, i64* @errno
%137 = call i32 @strerror(i64 %136)
%138 = call i32 (i32, i8*, ...) @Log(i32 4, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.13, i64 0, i64 0), i32 %137)
%139 = call i32 @close(i32 %32)
br label %140
140: ; preds = %79, %131, %135, %126, %117, %108, %98, %85, %45, %34, %20
%141 = phi i32 [ -2, %20 ], [ -2, %34 ], [ -2, %45 ], [ -2, %98 ], [ -2, %108 ], [ -2, %117 ], [ -2, %126 ], [ -2, %135 ], [ -2, %85 ], [ %32, %131 ], [ -2, %79 ]
ret i32 %141
}