#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct sockaddr_in6 {
  int dummy;
};
struct sockaddr_in {
  int dummy;
};
struct rtnl_link_stats {
  int tx_packets;
  int rx_packets;
  int tx_bytes;
  int rx_bytes;
};
struct ifaddrs {
  char *ifa_name;
  struct rtnl_link_stats *ifa_data;
  TYPE_1__ *ifa_addr;
  struct ifaddrs *ifa_next;
};
struct TYPE_2__ {
  int sa_family;
};

/* Variables and functions */
int AF_INET;
int AF_INET6;
int AF_PACKET;
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int NI_MAXHOST;
int /*<<< orphan*/ NI_NUMERICHOST;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ freeifaddrs(struct ifaddrs *);
char *gai_strerror(int);
int getifaddrs(struct ifaddrs **);
int getnameinfo(TYPE_1__ *, int, char *, int, int /*<<< orphan*/ *,
                int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  struct ifaddrs *ifaddr, *ifa;
  int family, s, n;
  char host[NI_MAXHOST];
  if (getifaddrs(&ifaddr) == -1) {
    perror("getifaddrs");
    exit(EXIT_FAILURE);
  }
  for (ifa = ifaddr, n = 0; ifa != NULL; ifa = ifa->ifa_next, n++) {
    if (ifa->ifa_addr == NULL)
      continue;
    family = ifa->ifa_addr->sa_family;
    printf("%-8s %s (%d)\n", ifa->ifa_name,
           (family == AF_PACKET)  ? "AF_PACKET"
           : (family == AF_INET)  ? "AF_INET"
           : (family == AF_INET6) ? "AF_INET6"
                                  : "???",
           family);
    if (family == AF_INET || family == AF_INET6) {
      s = getnameinfo(ifa->ifa_addr,
                      (family == AF_INET) ? sizeof(struct sockaddr_in)
                                          : sizeof(struct sockaddr_in6),
                      host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST);
      if (s != 0) {
        printf("getnameinfo() failed: %s\n", gai_strerror(s));
        exit(EXIT_FAILURE);
      }
      printf("\t\taddress: <%s>\n", host);
    } else if (family == AF_PACKET && ifa->ifa_data != NULL) {
      struct rtnl_link_stats *stats = ifa->ifa_data;
      printf("\t\ttx_packets = %10u; rx_packets = %10u\n"
             "\t\ttx_bytes   = %10u; rx_bytes   = %10u\n",
             stats->tx_packets, stats->rx_packets, stats->tx_bytes,
             stats->rx_bytes);
    }
  }
  freeifaddrs(ifaddr);
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e23(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x38(%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,-0x40(%rbp)
lea    -0x18(%rbp),%rdi
call   1060 <getifaddrs@plt>
cmp    $0xffffffff,%eax
jne    11de <main+0x6e>
lea    0xe35(%rip),%rdi
call   1080 <perror@plt>
mov    0x2de9(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     13e4 <main+0x274>
mov    -0x20(%rbp),%rax
cmpq   $0x0,0x10(%rax)
jne    120c <main+0x9c>
jmp    13ca <main+0x25a>
mov    -0x20(%rbp),%rax
mov    0x10(%rax),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x58(%rbp)
mov    -0x24(%rbp),%eax
mov    0x2da2(%rip),%rcx
cmp    (%rcx),%eax
jne    1246 <main+0xd6>
lea    0xddc(%rip),%rax
mov    %rax,-0x60(%rbp)
jmp    1294 <main+0x124>
mov    -0x24(%rbp),%eax
mov    0x2d98(%rip),%rcx
cmp    (%rcx),%eax
jne    1268 <main+0xf8>
lea    0xdc4(%rip),%rax
mov    %rax,-0x68(%rbp)
jmp    128c <main+0x11c>
mov    -0x24(%rbp),%edx
mov    0x2d6e(%rip),%rax
mov    (%rax),%esi
lea    0xdb9(%rip),%rax
lea    0xda9(%rip),%rcx
cmp    %esi,%edx
cmove  %rcx,%rax
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x58(%rbp),%rsi
mov    -0x60(%rbp),%rdx
mov    -0x24(%rbp),%ecx
lea    0xd65(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
mov    0x2d31(%rip),%rcx
cmp    (%rcx),%eax
je     12d1 <main+0x161>
mov    -0x24(%rbp),%eax
mov    0x2d17(%rip),%rcx
cmp    (%rcx),%eax
jne    1369 <main+0x1f9>
mov    -0x50(%rbp),%rdx
mov    -0x20(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x24(%rbp),%ecx
mov    0x2d01(%rip),%rax
mov    (%rax),%esi
mov    $0x4,%eax
cmp    %esi,%ecx
cmove  %rax,%rax
mov    %eax,%esi
mov    0x2cb3(%rip),%rax
mov    (%rax),%ecx
mov    0x2cc2(%rip),%rax
mov    (%rax),%eax
xor    %r8d,%r8d
xor    %r9d,%r9d
sub    $0x10,%rsp
mov    %eax,(%rsp)
call   1050 <getnameinfo@plt>
add    $0x10,%rsp
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
je     1352 <main+0x1e2>
mov    -0x28(%rbp),%edi
call   1040 <gai_strerror@plt>
mov    %rax,%rsi
lea    0xcfb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2c75(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
mov    -0x50(%rbp),%rsi
lea    0xcf5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    13c5 <main+0x255>
mov    -0x24(%rbp),%eax
mov    0x2c5d(%rip),%rcx
cmp    (%rcx),%eax
jne    13c0 <main+0x250>
mov    -0x20(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     13c0 <main+0x250>
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
mov    (%rax),%esi
mov    -0x48(%rbp),%rax
mov    0x4(%rax),%edx
mov    -0x48(%rbp),%rax
mov    0x8(%rax),%ecx
mov    -0x48(%rbp),%rax
mov    0xc(%rax),%r8d
lea    0xcaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    13c5 <main+0x255>
jmp    13ca <main+0x25a>
mov    -0x20(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11ed <main+0x7d>
mov    -0x18(%rbp),%rdi
call   1070 <freeifaddrs@plt>
mov    0x2bc4(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x2e2b(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r13
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
lea    -0x30(%rbp),%rdi
call   1060 <getifaddrs@plt>
cmp    $0xffffffff,%eax
jne    11c0 <main+0x50>
lea    0xe53(%rip),%rdi
call   1080 <perror@plt>
mov    0x2e07(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
mov    -0x30(%rbp),%r12
test   %r12,%r12
jne    11d0 <main+0x60>
xor    %edi,%edi
jmp    12e1 <main+0x171>
mov    0x2df9(%rip),%r15
mov    0x2e0a(%rip),%r14
jmp    11ee <main+0x7e>
mov    0x18(%r12),%r12
test   %r12,%r12
je     12dd <main+0x16d>
mov    0x10(%r12),%rax
test   %rax,%rax
je     11e0 <main+0x70>
mov    (%rax),%ebx
lea    0xe18(%rip),%rdx
cmp    (%r15),%ebx
je     1230 <main+0xc0>
lea    0xe16(%rip),%rdx
cmp    (%r14),%ebx
je     1230 <main+0xc0>
lea    0xe12(%rip),%rdx
mov    0x2dc0(%rip),%rax
cmp    (%rax),%ebx
je     1230 <main+0xc0>
lea    0xe09(%rip),%rdx
nopl   0x0(%rax,%rax,1)
mov    (%r12),%rsi
lea    0xdd0(%rip),%rdi
mov    %ebx,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
cmp    (%r14),%ebx
je     1290 <main+0x120>
mov    0x2d90(%rip),%rax
cmp    (%rax),%ebx
je     1290 <main+0x120>
cmp    (%r15),%ebx
jne    11e0 <main+0x70>
mov    0x8(%r12),%rax
test   %rax,%rax
je     11e0 <main+0x70>
mov    (%rax),%esi
mov    0x4(%rax),%edx
mov    0x8(%rax),%ecx
mov    0xc(%rax),%r8d
lea    0xde9(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11e0 <main+0x70>
cs nopw 0x0(%rax,%rax,1)
mov    0x10(%r12),%rdi
mov    0x2d14(%rip),%rax
mov    (%rax),%ecx
mov    0x2d23(%rip),%rax
mov    (%rax),%eax
sub    $0x8,%rsp
mov    $0x4,%esi
mov    %r13,%rdx
xor    %r8d,%r8d
xor    %r9d,%r9d
push   %rax
call   1050 <getnameinfo@plt>
add    $0x10,%rsp
test   %eax,%eax
jne    12f4 <main+0x184>
lea    0xd84(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11e0 <main+0x70>
mov    -0x30(%rbp),%rdi
call   1070 <freeifaddrs@plt>
mov    0x2ccb(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
mov    %eax,%edi
call   1040 <gai_strerror@plt>
lea    0xd36(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11b2 <main+0x42>

LLVM IR (-O0):
%struct.ifaddrs = type { i8*, %struct.rtnl_link_stats*, %struct.TYPE_2__*, %struct.ifaddrs* }
%struct.rtnl_link_stats = type { i32, i32, i32, i32 }
%struct.TYPE_2__ = type { i32 }
@NI_MAXHOST = global i32 0
@.str = [11 x i8] c"getifaddrs\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [14 x i8] c"%-8s %s (%d)\0A\00"
@AF_PACKET = global i32 0
@.str.2 = [10 x i8] c"AF_PACKET\00"
@AF_INET = global i32 0
@.str.3 = [8 x i8] c"AF_INET\00"
@AF_INET6 = global i32 0
@.str.4 = [9 x i8] c"AF_INET6\00"
@.str.5 = [4 x i8] c"???\00"
@NI_NUMERICHOST = global i32 0
@.str.6 = [26 x i8] c"getnameinfo() failed: %s\0A\00"
@.str.7 = [17 x i8] c"\09\09address: <%s>\0A\00"
@.str.8 = [79 x i8] c"\09\09tx_packets = %10u; rx_packets = %10u\0A\09\09tx_bytes = %10u; rx_bytes = %10u\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 %struct.ifaddrs*
%7 = alloca %struct.ifaddrs*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i64
%13 = alloca %struct.rtnl_link_stats*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = load i32, i32* @NI_MAXHOST
%15 = zext i32 %14 to i64
%16 = call i8* @llvm.stacksave()
store i8* %16, i8** %11
%17 = alloca i8, i64 %15
store i64 %15, i64* %12
%18 = call i32 @getifaddrs(%struct.ifaddrs** %6)
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %24
20: ; preds = %2
%21 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%22 = load i32, i32* @EXIT_FAILURE
%23 = call i32 @exit(i32 %22)
unreachable
24: ; preds = %2
%25 = load %struct.ifaddrs*, %struct.ifaddrs** %6
store %struct.ifaddrs* %25, %struct.ifaddrs** %7
store i32 0, i32* %10
br label %26
26: ; preds = %123, %24
%27 = load %struct.ifaddrs*, %struct.ifaddrs** %7
%28 = icmp ne %struct.ifaddrs* %27, null
br i1 %28, label %29, label %129
29: ; preds = %26
%30 = load %struct.ifaddrs*, %struct.ifaddrs** %7
%31 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %30, i32 0, i32 2
%32 = load %struct.TYPE_2__*, %struct.TYPE_2__** %31
%33 = icmp eq %struct.TYPE_2__* %32, null
br i1 %33, label %34, label %35
34: ; preds = %29
br label %123
35: ; preds = %29
%36 = load %struct.ifaddrs*, %struct.ifaddrs** %7
%37 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %36, i32 0, i32 2
%38 = load %struct.TYPE_2__*, %struct.TYPE_2__** %37
%39 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %38, i32 0, i32 0
%40 = load i32, i32* %39
store i32 %40, i32* %8
%41 = load %struct.ifaddrs*, %struct.ifaddrs** %7
%42 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %41, i32 0, i32 0
%43 = load i8*, i8** %42
%44 = load i32, i32* %8
%45 = load i32, i32* @AF_PACKET
%46 = icmp eq i32 %44, %45
br i1 %46, label %47, label %48
47: ; preds = %35
br label %61
48: ; preds = %35
%49 = load i32, i32* %8
%50 = load i32, i32* @AF_INET
%51 = icmp eq i32 %49, %50
br i1 %51, label %52, label %53
52: ; preds = %48
br label %59
53: ; preds = %48
%54 = load i32, i32* %8
%55 = load i32, i32* @AF_INET6
%56 = icmp eq i32 %54, %55
%57 = zext i1 %56 to i64
%58 = select i1 %56, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0)
br label %59
59: ; preds = %53, %52
%60 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), %52 ], [ %58, %53 ]
br label %61
61: ; preds = %59, %47
%62 = phi i8* [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), %47 ], [ %60, %59 ]
%63 = load i32, i32* %8
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %43, i8* %62, i32 %63)
%65 = load i32, i32* %8
%66 = load i32, i32* @AF_INET
%67 = icmp eq i32 %65, %66
br i1 %67, label %72, label %68
68: ; preds = %61
%69 = load i32, i32* %8
%70 = load i32, i32* @AF_INET6
%71 = icmp eq i32 %69, %70
br i1 %71, label %72, label %95
72: ; preds = %68, %61
%73 = load %struct.ifaddrs*, %struct.ifaddrs** %7
%74 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %73, i32 0, i32 2
%75 = load %struct.TYPE_2__*, %struct.TYPE_2__** %74
%76 = load i32, i32* %8
%77 = load i32, i32* @AF_INET
%78 = icmp eq i32 %76, %77
%79 = zext i1 %78 to i64
%80 = select i1 %78, i64 4, i64 4
%81 = trunc i64 %80 to i32
%82 = load i32, i32* @NI_MAXHOST
%83 = load i32, i32* @NI_NUMERICHOST
%84 = call i32 @getnameinfo(%struct.TYPE_2__* %75, i32 %81, i8* %17, i32 %82, i32* null, i32 0, i32 %83)
store i32 %84, i32* %9
%85 = load i32, i32* %9
%86 = icmp ne i32 %85, 0
br i1 %86, label %87, label %93
87: ; preds = %72
%88 = load i32, i32* %9
%89 = call i8* @gai_strerror(i32 %88)
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i8* %89)
%91 = load i32, i32* @EXIT_FAILURE
%92 = call i32 @exit(i32 %91)
unreachable
93: ; preds = %72
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i8* %17)
br label %122
95: ; preds = %68
%96 = load i32, i32* %8
%97 = load i32, i32* @AF_PACKET
%98 = icmp eq i32 %96, %97
br i1 %98, label %99, label %121
99: ; preds = %95
%100 = load %struct.ifaddrs*, %struct.ifaddrs** %7
%101 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %100, i32 0, i32 1
%102 = load %struct.rtnl_link_stats*, %struct.rtnl_link_stats** %101
%103 = icmp ne %struct.rtnl_link_stats* %102, null
br i1 %103, label %104, label %121
104: ; preds = %99
%105 = load %struct.ifaddrs*, %struct.ifaddrs** %7
%106 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %105, i32 0, i32 1
%107 = load %struct.rtnl_link_stats*, %struct.rtnl_link_stats** %106
store %struct.rtnl_link_stats* %107, %struct.rtnl_link_stats** %13
%108 = load %struct.rtnl_link_stats*, %struct.rtnl_link_stats** %13
%109 = getelementptr inbounds %struct.rtnl_link_stats, %struct.rtnl_link_stats* %108, i32 0, i32 0
%110 = load i32, i32* %109
%111 = load %struct.rtnl_link_stats*, %struct.rtnl_link_stats** %13
%112 = getelementptr inbounds %struct.rtnl_link_stats, %struct.rtnl_link_stats* %111, i32 0, i32 1
%113 = load i32, i32* %112
%114 = load %struct.rtnl_link_stats*, %struct.rtnl_link_stats** %13
%115 = getelementptr inbounds %struct.rtnl_link_stats, %struct.rtnl_link_stats* %114, i32 0, i32 2
%116 = load i32, i32* %115
%117 = load %struct.rtnl_link_stats*, %struct.rtnl_link_stats** %13
%118 = getelementptr inbounds %struct.rtnl_link_stats, %struct.rtnl_link_stats* %117, i32 0, i32 3
%119 = load i32, i32* %118
%120 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.8, i64 0, i64 0), i32 %110, i32 %113, i32 %116, i32 %119)
br label %121
121: ; preds = %104, %99, %95
br label %122
122: ; preds = %121, %93
br label %123
123: ; preds = %122, %34
%124 = load %struct.ifaddrs*, %struct.ifaddrs** %7
%125 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %124, i32 0, i32 3
%126 = load %struct.ifaddrs*, %struct.ifaddrs** %125
store %struct.ifaddrs* %126, %struct.ifaddrs** %7
%127 = load i32, i32* %10
%128 = add nsw i32 %127, 1
store i32 %128, i32* %10
br label %26
129: ; preds = %26
%130 = load %struct.ifaddrs*, %struct.ifaddrs** %6
%131 = call i32 @freeifaddrs(%struct.ifaddrs* %130)
%132 = load i32, i32* @EXIT_SUCCESS
%133 = call i32 @exit(i32 %132)
unreachable
}

LLVM IR (-O2):
%struct.ifaddrs = type { i8*, %struct.rtnl_link_stats*, %struct.TYPE_2__*, %struct.ifaddrs* }
%struct.rtnl_link_stats = type { i32, i32, i32, i32 }
%struct.TYPE_2__ = type { i32 }
@NI_MAXHOST = global i32 0
@.str = [11 x i8] c"getifaddrs\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [14 x i8] c"%-8s %s (%d)\0A\00"
@AF_PACKET = global i32 0
@.str.2 = [10 x i8] c"AF_PACKET\00"
@AF_INET = global i32 0
@.str.3 = [8 x i8] c"AF_INET\00"
@AF_INET6 = global i32 0
@.str.4 = [9 x i8] c"AF_INET6\00"
@.str.5 = [4 x i8] c"???\00"
@NI_NUMERICHOST = global i32 0
@.str.6 = [26 x i8] c"getnameinfo() failed: %s\0A\00"
@.str.7 = [17 x i8] c"\09\09address: <%s>\0A\00"
@.str.8 = [79 x i8] c"\09\09tx_packets = %10u; rx_packets = %10u\0A\09\09tx_bytes = %10u; rx_bytes = %10u\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.ifaddrs*
%4 = bitcast %struct.ifaddrs** %3 to i8*
%5 = load i32, i32* @NI_MAXHOST
%6 = zext i32 %5 to i64
%7 = alloca i8, i64 %6
%8 = call i32 @getifaddrs(%struct.ifaddrs** %3)
%9 = icmp eq i32 %8, -1
br i1 %9, label %13, label %10
10: ; preds = %2
%11 = load %struct.ifaddrs*, %struct.ifaddrs** %3
%12 = icmp eq %struct.ifaddrs* %11, null
br i1 %12, label %80, label %17
13: ; preds = %2
%14 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%15 = load i32, i32* @EXIT_FAILURE
%16 = call i32 @exit(i32 %15)
unreachable
17: ; preds = %10, %74
%18 = phi %struct.ifaddrs* [ %76, %74 ], [ %11, %10 ]
%19 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %18, i64 0, i32 2
%20 = load %struct.TYPE_2__*, %struct.TYPE_2__** %19
%21 = icmp eq %struct.TYPE_2__* %20, null
br i1 %21, label %74, label %22
22: ; preds = %17
%23 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %20, i64 0, i32 0
%24 = load i32, i32* %23
%25 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %18, i64 0, i32 0
%26 = load i8*, i8** %25
%27 = load i32, i32* @AF_PACKET
%28 = icmp eq i32 %24, %27
br i1 %28, label %36, label %29
29: ; preds = %22
%30 = load i32, i32* @AF_INET
%31 = icmp eq i32 %24, %30
br i1 %31, label %36, label %32
32: ; preds = %29
%33 = load i32, i32* @AF_INET6
%34 = icmp eq i32 %24, %33
%35 = select i1 %34, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0)
br label %36
36: ; preds = %32, %29, %22
%37 = phi i8* [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), %22 ], [ %35, %32 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), %29 ]
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %26, i8* %37, i32 %24)
%39 = load i32, i32* @AF_INET
%40 = icmp eq i32 %24, %39
%41 = load i32, i32* @AF_INET6
%42 = icmp eq i32 %24, %41
%43 = select i1 %40, i1 true, i1 %42
br i1 %43, label %44, label %57
44: ; preds = %36
%45 = load %struct.TYPE_2__*, %struct.TYPE_2__** %19
%46 = load i32, i32* @NI_MAXHOST
%47 = load i32, i32* @NI_NUMERICHOST
%48 = call i32 @getnameinfo(%struct.TYPE_2__* %45, i32 4, i8* %7, i32 %46, i32* null, i32 0, i32 %47)
%49 = icmp eq i32 %48, 0
br i1 %49, label %55, label %50
50: ; preds = %44
%51 = call i8* @gai_strerror(i32 %48)
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i8* %51)
%53 = load i32, i32* @EXIT_FAILURE
%54 = call i32 @exit(i32 %53)
unreachable
55: ; preds = %44
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i8* %7)
br label %74
57: ; preds = %36
%58 = load i32, i32* @AF_PACKET
%59 = icmp eq i32 %24, %58
br i1 %59, label %60, label %74
60: ; preds = %57
%61 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %18, i64 0, i32 1
%62 = load %struct.rtnl_link_stats*, %struct.rtnl_link_stats** %61
%63 = icmp eq %struct.rtnl_link_stats* %62, null
br i1 %63, label %74, label %64
64: ; preds = %60
%65 = getelementptr inbounds %struct.rtnl_link_stats, %struct.rtnl_link_stats* %62, i64 0, i32 0
%66 = load i32, i32* %65
%67 = getelementptr inbounds %struct.rtnl_link_stats, %struct.rtnl_link_stats* %62, i64 0, i32 1
%68 = load i32, i32* %67
%69 = getelementptr inbounds %struct.rtnl_link_stats, %struct.rtnl_link_stats* %62, i64 0, i32 2
%70 = load i32, i32* %69
%71 = getelementptr inbounds %struct.rtnl_link_stats, %struct.rtnl_link_stats* %62, i64 0, i32 3
%72 = load i32, i32* %71
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([79 x i8], [79 x i8]* @.str.8, i64 0, i64 0), i32 %66, i32 %68, i32 %70, i32 %72)
br label %74
74: ; preds = %55, %64, %60, %57, %17
%75 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %18, i64 0, i32 3
%76 = load %struct.ifaddrs*, %struct.ifaddrs** %75
%77 = icmp eq %struct.ifaddrs* %76, null
br i1 %77, label %78, label %17
78: ; preds = %74
%79 = load %struct.ifaddrs*, %struct.ifaddrs** %3
br label %80
80: ; preds = %78, %10
%81 = phi %struct.ifaddrs* [ %79, %78 ], [ null, %10 ]
%82 = call i32 @freeifaddrs(%struct.ifaddrs* %81)
%83 = load i32, i32* @EXIT_SUCCESS
%84 = call i32 @exit(i32 %83)
unreachable
}