#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_addr;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_addr;
};
struct addrinfo {
  scalar_t__ ai_family;
  int /*<<< orphan*/ ai_protocol;
  int /*<<< orphan*/ ai_socktype;
  scalar_t__ ai_addr;
  struct addrinfo *ai_next;
  int /*<<< orphan*/ ai_flags;
};

/* Variables and functions */
scalar_t__ AF_INET;
scalar_t__ AF_UNSPEC;
int /*<<< orphan*/ AI_PASSIVE;
int /*<<< orphan*/ EXIT_FAILURE;
int EXIT_SUCCESS;
int INET6_ADDRSTRLEN;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ freeaddrinfo(struct addrinfo *);
char *gai_strerror(int);
int getaddrinfo(char *, char *, struct addrinfo *, struct addrinfo **);
int /*<<< orphan*/ inet_ntop(scalar_t__, void *, char *, int);
int /*<<< orphan*/ insert_integer(int *);
int /*<<< orphan*/ memset(struct addrinfo *, int /*<<< orphan*/, int);
int /*<<< orphan*/ pd_debug(char *, char *, int);
int /*<<< orphan*/ pd_error(char *, char *, int);
int /*<<< orphan*/ printf(char *, ...);
int socket(scalar_t__, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  if (argc != 3) {
    fprintf(stderr, "usage: %s <hostname> <port>\n\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  printf("Hostname:\t%s\n", argv[1]);
  printf("Port:\t\t%s\n\n", argv[2]);
  struct addrinfo hints;
  struct addrinfo *gai_results = NULL;
  pd_debug("Preparing hints struct",
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/CaioIcy/c_socket_chat/refs/heads/master/"
           "src/client.c",
           34);
  memset(&hints, 0, sizeof hints);
  hints.ai_family = AF_UNSPEC;
  hints.ai_socktype = SOCK_STREAM;
  hints.ai_flags = AI_PASSIVE;
  pd_debug("Using getaddrinfo",
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/CaioIcy/c_socket_chat/refs/heads/master/"
           "src/client.c",
           41);
  int rv_gai = getaddrinfo(argv[1], argv[2], &hints, &gai_results);
  if (rv_gai != 0) {
    fprintf(stderr, "getaddrinfo error:\n");
    pd_error(gai_strerror(rv_gai),
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/CaioIcy/c_socket_chat/refs/heads/"
             "master/src/client.c",
             46);
    return 1;
  }
  pd_debug("Displaying all found hosts",
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/CaioIcy/c_socket_chat/refs/heads/master/"
           "src/client.c",
           50);
  char ipstr[INET6_ADDRSTRLEN];
  struct addrinfo *p = NULL;
  int i = 0;
  for (p = gai_results; p != NULL; p = p->ai_next, i++) {
    void *address = NULL;
    char *ip_version = NULL;
    if (p->ai_family == AF_INET) {
      struct sockaddr_in *ipv4 = (struct sockaddr_in *)p->ai_addr;
      address = &(ipv4->sin_addr);
      ip_version = "IPv4";
    } else {
      struct sockaddr_in6 *ipv6 = (struct sockaddr_in6 *)p->ai_addr;
      address = &(ipv6->sin6_addr);
      ip_version = "IPv6";
    }
    inet_ntop(p->ai_family, address, ipstr, sizeof ipstr);
    printf("[%d] %s: %s\n", (i + 1), ip_version, ipstr);
  }
  if (i <= 0) {
    printf("Nothing was found.");
    return 2;
  }
  pd_debug("Choosing IP",
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/CaioIcy/c_socket_chat/refs/heads/master/"
           "src/client.c",
           83);
  printf("Choose an IP based on its number on the list above. Must be between "
         "1 and %d.\n",
         i);
  printf("Number: ");
  int choice = 0;
  do {
    printf("Must be between 1 and %d.\n", i);
    insert_integer(&choice);
    printf("%d > %d ?\n", choice, i);
  } while (choice > i || choice < 1);
  struct addrinfo *chosen_addrinfo = gai_results;
  int j = 1;
  while (j < choice) {
    chosen_addrinfo = chosen_addrinfo->ai_next;
    j++;
  }
  char chosen_ipstr[INET6_ADDRSTRLEN];
  void *chosen_address = NULL;
  if (chosen_addrinfo->ai_family == AF_INET) {
    struct sockaddr_in *ipv4 = (struct sockaddr_in *)chosen_addrinfo->ai_addr;
    chosen_address = &(ipv4->sin_addr);
  } else {
    struct sockaddr_in6 *ipv6 = (struct sockaddr_in6 *)chosen_addrinfo->ai_addr;
    chosen_address = &(ipv6->sin6_addr);
  }
  inet_ntop(chosen_addrinfo->ai_family, chosen_address, chosen_ipstr,
            sizeof chosen_ipstr);
  printf("Chosen IP was: %s\n", chosen_ipstr);
  pd_debug("Opening the socket",
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/CaioIcy/c_socket_chat/refs/heads/master/"
           "src/client.c",
           114);
  int socket_fd =
      socket(chosen_addrinfo->ai_family, chosen_addrinfo->ai_socktype,
             chosen_addrinfo->ai_protocol);
  if (socket_fd == -1) {
    pd_error("Opening socket",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/CaioIcy/c_socket_chat/refs/heads/"
             "master/src/client.c",
             118);
    close(socket_fd);
    return 3;
  }
  pd_debug("Exiting",
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/CaioIcy/c_socket_chat/refs/heads/master/"
           "src/client.c",
           123);
  close(socket_fd);
  freeaddrinfo(gai_results);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     121f <main+0x4f>
mov    0x2dc6(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdf6(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2d98(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xdf0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xde8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movq   $0x0,-0x40(%rbp)
lea    0xdde(%rip),%rdi
lea    0xdee(%rip),%rsi
mov    $0x22,%edx
call   10b0 <pd_debug@plt>
lea    -0x38(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1060 <memset@plt>
mov    0x2d4e(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
mov    0x2d28(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    0x2d44(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
lea    0xe36(%rip),%rdi
lea    0xda0(%rip),%rsi
mov    $0x29,%edx
call   10b0 <pd_debug@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    -0x38(%rbp),%rdx
lea    -0x40(%rbp),%rcx
call   10c0 <getaddrinfo@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
je     1322 <main+0x152>
mov    0x2cd6(%rip),%rax
mov    (%rax),%edi
lea    0xdfd(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x44(%rbp),%edi
call   1050 <gai_strerror@plt>
mov    %rax,%rdi
lea    0xd43(%rip),%rsi
mov    $0x2e,%edx
call   10d0 <pd_error@plt>
movl   $0x1,-0x4(%rbp)
jmp    1727 <main+0x557>
lea    0xddb(%rip),%rdi
lea    0xd1f(%rip),%rsi
mov    $0x32,%edx
call   10b0 <pd_debug@plt>
mov    0x2ca7(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0xd8(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xd0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x58(%rbp)
movq   $0x0,-0x60(%rbp)
movl   $0x0,-0x64(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x60(%rbp)
cmpq   $0x0,-0x60(%rbp)
je     145b <main+0x28b>
movq   $0x0,-0x70(%rbp)
movq   $0x0,-0x78(%rbp)
mov    -0x60(%rbp),%rax
mov    (%rax),%rax
mov    0x2c28(%rip),%rcx
cmp    (%rcx),%rax
jne    13dd <main+0x20d>
mov    -0x60(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x80(%rbp)
mov    -0x80(%rbp),%rax
mov    %rax,-0x70(%rbp)
lea    0xd4b(%rip),%rax
mov    %rax,-0x78(%rbp)
jmp    1402 <main+0x232>
mov    -0x60(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x88(%rbp)
mov    -0x88(%rbp),%rax
mov    %rax,-0x70(%rbp)
lea    0xd26(%rip),%rax
mov    %rax,-0x78(%rbp)
mov    -0xd0(%rbp),%rdx
mov    -0xd8(%rbp),%rax
mov    -0x60(%rbp),%rcx
mov    (%rcx),%rdi
mov    -0x70(%rbp),%rsi
mov    %eax,%ecx
call   1030 <inet_ntop@plt>
mov    -0xd0(%rbp),%rcx
mov    -0x64(%rbp),%esi
add    $0x1,%esi
mov    -0x78(%rbp),%rdx
lea    0xcef(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x60(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x60(%rbp)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1387 <main+0x1b7>
cmpl   $0x0,-0x64(%rbp)
jg     1489 <main+0x2b9>
lea    0xcca(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x2,-0x4(%rbp)
movl   $0x1,-0x8c(%rbp)
jmp    1720 <main+0x550>
lea    0xcb9(%rip),%rdi
lea    0xbb8(%rip),%rsi
mov    $0x53,%edx
call   10b0 <pd_debug@plt>
mov    -0x64(%rbp),%esi
lea    0xcaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xceb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x90(%rbp)
mov    -0x64(%rbp),%esi
lea    0xcb5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x90(%rbp),%rdi
call   1090 <insert_integer@plt>
mov    -0x90(%rbp),%esi
mov    -0x64(%rbp),%edx
lea    0xcb6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x90(%rbp),%ecx
mov    $0x1,%al
cmp    -0x64(%rbp),%ecx
mov    %al,-0xd9(%rbp)
jg     1525 <main+0x355>
cmpl   $0x1,-0x90(%rbp)
setl   %al
mov    %al,-0xd9(%rbp)
mov    -0xd9(%rbp),%al
test   $0x1,%al
jne    14ca <main+0x2fa>
mov    -0x40(%rbp),%rax
mov    %rax,-0x98(%rbp)
movl   $0x1,-0x9c(%rbp)
mov    -0x9c(%rbp),%eax
cmp    -0x90(%rbp),%eax
jge    1580 <main+0x3b0>
mov    -0x98(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x98(%rbp)
mov    -0x9c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c(%rbp)
jmp    1548 <main+0x378>
mov    0x2a61(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0xf0(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xe8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0xa8(%rbp)
movq   $0x0,-0xb0(%rbp)
mov    -0x98(%rbp),%rax
mov    (%rax),%rax
mov    0x2a0a(%rip),%rcx
cmp    (%rcx),%rax
jne    15fc <main+0x42c>
mov    -0x98(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0xb8(%rbp)
mov    -0xb8(%rbp),%rax
mov    %rax,-0xb0(%rbp)
jmp    161c <main+0x44c>
mov    -0x98(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0xc0(%rbp)
mov    -0xc0(%rbp),%rax
mov    %rax,-0xb0(%rbp)
mov    -0xe8(%rbp),%rdx
mov    -0xf0(%rbp),%rax
mov    -0x98(%rbp),%rcx
mov    (%rcx),%rdi
mov    -0xb0(%rbp),%rsi
mov    %eax,%ecx
call   1030 <inet_ntop@plt>
mov    -0xe8(%rbp),%rsi
lea    0xb68(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xb6d(%rip),%rdi
lea    0x9ea(%rip),%rsi
mov    $0x72,%edx
call   10b0 <pd_debug@plt>
mov    -0x98(%rbp),%rax
mov    (%rax),%rdi
mov    -0x98(%rbp),%rax
mov    0xc(%rax),%esi
mov    -0x98(%rbp),%rax
mov    0x8(%rax),%edx
call   10f0 <socket@plt>
mov    %eax,-0xc4(%rbp)
cmpl   $0xffffffff,-0xc4(%rbp)
jne    16de <main+0x50e>
lea    0xb32(%rip),%rdi
lea    0x99c(%rip),%rsi
mov    $0x76,%edx
call   10d0 <pd_error@plt>
mov    -0xc4(%rbp),%edi
call   1070 <close@plt>
movl   $0x3,-0x4(%rbp)
movl   $0x1,-0x8c(%rbp)
jmp    1720 <main+0x550>
lea    0xb08(%rip),%rdi
lea    0x963(%rip),%rsi
mov    $0x7b,%edx
call   10b0 <pd_debug@plt>
mov    -0xc4(%rbp),%edi
call   1070 <close@plt>
mov    -0x40(%rbp),%rdi
call   10e0 <freeaddrinfo@plt>
mov    0x2897(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x8c(%rbp)
mov    -0x50(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rsi,%rbx
cmp    $0x3,%edi
jne    155d <main+0x38d>
mov    0x8(%rbx),%rsi
lea    0xe26(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rbx),%rsi
lea    0xe22(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movq   $0x0,-0x38(%rbp)
lea    0xe18(%rip),%rdi
lea    0xe28(%rip),%r15
mov    %r15,%rsi
mov    $0x22,%edx
call   10b0 <pd_debug@plt>
lea    -0x68(%rbp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1060 <memset@plt>
mov    0x2d82(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x68(%rbp)
mov    0x2d5c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x5c(%rbp)
mov    0x2d78(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
lea    0xe6a(%rip),%rdi
mov    %r15,%rsi
mov    $0x29,%edx
call   10b0 <pd_debug@plt>
mov    0x8(%rbx),%rdi
mov    0x10(%rbx),%rsi
lea    -0x38(%rbp),%rcx
mov    %r14,%rdx
call   10c0 <getaddrinfo@plt>
test   %eax,%eax
je     12d7 <main+0x107>
mov    %eax,%ebx
mov    0x2d1e(%rip),%rax
mov    (%rax),%edi
lea    0xe45(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %ebx,%edi
call   1050 <gai_strerror@plt>
lea    0xd8f(%rip),%rsi
mov    %rax,%rdi
mov    $0x2e,%edx
call   10d0 <pd_error@plt>
mov    $0x1,%eax
jmp    154e <main+0x37e>
lea    0xe26(%rip),%rdi
lea    0xd6a(%rip),%rsi
mov    $0x32,%edx
call   10b0 <pd_debug@plt>
mov    %rsp,%rbx
mov    0x2cef(%rip),%rax
mov    (%rax),%r14d
mov    %rsp,%r15
lea    0xf(%r14),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
mov    -0x38(%rbp),%r12
test   %r12,%r12
je     146b <main+0x29b>
mov    %rbx,-0x40(%rbp)
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r12),%rdi
mov    0x10(%r12),%rsi
mov    0x2c98(%rip),%rax
cmp    (%rax),%rdi
lea    0xdda(%rip),%rbx
lea    0xdce(%rip),%rax
cmove  %rax,%rbx
mov    %r15,%rdx
mov    %r14d,%ecx
call   1030 <inet_ntop@plt>
add    $0x1,%r13d
lea    0xdbe(%rip),%rdi
mov    %r13d,%esi
mov    %rbx,%rdx
mov    %r15,%rcx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%r12),%r12
test   %r12,%r12
jne    1330 <main+0x160>
lea    0xdbd(%rip),%rdi
lea    0xcbc(%rip),%rsi
mov    $0x53,%edx
call   10b0 <pd_debug@plt>
lea    0xdb1(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdef(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movl   $0x0,-0x2c(%rbp)
lea    0xdbf(%rip),%r14
lea    -0x2c(%rbp),%r15
lea    0xdd8(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
call   1090 <insert_integer@plt>
mov    -0x2c(%rbp),%esi
mov    %r12,%rdi
mov    %r13d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    -0x2c(%rbp),%edx
cmp    %r13d,%edx
jg     13e0 <main+0x210>
test   %edx,%edx
jle    13e0 <main+0x210>
mov    -0x38(%rbp),%rbx
cmp    $0x2,%edx
jb     1483 <main+0x2b3>
lea    -0x1(%rdx),%ecx
add    $0xfffffffe,%edx
mov    %ecx,%eax
and    $0x7,%eax
cmp    $0x7,%edx
jb     1455 <main+0x285>
and    $0xfffffff8,%ecx
nopl   (%rax)
mov    0x18(%rbx),%rdx
mov    0x18(%rdx),%rdx
mov    0x18(%rdx),%rdx
mov    0x18(%rdx),%rdx
mov    0x18(%rdx),%rdx
mov    0x18(%rdx),%rdx
mov    0x18(%rdx),%rdx
mov    0x18(%rdx),%rbx
add    $0xfffffff8,%ecx
jne    1430 <main+0x260>
test   %eax,%eax
mov    0x2b8a(%rip),%rcx
je     148a <main+0x2ba>
mov    0x18(%rbx),%rbx
add    $0xffffffff,%eax
jne    1460 <main+0x290>
jmp    148a <main+0x2ba>
lea    0xcc4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x2,%eax
jmp    154b <main+0x37b>
mov    0x2b5e(%rip),%rcx
mov    (%rcx),%ecx
mov    %rsp,%r14
mov    %rcx,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
mov    (%rbx),%rdi
mov    0x10(%rbx),%rsi
mov    %r14,%rdx
call   1030 <inet_ntop@plt>
lea    0xd02(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd04(%rip),%rdi
lea    0xb81(%rip),%rsi
mov    $0x72,%edx
call   10b0 <pd_debug@plt>
mov    (%rbx),%rdi
mov    0xc(%rbx),%esi
mov    0x8(%rbx),%edx
call   10f0 <socket@plt>
cmp    $0xffffffff,%eax
je     1520 <main+0x350>
mov    %eax,%ebx
lea    0xcf9(%rip),%rdi
lea    0xb54(%rip),%rsi
mov    $0x7b,%edx
call   10b0 <pd_debug@plt>
mov    %ebx,%edi
call   1070 <close@plt>
mov    -0x38(%rbp),%rdi
call   10e0 <freeaddrinfo@plt>
mov    0x2a8c(%rip),%rax
mov    (%rax),%eax
jmp    1547 <main+0x377>
lea    0xcb7(%rip),%rdi
lea    0xb21(%rip),%rsi
mov    $0x76,%edx
call   10d0 <pd_error@plt>
mov    $0xffffffff,%edi
call   1070 <close@plt>
mov    $0x3,%eax
mov    -0x40(%rbp),%rbx
mov    %rbx,%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2a5c(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xa90(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x2a32(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
%struct.addrinfo = type { i64, i32, i32, i64, %struct.addrinfo*, i32 }
%struct.sockaddr_in = type { i32 }
%struct.sockaddr_in6 = type { i32 }
@stderr = global i32 0
@.str = [30 x i8] c"usage: %s <hostname> <port>\0A\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [14 x i8] c"Hostname:\09%s\0A\00"
@.str.2 = [12 x i8] c"Port:\09\09%s\0A\0A\00"
@.str.3 = [23 x i8] c"Preparing hints struct\00"
@.str.4 = [143 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/CaioIcy/c_socket_chat/refs/heads/master/src/client.c\00"
@AF_UNSPEC = global i64 0
@SOCK_STREAM = global i32 0
@AI_PASSIVE = global i32 0
@.str.5 = [18 x i8] c"Using getaddrinfo\00"
@.str.6 = [20 x i8] c"getaddrinfo error:\0A\00"
@.str.7 = [27 x i8] c"Displaying all found hosts\00"
@INET6_ADDRSTRLEN = global i32 0
@AF_INET = global i64 0
@.str.8 = [5 x i8] c"IPv4\00"
@.str.9 = [5 x i8] c"IPv6\00"
@.str.10 = [13 x i8] c"[%d] %s: %s\0A\00"
@.str.11 = [19 x i8] c"Nothing was found.\00"
@.str.12 = [12 x i8] c"Choosing IP\00"
@.str.13 = [79 x i8] c"Choose an IP based on its number on the list above. Must be between 1 and %d.\0A\00"
@.str.14 = [9 x i8] c"Number: \00"
@.str.15 = [27 x i8] c"Must be between 1 and %d.\0A\00"
@.str.16 = [11 x i8] c"%d > %d ?\0A\00"
@.str.17 = [19 x i8] c"Chosen IP was: %s\0A\00"
@.str.18 = [19 x i8] c"Opening the socket\00"
@.str.19 = [15 x i8] c"Opening socket\00"
@.str.20 = [8 x i8] c"Exiting\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.addrinfo
%7 = alloca %struct.addrinfo*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i64
%11 = alloca %struct.addrinfo*
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca %struct.sockaddr_in*
%16 = alloca %struct.sockaddr_in6*
%17 = alloca i32
%18 = alloca i32
%19 = alloca %struct.addrinfo*
%20 = alloca i32
%21 = alloca i64
%22 = alloca i8*
%23 = alloca %struct.sockaddr_in*
%24 = alloca %struct.sockaddr_in6*
%25 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%26 = load i32, i32* %4
%27 = icmp ne i32 %26, 3
br i1 %27, label %28, label %36
28: ; preds = %2
%29 = load i32, i32* @stderr
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 0
%32 = load i8*, i8** %31
%33 = call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %32)
%34 = load i32, i32* @EXIT_FAILURE
%35 = call i32 @exit(i32 %34)
unreachable
36: ; preds = %2
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 1
%39 = load i8*, i8** %38
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %39)
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 2
%43 = load i8*, i8** %42
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %43)
store %struct.addrinfo* null, %struct.addrinfo** %7
%45 = call i32 @pd_debug(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str.4, i64 0, i64 0), i32 34)
%46 = call i32 @memset(%struct.addrinfo* %6, i32 0, i32 40)
%47 = load i64, i64* @AF_UNSPEC
%48 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %6, i32 0, i32 0
store i64 %47, i64* %48
%49 = load i32, i32* @SOCK_STREAM
%50 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %6, i32 0, i32 2
store i32 %49, i32* %50
%51 = load i32, i32* @AI_PASSIVE
%52 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %6, i32 0, i32 5
store i32 %51, i32* %52
%53 = call i32 @pd_debug(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str.4, i64 0, i64 0), i32 41)
%54 = load i8**, i8*** %5
%55 = getelementptr inbounds i8*, i8** %54, i64 1
%56 = load i8*, i8** %55
%57 = load i8**, i8*** %5
%58 = getelementptr inbounds i8*, i8** %57, i64 2
%59 = load i8*, i8** %58
%60 = call i32 @getaddrinfo(i8* %56, i8* %59, %struct.addrinfo* %6, %struct.addrinfo** %7)
store i32 %60, i32* %8
%61 = load i32, i32* %8
%62 = icmp ne i32 %61, 0
br i1 %62, label %63, label %69
63: ; preds = %36
%64 = load i32, i32* @stderr
%65 = call i32 (i32, i8*, ...) @fprintf(i32 %64, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
%66 = load i32, i32* %8
%67 = call i8* @gai_strerror(i32 %66)
%68 = call i32 @pd_error(i8* %67, i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str.4, i64 0, i64 0), i32 46)
store i32 1, i32* %3
br label %215
69: ; preds = %36
%70 = call i32 @pd_debug(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str.4, i64 0, i64 0), i32 50)
%71 = load i32, i32* @INET6_ADDRSTRLEN
%72 = zext i32 %71 to i64
%73 = call i8* @llvm.stacksave()
store i8* %73, i8** %9
%74 = alloca i8, i64 %72
store i64 %72, i64* %10
store %struct.addrinfo* null, %struct.addrinfo** %11
store i32 0, i32* %12
%75 = load %struct.addrinfo*, %struct.addrinfo** %7
store %struct.addrinfo* %75, %struct.addrinfo** %11
br label %76
76: ; preds = %112, %69
%77 = load %struct.addrinfo*, %struct.addrinfo** %11
%78 = icmp ne %struct.addrinfo* %77, null
br i1 %78, label %79, label %118
79: ; preds = %76
store i8* null, i8** %13
store i8* null, i8** %14
%80 = load %struct.addrinfo*, %struct.addrinfo** %11
%81 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %80, i32 0, i32 0
%82 = load i64, i64* %81
%83 = load i64, i64* @AF_INET
%84 = icmp eq i64 %82, %83
br i1 %84, label %85, label %93
85: ; preds = %79
%86 = load %struct.addrinfo*, %struct.addrinfo** %11
%87 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %86, i32 0, i32 3
%88 = load i64, i64* %87
%89 = inttoptr i64 %88 to %struct.sockaddr_in*
store %struct.sockaddr_in* %89, %struct.sockaddr_in** %15
%90 = load %struct.sockaddr_in*, %struct.sockaddr_in** %15
%91 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %90, i32 0, i32 0
%92 = bitcast i32* %91 to i8*
store i8* %92, i8** %13
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8** %14
br label %101
93: ; preds = %79
%94 = load %struct.addrinfo*, %struct.addrinfo** %11
%95 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %94, i32 0, i32 3
%96 = load i64, i64* %95
%97 = inttoptr i64 %96 to %struct.sockaddr_in6*
store %struct.sockaddr_in6* %97, %struct.sockaddr_in6** %16
%98 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %16
%99 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %98, i32 0, i32 0
%100 = bitcast i32* %99 to i8*
store i8* %100, i8** %13
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i8** %14
br label %101
101: ; preds = %93, %85
%102 = load %struct.addrinfo*, %struct.addrinfo** %11
%103 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %102, i32 0, i32 0
%104 = load i64, i64* %103
%105 = load i8*, i8** %13
%106 = trunc i64 %72 to i32
%107 = call i32 @inet_ntop(i64 %104, i8* %105, i8* %74, i32 %106)
%108 = load i32, i32* %12
%109 = add nsw i32 %108, 1
%110 = load i8*, i8** %14
%111 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), i32 %109, i8* %110, i8* %74)
br label %112
112: ; preds = %101
%113 = load %struct.addrinfo*, %struct.addrinfo** %11
%114 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %113, i32 0, i32 4
%115 = load %struct.addrinfo*, %struct.addrinfo** %114
store %struct.addrinfo* %115, %struct.addrinfo** %11
%116 = load i32, i32* %12
%117 = add nsw i32 %116, 1
store i32 %117, i32* %12
br label %76
118: ; preds = %76
%119 = load i32, i32* %12
%120 = icmp sle i32 %119, 0
br i1 %120, label %121, label %123
121: ; preds = %118
%122 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.11, i64 0, i64 0))
store i32 2, i32* %3
store i32 1, i32* %17
br label %213
123: ; preds = %118
%124 = call i32 @pd_debug(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str.4, i64 0, i64 0), i32 83)
%125 = load i32, i32* %12
%126 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.13, i64 0, i64 0), i32 %125)
%127 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.14, i64 0, i64 0))
store i32 0, i32* %18
br label %128
128: ; preds = %142, %123
%129 = load i32, i32* %12
%130 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.15, i64 0, i64 0), i32 %129)
%131 = call i32 @insert_integer(i32* %18)
%132 = load i32, i32* %18
%133 = load i32, i32* %12
%134 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0), i32 %132, i32 %133)
br label %135
135: ; preds = %128
%136 = load i32, i32* %18
%137 = load i32, i32* %12
%138 = icmp sgt i32 %136, %137
br i1 %138, label %142, label %139
139: ; preds = %135
%140 = load i32, i32* %18
%141 = icmp slt i32 %140, 1
br label %142
142: ; preds = %139, %135
%143 = phi i1 [ true, %135 ], [ %141, %139 ]
br i1 %143, label %128, label %144
144: ; preds = %142
%145 = load %struct.addrinfo*, %struct.addrinfo** %7
store %struct.addrinfo* %145, %struct.addrinfo** %19
store i32 1, i32* %20
br label %146
146: ; preds = %150, %144
%147 = load i32, i32* %20
%148 = load i32, i32* %18
%149 = icmp slt i32 %147, %148
br i1 %149, label %150, label %156
150: ; preds = %146
%151 = load %struct.addrinfo*, %struct.addrinfo** %19
%152 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %151, i32 0, i32 4
%153 = load %struct.addrinfo*, %struct.addrinfo** %152
store %struct.addrinfo* %153, %struct.addrinfo** %19
%154 = load i32, i32* %20
%155 = add nsw i32 %154, 1
store i32 %155, i32* %20
br label %146
156: ; preds = %146
%157 = load i32, i32* @INET6_ADDRSTRLEN
%158 = zext i32 %157 to i64
%159 = alloca i8, i64 %158
store i64 %158, i64* %21
store i8* null, i8** %22
%160 = load %struct.addrinfo*, %struct.addrinfo** %19
%161 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %160, i32 0, i32 0
%162 = load i64, i64* %161
%163 = load i64, i64* @AF_INET
%164 = icmp eq i64 %162, %163
br i1 %164, label %165, label %173
165: ; preds = %156
%166 = load %struct.addrinfo*, %struct.addrinfo** %19
%167 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %166, i32 0, i32 3
%168 = load i64, i64* %167
%169 = inttoptr i64 %168 to %struct.sockaddr_in*
store %struct.sockaddr_in* %169, %struct.sockaddr_in** %23
%170 = load %struct.sockaddr_in*, %struct.sockaddr_in** %23
%171 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %170, i32 0, i32 0
%172 = bitcast i32* %171 to i8*
store i8* %172, i8** %22
br label %181
173: ; preds = %156
%174 = load %struct.addrinfo*, %struct.addrinfo** %19
%175 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %174, i32 0, i32 3
%176 = load i64, i64* %175
%177 = inttoptr i64 %176 to %struct.sockaddr_in6*
store %struct.sockaddr_in6* %177, %struct.sockaddr_in6** %24
%178 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %24
%179 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %178, i32 0, i32 0
%180 = bitcast i32* %179 to i8*
store i8* %180, i8** %22
br label %181
181: ; preds = %173, %165
%182 = load %struct.addrinfo*, %struct.addrinfo** %19
%183 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %182, i32 0, i32 0
%184 = load i64, i64* %183
%185 = load i8*, i8** %22
%186 = trunc i64 %158 to i32
%187 = call i32 @inet_ntop(i64 %184, i8* %185, i8* %159, i32 %186)
%188 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.17, i64 0, i64 0), i8* %159)
%189 = call i32 @pd_debug(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str.4, i64 0, i64 0), i32 114)
%190 = load %struct.addrinfo*, %struct.addrinfo** %19
%191 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %190, i32 0, i32 0
%192 = load i64, i64* %191
%193 = load %struct.addrinfo*, %struct.addrinfo** %19
%194 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %193, i32 0, i32 2
%195 = load i32, i32* %194
%196 = load %struct.addrinfo*, %struct.addrinfo** %19
%197 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %196, i32 0, i32 1
%198 = load i32, i32* %197
%199 = call i32 @socket(i64 %192, i32 %195, i32 %198)
store i32 %199, i32* %25
%200 = load i32, i32* %25
%201 = icmp eq i32 %200, -1
br i1 %201, label %202, label %206
202: ; preds = %181
%203 = call i32 @pd_error(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.19, i64 0, i64 0), i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str.4, i64 0, i64 0), i32 118)
%204 = load i32, i32* %25
%205 = call i32 @close(i32 %204)
store i32 3, i32* %3
store i32 1, i32* %17
br label %213
206: ; preds = %181
%207 = call i32 @pd_debug(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.20, i64 0, i64 0), i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str.4, i64 0, i64 0), i32 123)
%208 = load i32, i32* %25
%209 = call i32 @close(i32 %208)
%210 = load %struct.addrinfo*, %struct.addrinfo** %7
%211 = call i32 @freeaddrinfo(%struct.addrinfo* %210)
%212 = load i32, i32* @EXIT_SUCCESS
store i32 %212, i32* %3
store i32 1, i32* %17
br label %213
213: ; preds = %206, %202, %121
%214 = load i8*, i8** %9
br label %215
215: ; preds = %213, %63
%216 = load i32, i32* %3
ret i32 %216
}

LLVM IR (-O2):
%struct.addrinfo = type { i64, i32, i32, i64, %struct.addrinfo*, i32 }
@stderr = global i32 0
@.str = [30 x i8] c"usage: %s <hostname> <port>\0A\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [14 x i8] c"Hostname:\09%s\0A\00"
@.str.2 = [12 x i8] c"Port:\09\09%s\0A\0A\00"
@.str.3 = [23 x i8] c"Preparing hints struct\00"
@.str.4 = [143 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/CaioIcy/c_socket_chat/refs/heads/master/src/client.c\00"
@AF_UNSPEC = global i64 0
@SOCK_STREAM = global i32 0
@AI_PASSIVE = global i32 0
@.str.5 = [18 x i8] c"Using getaddrinfo\00"
@.str.6 = [20 x i8] c"getaddrinfo error:\0A\00"
@.str.7 = [27 x i8] c"Displaying all found hosts\00"
@INET6_ADDRSTRLEN = global i32 0
@AF_INET = global i64 0
@.str.8 = [5 x i8] c"IPv4\00"
@.str.9 = [5 x i8] c"IPv6\00"
@.str.10 = [13 x i8] c"[%d] %s: %s\0A\00"
@.str.11 = [19 x i8] c"Nothing was found.\00"
@.str.12 = [12 x i8] c"Choosing IP\00"
@.str.13 = [79 x i8] c"Choose an IP based on its number on the list above. Must be between 1 and %d.\0A\00"
@.str.14 = [9 x i8] c"Number: \00"
@.str.15 = [27 x i8] c"Must be between 1 and %d.\0A\00"
@.str.16 = [11 x i8] c"%d > %d ?\0A\00"
@.str.17 = [19 x i8] c"Chosen IP was: %s\0A\00"
@.str.18 = [19 x i8] c"Opening the socket\00"
@.str.19 = [15 x i8] c"Opening socket\00"
@.str.20 = [8 x i8] c"Exiting\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.addrinfo
%4 = alloca %struct.addrinfo*
%5 = alloca i32
%6 = icmp eq i32 %0, 3
br i1 %6, label %13, label %7
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = load i8*, i8** %1
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = load i32, i32* @EXIT_FAILURE
%12 = tail call i32 @exit(i32 %11)
unreachable
13: ; preds = %2
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = getelementptr inbounds i8*, i8** %1, i64 2
%18 = load i8*, i8** %17
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %18)
%20 = bitcast %struct.addrinfo* %3 to i8*
%21 = bitcast %struct.addrinfo** %4 to i8*
store %struct.addrinfo* null, %struct.addrinfo** %4
%22 = tail call i32 @pd_debug(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str.4, i64 0, i64 0), i32 34)
%23 = call i32 @memset(%struct.addrinfo* %3, i32 0, i32 40)
%24 = load i64, i64* @AF_UNSPEC
%25 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 0
store i64 %24, i64* %25
%26 = load i32, i32* @SOCK_STREAM
%27 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 2
store i32 %26, i32* %27
%28 = load i32, i32* @AI_PASSIVE
%29 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 5
store i32 %28, i32* %29
%30 = call i32 @pd_debug(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str.4, i64 0, i64 0), i32 41)
%31 = load i8*, i8** %14
%32 = load i8*, i8** %17
%33 = call i32 @getaddrinfo(i8* %31, i8* %32, %struct.addrinfo* %3, %struct.addrinfo** %4)
%34 = icmp eq i32 %33, 0
br i1 %34, label %40, label %35
35: ; preds = %13
%36 = load i32, i32* @stderr
%37 = call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
%38 = call i8* @gai_strerror(i32 %33)
%39 = call i32 @pd_error(i8* %38, i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str.4, i64 0, i64 0), i32 46)
br label %156
40: ; preds = %13
%41 = call i32 @pd_debug(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str.4, i64 0, i64 0), i32 50)
%42 = load i32, i32* @INET6_ADDRSTRLEN
%43 = zext i32 %42 to i64
%44 = call i8* @llvm.stacksave()
%45 = alloca i8, i64 %43
%46 = load %struct.addrinfo*, %struct.addrinfo** %4
%47 = icmp eq %struct.addrinfo* %46, null
br i1 %47, label %65, label %48
48: ; preds = %40, %48
%49 = phi %struct.addrinfo* [ %63, %48 ], [ %46, %40 ]
%50 = phi i32 [ %60, %48 ], [ 0, %40 ]
%51 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %49, i64 0, i32 0
%52 = load i64, i64* %51
%53 = load i64, i64* @AF_INET
%54 = icmp eq i64 %52, %53
%55 = select i1 %54, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0)
%56 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %49, i64 0, i32 3
%57 = load i64, i64* %56
%58 = inttoptr i64 %57 to i8*
%59 = call i32 @inet_ntop(i64 %52, i8* %58, i8* %45, i32 %42)
%60 = add nuw nsw i32 %50, 1
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), i32 %60, i8* %55, i8* %45)
%62 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %49, i64 0, i32 4
%63 = load %struct.addrinfo*, %struct.addrinfo** %62
%64 = icmp eq %struct.addrinfo* %63, null
br i1 %64, label %67, label %48
65: ; preds = %40
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.11, i64 0, i64 0))
br label %154
67: ; preds = %48
%68 = call i32 @pd_debug(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str.4, i64 0, i64 0), i32 83)
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([79 x i8], [79 x i8]* @.str.13, i64 0, i64 0), i32 %60)
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.14, i64 0, i64 0))
%71 = bitcast i32* %5 to i8*
store i32 0, i32* %5
br label %72
72: ; preds = %72, %67
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.15, i64 0, i64 0), i32 %60)
%74 = call i32 @insert_integer(i32* %5)
%75 = load i32, i32* %5
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0), i32 %75, i32 %60)
%77 = load i32, i32* %5
%78 = icmp sgt i32 %77, %60
%79 = icmp slt i32 %77, 1
%80 = or i1 %78, %79
br i1 %80, label %72, label %81
81: ; preds = %72
%82 = load %struct.addrinfo*, %struct.addrinfo** %4
%83 = icmp ugt i32 %77, 1
br i1 %83, label %84, label %123
84: ; preds = %81
%85 = add i32 %77, -1
%86 = add i32 %77, -2
%87 = and i32 %85, 7
%88 = icmp ult i32 %86, 7
br i1 %88, label %112, label %89
89: ; preds = %84
%90 = and i32 %85, -8
br label %91
91: ; preds = %91, %89
%92 = phi %struct.addrinfo* [ %82, %89 ], [ %109, %91 ]
%93 = phi i32 [ 0, %89 ], [ %110, %91 ]
%94 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %92, i64 0, i32 4
%95 = load %struct.addrinfo*, %struct.addrinfo** %94
%96 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %95, i64 0, i32 4
%97 = load %struct.addrinfo*, %struct.addrinfo** %96
%98 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %97, i64 0, i32 4
%99 = load %struct.addrinfo*, %struct.addrinfo** %98
%100 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %99, i64 0, i32 4
%101 = load %struct.addrinfo*, %struct.addrinfo** %100
%102 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %101, i64 0, i32 4
%103 = load %struct.addrinfo*, %struct.addrinfo** %102
%104 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %103, i64 0, i32 4
%105 = load %struct.addrinfo*, %struct.addrinfo** %104
%106 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %105, i64 0, i32 4
%107 = load %struct.addrinfo*, %struct.addrinfo** %106
%108 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %107, i64 0, i32 4
%109 = load %struct.addrinfo*, %struct.addrinfo** %108
%110 = add i32 %93, 8
%111 = icmp eq i32 %110, %90
br i1 %111, label %112, label %91
112: ; preds = %91, %84
%113 = phi %struct.addrinfo* [ undef, %84 ], [ %109, %91 ]
%114 = phi %struct.addrinfo* [ %82, %84 ], [ %109, %91 ]
%115 = icmp eq i32 %87, 0
br i1 %115, label %123, label %116
116: ; preds = %112, %116
%117 = phi %struct.addrinfo* [ %120, %116 ], [ %114, %112 ]
%118 = phi i32 [ %121, %116 ], [ 0, %112 ]
%119 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %117, i64 0, i32 4
%120 = load %struct.addrinfo*, %struct.addrinfo** %119
%121 = add i32 %118, 1
%122 = icmp eq i32 %121, %87
br i1 %122, label %123, label %116
123: ; preds = %112, %116, %81
%124 = phi %struct.addrinfo* [ %82, %81 ], [ %113, %112 ], [ %120, %116 ]
%125 = load i32, i32* @INET6_ADDRSTRLEN
%126 = zext i32 %125 to i64
%127 = alloca i8, i64 %126
%128 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %124, i64 0, i32 0
%129 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %124, i64 0, i32 3
%130 = load i64, i64* %129
%131 = inttoptr i64 %130 to i8*
%132 = load i64, i64* %128
%133 = call i32 @inet_ntop(i64 %132, i8* %131, i8* %127, i32 %125)
%134 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.17, i64 0, i64 0), i8* %127)
%135 = call i32 @pd_debug(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str.4, i64 0, i64 0), i32 114)
%136 = load i64, i64* %128
%137 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %124, i64 0, i32 2
%138 = load i32, i32* %137
%139 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %124, i64 0, i32 1
%140 = load i32, i32* %139
%141 = call i32 @socket(i64 %136, i32 %138, i32 %140)
%142 = icmp eq i32 %141, -1
br i1 %142, label %143, label %146
143: ; preds = %123
%144 = call i32 @pd_error(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.19, i64 0, i64 0), i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str.4, i64 0, i64 0), i32 118)
%145 = call i32 @close(i32 -1)
br label %152
146: ; preds = %123
%147 = call i32 @pd_debug(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.20, i64 0, i64 0), i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str.4, i64 0, i64 0), i32 123)
%148 = call i32 @close(i32 %141)
%149 = load %struct.addrinfo*, %struct.addrinfo** %4
%150 = call i32 @freeaddrinfo(%struct.addrinfo* %149)
%151 = load i32, i32* @EXIT_SUCCESS
br label %152
152: ; preds = %146, %143
%153 = phi i32 [ 3, %143 ], [ %151, %146 ]
br label %154
154: ; preds = %152, %65
%155 = phi i32 [ 2, %65 ], [ %153, %152 ]
br label %156
156: ; preds = %154, %35
%157 = phi i32 [ 1, %35 ], [ %155, %154 ]
ret i32 %157
}