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

/* Forward declarations */

/* Type definitions */
struct sockaddr_in6 {
  int /*<<< orphan*/ sin6_port;
  int /*<<< orphan*/ sin6_addr;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_addr;
};
struct addrinfo {
  int ai_family;
  int ai_socktype;
  int ai_flags;
  int ai_protocol;
  char *ai_canonname;
  scalar_t__ ai_addr;
};

/* Variables and functions */
#define AF_INET 135
#define AF_INET6 134
#define AF_UNIX 133
int AI_ALL;
int AI_CANONNAME;
int AI_NUMERICHOST;
int AI_NUMERICSERV;
int AI_PASSIVE;
int INET6_ADDRSTRLEN;
int INET_ADDRSTRLEN;
#define IPPROTO_RAW 132
#define IPPROTO_TCP 131
#define IPPROTO_UDP 130
#define SOCK_DGRAM 129
#define SOCK_STREAM 128
char *inet_ntop(int const, int /*<<< orphan*/ *, char *, int);
int ntohs(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
void pr_addrinfo(struct addrinfo *ai) {
  printf("Family: ");
  switch (ai->ai_family) {
  case AF_INET:
    printf("AF_INET");
    break;
  case AF_INET6:
    printf("AF_INET6");
    break;
  case AF_UNIX:
    printf("AF_UNIX");
    break;
  default:
    printf("*other*");
    break;
  }
  printf(", Type: ");
  switch (ai->ai_socktype) {
  case SOCK_STREAM:
    printf("STREAM");
    break;
  case SOCK_DGRAM:
    printf("DGRAM");
    break;
  default:
    printf("*other*");
    break;
  }
  printf(", Flags: ");
  if (ai->ai_flags == 0)
    printf(" 0");
  else {
    if (ai->ai_flags & AI_PASSIVE)
      printf(" PASSIVE");
    if (ai->ai_flags & AI_CANONNAME)
      printf(" CANON");
    if (ai->ai_flags & AI_NUMERICHOST)
      printf(" numhost");
    if (ai->ai_flags & AI_NUMERICSERV)
      printf(" numserv");
    if (ai->ai_flags & AI_ALL)
      printf(" ALL");
  }
  printf(", Protocol: ");
  switch (ai->ai_protocol) {
  case 0:
    printf(" default");
    break;
  case IPPROTO_TCP:
    printf(" TCP");
    break;
  case IPPROTO_UDP:
    printf(" UDP");
    break;
  case IPPROTO_RAW:
    printf(" RAW");
    break;
  default:
    printf(" *unknown-%d*", ai->ai_protocol);
    break;
  }
  printf(", Host: %s", ai->ai_canonname ? ai->ai_canonname : "-");
  char *addr;
  char abuff[INET6_ADDRSTRLEN];
  if (AF_INET == ai->ai_family) {
    struct sockaddr_in *sin;
    sin = (struct sockaddr_in *)ai->ai_addr;
    addr = inet_ntop(AF_INET, &sin->sin_addr, abuff, INET_ADDRSTRLEN);
    printf(", IPv4 Address: %s", addr ? addr : "*unkown*");
    printf(", Port: %d", ntohs(sin->sin_port));
  } else if (AF_INET6 == ai->ai_family) {
    struct sockaddr_in6 *sin6;
    sin6 = (struct sockaddr_in6 *)ai->ai_addr;
    addr = inet_ntop(AF_INET6, &sin6->sin6_addr, abuff, INET6_ADDRSTRLEN);
    printf(", IPv6 Address: %s", addr ? addr : "*unknown*");
    printf(", Port: %d", ntohs(sin6->sin6_port));
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<pr_addrinfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xebd(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
sub    $0x85,%eax
je     11af <pr_addrinfo+0x7f>
jmp    1163 <pr_addrinfo+0x33>
mov    -0x34(%rbp),%eax
sub    $0x86,%eax
je     119c <pr_addrinfo+0x6c>
jmp    1176 <pr_addrinfo+0x46>
mov    -0x34(%rbp),%eax
sub    $0x87,%eax
jne    11c2 <pr_addrinfo+0x92>
jmp    1189 <pr_addrinfo+0x59>
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11d0 <pr_addrinfo+0xa0>
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11d0 <pr_addrinfo+0xa0>
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11d0 <pr_addrinfo+0xa0>
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe53(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x38(%rbp)
sub    $0x80,%eax
je     120b <pr_addrinfo+0xdb>
jmp    11f8 <pr_addrinfo+0xc8>
mov    -0x38(%rbp),%eax
sub    $0x81,%eax
je     121e <pr_addrinfo+0xee>
jmp    1231 <pr_addrinfo+0x101>
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    123f <pr_addrinfo+0x10f>
lea    0xe15(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    123f <pr_addrinfo+0x10f>
lea    0xdea(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdfa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
cmpl   $0x0,0x8(%rax)
jne    126e <pr_addrinfo+0x13e>
lea    0xde8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1336 <pr_addrinfo+0x206>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%eax
mov    0x2d5c(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1295 <pr_addrinfo+0x165>
lea    0xdbf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%eax
mov    0x2d25(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     12bc <pr_addrinfo+0x18c>
lea    0xda1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%eax
mov    0x2d06(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     12e3 <pr_addrinfo+0x1b3>
lea    0xd81(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%eax
mov    0x2d07(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     130a <pr_addrinfo+0x1da>
lea    0xd63(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%eax
mov    0x2ca0(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1331 <pr_addrinfo+0x201>
lea    0xd45(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1336 <pr_addrinfo+0x206>
lea    0xd37(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%eax
mov    %eax,-0x3c(%rbp)
test   %eax,%eax
je     1394 <pr_addrinfo+0x264>
jmp    135b <pr_addrinfo+0x22b>
mov    -0x3c(%rbp),%eax
sub    $0x82,%eax
je     13ba <pr_addrinfo+0x28a>
jmp    136e <pr_addrinfo+0x23e>
mov    -0x3c(%rbp),%eax
sub    $0x83,%eax
je     13a7 <pr_addrinfo+0x277>
jmp    1381 <pr_addrinfo+0x251>
mov    -0x3c(%rbp),%eax
sub    $0x84,%eax
je     13cd <pr_addrinfo+0x29d>
jmp    13e0 <pr_addrinfo+0x2b0>
lea    0xce6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    13f5 <pr_addrinfo+0x2c5>
lea    0xcdc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    13f5 <pr_addrinfo+0x2c5>
lea    0xcce(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    13f5 <pr_addrinfo+0x2c5>
lea    0xcc0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    13f5 <pr_addrinfo+0x2c5>
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%esi
lea    0xcab(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
cmpq   $0x0,0x10(%rax)
je     1415 <pr_addrinfo+0x2e5>
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x48(%rbp)
jmp    1425 <pr_addrinfo+0x2f5>
lea    0xc96(%rip),%rax
mov    %rax,-0x48(%rbp)
jmp    1425 <pr_addrinfo+0x2f5>
mov    -0x48(%rbp),%rsi
lea    0xc77(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2ba2(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rcx
mov    $0x87,%eax
cmp    (%rcx),%eax
jne    14fd <pr_addrinfo+0x3cd>
mov    -0x50(%rbp),%rdx
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
add    $0x4,%rsi
mov    0x2b1d(%rip),%rax
mov    (%rax),%ecx
mov    $0x87,%edi
call   1030 <inet_ntop@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     14bb <pr_addrinfo+0x38b>
mov    -0x10(%rbp),%rax
mov    %rax,-0x58(%rbp)
jmp    14cb <pr_addrinfo+0x39b>
lea    0xc05(%rip),%rax
mov    %rax,-0x58(%rbp)
jmp    14cb <pr_addrinfo+0x39b>
mov    -0x58(%rbp),%rsi
lea    0xbde(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%rax
mov    (%rax),%edi
call   1050 <ntohs@plt>
mov    %eax,%esi
lea    0xbdf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1597 <pr_addrinfo+0x467>
mov    -0x8(%rbp),%rcx
mov    $0x86,%eax
cmp    (%rcx),%eax
jne    1592 <pr_addrinfo+0x462>
mov    -0x50(%rbp),%rdx
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rsi
add    $0x4,%rsi
mov    0x2ab3(%rip),%rax
mov    (%rax),%ecx
mov    $0x86,%edi
call   1030 <inet_ntop@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1555 <pr_addrinfo+0x425>
mov    -0x10(%rbp),%rax
mov    %rax,-0x60(%rbp)
jmp    1565 <pr_addrinfo+0x435>
lea    0xb92(%rip),%rax
mov    %rax,-0x60(%rbp)
jmp    1565 <pr_addrinfo+0x435>
mov    -0x60(%rbp),%rsi
lea    0xb6b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%rax
mov    (%rax),%edi
call   1050 <ntohs@plt>
mov    %eax,%esi
lea    0xb45(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1597 <pr_addrinfo+0x467>
lea    0xb5a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pr_addrinfo>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
mov    %rdi,%r14
lea    0xeaf(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xffffff7b,%eax
add    (%r14),%eax
lea    0xebb(%rip),%rbx
mov    %rbx,%rdi
cmp    $0x2,%eax
ja     117f <pr_addrinfo+0x3f>
cltq
lea    0xf80(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe9d(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%r14),%eax
cmp    $0x81,%eax
lea    0xe96(%rip),%rcx
cmove  %rcx,%rbx
cmp    $0x80,%eax
lea    0xe7f(%rip),%rdi
cmovne %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe7a(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%r14),%eax
test   %eax,%eax
je     1261 <pr_addrinfo+0x121>
mov    0x2df8(%rip),%rcx
test   %eax,(%rcx)
je     11f6 <pr_addrinfo+0xb6>
lea    0xe62(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%r14),%eax
mov    0x2dcb(%rip),%rcx
test   %eax,(%rcx)
je     1213 <pr_addrinfo+0xd3>
lea    0xe4e(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%r14),%eax
mov    0x2db6(%rip),%rcx
test   %eax,(%rcx)
je     1230 <pr_addrinfo+0xf0>
lea    0xe38(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%r14),%eax
mov    0x2dc1(%rip),%rcx
test   %eax,(%rcx)
je     124d <pr_addrinfo+0x10d>
lea    0xe24(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%r14),%eax
mov    0x2d64(%rip),%rcx
test   %eax,(%rcx)
je     126f <pr_addrinfo+0x12f>
lea    0xe10(%rip),%rdi
jmp    1268 <pr_addrinfo+0x128>
lea    0xde2(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xdfe(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%r14),%esi
cmp    $0x82,%esi
jg     129e <pr_addrinfo+0x15e>
test   %esi,%esi
je     12c7 <pr_addrinfo+0x187>
cmp    $0x82,%esi
jne    12b7 <pr_addrinfo+0x177>
lea    0xdf3(%rip),%rdi
jmp    12d7 <pr_addrinfo+0x197>
cmp    $0x83,%esi
je     12d0 <pr_addrinfo+0x190>
cmp    $0x84,%esi
jne    12b7 <pr_addrinfo+0x177>
lea    0xddf(%rip),%rdi
jmp    12d7 <pr_addrinfo+0x197>
lea    0xddb(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    12de <pr_addrinfo+0x19e>
lea    0xdb3(%rip),%rdi
jmp    12d7 <pr_addrinfo+0x197>
lea    0xdb3(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%r14),%rax
test   %rax,%rax
lea    0xdc6(%rip),%rsi
cmovne %rax,%rsi
lea    0xdb0(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2cdb(%rip),%rax
mov    (%rax),%ecx
mov    %rsp,%rdx
lea    0xf(%rcx),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rdx
mov    %rdx,%rsp
mov    (%r14),%eax
cmp    $0x86,%eax
je     135b <pr_addrinfo+0x21b>
cmp    $0x87,%eax
jne    13a0 <pr_addrinfo+0x260>
mov    0x18(%r14),%rbx
lea    0x4(%rbx),%rsi
mov    0x2c78(%rip),%rax
mov    (%rax),%ecx
mov    $0x87,%edi
call   1030 <inet_ntop@plt>
test   %rax,%rax
lea    0xd79(%rip),%rsi
cmovne %rax,%rsi
lea    0xd5b(%rip),%rdi
jmp    1382 <pr_addrinfo+0x242>
mov    0x18(%r14),%rbx
lea    0x4(%rbx),%rsi
mov    $0x86,%edi
call   1030 <inet_ntop@plt>
test   %rax,%rax
lea    0xd77(%rip),%rsi
cmovne %rax,%rsi
lea    0xd59(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rbx),%edi
call   1060 <ntohs@plt>
lea    0xd39(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    -0x10(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.addrinfo = type { i32, i32, i32, i32, i8*, i64 }
%struct.sockaddr_in = type { i32, i32 }
%struct.sockaddr_in6 = type { i32, i32 }
@.str = [9 x i8] c"Family: \00"
@.str.1 = [8 x i8] c"AF_INET\00"
@.str.2 = [9 x i8] c"AF_INET6\00"
@.str.3 = [8 x i8] c"AF_UNIX\00"
@.str.4 = [8 x i8] c"*other*\00"
@.str.5 = [9 x i8] c", Type: \00"
@.str.6 = [7 x i8] c"STREAM\00"
@.str.7 = [6 x i8] c"DGRAM\00"
@.str.8 = [10 x i8] c", Flags: \00"
@.str.9 = [3 x i8] c" 0\00"
@AI_PASSIVE = global i32 0
@.str.10 = [9 x i8] c" PASSIVE\00"
@AI_CANONNAME = global i32 0
@.str.11 = [7 x i8] c" CANON\00"
@AI_NUMERICHOST = global i32 0
@.str.12 = [9 x i8] c" numhost\00"
@AI_NUMERICSERV = global i32 0
@.str.13 = [9 x i8] c" numserv\00"
@AI_ALL = global i32 0
@.str.14 = [5 x i8] c" ALL\00"
@.str.15 = [13 x i8] c", Protocol: \00"
@.str.16 = [9 x i8] c" default\00"
@.str.17 = [5 x i8] c" TCP\00"
@.str.18 = [5 x i8] c" UDP\00"
@.str.19 = [5 x i8] c" RAW\00"
@.str.20 = [14 x i8] c" *unknown-%d*\00"
@.str.21 = [11 x i8] c", Host: %s\00"
@.str.22 = [2 x i8] c"-\00"
@INET6_ADDRSTRLEN = global i32 0
@INET_ADDRSTRLEN = global i32 0
@.str.23 = [19 x i8] c", IPv4 Address: %s\00"
@.str.24 = [9 x i8] c"*unkown*\00"
@.str.25 = [11 x i8] c", Port: %d\00"
@.str.26 = [19 x i8] c", IPv6 Address: %s\00"
@.str.27 = [10 x i8] c"*unknown*\00"
@.str.28 = [2 x i8] c"\0A\00"
define void @pr_addrinfo(%struct.addrinfo* %0) {
%2 = alloca %struct.addrinfo*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
%6 = alloca %struct.sockaddr_in*
%7 = alloca %struct.sockaddr_in6*
store %struct.addrinfo* %0, %struct.addrinfo** %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%9 = load %struct.addrinfo*, %struct.addrinfo** %2
%10 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %9, i32 0, i32 0
%11 = load i32, i32* %10
switch i32 %11, label %18 [
i32 135, label %12
i32 134, label %14
i32 133, label %16
]
12: ; preds = %1
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %20
14: ; preds = %1
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %20
16: ; preds = %1
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
br label %20
18: ; preds = %1
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
br label %20
20: ; preds = %18, %16, %14, %12
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%22 = load %struct.addrinfo*, %struct.addrinfo** %2
%23 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %22, i32 0, i32 1
%24 = load i32, i32* %23
switch i32 %24, label %29 [
i32 128, label %25
i32 129, label %27
]
25: ; preds = %20
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
br label %31
27: ; preds = %20
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
br label %31
29: ; preds = %20
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
br label %31
31: ; preds = %29, %27, %25
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
%33 = load %struct.addrinfo*, %struct.addrinfo** %2
%34 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %33, i32 0, i32 2
%35 = load i32, i32* %34
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %31
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
br label %85
39: ; preds = %31
%40 = load %struct.addrinfo*, %struct.addrinfo** %2
%41 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %40, i32 0, i32 2
%42 = load i32, i32* %41
%43 = load i32, i32* @AI_PASSIVE
%44 = and i32 %42, %43
%45 = icmp ne i32 %44, 0
br i1 %45, label %46, label %48
46: ; preds = %39
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0))
br label %48
48: ; preds = %46, %39
%49 = load %struct.addrinfo*, %struct.addrinfo** %2
%50 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %49, i32 0, i32 2
%51 = load i32, i32* %50
%52 = load i32, i32* @AI_CANONNAME
%53 = and i32 %51, %52
%54 = icmp ne i32 %53, 0
br i1 %54, label %55, label %57
55: ; preds = %48
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0))
br label %57
57: ; preds = %55, %48
%58 = load %struct.addrinfo*, %struct.addrinfo** %2
%59 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %58, i32 0, i32 2
%60 = load i32, i32* %59
%61 = load i32, i32* @AI_NUMERICHOST
%62 = and i32 %60, %61
%63 = icmp ne i32 %62, 0
br i1 %63, label %64, label %66
64: ; preds = %57
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0))
br label %66
66: ; preds = %64, %57
%67 = load %struct.addrinfo*, %struct.addrinfo** %2
%68 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %67, i32 0, i32 2
%69 = load i32, i32* %68
%70 = load i32, i32* @AI_NUMERICSERV
%71 = and i32 %69, %70
%72 = icmp ne i32 %71, 0
br i1 %72, label %73, label %75
73: ; preds = %66
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.13, i64 0, i64 0))
br label %75
75: ; preds = %73, %66
%76 = load %struct.addrinfo*, %struct.addrinfo** %2
%77 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %76, i32 0, i32 2
%78 = load i32, i32* %77
%79 = load i32, i32* @AI_ALL
%80 = and i32 %78, %79
%81 = icmp ne i32 %80, 0
br i1 %81, label %82, label %84
82: ; preds = %75
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0))
br label %84
84: ; preds = %82, %75
br label %85
85: ; preds = %84, %37
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.15, i64 0, i64 0))
%87 = load %struct.addrinfo*, %struct.addrinfo** %2
%88 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %87, i32 0, i32 3
%89 = load i32, i32* %88
switch i32 %89, label %98 [
i32 0, label %90
i32 131, label %92
i32 130, label %94
i32 132, label %96
]
90: ; preds = %85
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.16, i64 0, i64 0))
br label %103
92: ; preds = %85
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i64 0, i64 0))
br label %103
94: ; preds = %85
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0))
br label %103
96: ; preds = %85
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0))
br label %103
98: ; preds = %85
%99 = load %struct.addrinfo*, %struct.addrinfo** %2
%100 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %99, i32 0, i32 3
%101 = load i32, i32* %100
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.20, i64 0, i64 0), i32 %101)
br label %103
103: ; preds = %98, %96, %94, %92, %90
%104 = load %struct.addrinfo*, %struct.addrinfo** %2
%105 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %104, i32 0, i32 4
%106 = load i8*, i8** %105
%107 = icmp ne i8* %106, null
br i1 %107, label %108, label %112
108: ; preds = %103
%109 = load %struct.addrinfo*, %struct.addrinfo** %2
%110 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %109, i32 0, i32 4
%111 = load i8*, i8** %110
br label %113
112: ; preds = %103
br label %113
113: ; preds = %112, %108
%114 = phi i8* [ %111, %108 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.22, i64 0, i64 0), %112 ]
%115 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.21, i64 0, i64 0), i8* %114)
%116 = load i32, i32* @INET6_ADDRSTRLEN
%117 = zext i32 %116 to i64
%118 = call i8* @llvm.stacksave()
store i8* %118, i8** %4
%119 = alloca i8, i64 %117
store i64 %117, i64* %5
%120 = load %struct.addrinfo*, %struct.addrinfo** %2
%121 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %120, i32 0, i32 0
%122 = load i32, i32* %121
%123 = icmp eq i32 135, %122
br i1 %123, label %124, label %146
124: ; preds = %113
%125 = load %struct.addrinfo*, %struct.addrinfo** %2
%126 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %125, i32 0, i32 5
%127 = load i64, i64* %126
%128 = inttoptr i64 %127 to %struct.sockaddr_in*
store %struct.sockaddr_in* %128, %struct.sockaddr_in** %6
%129 = load %struct.sockaddr_in*, %struct.sockaddr_in** %6
%130 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %129, i32 0, i32 1
%131 = load i32, i32* @INET_ADDRSTRLEN
%132 = call i8* @inet_ntop(i32 135, i32* %130, i8* %119, i32 %131)
store i8* %132, i8** %3
%133 = load i8*, i8** %3
%134 = icmp ne i8* %133, null
br i1 %134, label %135, label %137
135: ; preds = %124
%136 = load i8*, i8** %3
br label %138
137: ; preds = %124
br label %138
138: ; preds = %137, %135
%139 = phi i8* [ %136, %135 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0), %137 ]
%140 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.23, i64 0, i64 0), i8* %139)
%141 = load %struct.sockaddr_in*, %struct.sockaddr_in** %6
%142 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %141, i32 0, i32 0
%143 = load i32, i32* %142
%144 = call i32 @ntohs(i32 %143)
%145 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.25, i64 0, i64 0), i32 %144)
br label %174
146: ; preds = %113
%147 = load %struct.addrinfo*, %struct.addrinfo** %2
%148 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %147, i32 0, i32 0
%149 = load i32, i32* %148
%150 = icmp eq i32 134, %149
br i1 %150, label %151, label %173
151: ; preds = %146
%152 = load %struct.addrinfo*, %struct.addrinfo** %2
%153 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %152, i32 0, i32 5
%154 = load i64, i64* %153
%155 = inttoptr i64 %154 to %struct.sockaddr_in6*
store %struct.sockaddr_in6* %155, %struct.sockaddr_in6** %7
%156 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %7
%157 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %156, i32 0, i32 1
%158 = load i32, i32* @INET6_ADDRSTRLEN
%159 = call i8* @inet_ntop(i32 134, i32* %157, i8* %119, i32 %158)
store i8* %159, i8** %3
%160 = load i8*, i8** %3
%161 = icmp ne i8* %160, null
br i1 %161, label %162, label %164
162: ; preds = %151
%163 = load i8*, i8** %3
br label %165
164: ; preds = %151
br label %165
165: ; preds = %164, %162
%166 = phi i8* [ %163, %162 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.27, i64 0, i64 0), %164 ]
%167 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.26, i64 0, i64 0), i8* %166)
%168 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %7
%169 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %168, i32 0, i32 0
%170 = load i32, i32* %169
%171 = call i32 @ntohs(i32 %170)
%172 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.25, i64 0, i64 0), i32 %171)
br label %173
173: ; preds = %165, %146
br label %174
174: ; preds = %173, %138
%175 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.28, i64 0, i64 0))
%176 = load i8*, i8** %4
ret void
}

LLVM IR (-O2):
%struct.addrinfo = type { i32, i32, i32, i32, i8*, i64 }
%struct.sockaddr_in = type { i32, i32 }
%struct.sockaddr_in6 = type { i32, i32 }
@.str = [9 x i8] c"Family: \00"
@.str.1 = [8 x i8] c"AF_INET\00"
@.str.2 = [9 x i8] c"AF_INET6\00"
@.str.3 = [8 x i8] c"AF_UNIX\00"
@.str.4 = [8 x i8] c"*other*\00"
@.str.5 = [9 x i8] c", Type: \00"
@.str.6 = [7 x i8] c"STREAM\00"
@.str.7 = [6 x i8] c"DGRAM\00"
@.str.8 = [10 x i8] c", Flags: \00"
@.str.9 = [3 x i8] c" 0\00"
@AI_PASSIVE = global i32 0
@.str.10 = [9 x i8] c" PASSIVE\00"
@AI_CANONNAME = global i32 0
@.str.11 = [7 x i8] c" CANON\00"
@AI_NUMERICHOST = global i32 0
@.str.12 = [9 x i8] c" numhost\00"
@AI_NUMERICSERV = global i32 0
@.str.13 = [9 x i8] c" numserv\00"
@AI_ALL = global i32 0
@.str.14 = [5 x i8] c" ALL\00"
@.str.15 = [13 x i8] c", Protocol: \00"
@.str.16 = [9 x i8] c" default\00"
@.str.17 = [5 x i8] c" TCP\00"
@.str.18 = [5 x i8] c" UDP\00"
@.str.19 = [5 x i8] c" RAW\00"
@.str.20 = [14 x i8] c" *unknown-%d*\00"
@.str.21 = [11 x i8] c", Host: %s\00"
@.str.22 = [2 x i8] c"-\00"
@INET6_ADDRSTRLEN = global i32 0
@INET_ADDRSTRLEN = global i32 0
@.str.23 = [19 x i8] c", IPv4 Address: %s\00"
@.str.24 = [9 x i8] c"*unkown*\00"
@.str.25 = [11 x i8] c", Port: %d\00"
@.str.26 = [19 x i8] c", IPv6 Address: %s\00"
@.str.27 = [10 x i8] c"*unknown*\00"
@reltable.pr_addrinfo = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.3 to i64), i64 ptrtoint ([3 x i32]* @reltable.pr_addrinfo to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.2 to i64), i64 ptrtoint ([3 x i32]* @reltable.pr_addrinfo to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.1 to i64), i64 ptrtoint ([3 x i32]* @reltable.pr_addrinfo to i64)) to i32)]
define void @pr_addrinfo(%struct.addrinfo* nocapture %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%3 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %0, i64 0, i32 0
%4 = load i32, i32* %3
%5 = add i32 %4, -133
%6 = icmp ult i32 %5, 3
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = sext i32 %5 to i64
%9 = shl i64 %8, 2
%10 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.pr_addrinfo to i8*), i64 %9)
br label %11
11: ; preds = %1, %7
%12 = phi i8* [ %10, %7 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), %1 ]
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %12)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%15 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %0, i64 0, i32 1
%16 = load i32, i32* %15
%17 = icmp eq i32 %16, 129
%18 = select i1 %17, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0)
%19 = icmp eq i32 %16, 128
%20 = select i1 %19, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %18
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %20)
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
%23 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %0, i64 0, i32 2
%24 = load i32, i32* %23
%25 = icmp eq i32 %24, 0
br i1 %25, label %62, label %26
26: ; preds = %11
%27 = load i32, i32* @AI_PASSIVE
%28 = and i32 %27, %24
%29 = icmp eq i32 %28, 0
br i1 %29, label %33, label %30
30: ; preds = %26
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0))
%32 = load i32, i32* %23
br label %33
33: ; preds = %30, %26
%34 = phi i32 [ %32, %30 ], [ %24, %26 ]
%35 = load i32, i32* @AI_CANONNAME
%36 = and i32 %35, %34
%37 = icmp eq i32 %36, 0
br i1 %37, label %41, label %38
38: ; preds = %33
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0))
%40 = load i32, i32* %23
br label %41
41: ; preds = %38, %33
%42 = phi i32 [ %40, %38 ], [ %34, %33 ]
%43 = load i32, i32* @AI_NUMERICHOST
%44 = and i32 %43, %42
%45 = icmp eq i32 %44, 0
br i1 %45, label %49, label %46
46: ; preds = %41
%47 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0))
%48 = load i32, i32* %23
br label %49
49: ; preds = %46, %41
%50 = phi i32 [ %48, %46 ], [ %42, %41 ]
%51 = load i32, i32* @AI_NUMERICSERV
%52 = and i32 %51, %50
%53 = icmp eq i32 %52, 0
br i1 %53, label %57, label %54
54: ; preds = %49
%55 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.13, i64 0, i64 0))
%56 = load i32, i32* %23
br label %57
57: ; preds = %54, %49
%58 = phi i32 [ %56, %54 ], [ %50, %49 ]
%59 = load i32, i32* @AI_ALL
%60 = and i32 %59, %58
%61 = icmp eq i32 %60, 0
br i1 %61, label %65, label %62
62: ; preds = %57, %11
%63 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), %11 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0), %57 ]
%64 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %63)
br label %65
65: ; preds = %62, %57
%66 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.15, i64 0, i64 0))
%67 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %0, i64 0, i32 3
%68 = load i32, i32* %67
switch i32 %68, label %77 [
i32 0, label %69
i32 131, label %71
i32 130, label %73
i32 132, label %75
]
69: ; preds = %65
%70 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.16, i64 0, i64 0))
br label %79
71: ; preds = %65
%72 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i64 0, i64 0))
br label %79
73: ; preds = %65
%74 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0))
br label %79
75: ; preds = %65
%76 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0))
br label %79
77: ; preds = %65
%78 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.20, i64 0, i64 0), i32 %68)
br label %79
79: ; preds = %77, %75, %73, %71, %69
%80 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %0, i64 0, i32 4
%81 = load i8*, i8** %80
%82 = icmp eq i8* %81, null
%83 = select i1 %82, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.22, i64 0, i64 0), i8* %81
%84 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.21, i64 0, i64 0), i8* %83)
%85 = load i32, i32* @INET6_ADDRSTRLEN
%86 = zext i32 %85 to i64
%87 = alloca i8, i64 %86
%88 = load i32, i32* %3
switch i32 %88, label %115 [
i32 135, label %89
i32 134, label %100
]
89: ; preds = %79
%90 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %0, i64 0, i32 5
%91 = load i64, i64* %90
%92 = inttoptr i64 %91 to %struct.sockaddr_in*
%93 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %92, i64 0, i32 1
%94 = load i32, i32* @INET_ADDRSTRLEN
%95 = call i8* @inet_ntop(i32 135, i32* %93, i8* %87, i32 %94)
%96 = icmp eq i8* %95, null
%97 = select i1 %96, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0), i8* %95
%98 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.23, i64 0, i64 0), i8* %97)
%99 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %92, i64 0, i32 0
br label %110
100: ; preds = %79
%101 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %0, i64 0, i32 5
%102 = load i64, i64* %101
%103 = inttoptr i64 %102 to %struct.sockaddr_in6*
%104 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %103, i64 0, i32 1
%105 = call i8* @inet_ntop(i32 134, i32* %104, i8* %87, i32 %85)
%106 = icmp eq i8* %105, null
%107 = select i1 %106, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.27, i64 0, i64 0), i8* %105
%108 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.26, i64 0, i64 0), i8* %107)
%109 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %103, i64 0, i32 0
br label %110
110: ; preds = %89, %100
%111 = phi i32* [ %109, %100 ], [ %99, %89 ]
%112 = load i32, i32* %111
%113 = call i32 @ntohs(i32 %112)
%114 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.25, i64 0, i64 0), i32 %113)
br label %115
115: ; preds = %110, %79
%116 = call i32 @putchar(i32 10)
ret void
}