#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
struct addrinfo {
  int /*<<< orphan*/ ai_addrlen;
  int /*<<< orphan*/ *ai_addr;
  struct addrinfo *ai_next;
  int /*<<< orphan*/ *ai_canonname;
  int /*<<< orphan*/ ai_flags;
  int /*<<< orphan*/ ai_protocol;
  int /*<<< orphan*/ ai_socktype;
  int /*<<< orphan*/ ai_family;
};

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ AF_INET6;
int /*<<< orphan*/ AF_UNSPEC;
int /*<<< orphan*/ AI_NUMERICSERV;
int /*<<< orphan*/ EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ IPPROTO_TCP;
int NI_NUMERICHOST;
int NI_NUMERICSERV;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *const, char *);
int /*<<< orphan*/ freeaddrinfo(struct addrinfo *);
char *gai_strerror(int);
int getaddrinfo(char const *, char *, struct addrinfo *, struct addrinfo **);
int getnameinfo(int /*<<< orphan*/ *, int /*<<< orphan*/, char *, int,
                int /*<<< orphan*/ *, int /*<<< orphan*/, int);
int getopt(int const, char *const *, char *);
int const optind;
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ usage(char *const);
int main(const int argc, char *const argv[]) {
  int err;
  int optchar;
  bool ipv6 = false;
  bool ipv4 = false;
  struct addrinfo hints;
  struct addrinfo *res = NULL;
  struct addrinfo *elem;
  const char *hostname;
  char buffer[40];
  while ((optchar = getopt(argc, argv, "64")) != -1) {
    switch (optchar) {
    case '4':
      ipv4 = true;
      break;
    case '6':
      ipv6 = true;
      break;
    case '?':
      usage(argv[0]);
      exit(EXIT_FAILURE);
      break;
    default:
      assert(false);
      break;
    }
  }
  if (optind >= argc) {
    usage(argv[0]);
    exit(EXIT_FAILURE);
  }
  hostname = argv[optind];
  hints.ai_family = ipv4 == ipv6 ? AF_UNSPEC : ipv4 ? AF_INET : AF_INET6;
  hints.ai_socktype = SOCK_STREAM;
  hints.ai_protocol = IPPROTO_TCP;
  hints.ai_flags = AI_NUMERICSERV;
  hints.ai_canonname = NULL;
  hints.ai_addr = NULL;
  hints.ai_next = NULL;
  if ((err = getaddrinfo(hostname, "1", &hints, &res)) != 0) {
    fprintf(stderr, "%s: %s\n", argv[0], gai_strerror(err));
    if (res != NULL) {
      freeaddrinfo(res);
    }
    exit(EXIT_FAILURE);
  }
  for (elem = res; elem != NULL; elem = elem->ai_next) {
    if ((err = getnameinfo(elem->ai_addr, elem->ai_addrlen, buffer, 40, NULL, 0,
                           NI_NUMERICHOST | NI_NUMERICSERV)) != 0) {
      fprintf(stderr, "%s: %s\n", argv[0], gai_strerror(err));
      freeaddrinfo(res);
      exit(EXIT_FAILURE);
    }
    printf("%s\n", buffer);
  }
  freeaddrinfo(res);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movq   $0x0,-0x58(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe23(%rip),%rdx
call   1090 <getopt@plt>
mov    %eax,-0x18(%rbp)
cmp    $0xffffffff,%eax
je     126b <main+0xcb>
mov    -0x18(%rbp),%eax
mov    %eax,-0x94(%rbp)
sub    $0x34,%eax
je     122d <main+0x8d>
jmp    1205 <main+0x65>
mov    -0x94(%rbp),%eax
sub    $0x36,%eax
je     1239 <main+0x99>
jmp    1219 <main+0x79>
mov    -0x94(%rbp),%eax
sub    $0x3f,%eax
je     1245 <main+0xa5>
jmp    125f <main+0xbf>
movl   $0x1,-0x20(%rbp)
jmp    1266 <main+0xc6>
movl   $0x1,-0x1c(%rbp)
jmp    1266 <main+0xc6>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1080 <usage@plt>
mov    0x2d38(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
xor    %edi,%edi
call   1060 <assert@plt>
jmp    11cf <main+0x2f>
mov    0x2d4e(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jl     1297 <main+0xf7>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1080 <usage@plt>
mov    0x2d00(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x2d1e(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x68(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jne    12cd <main+0x12d>
mov    0x2d10(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x98(%rbp)
jmp    1306 <main+0x166>
cmpl   $0x0,-0x20(%rbp)
je     12eb <main+0x14b>
mov    0x2cfa(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x9c(%rbp)
jmp    12fa <main+0x15a>
mov    0x2cc6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x9c(%rbp)
mov    -0x9c(%rbp),%eax
mov    %eax,-0x98(%rbp)
mov    -0x98(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    0x2c8a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    0x2ca6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    0x2cca(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x48(%rbp)
movq   $0x0,-0x40(%rbp)
mov    -0x68(%rbp),%rdi
lea    0xcad(%rip),%rsi
lea    -0x50(%rbp),%rdx
lea    -0x58(%rbp),%rcx
call   10b0 <getaddrinfo@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     13d2 <main+0x232>
mov    0x2c32(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xac(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0xa8(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <gai_strerror@plt>
mov    -0xac(%rbp),%edi
mov    -0xa8(%rbp),%rdx
mov    %rax,%rcx
lea    0xc5a(%rip),%rsi
call   1070 <fprintf@plt>
cmpq   $0x0,-0x58(%rbp)
je     13c4 <main+0x224>
mov    -0x58(%rbp),%rdi
call   10c0 <freeaddrinfo@plt>
mov    0x2bc5(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    -0x58(%rbp),%rax
mov    %rax,-0x60(%rbp)
cmpq   $0x0,-0x60(%rbp)
je     14a7 <main+0x307>
mov    -0x60(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x60(%rbp),%rax
mov    (%rax),%esi
lea    -0x90(%rbp),%rdx
mov    0x2b97(%rip),%rax
mov    (%rax),%eax
mov    0x2bd6(%rip),%rcx
or     (%rcx),%eax
mov    $0x28,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
mov    %eax,(%rsp)
call   1050 <getnameinfo@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     1483 <main+0x2e3>
mov    0x2b76(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xbc(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0xb8(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <gai_strerror@plt>
mov    -0xbc(%rbp),%edi
mov    -0xb8(%rbp),%rdx
mov    %rax,%rcx
lea    0xb9e(%rip),%rsi
call   1070 <fprintf@plt>
mov    -0x58(%rbp),%rdi
call   10c0 <freeaddrinfo@plt>
mov    0x2b14(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
lea    -0x90(%rbp),%rsi
lea    0xb78(%rip),%rdi
call   1030 <printf@plt>
mov    -0x60(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x60(%rbp)
jmp    13da <main+0x23a>
mov    -0x58(%rbp),%rdi
call   10c0 <freeaddrinfo@plt>
mov    0x2ad1(%rip),%rax
mov    (%rax),%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %rsi,%r14
mov    %edi,%ebp
movq   $0x0,0x8(%rsp)
xor    %r12d,%r12d
lea    0xe3a(%rip),%rbx
xor    %r15d,%r15d
jmp    11e5 <main+0x45>
nopl   0x0(%rax,%rax,1)
cmp    $0x36,%eax
je     1209 <main+0x69>
cmp    $0x3f,%eax
je     1323 <main+0x183>
xor    %edi,%edi
call   1060 <assert@plt>
mov    %ebp,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1090 <getopt@plt>
cmp    $0x35,%eax
jg     11d0 <main+0x30>
cmp    $0xffffffff,%eax
je     1211 <main+0x71>
cmp    $0x34,%eax
jne    11de <main+0x3e>
mov    $0x1,%r15d
jmp    11e5 <main+0x45>
mov    $0x1,%r12d
jmp    11e5 <main+0x45>
mov    (%r14),%rdi
test   %ebp,%ebp
jle    136c <main+0x1cc>
cmp    %r12d,%r15d
jne    122a <main+0x8a>
mov    0x2da8(%rip),%rax
jmp    123f <main+0x9f>
test   %r15d,%r15d
jne    1238 <main+0x98>
mov    0x2d8a(%rip),%rax
jmp    123f <main+0x9f>
mov    0x2d99(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x3c(%rsp)
mov    0x2d5c(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x38(%rsp)
mov    0x2d6f(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x34(%rsp)
mov    0x2d92(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x30(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,0x18(%rsp)
movq   $0x0,0x28(%rsp)
lea    0xd7f(%rip),%rsi
lea    0x10(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   10b0 <getaddrinfo@plt>
test   %eax,%eax
jne    1373 <main+0x1d3>
mov    0x8(%rsp),%rbp
test   %rbp,%rbp
je     1304 <main+0x164>
mov    0x2cf4(%rip),%r12
mov    0x2d2d(%rip),%r13
lea    0x40(%rsp),%rbx
lea    0xd4a(%rip),%r15
nop
mov    0x8(%rbp),%rdi
mov    0x0(%rbp),%esi
mov    0x0(%r13),%eax
or     (%r12),%eax
mov    %eax,(%rsp)
mov    %rbx,%rdx
mov    $0x28,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1050 <getnameinfo@plt>
test   %eax,%eax
jne    132d <main+0x18d>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    0x10(%rbp),%rbp
test   %rbp,%rbp
jne    12c0 <main+0x120>
mov    0x8(%rsp),%rdi
jmp    1306 <main+0x166>
xor    %edi,%edi
call   10c0 <freeaddrinfo@plt>
mov    0x2c7e(%rip),%rax
mov    (%rax),%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%r14),%rdi
call   1080 <usage@plt>
jmp    135e <main+0x1be>
mov    0x2c7c(%rip),%rcx
mov    (%rcx),%ebx
mov    (%r14),%rbp
mov    %eax,%edi
call   1040 <gai_strerror@plt>
lea    0xcbe(%rip),%rsi
mov    %ebx,%edi
mov    %rbp,%rdx
mov    %rax,%rcx
call   1070 <fprintf@plt>
mov    0x8(%rsp),%rdi
call   10c0 <freeaddrinfo@plt>
mov    0x2c33(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
call   1080 <usage@plt>
jmp    135e <main+0x1be>
mov    0x2c36(%rip),%rcx
mov    (%rcx),%ebx
mov    (%r14),%rbp
mov    %eax,%edi
call   1040 <gai_strerror@plt>
lea    0xc78(%rip),%rsi
mov    %ebx,%edi
mov    %rbp,%rdx
mov    %rax,%rcx
call   1070 <fprintf@plt>
mov    0x8(%rsp),%rdi
test   %rdi,%rdi
jne    1359 <main+0x1b9>
jmp    135e <main+0x1be>

LLVM IR (-O0):
%struct.addrinfo = type { i32, i32*, %struct.addrinfo*, i32*, i32, i32, i32, i32 }
@.str = [3 x i8] c"64\00"
@EXIT_FAILURE = global i32 0
@optind = constant i32 0
@AF_UNSPEC = global i32 0
@AF_INET = global i32 0
@AF_INET6 = global i32 0
@SOCK_STREAM = global i32 0
@IPPROTO_TCP = global i32 0
@AI_NUMERICSERV = global i32 0
@.str.1 = [2 x i8] c"1\00"
@stderr = global i32 0
@.str.2 = [8 x i8] c"%s: %s\0A\00"
@NI_NUMERICHOST = global i32 0
@NI_NUMERICSERV = global i32 0
@.str.3 = [4 x i8] c"%s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca %struct.addrinfo
%11 = alloca %struct.addrinfo*
%12 = alloca %struct.addrinfo*
%13 = alloca i8*
%14 = alloca [40 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
store i32 0, i32* %9
store %struct.addrinfo* null, %struct.addrinfo** %11
br label %15
15: ; preds = %33, %2
%16 = load i32, i32* %4
%17 = load i8**, i8*** %5
%18 = call i32 @getopt(i32 %16, i8** %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 %18, i32* %7
%19 = icmp ne i32 %18, -1
br i1 %19, label %20, label %34
20: ; preds = %15
%21 = load i32, i32* %7
switch i32 %21, label %31 [
i32 52, label %22
i32 54, label %23
i32 63, label %24
]
22: ; preds = %20
store i32 1, i32* %9
br label %33
23: ; preds = %20
store i32 1, i32* %8
br label %33
24: ; preds = %20
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 0
%27 = load i8*, i8** %26
%28 = call i32 @usage(i8* %27)
%29 = load i32, i32* @EXIT_FAILURE
%30 = call i32 @exit(i32 %29)
unreachable
31: ; preds = %20
%32 = call i32 @assert(i32 0)
br label %33
33: ; preds = %31, %23, %22
br label %15
34: ; preds = %15
%35 = load i32, i32* @optind
%36 = load i32, i32* %4
%37 = icmp sge i32 %35, %36
br i1 %37, label %38, label %45
38: ; preds = %34
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 0
%41 = load i8*, i8** %40
%42 = call i32 @usage(i8* %41)
%43 = load i32, i32* @EXIT_FAILURE
%44 = call i32 @exit(i32 %43)
unreachable
45: ; preds = %34
%46 = load i8**, i8*** %5
%47 = load i32, i32* @optind
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8*, i8** %46, i64 %48
%50 = load i8*, i8** %49
store i8* %50, i8** %13
%51 = load i32, i32* %9
%52 = load i32, i32* %8
%53 = icmp eq i32 %51, %52
br i1 %53, label %54, label %56
54: ; preds = %45
%55 = load i32, i32* @AF_UNSPEC
br label %65
56: ; preds = %45
%57 = load i32, i32* %9
%58 = icmp ne i32 %57, 0
br i1 %58, label %59, label %61
59: ; preds = %56
%60 = load i32, i32* @AF_INET
br label %63
61: ; preds = %56
%62 = load i32, i32* @AF_INET6
br label %63
63: ; preds = %61, %59
%64 = phi i32 [ %60, %59 ], [ %62, %61 ]
br label %65
65: ; preds = %63, %54
%66 = phi i32 [ %55, %54 ], [ %64, %63 ]
%67 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %10, i32 0, i32 7
store i32 %66, i32* %67
%68 = load i32, i32* @SOCK_STREAM
%69 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %10, i32 0, i32 6
store i32 %68, i32* %69
%70 = load i32, i32* @IPPROTO_TCP
%71 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %10, i32 0, i32 5
store i32 %70, i32* %71
%72 = load i32, i32* @AI_NUMERICSERV
%73 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %10, i32 0, i32 4
store i32 %72, i32* %73
%74 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %10, i32 0, i32 3
store i32* null, i32** %74
%75 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %10, i32 0, i32 1
store i32* null, i32** %75
%76 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %10, i32 0, i32 2
store %struct.addrinfo* null, %struct.addrinfo** %76
%77 = load i8*, i8** %13
%78 = call i32 @getaddrinfo(i8* %77, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), %struct.addrinfo* %10, %struct.addrinfo** %11)
store i32 %78, i32* %6
%79 = icmp ne i32 %78, 0
br i1 %79, label %80, label %96
80: ; preds = %65
%81 = load i32, i32* @stderr
%82 = load i8**, i8*** %5
%83 = getelementptr inbounds i8*, i8** %82, i64 0
%84 = load i8*, i8** %83
%85 = load i32, i32* %6
%86 = call i8* @gai_strerror(i32 %85)
%87 = call i32 @fprintf(i32 %81, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %84, i8* %86)
%88 = load %struct.addrinfo*, %struct.addrinfo** %11
%89 = icmp ne %struct.addrinfo* %88, null
br i1 %89, label %90, label %93
90: ; preds = %80
%91 = load %struct.addrinfo*, %struct.addrinfo** %11
%92 = call i32 @freeaddrinfo(%struct.addrinfo* %91)
br label %93
93: ; preds = %90, %80
%94 = load i32, i32* @EXIT_FAILURE
%95 = call i32 @exit(i32 %94)
unreachable
96: ; preds = %65
%97 = load %struct.addrinfo*, %struct.addrinfo** %11
store %struct.addrinfo* %97, %struct.addrinfo** %12
br label %98
98: ; preds = %129, %96
%99 = load %struct.addrinfo*, %struct.addrinfo** %12
%100 = icmp ne %struct.addrinfo* %99, null
br i1 %100, label %101, label %133
101: ; preds = %98
%102 = load %struct.addrinfo*, %struct.addrinfo** %12
%103 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %102, i32 0, i32 1
%104 = load i32*, i32** %103
%105 = load %struct.addrinfo*, %struct.addrinfo** %12
%106 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %105, i32 0, i32 0
%107 = load i32, i32* %106
%108 = getelementptr inbounds [40 x i8], [40 x i8]* %14, i64 0, i64 0
%109 = load i32, i32* @NI_NUMERICHOST
%110 = load i32, i32* @NI_NUMERICSERV
%111 = or i32 %109, %110
%112 = call i32 @getnameinfo(i32* %104, i32 %107, i8* %108, i32 40, i32* null, i32 0, i32 %111)
store i32 %112, i32* %6
%113 = icmp ne i32 %112, 0
br i1 %113, label %114, label %126
114: ; preds = %101
%115 = load i32, i32* @stderr
%116 = load i8**, i8*** %5
%117 = getelementptr inbounds i8*, i8** %116, i64 0
%118 = load i8*, i8** %117
%119 = load i32, i32* %6
%120 = call i8* @gai_strerror(i32 %119)
%121 = call i32 @fprintf(i32 %115, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %118, i8* %120)
%122 = load %struct.addrinfo*, %struct.addrinfo** %11
%123 = call i32 @freeaddrinfo(%struct.addrinfo* %122)
%124 = load i32, i32* @EXIT_FAILURE
%125 = call i32 @exit(i32 %124)
unreachable
126: ; preds = %101
%127 = getelementptr inbounds [40 x i8], [40 x i8]* %14, i64 0, i64 0
%128 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %127)
br label %129
129: ; preds = %126
%130 = load %struct.addrinfo*, %struct.addrinfo** %12
%131 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %130, i32 0, i32 2
%132 = load %struct.addrinfo*, %struct.addrinfo** %131
store %struct.addrinfo* %132, %struct.addrinfo** %12
br label %98
133: ; preds = %98
%134 = load %struct.addrinfo*, %struct.addrinfo** %11
%135 = call i32 @freeaddrinfo(%struct.addrinfo* %134)
%136 = load i32, i32* @EXIT_SUCCESS
ret i32 %136
}

LLVM IR (-O2):
%struct.addrinfo = type { i32, i32*, %struct.addrinfo*, i32*, i32, i32, i32, i32 }
@.str = [3 x i8] c"64\00"
@EXIT_FAILURE = global i32 0
@optind = constant i32 0
@AF_UNSPEC = global i32 0
@AF_INET = global i32 0
@AF_INET6 = global i32 0
@SOCK_STREAM = global i32 0
@IPPROTO_TCP = global i32 0
@AI_NUMERICSERV = global i32 0
@.str.1 = [2 x i8] c"1\00"
@stderr = global i32 0
@.str.2 = [8 x i8] c"%s: %s\0A\00"
@NI_NUMERICHOST = global i32 0
@NI_NUMERICSERV = global i32 0
@.str.3 = [4 x i8] c"%s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca %struct.addrinfo
%4 = alloca %struct.addrinfo*
%5 = alloca [40 x i8]
%6 = bitcast %struct.addrinfo* %3 to i8*
%7 = bitcast %struct.addrinfo** %4 to i8*
store %struct.addrinfo* null, %struct.addrinfo** %4
%8 = getelementptr inbounds [40 x i8], [40 x i8]* %5, i64 0, i64 0
br label %9
9: ; preds = %14, %2
%10 = phi i32 [ 0, %2 ], [ 1, %14 ]
%11 = phi i32 [ 0, %2 ], [ %13, %14 ]
br label %12
12: ; preds = %14, %9
%13 = phi i32 [ %11, %9 ], [ 1, %14 ]
br label %14
14: ; preds = %12, %21
%15 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
switch i32 %15, label %21 [
i32 -1, label %23
i32 52, label %12
i32 54, label %9
i32 63, label %16
]
16: ; preds = %14
%17 = load i8*, i8** %1
%18 = tail call i32 @usage(i8* %17)
%19 = load i32, i32* @EXIT_FAILURE
%20 = tail call i32 @exit(i32 %19)
unreachable
21: ; preds = %14
%22 = tail call i32 @assert(i32 0)
br label %14
23: ; preds = %14
%24 = icmp slt i32 %0, 1
%25 = load i8*, i8** %1
br i1 %24, label %26, label %30
26: ; preds = %23
%27 = tail call i32 @usage(i8* %25)
%28 = load i32, i32* @EXIT_FAILURE
%29 = tail call i32 @exit(i32 %28)
unreachable
30: ; preds = %23
%31 = icmp eq i32 %13, %10
br i1 %31, label %32, label %34
32: ; preds = %30
%33 = load i32, i32* @AF_UNSPEC
br label %39
34: ; preds = %30
%35 = icmp eq i32 %13, 0
%36 = load i32, i32* @AF_INET
%37 = load i32, i32* @AF_INET6
%38 = select i1 %35, i32 %37, i32 %36
br label %39
39: ; preds = %34, %32
%40 = phi i32 [ %33, %32 ], [ %38, %34 ]
%41 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 7
store i32 %40, i32* %41
%42 = load i32, i32* @SOCK_STREAM
%43 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 6
store i32 %42, i32* %43
%44 = load i32, i32* @IPPROTO_TCP
%45 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 5
store i32 %44, i32* %45
%46 = load i32, i32* @AI_NUMERICSERV
%47 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 4
store i32 %46, i32* %47
%48 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 1
%49 = bitcast i32** %48 to i8*
%50 = call i32 @getaddrinfo(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), %struct.addrinfo* %3, %struct.addrinfo** %4)
%51 = icmp eq i32 %50, 0
br i1 %51, label %52, label %55
52: ; preds = %39
%53 = load %struct.addrinfo*, %struct.addrinfo** %4
%54 = icmp eq %struct.addrinfo* %53, null
br i1 %54, label %94, label %67
55: ; preds = %39
%56 = load i32, i32* @stderr
%57 = load i8*, i8** %1
%58 = call i8* @gai_strerror(i32 %50)
%59 = call i32 @fprintf(i32 %56, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %57, i8* %58)
%60 = load %struct.addrinfo*, %struct.addrinfo** %4
%61 = icmp eq %struct.addrinfo* %60, null
br i1 %61, label %64, label %62
62: ; preds = %55
%63 = call i32 @freeaddrinfo(%struct.addrinfo* %60)
br label %64
64: ; preds = %62, %55
%65 = load i32, i32* @EXIT_FAILURE
%66 = call i32 @exit(i32 %65)
unreachable
67: ; preds = %52, %87
%68 = phi %struct.addrinfo* [ %90, %87 ], [ %53, %52 ]
%69 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %68, i64 0, i32 1
%70 = load i32*, i32** %69
%71 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %68, i64 0, i32 0
%72 = load i32, i32* %71
%73 = load i32, i32* @NI_NUMERICHOST
%74 = load i32, i32* @NI_NUMERICSERV
%75 = or i32 %74, %73
%76 = call i32 @getnameinfo(i32* %70, i32 %72, i8* %8, i32 40, i32* null, i32 0, i32 %75)
%77 = icmp eq i32 %76, 0
br i1 %77, label %87, label %78
78: ; preds = %67
%79 = load i32, i32* @stderr
%80 = load i8*, i8** %1
%81 = call i8* @gai_strerror(i32 %76)
%82 = call i32 @fprintf(i32 %79, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %80, i8* %81)
%83 = load %struct.addrinfo*, %struct.addrinfo** %4
%84 = call i32 @freeaddrinfo(%struct.addrinfo* %83)
%85 = load i32, i32* @EXIT_FAILURE
%86 = call i32 @exit(i32 %85)
unreachable
87: ; preds = %67
%88 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %8)
%89 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %68, i64 0, i32 2
%90 = load %struct.addrinfo*, %struct.addrinfo** %89
%91 = icmp eq %struct.addrinfo* %90, null
br i1 %91, label %92, label %67
92: ; preds = %87
%93 = load %struct.addrinfo*, %struct.addrinfo** %4
br label %94
94: ; preds = %92, %52
%95 = phi %struct.addrinfo* [ %93, %92 ], [ null, %52 ]
%96 = call i32 @freeaddrinfo(%struct.addrinfo* %95)
%97 = load i32, i32* @EXIT_SUCCESS
ret i32 %97
}