#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 */
typedef int uint8_t;
typedef int uint32_t;
struct sockaddr_in6 {
  int /*<<< orphan*/ sin6_addr;
  int /*<<< orphan*/ sin6_scope_id;
};
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  TYPE_1__ sin_addr;
};
struct sockaddr {
  int sa_family;
};
struct option {
  char *member_0;
  int *member_2;
  int member_3;
  int /*<<< orphan*/ member_1;
};
struct ifaddrs {
  int ifa_flags;
  struct sockaddr *ifa_addr;
  struct ifaddrs *ifa_next;
};
typedef int /*<<< orphan*/ addrbuf;

/* Variables and functions */
#define AF_INET 129
#define AF_INET6 128
int IFF_LOOPBACK;
int /*<<< orphan*/ IN6_IS_ADDR_LOOPBACK(int /*<<< orphan*/ *);
int INET6_ADDRSTRLEN;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int getifaddrs(struct ifaddrs **);
int getopt_long(int, char **, char *, struct option *, int /*<<< orphan*/ *);
char *inet_ntop(int, void const *, char *, int);
int /*<<< orphan*/ no_argument;
int ntohl(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char const *);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  struct ifaddrs *list;
  int err;
  int c;
  int no_loopback = 0;
  struct option opts[] = {
      {"no-loopback", no_argument, &no_loopback, 1},
      {NULL},
  };
  while ((c = getopt_long(argc, argv, "", opts, NULL)) != -1) {
    switch (c) {
    case 0:
      break;
    default:
      fprintf(stderr, "usage: %s [--no-loopback]\n", argv[0]);
      return 1;
    }
  }
  err = getifaddrs(&list);
  if (err) {
    perror("getifaddrs");
    return 1;
  }
  for (; list; list = list->ifa_next) {
    const void *netaddr;
    char addrbuf[INET6_ADDRSTRLEN];
    const char *addrstr;
    struct sockaddr_in *addr4;
    struct sockaddr_in6 *addr6;
    struct sockaddr *addr = list->ifa_addr;
    bool exclude_loopback = (no_loopback && (list->ifa_flags & IFF_LOOPBACK));
    if (addr == NULL)
      continue;
    switch (addr->sa_family) {
    case AF_INET:
      addr4 = (struct sockaddr_in *)addr;
      if (exclude_loopback) {
        uint32_t saddr = ntohl(addr4->sin_addr.s_addr);
        uint8_t b1;
        b1 = (uint8_t)(saddr >> 24 & 0xff);
        if (b1 == 127)
          continue;
      }
      netaddr = &addr4->sin_addr;
      break;
    case AF_INET6:
      addr6 = (struct sockaddr_in6 *)addr;
      if (addr6->sin6_scope_id) {
        continue;
      }
      if (exclude_loopback && IN6_IS_ADDR_LOOPBACK(&addr6->sin6_addr))
        continue;
      netaddr = &addr6->sin6_addr;
      break;
    default:
      continue;
    }
    addrstr = inet_ntop(addr->sa_family, netaddr, addrbuf, sizeof(addrbuf));
    if (!addrstr) {
      perror("inet_ntop");
      return 1;
    }
    printf("%s\n", addrstr);
  }
  return 0;
}


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,-0x24(%rbp)
lea    -0x60(%rbp),%rdi
lea    0xe45(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0x2e02(%rip),%rax
movslq (%rax),%rax
mov    %rax,-0x58(%rbp)
lea    -0x24(%rbp),%rax
mov    %eax,-0x50(%rbp)
movl   $0x1,-0x4c(%rbp)
add    $0x18,%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1060 <memset@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x60(%rbp),%rcx
lea    0xe29(%rip),%rdx
xor    %eax,%eax
mov    %eax,%r8d
call   1040 <getopt_long@plt>
mov    %eax,-0x20(%rbp)
cmp    $0xffffffff,%eax
je     1255 <main+0xc5>
mov    -0x20(%rbp),%eax
test   %eax,%eax
jne    1228 <main+0x98>
jmp    1223 <main+0x93>
jmp    1250 <main+0xc0>
mov    0x2da1(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdcd(%rip),%rsi
call   1080 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    151d <main+0x38d>
jmp    11eb <main+0x5b>
lea    -0x18(%rbp),%rdi
call   1090 <getifaddrs@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     1283 <main+0xf3>
lea    0xdb5(%rip),%rdi
call   10a0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    151d <main+0x38d>
jmp    1288 <main+0xf8>
cmpq   $0x0,-0x18(%rbp)
je     1516 <main+0x386>
mov    0x2d46(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0xc0(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x70(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xb8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x78(%rbp)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x98(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x24(%rbp)
mov    %al,-0xa9(%rbp)
je     1305 <main+0x175>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    0x2d01(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0xa9(%rbp)
mov    -0xa9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x9c(%rbp)
cmpq   $0x0,-0x98(%rbp)
jne    1333 <main+0x1a3>
movl   $0x7,-0xa0(%rbp)
jmp    14c7 <main+0x337>
mov    -0x98(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc4(%rbp)
sub    $0x80,%eax
je     13dc <main+0x24c>
jmp    1352 <main+0x1c2>
mov    -0xc4(%rbp),%eax
sub    $0x81,%eax
jne    144b <main+0x2bb>
jmp    1368 <main+0x1d8>
mov    -0x98(%rbp),%rax
mov    %rax,-0x88(%rbp)
cmpl   $0x0,-0x9c(%rbp)
je     13cc <main+0x23c>
mov    -0x88(%rbp),%rax
mov    (%rax),%edi
call   10b0 <ntohl@plt>
mov    %eax,-0xa4(%rbp)
mov    -0xa4(%rbp),%eax
sar    $0x18,%eax
and    $0xff,%eax
mov    %eax,-0xa8(%rbp)
cmpl   $0x7f,-0xa8(%rbp)
jne    13c7 <main+0x237>
movl   $0x7,-0xa0(%rbp)
jmp    14c7 <main+0x337>
jmp    13cc <main+0x23c>
mov    -0x88(%rbp),%rax
mov    %rax,-0x68(%rbp)
jmp    145a <main+0x2ca>
mov    -0x98(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x90(%rbp),%rax
cmpl   $0x0,0x4(%rax)
je     140a <main+0x27a>
movl   $0x7,-0xa0(%rbp)
jmp    14c7 <main+0x337>
cmpl   $0x0,-0x9c(%rbp)
je     143b <main+0x2ab>
mov    -0x90(%rbp),%rdi
call   1070 <IN6_IS_ADDR_LOOPBACK@plt>
cmp    $0x0,%eax
je     143b <main+0x2ab>
movl   $0x7,-0xa0(%rbp)
jmp    14c7 <main+0x337>
mov    -0x90(%rbp),%rax
mov    %rax,-0x68(%rbp)
jmp    145a <main+0x2ca>
movl   $0x7,-0xa0(%rbp)
jmp    14c7 <main+0x337>
mov    -0xb8(%rbp),%rdx
mov    -0xc0(%rbp),%rax
mov    -0x98(%rbp),%rcx
mov    (%rcx),%edi
mov    -0x68(%rbp),%rsi
mov    %eax,%ecx
call   1030 <inet_ntop@plt>
mov    %rax,-0x80(%rbp)
cmpq   $0x0,-0x80(%rbp)
jne    14ad <main+0x31d>
lea    0xba0(%rip),%rdi
call   10a0 <perror@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0xa0(%rbp)
jmp    14c7 <main+0x337>
mov    -0x80(%rbp),%rsi
lea    0xb84(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0xa0(%rbp)
mov    -0x70(%rbp),%rax
mov    %rax,%rsp
mov    -0xa0(%rbp),%eax
mov    %eax,-0xc8(%rbp)
test   %eax,%eax
je     1500 <main+0x370>
jmp    14e7 <main+0x357>
mov    -0xc8(%rbp),%eax
sub    $0x1,%eax
je     151d <main+0x38d>
jmp    14fb <main+0x36b>
jmp    1505 <main+0x375>
jmp    1505 <main+0x375>
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    1288 <main+0xf8>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rsi,%r14
mov    %edi,%ebx
movl   $0x0,-0x2c(%rbp)
lea    0xe5c(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0x2e19(%rip),%rax
movslq (%rax),%rax
mov    %rax,-0x68(%rbp)
lea    -0x2c(%rbp),%rax
mov    %eax,-0x60(%rbp)
movl   $0x1,-0x5c(%rbp)
xorps  %xmm0,%xmm0
movups %xmm0,-0x58(%rbp)
movq   $0x0,-0x48(%rbp)
lea    0xe4c(%rip),%r15
lea    -0x70(%rbp),%r12
xchg   %ax,%ax
mov    %ebx,%edi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
xor    %r8d,%r8d
call   1040 <getopt_long@plt>
test   %eax,%eax
je     11e0 <main+0x60>
cmp    $0xffffffff,%eax
jne    1341 <main+0x1c1>
lea    -0x38(%rbp),%rdi
call   1080 <getifaddrs@plt>
test   %eax,%eax
jne    1371 <main+0x1f1>
cmpq   $0x0,-0x38(%rbp)
je     1360 <main+0x1e0>
mov    0x2dbd(%rip),%rdx
jmp    1258 <main+0xd8>
cs nopw 0x0(%rax,%rax,1)
nop
cmpl   $0x0,0x4(%r12)
je     12e2 <main+0x162>
nopl   0x0(%rax)
mov    %r14,%rsp
mov    -0x38(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x38(%rbp)
test   %rax,%rax
je     1360 <main+0x1e0>
mov    %rsp,%r14
mov    (%rdx),%r15d
mov    %rsp,%rbx
lea    0xf(%r15),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    -0x38(%rbp),%rcx
cmpl   $0x0,-0x2c(%rbp)
je     1290 <main+0x110>
mov    0x2d78(%rip),%rax
mov    (%rax),%eax
test   %eax,(%rcx)
setne  %al
jmp    1292 <main+0x112>
nopl   0x0(%rax)
xor    %eax,%eax
mov    0x8(%rcx),%r12
test   %r12,%r12
je     1240 <main+0xc0>
mov    (%r12),%ecx
cmp    $0x80,%ecx
je     1230 <main+0xb0>
cmp    $0x81,%ecx
jne    1240 <main+0xc0>
mov    $0x81,%r13d
test   %al,%al
je     1310 <main+0x190>
mov    $0x81,%r13d
mov    $0x81,%edi
call   10a0 <ntohl@plt>
mov    0x2d10(%rip),%rdx
and    $0xff000000,%eax
cmp    $0x7f000000,%eax
je     1240 <main+0xc0>
jmp    1310 <main+0x190>
mov    $0x80,%r13d
test   %al,%al
je     1310 <main+0x190>
mov    %r12,%rdi
call   1060 <IN6_IS_ADDR_LOOPBACK@plt>
mov    0x2ce5(%rip),%rdx
test   %eax,%eax
jne    1240 <main+0xc0>
mov    (%r12),%r13d
nopw   0x0(%rax,%rax,1)
mov    %r13d,%edi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    %r15d,%ecx
call   1030 <inet_ntop@plt>
test   %rax,%rax
je     1384 <main+0x204>
lea    0xd0f(%rip),%rdi
mov    %rax,%rsi
call   1050 <printf@plt>
mov    0x2ca4(%rip),%rdx
jmp    1240 <main+0xc0>
mov    0x2c88(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xcb8(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%eax
jmp    1362 <main+0x1e2>
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xcaf(%rip),%rdi
call   1090 <perror@plt>
mov    $0x1,%eax
jmp    1362 <main+0x1e2>
lea    0xca7(%rip),%rdi
call   1090 <perror@plt>
mov    $0x1,%eax
mov    %r14,%rsp
jmp    1362 <main+0x1e2>

LLVM IR (-O0):
%struct.ifaddrs = type { i32, %struct.sockaddr*, %struct.ifaddrs* }
%struct.sockaddr = type { i32 }
%struct.option = type { i8*, i32*, i32, i32 }
%struct.sockaddr_in = type { %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr_in6 = type { i32, i32 }
@.str = [12 x i8] c"no-loopback\00"
@no_argument = global i32 0
@.str.1 = [1 x i8] zeroinitializer
@stderr = global i32 0
@.str.2 = [27 x i8] c"usage: %s [--no-loopback]\0A\00"
@.str.3 = [11 x i8] c"getifaddrs\00"
@INET6_ADDRSTRLEN = global i32 0
@IFF_LOOPBACK = global i32 0
@.str.4 = [10 x i8] c"inet_ntop\00"
@.str.5 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.ifaddrs*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca [2 x %struct.option]
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i64
%14 = alloca i8*
%15 = alloca %struct.sockaddr_in*
%16 = alloca %struct.sockaddr_in6*
%17 = alloca %struct.sockaddr*
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %9
%22 = getelementptr inbounds [2 x %struct.option], [2 x %struct.option]* %10, i64 0, i64 0
%23 = getelementptr inbounds %struct.option, %struct.option* %22, i32 0, i32 0
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %23
%24 = getelementptr inbounds %struct.option, %struct.option* %22, i32 0, i32 1
%25 = load i32, i32* @no_argument
%26 = sext i32 %25 to i64
%27 = inttoptr i64 %26 to i32*
store i32* %27, i32** %24
%28 = getelementptr inbounds %struct.option, %struct.option* %22, i32 0, i32 2
%29 = ptrtoint i32* %9 to i32
store i32 %29, i32* %28
%30 = getelementptr inbounds %struct.option, %struct.option* %22, i32 0, i32 3
store i32 1, i32* %30
%31 = getelementptr inbounds %struct.option, %struct.option* %22, i64 1
%32 = bitcast %struct.option* %31 to i8*
br label %33
33: ; preds = %48, %2
%34 = load i32, i32* %4
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds [2 x %struct.option], [2 x %struct.option]* %10, i64 0, i64 0
%37 = call i32 @getopt_long(i32 %34, i8** %35, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), %struct.option* %36, i32* null)
store i32 %37, i32* %8
%38 = icmp ne i32 %37, -1
br i1 %38, label %39, label %49
39: ; preds = %33
%40 = load i32, i32* %8
switch i32 %40, label %42 [
i32 0, label %41
]
41: ; preds = %39
br label %48
42: ; preds = %39
%43 = load i32, i32* @stderr
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 0
%46 = load i8*, i8** %45
%47 = call i32 @fprintf(i32 %43, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %46)
store i32 1, i32* %3
br label %153
48: ; preds = %41
br label %33
49: ; preds = %33
%50 = call i32 @getifaddrs(%struct.ifaddrs** %6)
store i32 %50, i32* %7
%51 = load i32, i32* %7
%52 = icmp ne i32 %51, 0
br i1 %52, label %53, label %55
53: ; preds = %49
%54 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %153
55: ; preds = %49
br label %56
56: ; preds = %148, %55
%57 = load %struct.ifaddrs*, %struct.ifaddrs** %6
%58 = icmp ne %struct.ifaddrs* %57, null
br i1 %58, label %59, label %152
59: ; preds = %56
%60 = load i32, i32* @INET6_ADDRSTRLEN
%61 = zext i32 %60 to i64
%62 = call i8* @llvm.stacksave()
store i8* %62, i8** %12
%63 = alloca i8, i64 %61
store i64 %61, i64* %13
%64 = load %struct.ifaddrs*, %struct.ifaddrs** %6
%65 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %64, i32 0, i32 1
%66 = load %struct.sockaddr*, %struct.sockaddr** %65
store %struct.sockaddr* %66, %struct.sockaddr** %17
%67 = load i32, i32* %9
%68 = icmp ne i32 %67, 0
br i1 %68, label %69, label %76
69: ; preds = %59
%70 = load %struct.ifaddrs*, %struct.ifaddrs** %6
%71 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %70, i32 0, i32 0
%72 = load i32, i32* %71
%73 = load i32, i32* @IFF_LOOPBACK
%74 = and i32 %72, %73
%75 = icmp ne i32 %74, 0
br label %76
76: ; preds = %69, %59
%77 = phi i1 [ false, %59 ], [ %75, %69 ]
%78 = zext i1 %77 to i32
store i32 %78, i32* %18
%79 = load %struct.sockaddr*, %struct.sockaddr** %17
%80 = icmp eq %struct.sockaddr* %79, null
br i1 %80, label %81, label %82
81: ; preds = %76
store i32 7, i32* %19
br label %144
82: ; preds = %76
%83 = load %struct.sockaddr*, %struct.sockaddr** %17
%84 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %83, i32 0, i32 0
%85 = load i32, i32* %84
switch i32 %85, label %129 [
i32 129, label %86
i32 128, label %108
]
86: ; preds = %82
%87 = load %struct.sockaddr*, %struct.sockaddr** %17
%88 = bitcast %struct.sockaddr* %87 to %struct.sockaddr_in*
store %struct.sockaddr_in* %88, %struct.sockaddr_in** %15
%89 = load i32, i32* %18
%90 = icmp ne i32 %89, 0
br i1 %90, label %91, label %104
91: ; preds = %86
%92 = load %struct.sockaddr_in*, %struct.sockaddr_in** %15
%93 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %92, i32 0, i32 0
%94 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %93, i32 0, i32 0
%95 = load i32, i32* %94
%96 = call i32 @ntohl(i32 %95)
store i32 %96, i32* %20
%97 = load i32, i32* %20
%98 = ashr i32 %97, 24
%99 = and i32 %98, 255
store i32 %99, i32* %21
%100 = load i32, i32* %21
%101 = icmp eq i32 %100, 127
br i1 %101, label %102, label %103
102: ; preds = %91
store i32 7, i32* %19
br label %144
103: ; preds = %91
br label %104
104: ; preds = %103, %86
%105 = load %struct.sockaddr_in*, %struct.sockaddr_in** %15
%106 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %105, i32 0, i32 0
%107 = bitcast %struct.TYPE_2__* %106 to i8*
store i8* %107, i8** %11
br label %130
108: ; preds = %82
%109 = load %struct.sockaddr*, %struct.sockaddr** %17
%110 = bitcast %struct.sockaddr* %109 to %struct.sockaddr_in6*
store %struct.sockaddr_in6* %110, %struct.sockaddr_in6** %16
%111 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %16
%112 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %111, i32 0, i32 1
%113 = load i32, i32* %112
%114 = icmp ne i32 %113, 0
br i1 %114, label %115, label %116
115: ; preds = %108
store i32 7, i32* %19
br label %144
116: ; preds = %108
%117 = load i32, i32* %18
%118 = icmp ne i32 %117, 0
br i1 %118, label %119, label %125
119: ; preds = %116
%120 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %16
%121 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %120, i32 0, i32 0
%122 = call i32 @IN6_IS_ADDR_LOOPBACK(i32* %121)
%123 = icmp ne i32 %122, 0
br i1 %123, label %124, label %125
124: ; preds = %119
store i32 7, i32* %19
br label %144
125: ; preds = %119, %116
%126 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %16
%127 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %126, i32 0, i32 0
%128 = bitcast i32* %127 to i8*
store i8* %128, i8** %11
br label %130
129: ; preds = %82
store i32 7, i32* %19
br label %144
130: ; preds = %125, %104
%131 = load %struct.sockaddr*, %struct.sockaddr** %17
%132 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %131, i32 0, i32 0
%133 = load i32, i32* %132
%134 = load i8*, i8** %11
%135 = trunc i64 %61 to i32
%136 = call i8* @inet_ntop(i32 %133, i8* %134, i8* %63, i32 %135)
store i8* %136, i8** %14
%137 = load i8*, i8** %14
%138 = icmp ne i8* %137, null
br i1 %138, label %141, label %139
139: ; preds = %130
%140 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %3
store i32 1, i32* %19
br label %144
141: ; preds = %130
%142 = load i8*, i8** %14
%143 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %142)
store i32 0, i32* %19
br label %144
144: ; preds = %141, %139, %129, %124, %115, %102, %81
%145 = load i8*, i8** %12
%146 = load i32, i32* %19
switch i32 %146, label %155 [
i32 0, label %147
i32 7, label %148
i32 1, label %153
]
147: ; preds = %144
br label %148
148: ; preds = %147, %144
%149 = load %struct.ifaddrs*, %struct.ifaddrs** %6
%150 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %149, i32 0, i32 2
%151 = load %struct.ifaddrs*, %struct.ifaddrs** %150
store %struct.ifaddrs* %151, %struct.ifaddrs** %6
br label %56
152: ; preds = %56
store i32 0, i32* %3
br label %153
153: ; preds = %152, %144, %53, %42
%154 = load i32, i32* %3
ret i32 %154
155: ; preds = %144
unreachable
}

LLVM IR (-O2):
%struct.ifaddrs = type { i32, %struct.sockaddr*, %struct.ifaddrs* }
%struct.sockaddr = type { i32 }
%struct.option = type { i8*, i32*, i32, i32 }
@.str = [12 x i8] c"no-loopback\00"
@no_argument = global i32 0
@.str.1 = [1 x i8] zeroinitializer
@stderr = global i32 0
@.str.2 = [27 x i8] c"usage: %s [--no-loopback]\0A\00"
@.str.3 = [11 x i8] c"getifaddrs\00"
@INET6_ADDRSTRLEN = global i32 0
@IFF_LOOPBACK = global i32 0
@.str.4 = [10 x i8] c"inet_ntop\00"
@.str.5 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca %struct.ifaddrs*
%4 = alloca i32
%5 = alloca [2 x %struct.option]
%6 = bitcast %struct.ifaddrs** %3 to i8*
%7 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%8 = bitcast [2 x %struct.option]* %5 to i8*
%9 = getelementptr inbounds [2 x %struct.option], [2 x %struct.option]* %5, i64 0, i64 0
%10 = getelementptr inbounds [2 x %struct.option], [2 x %struct.option]* %5, i64 0, i64 0, i32 0
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %10
%11 = getelementptr inbounds [2 x %struct.option], [2 x %struct.option]* %5, i64 0, i64 0, i32 1
%12 = load i32, i32* @no_argument
%13 = sext i32 %12 to i64
%14 = inttoptr i64 %13 to i32*
store i32* %14, i32** %11
%15 = getelementptr inbounds [2 x %struct.option], [2 x %struct.option]* %5, i64 0, i64 0, i32 2
%16 = ptrtoint i32* %4 to i64
%17 = trunc i64 %16 to i32
store i32 %17, i32* %15
%18 = getelementptr inbounds [2 x %struct.option], [2 x %struct.option]* %5, i64 0, i64 0, i32 3
store i32 1, i32* %18
%19 = getelementptr inbounds [2 x %struct.option], [2 x %struct.option]* %5, i64 0, i64 1
%20 = bitcast %struct.option* %19 to i8*
br label %21
21: ; preds = %21, %2
%22 = call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), %struct.option* %9, i32* null)
switch i32 %22, label %23 [
i32 -1, label %27
i32 0, label %21
]
23: ; preds = %21
%24 = load i32, i32* @stderr
%25 = load i8*, i8** %1
%26 = call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %25)
br label %86
27: ; preds = %21
%28 = call i32 @getifaddrs(%struct.ifaddrs** %3)
%29 = icmp eq i32 %28, 0
br i1 %29, label %32, label %30
30: ; preds = %27
%31 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
br label %86
32: ; preds = %27
%33 = load %struct.ifaddrs*, %struct.ifaddrs** %3
%34 = icmp eq %struct.ifaddrs* %33, null
br i1 %34, label %86, label %35
35: ; preds = %32, %81
%36 = load i32, i32* @INET6_ADDRSTRLEN
%37 = zext i32 %36 to i64
%38 = call i8* @llvm.stacksave()
%39 = alloca i8, i64 %37
%40 = load %struct.ifaddrs*, %struct.ifaddrs** %3
%41 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %40, i64 0, i32 1
%42 = load %struct.sockaddr*, %struct.sockaddr** %41
%43 = load i32, i32* %4
%44 = icmp eq i32 %43, 0
br i1 %44, label %51, label %45
45: ; preds = %35
%46 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %40, i64 0, i32 0
%47 = load i32, i32* %46
%48 = load i32, i32* @IFF_LOOPBACK
%49 = and i32 %48, %47
%50 = icmp ne i32 %49, 0
br label %51
51: ; preds = %45, %35
%52 = phi i1 [ false, %35 ], [ %50, %45 ]
%53 = icmp eq %struct.sockaddr* %42, null
br i1 %53, label %81, label %54
54: ; preds = %51
%55 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %42, i64 0, i32 0
%56 = load i32, i32* %55
switch i32 %56, label %81 [
i32 129, label %57
i32 128, label %62
]
57: ; preds = %54
br i1 %52, label %58, label %72
58: ; preds = %57
%59 = call i32 @ntohl(i32 129)
%60 = and i32 %59, -16777216
%61 = icmp eq i32 %60, 2130706432
br i1 %61, label %81, label %72
62: ; preds = %54
%63 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %42, i64 1, i32 0
%64 = load i32, i32* %63
%65 = icmp eq i32 %64, 0
br i1 %65, label %66, label %81
66: ; preds = %62
br i1 %52, label %67, label %72
67: ; preds = %66
%68 = call i32 @IN6_IS_ADDR_LOOPBACK(i32* %55)
%69 = icmp eq i32 %68, 0
br i1 %69, label %70, label %81
70: ; preds = %67
%71 = load i32, i32* %55
br label %72
72: ; preds = %70, %66, %57, %58
%73 = phi i32 [ %71, %70 ], [ 128, %66 ], [ 129, %57 ], [ 129, %58 ]
%74 = bitcast %struct.sockaddr* %42 to i8*
%75 = call i8* @inet_ntop(i32 %73, i8* %74, i8* %39, i32 %36)
%76 = icmp eq i8* %75, null
br i1 %76, label %77, label %79
77: ; preds = %72
%78 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
br label %86
79: ; preds = %72
%80 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %75)
br label %81
81: ; preds = %58, %54, %67, %62, %51, %79
%82 = load %struct.ifaddrs*, %struct.ifaddrs** %3
%83 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %82, i64 0, i32 2
%84 = load %struct.ifaddrs*, %struct.ifaddrs** %83
store %struct.ifaddrs* %84, %struct.ifaddrs** %3
%85 = icmp eq %struct.ifaddrs* %84, null
br i1 %85, label %86, label %35
86: ; preds = %81, %32, %77, %30, %23
%87 = phi i32 [ 1, %23 ], [ 1, %30 ], [ 1, %77 ], [ 0, %32 ], [ 0, %81 ]
ret i32 %87
}