#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 EXIT_FAILURE;
int EXIT_SUCCESS;
int NI_MAXHOST;
int /*<<< orphan*/ NI_NUMERICHOST;
int /*<<< orphan*/ exit(int);
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(void) {
  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));
        return 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);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e2a(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x30(%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,-0x38(%rbp)
lea    -0x10(%rbp),%rdi
call   1060 <getifaddrs@plt>
cmp    $0xffffffff,%eax
jne    11d7 <main+0x67>
lea    0xe3c(%rip),%rdi
call   1080 <perror@plt>
mov    0x2df0(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x24(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     13e7 <main+0x277>
mov    -0x18(%rbp),%rax
cmpq   $0x0,0x10(%rax)
jne    1205 <main+0x95>
jmp    13cd <main+0x25d>
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x58(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x2da9(%rip),%rcx
cmp    (%rcx),%eax
jne    123f <main+0xcf>
lea    0xde3(%rip),%rax
mov    %rax,-0x60(%rbp)
jmp    128d <main+0x11d>
mov    -0x1c(%rbp),%eax
mov    0x2d9f(%rip),%rcx
cmp    (%rcx),%eax
jne    1261 <main+0xf1>
lea    0xdcb(%rip),%rax
mov    %rax,-0x68(%rbp)
jmp    1285 <main+0x115>
mov    -0x1c(%rbp),%edx
mov    0x2d75(%rip),%rax
mov    (%rax),%esi
lea    0xdc0(%rip),%rax
lea    0xdb0(%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    -0x1c(%rbp),%ecx
lea    0xd6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
mov    0x2d38(%rip),%rcx
cmp    (%rcx),%eax
je     12ca <main+0x15a>
mov    -0x1c(%rbp),%eax
mov    0x2d1e(%rip),%rcx
cmp    (%rcx),%eax
jne    136c <main+0x1fc>
mov    -0x50(%rbp),%rdx
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x1c(%rbp),%ecx
mov    0x2d08(%rip),%rax
mov    (%rax),%esi
mov    $0x4,%eax
cmp    %esi,%ecx
cmove  %rax,%rax
mov    %eax,%esi
mov    0x2cba(%rip),%rax
mov    (%rax),%ecx
mov    0x2cc9(%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,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     1355 <main+0x1e5>
mov    -0x20(%rbp),%edi
call   1040 <gai_strerror@plt>
mov    %rax,%rsi
lea    0xd02(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2c7c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x3c(%rbp)
jmp    1403 <main+0x293>
mov    -0x50(%rbp),%rsi
lea    0xcf2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    13c8 <main+0x258>
mov    -0x1c(%rbp),%eax
mov    0x2c5a(%rip),%rcx
cmp    (%rcx),%eax
jne    13c3 <main+0x253>
mov    -0x18(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     13c3 <main+0x253>
mov    -0x18(%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    0xca7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    13c8 <main+0x258>
jmp    13cd <main+0x25d>
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11e6 <main+0x76>
mov    -0x10(%rbp),%rdi
call   1070 <freeifaddrs@plt>
mov    0x2bc1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x3c(%rbp)
mov    -0x30(%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    $0x18,%rsp
mov    %rsp,%rbx
mov    0x2e25(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r13
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
lea    -0x38(%rbp),%rdi
call   1060 <getifaddrs@plt>
cmp    $0xffffffff,%eax
je     1332 <main+0x1c2>
mov    -0x38(%rbp),%r15
test   %r15,%r15
je     12eb <main+0x17b>
mov    %rbx,-0x30(%rbp)
mov    0x2e08(%rip),%r12
mov    0x2e19(%rip),%r14
jmp    1238 <main+0xc8>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x10(%r15),%rdi
mov    0x2dc5(%rip),%rax
mov    (%rax),%ecx
mov    0x2dd4(%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    130d <main+0x19d>
lea    0xe31(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x18(%r15),%r15
test   %r15,%r15
je     12e1 <main+0x171>
mov    0x10(%r15),%rax
test   %rax,%rax
je     122b <main+0xbb>
mov    (%rax),%ebx
lea    0xdcf(%rip),%rdx
cmp    (%r12),%ebx
je     1280 <main+0x110>
lea    0xdcc(%rip),%rdx
cmp    (%r14),%ebx
je     1280 <main+0x110>
lea    0xdc8(%rip),%rdx
mov    0x2d76(%rip),%rax
cmp    (%rax),%ebx
je     1280 <main+0x110>
lea    0xdbf(%rip),%rdx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r15),%rsi
lea    0xd81(%rip),%rdi
mov    %ebx,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
cmp    (%r14),%ebx
je     11e0 <main+0x70>
mov    0x2d3d(%rip),%rax
cmp    (%rax),%ebx
je     11e0 <main+0x70>
cmp    (%r12),%ebx
jne    122b <main+0xbb>
mov    0x8(%r15),%rax
test   %rax,%rax
je     122b <main+0xbb>
mov    (%rax),%esi
mov    0x4(%rax),%edx
mov    0x8(%rax),%ecx
mov    0xc(%rax),%r8d
lea    0xd8e(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    122b <main+0xbb>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rbx
jmp    12ed <main+0x17d>
xor    %edi,%edi
call   1070 <freeifaddrs@plt>
mov    0x2cbf(%rip),%rax
mov    (%rax),%eax
mov    %rbx,%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%edi
call   1040 <gai_strerror@plt>
lea    0xd1d(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2c94(%rip),%rax
mov    -0x30(%rbp),%rbx
jmp    12f9 <main+0x189>
lea    0xcc7(%rip),%rdi
call   1080 <perror@plt>
mov    0x2c7b(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>

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

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