#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 ai_socktype;
  int ai_protocol;
  scalar_t__ ai_addr;
  struct addrinfo *ai_next;
};

/* Variables and functions */
scalar_t__ AF_INET;
scalar_t__ AF_UNSPEC;
int INET6_ADDRSTRLEN;
#define IPPROTO_AH 159
#define IPPROTO_BEETPH 158
#define IPPROTO_COMP 157
#define IPPROTO_DCCP 156
#define IPPROTO_EGP 155
#define IPPROTO_ENCAP 154
#define IPPROTO_ESP 153
#define IPPROTO_GRE 152
#define IPPROTO_ICMP 151
#define IPPROTO_IDP 150
#define IPPROTO_IGMP 149
#define IPPROTO_IP 148
#define IPPROTO_IPIP 147
#define IPPROTO_IPV6 146
#define IPPROTO_MPLS 145
#define IPPROTO_MTP 144
#define IPPROTO_PIM 143
#define IPPROTO_PUP 142
#define IPPROTO_RAW 141
#define IPPROTO_RSVP 140
#define IPPROTO_SCTP 139
#define IPPROTO_TCP 138
#define IPPROTO_TP 137
#define IPPROTO_UDP 136
#define IPPROTO_UDPLITE 135
#define SOCK_DCCP 134
#define SOCK_DGRAM 133
#define SOCK_PACKET 132
#define SOCK_RAW 131
#define SOCK_RDM 130
#define SOCK_SEQPACKET 129
#define SOCK_STREAM 128
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ freeaddrinfo(struct addrinfo *);
char *gai_strerror(int);
int getaddrinfo(char *, int /*<<< orphan*/ *, struct addrinfo *,
                struct addrinfo **);
int /*<<< orphan*/ inet_ntop(scalar_t__, void *, char *, int);
scalar_t__ malloc(int);
int /*<<< orphan*/ memset(struct addrinfo *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  struct addrinfo hints, *res, *p;
  int status;
  char ipstr[INET6_ADDRSTRLEN];
  if (argc != 2) {
    fprintf(stderr, "usage: showip hostname\n");
    return 1;
  }
  memset(&hints, 0, sizeof hints);
  hints.ai_family = AF_UNSPEC;
  if ((status = getaddrinfo(argv[1], NULL, &hints, &res)) != 0) {
    fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(status));
    return 2;
  }
  printf("IP data for %s:\n\n", argv[1]);
  for (p = res; p != NULL; p = p->ai_next) {
    void *addr;
    char *ipver, *sock_type, *protocol;
    int allocmem_sock = 0;
    int allocmem_prot = 0;
    if (p->ai_family == AF_INET) {
      struct sockaddr_in *ipv4 = (struct sockaddr_in *)p->ai_addr;
      addr = &(ipv4->sin_addr);
      ipver = "IPv4";
    } else {
      struct sockaddr_in6 *ipv6 = (struct sockaddr_in6 *)p->ai_addr;
      addr = &(ipv6->sin6_addr);
      ipver = "IPv6";
    }
    switch (p->ai_socktype) {
    case SOCK_STREAM:
      sock_type = "SOCK_STREAM";
      break;
    case SOCK_DGRAM:
      sock_type = "SOCK_DGRAM";
      break;
    case SOCK_RAW:
      sock_type = "SOCK_RAW";
      break;
    case SOCK_RDM:
      sock_type = "SOCK_RDM";
      break;
    case SOCK_SEQPACKET:
      sock_type = "SOCK_SEQPACKET";
      break;
    case SOCK_DCCP:
      sock_type = "SOCK_DCCP";
      break;
    case SOCK_PACKET:
      sock_type = "SOCK_PACKET";
      break;
    default:
      sock_type = (char *)malloc(sizeof(char) * 4);
      if (sock_type != 0) {
        allocmem_sock = 1;
        snprintf(sock_type, 4, "%d", p->ai_socktype);
      } else {
        printf("Memory allocation error.\n");
        return 1;
      }
      break;
    }
    switch (p->ai_protocol) {
    case IPPROTO_IP:
      protocol = "IPPROTO_IP";
      break;
    case IPPROTO_ICMP:
      protocol = "IPPROTO_ICMP";
      break;
    case IPPROTO_IGMP:
      protocol = "IPPROTO_IGMP";
      break;
    case IPPROTO_IPIP:
      protocol = "IPPROTO_IPIP";
      break;
    case IPPROTO_TCP:
      protocol = "IPPROTO_TCP";
      break;
    case IPPROTO_EGP:
      protocol = "IPPROTO_EGP";
      break;
    case IPPROTO_PUP:
      protocol = "IPPROTO_PUP";
      break;
    case IPPROTO_UDP:
      protocol = "IPPROTO_UDP";
      break;
    case IPPROTO_IDP:
      protocol = "IPPROTO_IDP";
      break;
    case IPPROTO_TP:
      protocol = "IPPROTO_TP";
      break;
    case IPPROTO_DCCP:
      protocol = "IPPROTO_DCCP";
      break;
    case IPPROTO_IPV6:
      protocol = "IPPROTO_IPV6";
      break;
    case IPPROTO_RSVP:
      protocol = "IPPROTO_RSVP";
      break;
    case IPPROTO_GRE:
      protocol = "IPPROTO_GRE";
      break;
    case IPPROTO_ESP:
      protocol = "IPPROTO_ESP";
      break;
    case IPPROTO_AH:
      protocol = "IPPROTO_AH";
      break;
    case IPPROTO_MTP:
      protocol = "IPPROTO_MTP";
      break;
    case IPPROTO_BEETPH:
      protocol = "IPPROTO_BEETPH";
      break;
    case IPPROTO_ENCAP:
      protocol = "IPPROTO_ENCAP";
      break;
    case IPPROTO_PIM:
      protocol = "IPPROTO_PIM";
      break;
    case IPPROTO_COMP:
      protocol = "IPPROTO_COMP";
      break;
    case IPPROTO_SCTP:
      protocol = "IPPROTO_SCTP";
      break;
    case IPPROTO_UDPLITE:
      protocol = "IPPROTO_UDPLITE";
      break;
    case IPPROTO_MPLS:
      protocol = "IPPROTO_MPLS";
      break;
    case IPPROTO_RAW:
      protocol = "IPPROTO_RAW";
      break;
    default:
      protocol = (char *)malloc(sizeof(char) * 5);
      if (protocol != 0) {
        allocmem_prot = 1;
        snprintf(protocol, 5, "%d", p->ai_protocol);
      } else {
        printf("Memory allocation error.\n");
        return 1;
      }
      break;
    }
    inet_ntop(p->ai_family, addr, ipstr, sizeof ipstr);
    printf(" %s: %s %s %s\n", ipver, ipstr, sock_type, protocol);
    if (allocmem_sock) {
      free(sock_type);
      allocmem_sock = 0;
    }
    if (allocmem_prot) {
      free(protocol);
      allocmem_prot = 0;
    }
  }
  freeaddrinfo(res);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e28(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0xa8(%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,-0xa0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x58(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1223 <main+0x83>
mov    0x2dc8(%rip),%rax
mov    (%rax),%edi
lea    0xe77(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x5c(%rbp)
jmp    1734 <main+0x594>
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1080 <memset@plt>
mov    0x2d9e(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
lea    -0x30(%rbp),%rdx
lea    -0x38(%rbp),%rcx
call   10b0 <getaddrinfo@plt>
mov    %eax,-0x44(%rbp)
cmp    $0x0,%eax
je     12a7 <main+0x107>
mov    0x2d5b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xac(%rbp)
mov    -0x44(%rbp),%edi
call   1070 <gai_strerror@plt>
mov    -0xac(%rbp),%edi
mov    %rax,%rdx
lea    0xe0b(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x2,-0x4(%rbp)
movl   $0x1,-0x5c(%rbp)
jmp    1734 <main+0x594>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xdf3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x38(%rbp),%rax
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
je     171d <main+0x57d>
movl   $0x0,-0x84(%rbp)
movl   $0x0,-0x88(%rbp)
mov    -0x40(%rbp),%rax
mov    (%rax),%rax
mov    0x2cee(%rip),%rcx
cmp    (%rcx),%rax
jne    1325 <main+0x185>
mov    -0x40(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x90(%rbp)
mov    -0x90(%rbp),%rax
mov    %rax,-0x68(%rbp)
lea    0xd9f(%rip),%rax
mov    %rax,-0x70(%rbp)
jmp    134a <main+0x1aa>
mov    -0x40(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x98(%rbp)
mov    -0x98(%rbp),%rax
mov    %rax,-0x68(%rbp)
lea    0xd7a(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    -0x40(%rbp),%rax
mov    0x8(%rax),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0xb8(%rbp)
sub    $0x6,%eax
ja     13ed <main+0x24d>
mov    -0xb8(%rbp),%rax
lea    0xc8c(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xd41(%rip),%rax
mov    %rax,-0x78(%rbp)
jmp    1457 <main+0x2b7>
lea    0xd3d(%rip),%rax
mov    %rax,-0x78(%rbp)
jmp    1457 <main+0x2b7>
lea    0xd38(%rip),%rax
mov    %rax,-0x78(%rbp)
jmp    1457 <main+0x2b7>
lea    0xd31(%rip),%rax
mov    %rax,-0x78(%rbp)
jmp    1457 <main+0x2b7>
lea    0xd2a(%rip),%rax
mov    %rax,-0x78(%rbp)
jmp    1457 <main+0x2b7>
lea    0xd29(%rip),%rax
mov    %rax,-0x78(%rbp)
jmp    1457 <main+0x2b7>
lea    0xd23(%rip),%rax
mov    %rax,-0x78(%rbp)
jmp    1457 <main+0x2b7>
mov    $0x4,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x78(%rbp)
cmpq   $0x0,-0x78(%rbp)
je     1431 <main+0x291>
movl   $0x1,-0x84(%rbp)
mov    -0x78(%rbp),%rdi
mov    -0x40(%rbp),%rax
mov    0x8(%rax),%ecx
mov    $0x4,%esi
lea    0xcec(%rip),%rdx
call   1060 <snprintf@plt>
jmp    1452 <main+0x2b2>
lea    0xcde(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x5c(%rbp)
jmp    1734 <main+0x594>
jmp    1457 <main+0x2b7>
mov    -0x40(%rbp),%rax
mov    0xc(%rax),%eax
add    $0xffffff79,%eax
mov    %eax,%ecx
mov    %rcx,-0xc0(%rbp)
sub    $0x18,%eax
ja     161c <main+0x47c>
mov    -0xc0(%rbp),%rax
lea    0xb99(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xc9d(%rip),%rax
mov    %rax,-0x80(%rbp)
jmp    1686 <main+0x4e6>
lea    0xc98(%rip),%rax
mov    %rax,-0x80(%rbp)
jmp    1686 <main+0x4e6>
lea    0xc95(%rip),%rax
mov    %rax,-0x80(%rbp)
jmp    1686 <main+0x4e6>
lea    0xc92(%rip),%rax
mov    %rax,-0x80(%rbp)
jmp    1686 <main+0x4e6>
lea    0xc8f(%rip),%rax
mov    %rax,-0x80(%rbp)
jmp    1686 <main+0x4e6>
lea    0xc8b(%rip),%rax
mov    %rax,-0x80(%rbp)
jmp    1686 <main+0x4e6>
lea    0xc87(%rip),%rax
mov    %rax,-0x80(%rbp)
jmp    1686 <main+0x4e6>
lea    0xc83(%rip),%rax
mov    %rax,-0x80(%rbp)
jmp    1686 <main+0x4e6>
lea    0xc7f(%rip),%rax
mov    %rax,-0x80(%rbp)
jmp    1686 <main+0x4e6>
lea    0xc7b(%rip),%rax
mov    %rax,-0x80(%rbp)
jmp    1686 <main+0x4e6>
lea    0xc76(%rip),%rax
mov    %rax,-0x80(%rbp)
jmp    1686 <main+0x4e6>
lea    0xc73(%rip),%rax
mov    %rax,-0x80(%rbp)
jmp    1686 <main+0x4e6>
lea    0xc70(%rip),%rax
mov    %rax,-0x80(%rbp)
jmp    1686 <main+0x4e6>
lea    0xc6d(%rip),%rax
mov    %rax,-0x80(%rbp)
jmp    1686 <main+0x4e6>
lea    0xc69(%rip),%rax
mov    %rax,-0x80(%rbp)
jmp    1686 <main+0x4e6>
lea    0xc65(%rip),%rax
mov    %rax,-0x80(%rbp)
jmp    1686 <main+0x4e6>
lea    0xc60(%rip),%rax
mov    %rax,-0x80(%rbp)
jmp    1686 <main+0x4e6>
lea    0xc5c(%rip),%rax
mov    %rax,-0x80(%rbp)
jmp    1686 <main+0x4e6>
lea    0xc5b(%rip),%rax
mov    %rax,-0x80(%rbp)
jmp    1686 <main+0x4e6>
lea    0xc59(%rip),%rax
mov    %rax,-0x80(%rbp)
jmp    1686 <main+0x4e6>
lea    0xc55(%rip),%rax
mov    %rax,-0x80(%rbp)
jmp    1686 <main+0x4e6>
lea    0xc52(%rip),%rax
mov    %rax,-0x80(%rbp)
jmp    1686 <main+0x4e6>
lea    0xc4f(%rip),%rax
mov    %rax,-0x80(%rbp)
jmp    1686 <main+0x4e6>
lea    0xc4f(%rip),%rax
mov    %rax,-0x80(%rbp)
jmp    1686 <main+0x4e6>
lea    0xc4c(%rip),%rax
mov    %rax,-0x80(%rbp)
jmp    1686 <main+0x4e6>
mov    $0x5,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x80(%rbp)
cmpq   $0x0,-0x80(%rbp)
je     1660 <main+0x4c0>
movl   $0x1,-0x88(%rbp)
mov    -0x80(%rbp),%rdi
mov    -0x40(%rbp),%rax
mov    0xc(%rax),%ecx
mov    $0x5,%esi
lea    0xabd(%rip),%rdx
call   1060 <snprintf@plt>
jmp    1681 <main+0x4e1>
lea    0xaaf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x5c(%rbp)
jmp    1734 <main+0x594>
jmp    1686 <main+0x4e6>
mov    -0xa0(%rbp),%rdx
mov    -0xa8(%rbp),%rax
mov    -0x40(%rbp),%rcx
mov    (%rcx),%rdi
mov    -0x68(%rbp),%rsi
mov    %eax,%ecx
call   1030 <inet_ntop@plt>
mov    -0xa0(%rbp),%rdx
mov    -0x70(%rbp),%rsi
mov    -0x78(%rbp),%rcx
mov    -0x80(%rbp),%r8
lea    0xbab(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x0,-0x84(%rbp)
je     16e7 <main+0x547>
mov    -0x78(%rbp),%rdi
call   1040 <free@plt>
movl   $0x0,-0x84(%rbp)
cmpl   $0x0,-0x88(%rbp)
je     1707 <main+0x567>
mov    -0x80(%rbp),%rdi
call   1040 <free@plt>
movl   $0x0,-0x88(%rbp)
jmp    170c <main+0x56c>
mov    -0x40(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x40(%rbp)
jmp    12c5 <main+0x125>
mov    -0x38(%rbp),%rdi
call   10c0 <freeaddrinfo@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x5c(%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    %rsp,%r12
mov    0x2e1d(%rip),%rax
mov    (%rax),%r15d
mov    %rsp,%rbx
lea    0xf(%r15),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
cmp    $0x2,%edi
jne    124d <main+0x9d>
mov    %rsi,%r14
lea    -0x70(%rbp),%r13
mov    %r13,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1090 <memset@plt>
mov    0x2dd7(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x70(%rbp)
mov    0x8(%r14),%rdi
lea    -0x40(%rbp),%rcx
xor    %esi,%esi
mov    %r13,%rdx
call   10c0 <getaddrinfo@plt>
test   %eax,%eax
je     126e <main+0xbe>
mov    0x2da3(%rip),%rcx
mov    (%rcx),%r14d
mov    %eax,%edi
call   1080 <gai_strerror@plt>
lea    0xe62(%rip),%rsi
mov    %r14d,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x2,%eax
jmp    1539 <main+0x389>
mov    0x2d74(%rip),%rax
mov    (%rax),%edi
lea    0xe23(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x1,%eax
jmp    1539 <main+0x389>
mov    %rbx,-0x50(%rbp)
mov    %r12,-0x38(%rbp)
mov    0x8(%r14),%rsi
lea    0xe28(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    -0x40(%rbp),%r13
test   %r13,%r13
je     152c <main+0x37c>
mov    %r15,-0x48(%rbp)
jmp    12ad <main+0xfd>
nopl   0x0(%rax,%rax,1)
mov    0x18(%r13),%r13
test   %r13,%r13
je     1526 <main+0x376>
mov    0x0(%r13),%rax
mov    0x2d28(%rip),%rcx
cmp    (%rcx),%rax
lea    0xdfe(%rip),%r12
lea    0xdf2(%rip),%rax
cmove  %rax,%r12
mov    0x10(%r13),%rbx
mov    0x8(%r13),%eax
add    $0xffffff80,%eax
cmp    $0x6,%eax
ja     1302 <main+0x152>
mov    $0x1,%cl
mov    %ecx,-0x30(%rbp)
lea    0xd17(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
lea    0xdce(%rip),%r15
jmp    *%rax
lea    0xdee(%rip),%r15
jmp    1370 <main+0x1c0>
mov    $0x4,%edi
call   10b0 <malloc@plt>
test   %rax,%rax
je     154b <main+0x39b>
mov    %rax,%r15
mov    0x8(%r13),%ecx
mov    %rax,%rdi
mov    $0x4,%esi
lea    0xde8(%rip),%rdx
call   1070 <snprintf@plt>
movl   $0x0,-0x30(%rbp)
jmp    1370 <main+0x1c0>
lea    0xda5(%rip),%r15
jmp    1370 <main+0x1c0>
lea    0xd93(%rip),%r15
jmp    1370 <main+0x1c0>
lea    0xdb5(%rip),%r15
jmp    1370 <main+0x1c0>
lea    0xd76(%rip),%r15
jmp    1370 <main+0x1c0>
lea    0xd99(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0xc(%r13),%eax
mov    $0xffffff79,%ecx
add    %ecx,%eax
cmp    $0x18,%eax
ja     13a8 <main+0x1f8>
mov    $0x1,%cl
mov    %ecx,-0x2c(%rbp)
lea    0xc90(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
lea    0xd7c(%rip),%r14
jmp    *%rax
lea    0xe85(%rip),%r14
jmp    14d0 <main+0x320>
mov    $0x5,%edi
call   10b0 <malloc@plt>
test   %rax,%rax
je     154b <main+0x39b>
mov    %rax,%r14
mov    0xc(%r13),%ecx
mov    %rax,%rdi
mov    $0x5,%esi
lea    0xd42(%rip),%rdx
call   1070 <snprintf@plt>
movl   $0x0,-0x2c(%rbp)
jmp    14d0 <main+0x320>
lea    0xd83(%rip),%r14
jmp    14d0 <main+0x320>
lea    0xd8f(%rip),%r14
jmp    14d0 <main+0x320>
lea    0xd47(%rip),%r14
jmp    14d0 <main+0x320>
lea    0xe0e(%rip),%r14
jmp    14d0 <main+0x320>
lea    0xd90(%rip),%r14
jmp    14d0 <main+0x320>
lea    0xe20(%rip),%r14
jmp    14d0 <main+0x320>
lea    0xd2f(%rip),%r14
jmp    14d0 <main+0x320>
lea    0xdc5(%rip),%r14
jmp    14d0 <main+0x320>
lea    0xd90(%rip),%r14
jmp    14d0 <main+0x320>
lea    0xde3(%rip),%r14
jmp    14d0 <main+0x320>
lea    0xd3e(%rip),%r14
jmp    14d0 <main+0x320>
lea    0xcd4(%rip),%r14
jmp    14d0 <main+0x320>
lea    0xcbe(%rip),%r14
jmp    14d0 <main+0x320>
lea    0xcff(%rip),%r14
jmp    14d0 <main+0x320>
lea    0xc9f(%rip),%r14
jmp    14d0 <main+0x320>
lea    0xd2b(%rip),%r14
jmp    14d0 <main+0x320>
lea    0xd2e(%rip),%r14
jmp    14d0 <main+0x320>
lea    0xd57(%rip),%r14
jmp    14d0 <main+0x320>
lea    0xcae(%rip),%r14
jmp    14d0 <main+0x320>
lea    0xce0(%rip),%r14
jmp    14d0 <main+0x320>
lea    0xd56(%rip),%r14
jmp    14d0 <main+0x320>
lea    0xd24(%rip),%r14
jmp    14d0 <main+0x320>
lea    0xd04(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    0x0(%r13),%rdi
mov    %rbx,%rsi
mov    -0x50(%rbp),%rbx
mov    %rbx,%rdx
mov    -0x48(%rbp),%rcx
call   1030 <inet_ntop@plt>
lea    0xd63(%rip),%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    %r15,%rcx
mov    %r14,%r8
xor    %eax,%eax
call   1060 <printf@plt>
cmpb   $0x0,-0x30(%rbp)
jne    150f <main+0x35f>
mov    %r15,%rdi
call   1040 <free@plt>
cmpb   $0x0,-0x2c(%rbp)
jne    12a0 <main+0xf0>
mov    %r14,%rdi
call   1040 <free@plt>
jmp    12a0 <main+0xf0>
mov    -0x40(%rbp),%rdi
jmp    152e <main+0x37e>
xor    %edi,%edi
call   10d0 <freeaddrinfo@plt>
mov    -0x38(%rbp),%r12
xor    %eax,%eax
mov    %r12,%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd0e(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%eax
mov    -0x38(%rbp),%r12
jmp    1539 <main+0x389>

LLVM IR (-O0):
%struct.addrinfo = type { i64, i32, i32, i64, %struct.addrinfo* }
%struct.sockaddr_in = type { i32 }
%struct.sockaddr_in6 = type { i32 }
@INET6_ADDRSTRLEN = global i32 0
@stderr = global i32 0
@.str = [24 x i8] c"usage: showip hostname\0A\00"
@AF_UNSPEC = global i64 0
@.str.1 = [17 x i8] c"getaddrinfo: %s\0A\00"
@.str.2 = [18 x i8] c"IP data for %s:\0A\0A\00"
@AF_INET = global i64 0
@.str.3 = [5 x i8] c"IPv4\00"
@.str.4 = [5 x i8] c"IPv6\00"
@.str.5 = [12 x i8] c"SOCK_STREAM\00"
@.str.6 = [11 x i8] c"SOCK_DGRAM\00"
@.str.7 = [9 x i8] c"SOCK_RAW\00"
@.str.8 = [9 x i8] c"SOCK_RDM\00"
@.str.9 = [15 x i8] c"SOCK_SEQPACKET\00"
@.str.10 = [10 x i8] c"SOCK_DCCP\00"
@.str.11 = [12 x i8] c"SOCK_PACKET\00"
@.str.12 = [3 x i8] c"%d\00"
@.str.13 = [26 x i8] c"Memory allocation error.\0A\00"
@.str.14 = [11 x i8] c"IPPROTO_IP\00"
@.str.15 = [13 x i8] c"IPPROTO_ICMP\00"
@.str.16 = [13 x i8] c"IPPROTO_IGMP\00"
@.str.17 = [13 x i8] c"IPPROTO_IPIP\00"
@.str.18 = [12 x i8] c"IPPROTO_TCP\00"
@.str.19 = [12 x i8] c"IPPROTO_EGP\00"
@.str.20 = [12 x i8] c"IPPROTO_PUP\00"
@.str.21 = [12 x i8] c"IPPROTO_UDP\00"
@.str.22 = [12 x i8] c"IPPROTO_IDP\00"
@.str.23 = [11 x i8] c"IPPROTO_TP\00"
@.str.24 = [13 x i8] c"IPPROTO_DCCP\00"
@.str.25 = [13 x i8] c"IPPROTO_IPV6\00"
@.str.26 = [13 x i8] c"IPPROTO_RSVP\00"
@.str.27 = [12 x i8] c"IPPROTO_GRE\00"
@.str.28 = [12 x i8] c"IPPROTO_ESP\00"
@.str.29 = [11 x i8] c"IPPROTO_AH\00"
@.str.30 = [12 x i8] c"IPPROTO_MTP\00"
@.str.31 = [15 x i8] c"IPPROTO_BEETPH\00"
@.str.32 = [14 x i8] c"IPPROTO_ENCAP\00"
@.str.33 = [12 x i8] c"IPPROTO_PIM\00"
@.str.34 = [13 x i8] c"IPPROTO_COMP\00"
@.str.35 = [13 x i8] c"IPPROTO_SCTP\00"
@.str.36 = [16 x i8] c"IPPROTO_UDPLITE\00"
@.str.37 = [13 x i8] c"IPPROTO_MPLS\00"
@.str.38 = [12 x i8] c"IPPROTO_RAW\00"
@.str.39 = [15 x i8] c" %s: %s %s %s\0A\00"
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 %struct.addrinfo*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca i32
%18 = alloca i32
%19 = alloca %struct.sockaddr_in*
%20 = alloca %struct.sockaddr_in6*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%21 = load i32, i32* @INET6_ADDRSTRLEN
%22 = zext i32 %21 to i64
%23 = call i8* @llvm.stacksave()
store i8* %23, i8** %10
%24 = alloca i8, i64 %22
store i64 %22, i64* %11
%25 = load i32, i32* %4
%26 = icmp ne i32 %25, 2
br i1 %26, label %27, label %30
27: ; preds = %2
%28 = load i32, i32* @stderr
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
store i32 1, i32* %12
br label %173
30: ; preds = %2
%31 = call i32 @memset(%struct.addrinfo* %6, i32 0, i32 32)
%32 = load i64, i64* @AF_UNSPEC
%33 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %6, i32 0, i32 0
store i64 %32, i64* %33
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 1
%36 = load i8*, i8** %35
%37 = call i32 @getaddrinfo(i8* %36, i32* null, %struct.addrinfo* %6, %struct.addrinfo** %7)
store i32 %37, i32* %9
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %44
39: ; preds = %30
%40 = load i32, i32* @stderr
%41 = load i32, i32* %9
%42 = call i8* @gai_strerror(i32 %41)
%43 = call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %42)
store i32 2, i32* %3
store i32 1, i32* %12
br label %173
44: ; preds = %30
%45 = load i8**, i8*** %5
%46 = getelementptr inbounds i8*, i8** %45, i64 1
%47 = load i8*, i8** %46
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %47)
%49 = load %struct.addrinfo*, %struct.addrinfo** %7
store %struct.addrinfo* %49, %struct.addrinfo** %8
br label %50
50: ; preds = %166, %44
%51 = load %struct.addrinfo*, %struct.addrinfo** %8
%52 = icmp ne %struct.addrinfo* %51, null
br i1 %52, label %53, label %170
53: ; preds = %50
store i32 0, i32* %17
store i32 0, i32* %18
%54 = load %struct.addrinfo*, %struct.addrinfo** %8
%55 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %54, i32 0, i32 0
%56 = load i64, i64* %55
%57 = load i64, i64* @AF_INET
%58 = icmp eq i64 %56, %57
br i1 %58, label %59, label %67
59: ; preds = %53
%60 = load %struct.addrinfo*, %struct.addrinfo** %8
%61 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %60, i32 0, i32 3
%62 = load i64, i64* %61
%63 = inttoptr i64 %62 to %struct.sockaddr_in*
store %struct.sockaddr_in* %63, %struct.sockaddr_in** %19
%64 = load %struct.sockaddr_in*, %struct.sockaddr_in** %19
%65 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %64, i32 0, i32 0
%66 = bitcast i32* %65 to i8*
store i8* %66, i8** %13
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8** %14
br label %75
67: ; preds = %53
%68 = load %struct.addrinfo*, %struct.addrinfo** %8
%69 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %68, i32 0, i32 3
%70 = load i64, i64* %69
%71 = inttoptr i64 %70 to %struct.sockaddr_in6*
store %struct.sockaddr_in6* %71, %struct.sockaddr_in6** %20
%72 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %20
%73 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %72, i32 0, i32 0
%74 = bitcast i32* %73 to i8*
store i8* %74, i8** %13
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8** %14
br label %75
75: ; preds = %67, %59
%76 = load %struct.addrinfo*, %struct.addrinfo** %8
%77 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %76, i32 0, i32 1
%78 = load i32, i32* %77
switch i32 %78, label %86 [
i32 128, label %79
i32 133, label %80
i32 131, label %81
i32 130, label %82
i32 129, label %83
i32 134, label %84
i32 132, label %85
]
79: ; preds = %75
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8** %15
br label %100
80: ; preds = %75
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8** %15
br label %100
81: ; preds = %75
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i8** %15
br label %100
82: ; preds = %75
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i8** %15
br label %100
83: ; preds = %75
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i8** %15
br label %100
84: ; preds = %75
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i8** %15
br label %100
85: ; preds = %75
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), i8** %15
br label %100
86: ; preds = %75
%87 = call i64 @malloc(i32 4)
%88 = inttoptr i64 %87 to i8*
store i8* %88, i8** %15
%89 = load i8*, i8** %15
%90 = icmp ne i8* %89, null
br i1 %90, label %91, label %97
91: ; preds = %86
store i32 1, i32* %17
%92 = load i8*, i8** %15
%93 = load %struct.addrinfo*, %struct.addrinfo** %8
%94 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %93, i32 0, i32 1
%95 = load i32, i32* %94
%96 = call i32 @snprintf(i8* %92, i32 4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i32 %95)
br label %99
97: ; preds = %86
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.13, i64 0, i64 0))
store i32 1, i32* %3
store i32 1, i32* %12
br label %173
99: ; preds = %91
br label %100
100: ; preds = %99, %85, %84, %83, %82, %81, %80, %79
%101 = load %struct.addrinfo*, %struct.addrinfo** %8
%102 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %101, i32 0, i32 2
%103 = load i32, i32* %102
switch i32 %103, label %129 [
i32 148, label %104
i32 151, label %105
i32 149, label %106
i32 147, label %107
i32 138, label %108
i32 155, label %109
i32 142, label %110
i32 136, label %111
i32 150, label %112
i32 137, label %113
i32 156, label %114
i32 146, label %115
i32 140, label %116
i32 152, label %117
i32 153, label %118
i32 159, label %119
i32 144, label %120
i32 158, label %121
i32 154, label %122
i32 143, label %123
i32 157, label %124
i32 139, label %125
i32 135, label %126
i32 145, label %127
i32 141, label %128
]
104: ; preds = %100
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.14, i64 0, i64 0), i8** %16
br label %143
105: ; preds = %100
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.15, i64 0, i64 0), i8** %16
br label %143
106: ; preds = %100
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.16, i64 0, i64 0), i8** %16
br label %143
107: ; preds = %100
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.17, i64 0, i64 0), i8** %16
br label %143
108: ; preds = %100
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.18, i64 0, i64 0), i8** %16
br label %143
109: ; preds = %100
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.19, i64 0, i64 0), i8** %16
br label %143
110: ; preds = %100
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.20, i64 0, i64 0), i8** %16
br label %143
111: ; preds = %100
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.21, i64 0, i64 0), i8** %16
br label %143
112: ; preds = %100
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.22, i64 0, i64 0), i8** %16
br label %143
113: ; preds = %100
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.23, i64 0, i64 0), i8** %16
br label %143
114: ; preds = %100
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.24, i64 0, i64 0), i8** %16
br label %143
115: ; preds = %100
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.25, i64 0, i64 0), i8** %16
br label %143
116: ; preds = %100
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.26, i64 0, i64 0), i8** %16
br label %143
117: ; preds = %100
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.27, i64 0, i64 0), i8** %16
br label %143
118: ; preds = %100
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.28, i64 0, i64 0), i8** %16
br label %143
119: ; preds = %100
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.29, i64 0, i64 0), i8** %16
br label %143
120: ; preds = %100
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.30, i64 0, i64 0), i8** %16
br label %143
121: ; preds = %100
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.31, i64 0, i64 0), i8** %16
br label %143
122: ; preds = %100
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.32, i64 0, i64 0), i8** %16
br label %143
123: ; preds = %100
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.33, i64 0, i64 0), i8** %16
br label %143
124: ; preds = %100
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.34, i64 0, i64 0), i8** %16
br label %143
125: ; preds = %100
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.35, i64 0, i64 0), i8** %16
br label %143
126: ; preds = %100
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.36, i64 0, i64 0), i8** %16
br label %143
127: ; preds = %100
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.37, i64 0, i64 0), i8** %16
br label %143
128: ; preds = %100
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.38, i64 0, i64 0), i8** %16
br label %143
129: ; preds = %100
%130 = call i64 @malloc(i32 5)
%131 = inttoptr i64 %130 to i8*
store i8* %131, i8** %16
%132 = load i8*, i8** %16
%133 = icmp ne i8* %132, null
br i1 %133, label %134, label %140
134: ; preds = %129
store i32 1, i32* %18
%135 = load i8*, i8** %16
%136 = load %struct.addrinfo*, %struct.addrinfo** %8
%137 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %136, i32 0, i32 2
%138 = load i32, i32* %137
%139 = call i32 @snprintf(i8* %135, i32 5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i32 %138)
br label %142
140: ; preds = %129
%141 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.13, i64 0, i64 0))
store i32 1, i32* %3
store i32 1, i32* %12
br label %173
142: ; preds = %134
br label %143
143: ; preds = %142, %128, %127, %126, %125, %124, %123, %122, %121, %120, %119, %118, %117, %116, %115, %114, %113, %112, %111, %110, %109, %108, %107, %106, %105, %104
%144 = load %struct.addrinfo*, %struct.addrinfo** %8
%145 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %144, i32 0, i32 0
%146 = load i64, i64* %145
%147 = load i8*, i8** %13
%148 = trunc i64 %22 to i32
%149 = call i32 @inet_ntop(i64 %146, i8* %147, i8* %24, i32 %148)
%150 = load i8*, i8** %14
%151 = load i8*, i8** %15
%152 = load i8*, i8** %16
%153 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.39, i64 0, i64 0), i8* %150, i8* %24, i8* %151, i8* %152)
%154 = load i32, i32* %17
%155 = icmp ne i32 %154, 0
br i1 %155, label %156, label %159
156: ; preds = %143
%157 = load i8*, i8** %15
%158 = call i32 @free(i8* %157)
store i32 0, i32* %17
br label %159
159: ; preds = %156, %143
%160 = load i32, i32* %18
%161 = icmp ne i32 %160, 0
br i1 %161, label %162, label %165
162: ; preds = %159
%163 = load i8*, i8** %16
%164 = call i32 @free(i8* %163)
store i32 0, i32* %18
br label %165
165: ; preds = %162, %159
br label %166
166: ; preds = %165
%167 = load %struct.addrinfo*, %struct.addrinfo** %8
%168 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %167, i32 0, i32 4
%169 = load %struct.addrinfo*, %struct.addrinfo** %168
store %struct.addrinfo* %169, %struct.addrinfo** %8
br label %50
170: ; preds = %50
%171 = load %struct.addrinfo*, %struct.addrinfo** %7
%172 = call i32 @freeaddrinfo(%struct.addrinfo* %171)
store i32 0, i32* %3
store i32 1, i32* %12
br label %173
173: ; preds = %170, %140, %97, %39, %27
%174 = load i8*, i8** %10
%175 = load i32, i32* %3
ret i32 %175
}

LLVM IR (-O2):
%struct.addrinfo = type { i64, i32, i32, i64, %struct.addrinfo* }
@INET6_ADDRSTRLEN = global i32 0
@stderr = global i32 0
@.str = [24 x i8] c"usage: showip hostname\0A\00"
@AF_UNSPEC = global i64 0
@.str.1 = [17 x i8] c"getaddrinfo: %s\0A\00"
@.str.2 = [18 x i8] c"IP data for %s:\0A\0A\00"
@AF_INET = global i64 0
@.str.3 = [5 x i8] c"IPv4\00"
@.str.4 = [5 x i8] c"IPv6\00"
@.str.5 = [12 x i8] c"SOCK_STREAM\00"
@.str.6 = [11 x i8] c"SOCK_DGRAM\00"
@.str.7 = [9 x i8] c"SOCK_RAW\00"
@.str.8 = [9 x i8] c"SOCK_RDM\00"
@.str.9 = [15 x i8] c"SOCK_SEQPACKET\00"
@.str.10 = [10 x i8] c"SOCK_DCCP\00"
@.str.11 = [12 x i8] c"SOCK_PACKET\00"
@.str.12 = [3 x i8] c"%d\00"
@.str.14 = [11 x i8] c"IPPROTO_IP\00"
@.str.15 = [13 x i8] c"IPPROTO_ICMP\00"
@.str.16 = [13 x i8] c"IPPROTO_IGMP\00"
@.str.17 = [13 x i8] c"IPPROTO_IPIP\00"
@.str.18 = [12 x i8] c"IPPROTO_TCP\00"
@.str.19 = [12 x i8] c"IPPROTO_EGP\00"
@.str.20 = [12 x i8] c"IPPROTO_PUP\00"
@.str.21 = [12 x i8] c"IPPROTO_UDP\00"
@.str.22 = [12 x i8] c"IPPROTO_IDP\00"
@.str.23 = [11 x i8] c"IPPROTO_TP\00"
@.str.24 = [13 x i8] c"IPPROTO_DCCP\00"
@.str.25 = [13 x i8] c"IPPROTO_IPV6\00"
@.str.26 = [13 x i8] c"IPPROTO_RSVP\00"
@.str.27 = [12 x i8] c"IPPROTO_GRE\00"
@.str.28 = [12 x i8] c"IPPROTO_ESP\00"
@.str.29 = [11 x i8] c"IPPROTO_AH\00"
@.str.30 = [12 x i8] c"IPPROTO_MTP\00"
@.str.31 = [15 x i8] c"IPPROTO_BEETPH\00"
@.str.32 = [14 x i8] c"IPPROTO_ENCAP\00"
@.str.33 = [12 x i8] c"IPPROTO_PIM\00"
@.str.34 = [13 x i8] c"IPPROTO_COMP\00"
@.str.35 = [13 x i8] c"IPPROTO_SCTP\00"
@.str.36 = [16 x i8] c"IPPROTO_UDPLITE\00"
@.str.37 = [13 x i8] c"IPPROTO_MPLS\00"
@.str.38 = [12 x i8] c"IPPROTO_RAW\00"
@.str.39 = [15 x i8] c" %s: %s %s %s\0A\00"
@str.40 = [25 x i8] c"Memory allocation error.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.addrinfo
%4 = alloca %struct.addrinfo*
%5 = bitcast %struct.addrinfo* %3 to i8*
%6 = bitcast %struct.addrinfo** %4 to i8*
%7 = load i32, i32* @INET6_ADDRSTRLEN
%8 = zext i32 %7 to i64
%9 = tail call i8* @llvm.stacksave()
%10 = alloca i8, i64 %8
%11 = icmp eq i32 %0, 2
br i1 %11, label %15, label %12
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %117
15: ; preds = %2
%16 = call i32 @memset(%struct.addrinfo* %3, i32 0, i32 32)
%17 = load i64, i64* @AF_UNSPEC
%18 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 0
store i64 %17, i64* %18
%19 = getelementptr inbounds i8*, i8** %1, i64 1
%20 = load i8*, i8** %19
%21 = call i32 @getaddrinfo(i8* %20, i32* null, %struct.addrinfo* %3, %struct.addrinfo** %4)
%22 = icmp eq i32 %21, 0
br i1 %22, label %27, label %23
23: ; preds = %15
%24 = load i32, i32* @stderr
%25 = call i8* @gai_strerror(i32 %21)
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %25)
br label %117
27: ; preds = %15
%28 = load i8*, i8** %19
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %28)
%30 = load %struct.addrinfo*, %struct.addrinfo** %4
%31 = icmp eq %struct.addrinfo* %30, null
br i1 %31, label %114, label %32
32: ; preds = %27, %108
%33 = phi %struct.addrinfo* [ %110, %108 ], [ %30, %27 ]
%34 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %33, i64 0, i32 0
%35 = load i64, i64* %34
%36 = load i64, i64* @AF_INET
%37 = icmp eq i64 %35, %36
%38 = select i1 %37, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0)
%39 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %33, i64 0, i32 3
%40 = load i64, i64* %39
%41 = inttoptr i64 %40 to i8*
%42 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %33, i64 0, i32 1
%43 = load i32, i32* %42
switch i32 %43, label %50 [
i32 128, label %59
i32 133, label %44
i32 131, label %45
i32 130, label %46
i32 129, label %47
i32 134, label %48
i32 132, label %49
]
44: ; preds = %32
br label %59
45: ; preds = %32
br label %59
46: ; preds = %32
br label %59
47: ; preds = %32
br label %59
48: ; preds = %32
br label %59
49: ; preds = %32
br label %59
50: ; preds = %32
%51 = call i64 @malloc(i32 4)
%52 = inttoptr i64 %51 to i8*
%53 = icmp eq i64 %51, 0
br i1 %53, label %57, label %54
54: ; preds = %50
%55 = load i32, i32* %42
%56 = call i32 @snprintf(i8* %52, i32 4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i32 %55)
br label %59
57: ; preds = %50
%58 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.40, i64 0, i64 0))
br label %117
59: ; preds = %32, %54, %49, %48, %47, %46, %45, %44
%60 = phi i8* [ %52, %54 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), %49 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), %48 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), %47 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), %46 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), %45 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), %44 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), %32 ]
%61 = phi i1 [ false, %54 ], [ true, %49 ], [ true, %48 ], [ true, %47 ], [ true, %46 ], [ true, %45 ], [ true, %44 ], [ true, %32 ]
%62 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %33, i64 0, i32 2
%63 = load i32, i32* %62
switch i32 %63, label %88 [
i32 148, label %97
i32 151, label %64
i32 149, label %65
i32 147, label %66
i32 138, label %67
i32 155, label %68
i32 142, label %69
i32 136, label %70
i32 150, label %71
i32 137, label %72
i32 156, label %73
i32 146, label %74
i32 140, label %75
i32 152, label %76
i32 153, label %77
i32 159, label %78
i32 144, label %79
i32 158, label %80
i32 154, label %81
i32 143, label %82
i32 157, label %83
i32 139, label %84
i32 135, label %85
i32 145, label %86
i32 141, label %87
]
64: ; preds = %59
br label %97
65: ; preds = %59
br label %97
66: ; preds = %59
br label %97
67: ; preds = %59
br label %97
68: ; preds = %59
br label %97
69: ; preds = %59
br label %97
70: ; preds = %59
br label %97
71: ; preds = %59
br label %97
72: ; preds = %59
br label %97
73: ; preds = %59
br label %97
74: ; preds = %59
br label %97
75: ; preds = %59
br label %97
76: ; preds = %59
br label %97
77: ; preds = %59
br label %97
78: ; preds = %59
br label %97
79: ; preds = %59
br label %97
80: ; preds = %59
br label %97
81: ; preds = %59
br label %97
82: ; preds = %59
br label %97
83: ; preds = %59
br label %97
84: ; preds = %59
br label %97
85: ; preds = %59
br label %97
86: ; preds = %59
br label %97
87: ; preds = %59
br label %97
88: ; preds = %59
%89 = call i64 @malloc(i32 5)
%90 = inttoptr i64 %89 to i8*
%91 = icmp eq i64 %89, 0
br i1 %91, label %95, label %92
92: ; preds = %88
%93 = load i32, i32* %62
%94 = call i32 @snprintf(i8* %90, i32 5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i32 %93)
br label %97
95: ; preds = %88
%96 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.40, i64 0, i64 0))
br label %117
97: ; preds = %59, %92, %87, %86, %85, %84, %83, %82, %81, %80, %79, %78, %77, %76, %75, %74, %73, %72, %71, %70, %69, %68, %67, %66, %65, %64
%98 = phi i8* [ %90, %92 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.38, i64 0, i64 0), %87 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.37, i64 0, i64 0), %86 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.36, i64 0, i64 0), %85 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.35, i64 0, i64 0), %84 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.34, i64 0, i64 0), %83 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.33, i64 0, i64 0), %82 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.32, i64 0, i64 0), %81 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.31, i64 0, i64 0), %80 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.30, i64 0, i64 0), %79 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.29, i64 0, i64 0), %78 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.28, i64 0, i64 0), %77 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.27, i64 0, i64 0), %76 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.26, i64 0, i64 0), %75 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.25, i64 0, i64 0), %74 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.24, i64 0, i64 0), %73 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.23, i64 0, i64 0), %72 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.22, i64 0, i64 0), %71 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.21, i64 0, i64 0), %70 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.20, i64 0, i64 0), %69 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.19, i64 0, i64 0), %68 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.18, i64 0, i64 0), %67 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.17, i64 0, i64 0), %66 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.16, i64 0, i64 0), %65 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.15, i64 0, i64 0), %64 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.14, i64 0, i64 0), %59 ]
%99 = phi i1 [ false, %92 ], [ true, %87 ], [ true, %86 ], [ true, %85 ], [ true, %84 ], [ true, %83 ], [ true, %82 ], [ true, %81 ], [ true, %80 ], [ true, %79 ], [ true, %78 ], [ true, %77 ], [ true, %76 ], [ true, %75 ], [ true, %74 ], [ true, %73 ], [ true, %72 ], [ true, %71 ], [ true, %70 ], [ true, %69 ], [ true, %68 ], [ true, %67 ], [ true, %66 ], [ true, %65 ], [ true, %64 ], [ true, %59 ]
%100 = load i64, i64* %34
%101 = call i32 @inet_ntop(i64 %100, i8* %41, i8* %10, i32 %7)
%102 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.39, i64 0, i64 0), i8* %38, i8* %10, i8* %60, i8* %98)
br i1 %61, label %105, label %103
103: ; preds = %97
%104 = call i32 @free(i8* %60)
br label %105
105: ; preds = %103, %97
br i1 %99, label %108, label %106
106: ; preds = %105
%107 = call i32 @free(i8* %98)
br label %108
108: ; preds = %106, %105
%109 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %33, i64 0, i32 4
%110 = load %struct.addrinfo*, %struct.addrinfo** %109
%111 = icmp eq %struct.addrinfo* %110, null
br i1 %111, label %112, label %32
112: ; preds = %108
%113 = load %struct.addrinfo*, %struct.addrinfo** %4
br label %114
114: ; preds = %112, %27
%115 = phi %struct.addrinfo* [ %113, %112 ], [ null, %27 ]
%116 = call i32 @freeaddrinfo(%struct.addrinfo* %115)
br label %117
117: ; preds = %57, %95, %114, %23, %12
%118 = phi i32 [ 1, %12 ], [ 2, %23 ], [ 0, %114 ], [ 1, %95 ], [ 1, %57 ]
ret i32 %118
}