#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_in {
  int dummy;
};
struct ifaddrs {
  char *ifa_name;
  TYPE_1__ *ifa_addr;
  struct ifaddrs *ifa_next;
};
struct TYPE_2__ {
  scalar_t__ sa_family;
};

/* Variables and functions */
scalar_t__ AF_INET;
int EXIT_FAILURE;
int EXIT_SUCCESS;
int NI_MAXHOST;
int /*<<< orphan*/ NI_NUMERICHOST;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
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 getopt(int, char const **, char *);
int optind;
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strlen(char const *);
scalar_t__ strncmp(char *, char const *, int /*<<< orphan*/);
int main(int argc, const char *argv[]) {
  const char *interface = "";
  int quiet = false;
  int opt;
  while ((opt = getopt(argc, argv, "q")) != -1) {
    switch (opt) {
    case 'q':
      quiet = true;
      break;
    default:
      if (!quiet)
        fprintf(stderr, "Usage: %s [-q] [interface]\n", argv[0]);
      exit(EXIT_FAILURE);
    }
  }
  if (optind < argc)
    interface = argv[optind];
  struct ifaddrs *ifaddr;
  if (getifaddrs(&ifaddr) == -1) {
    if (!quiet)
      perror("getifaddrs");
    freeifaddrs(ifaddr);
    return EXIT_FAILURE;
  }
  for (struct ifaddrs *ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
    if (!ifa->ifa_addr)
      continue;
    if (strncmp(ifa->ifa_name, interface, strlen(interface)) != 0 ||
        ifa->ifa_addr->sa_family != AF_INET)
      continue;
    char host[NI_MAXHOST];
    int s = 0;
    if ((s = getnameinfo(ifa->ifa_addr, sizeof(struct sockaddr_in), host,
                         NI_MAXHOST, NULL, 0, NI_NUMERICHOST)) != 0) {
      if (!quiet)
        printf("getnameinfo() failed: %s\n", gai_strerror(s));
      freeifaddrs(ifaddr);
      return EXIT_FAILURE;
    }
    if (quiet)
      printf("%s\n", host);
    else
      printf("%s:%s\n", ifa->ifa_name, host);
  }
  freeifaddrs(ifaddr);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe50(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe1a(%rip),%rdx
call   10c0 <getopt@plt>
mov    %eax,-0x20(%rbp)
cmp    $0xffffffff,%eax
je     124d <main+0x9d>
mov    -0x20(%rbp),%eax
sub    $0x71,%eax
jne    1214 <main+0x64>
jmp    1208 <main+0x58>
movl   $0x1,-0x1c(%rbp)
jmp    1248 <main+0x98>
cmpl   $0x0,-0x1c(%rbp)
jne    123a <main+0x8a>
mov    0x2dab(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdcd(%rip),%rsi
call   1080 <fprintf@plt>
mov    0x2d7f(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>
jmp    11d8 <main+0x28>
mov    0x2d8c(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jge    1275 <main+0xc5>
mov    -0x10(%rbp),%rax
mov    0x2d76(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x18(%rbp)
lea    -0x28(%rbp),%rdi
call   1090 <getifaddrs@plt>
cmp    $0xffffffff,%eax
jne    12b7 <main+0x107>
cmpl   $0x0,-0x1c(%rbp)
jne    129d <main+0xed>
lea    0xd86(%rip),%rdi
call   10b0 <perror@plt>
mov    -0x28(%rbp),%rdi
call   10a0 <freeifaddrs@plt>
mov    0x2d13(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1473 <main+0x2c3>
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     145e <main+0x2ae>
mov    -0x30(%rbp),%rax
cmpq   $0x0,0x8(%rax)
jne    12de <main+0x12e>
jmp    144d <main+0x29d>
mov    -0x30(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x58(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x58(%rbp),%rdi
mov    -0x50(%rbp),%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    132e <main+0x17e>
mov    -0x30(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%rax
mov    0x2cc3(%rip),%rcx
cmp    (%rcx),%rax
je     1333 <main+0x183>
jmp    144d <main+0x29d>
mov    0x2c76(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdx
sub    %rcx,%rdx
mov    %rdx,-0x60(%rbp)
mov    %rdx,%rsp
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x30(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2c3b(%rip),%rax
mov    (%rax),%ecx
mov    0x2c4a(%rip),%rax
mov    (%rax),%eax
mov    $0x4,%esi
xor    %r8d,%r8d
xor    %r9d,%r9d
sub    $0x10,%rsp
mov    %eax,(%rsp)
call   1070 <getnameinfo@plt>
add    $0x10,%rsp
mov    %eax,-0x44(%rbp)
cmp    $0x0,%eax
je     13eb <main+0x23b>
cmpl   $0x0,-0x1c(%rbp)
jne    13ca <main+0x21a>
mov    -0x44(%rbp),%edi
call   1060 <gai_strerror@plt>
mov    %rax,%rsi
lea    0xc66(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x28(%rbp),%rdi
call   10a0 <freeifaddrs@plt>
mov    0x2be6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x48(%rbp)
jmp    142c <main+0x27c>
cmpl   $0x0,-0x1c(%rbp)
je     140c <main+0x25c>
mov    -0x60(%rbp),%rsi
lea    0xc3f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1425 <main+0x275>
mov    -0x60(%rbp),%rdx
mov    -0x30(%rbp),%rax
mov    (%rax),%rsi
lea    0xc25(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x48(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,%rsp
mov    -0x48(%rbp),%eax
test   %eax,%eax
je     1448 <main+0x298>
jmp    1443 <main+0x293>
jmp    1473 <main+0x2c3>
jmp    144d <main+0x29d>
mov    -0x30(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x30(%rbp)
jmp    12bf <main+0x10f>
mov    -0x28(%rbp),%rdi
call   10a0 <freeifaddrs@plt>
mov    0x2b4a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-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    $0x18,%rsp
mov    %rsi,%r14
mov    %edi,%ebx
mov    $0x1,%cl
lea    0xe31(%rip),%r15
nop
mov    %ecx,%r13d
mov    %ebx,%edi
mov    %r14,%rsi
mov    %r15,%rdx
call   10c0 <getopt@plt>
xor    %ecx,%ecx
cmp    $0x71,%eax
je     11d0 <main+0x20>
cmp    $0xffffffff,%eax
jne    137b <main+0x1cb>
mov    0x2de9(%rip),%rax
movslq (%rax),%rax
cmp    %ebx,%eax
jge    1204 <main+0x54>
mov    (%r14,%rax,8),%r12
jmp    120b <main+0x5b>
lea    0xe12(%rip),%r12
lea    -0x30(%rbp),%rdi
call   1090 <getifaddrs@plt>
cmp    $0xffffffff,%eax
je     12fa <main+0x14a>
mov    -0x30(%rbp),%r14
test   %r14,%r14
je     1318 <main+0x168>
mov    0x2db7(%rip),%r15
jmp    125d <main+0xad>
mov    (%r14),%rsi
lea    0xe06(%rip),%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x38(%rbp),%rsp
nopl   0x0(%rax,%rax,1)
mov    0x10(%r14),%r14
test   %r14,%r14
je     1312 <main+0x162>
cmpq   $0x0,0x8(%r14)
je     1250 <main+0xa0>
mov    (%r14),%rbx
mov    %r12,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    1250 <main+0xa0>
mov    0x8(%r14),%rax
mov    (%rax),%rax
cmp    (%r15),%rax
jne    1250 <main+0xa0>
mov    %rsp,-0x38(%rbp)
mov    0x2d18(%rip),%rcx
mov    (%rcx),%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    0x8(%r14),%rdi
mov    (%rcx),%ecx
mov    0x2d10(%rip),%rax
mov    (%rax),%eax
sub    $0x8,%rsp
mov    $0x4,%esi
mov    %rbx,%rdx
xor    %r8d,%r8d
xor    %r9d,%r9d
push   %rax
call   1070 <getnameinfo@plt>
add    $0x10,%rsp
test   %eax,%eax
jne    1337 <main+0x187>
test   $0x1,%r13b
jne    1233 <main+0x83>
lea    0xd54(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1247 <main+0x97>
test   $0x1,%r13b
jne    136d <main+0x1bd>
mov    -0x30(%rbp),%rdi
call   10a0 <freeifaddrs@plt>
mov    0x2cb0(%rip),%rax
jmp    1326 <main+0x176>
mov    -0x30(%rbp),%rdi
jmp    131a <main+0x16a>
xor    %edi,%edi
call   10a0 <freeifaddrs@plt>
mov    0x2c92(%rip),%rax
mov    (%rax),%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
test   $0x1,%r13b
je     1355 <main+0x1a5>
mov    %eax,%edi
call   1060 <gai_strerror@plt>
lea    0xcde(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x30(%rbp),%rdi
call   10a0 <freeifaddrs@plt>
mov    0x2c5b(%rip),%rax
mov    (%rax),%eax
mov    -0x38(%rbp),%rsp
jmp    1328 <main+0x178>
lea    0xcaa(%rip),%rdi
call   10b0 <perror@plt>
jmp    1300 <main+0x150>
test   $0x1,%r13b
je     1399 <main+0x1e9>
mov    0x2c48(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xc6e(%rip),%rsi
call   1080 <fprintf@plt>
mov    0x2c20(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>

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

LLVM IR (-O2):
%struct.ifaddrs = type { i8*, %struct.TYPE_2__*, %struct.ifaddrs* }
%struct.TYPE_2__ = type { i64 }
@.str = [1 x i8] zeroinitializer
@.str.1 = [2 x i8] c"q\00"
@stderr = global i32 0
@.str.2 = [28 x i8] c"Usage: %s [-q] [interface]\0A\00"
@EXIT_FAILURE = global i32 0
@optind = global i32 0
@.str.3 = [11 x i8] c"getifaddrs\00"
@AF_INET = global i64 0
@NI_MAXHOST = global i32 0
@NI_NUMERICHOST = global i32 0
@.str.4 = [26 x i8] c"getnameinfo() failed: %s\0A\00"
@.str.5 = [4 x i8] c"%s\0A\00"
@.str.6 = [7 x i8] c"%s:%s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca %struct.ifaddrs*
br label %4
4: ; preds = %4, %2
%5 = phi i1 [ true, %2 ], [ false, %4 ]
%6 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
switch i32 %6, label %7 [
i32 -1, label %15
i32 113, label %4
]
7: ; preds = %4
br i1 %5, label %8, label %12
8: ; preds = %7
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %1
%11 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* %10)
br label %12
12: ; preds = %8, %7
%13 = load i32, i32* @EXIT_FAILURE
%14 = tail call i32 @exit(i32 %13)
unreachable
15: ; preds = %4
%16 = load i32, i32* @optind
%17 = icmp slt i32 %16, %0
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = sext i32 %16 to i64
%20 = getelementptr inbounds i8*, i8** %1, i64 %19
%21 = load i8*, i8** %20
br label %22
22: ; preds = %18, %15
%23 = phi i8* [ %21, %18 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %15 ]
%24 = bitcast %struct.ifaddrs** %3 to i8*
%25 = call i32 @getifaddrs(%struct.ifaddrs** %3)
%26 = icmp eq i32 %25, -1
br i1 %26, label %30, label %27
27: ; preds = %22
%28 = load %struct.ifaddrs*, %struct.ifaddrs** %3
%29 = icmp eq %struct.ifaddrs* %28, null
br i1 %29, label %85, label %37
30: ; preds = %22
br i1 %5, label %31, label %33
31: ; preds = %30
%32 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
br label %33
33: ; preds = %31, %30
%34 = load %struct.ifaddrs*, %struct.ifaddrs** %3
%35 = call i32 @freeifaddrs(%struct.ifaddrs* %34)
%36 = load i32, i32* @EXIT_FAILURE
br label %89
37: ; preds = %27, %75
%38 = phi %struct.ifaddrs* [ %77, %75 ], [ %28, %27 ]
%39 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %38, i64 0, i32 1
%40 = load %struct.TYPE_2__*, %struct.TYPE_2__** %39
%41 = icmp eq %struct.TYPE_2__* %40, null
br i1 %41, label %75, label %42
42: ; preds = %37
%43 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %38, i64 0, i32 0
%44 = load i8*, i8** %43
%45 = call i32 @strlen(i8* %23)
%46 = call i64 @strncmp(i8* %44, i8* %23, i32 %45)
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %75
48: ; preds = %42
%49 = load %struct.TYPE_2__*, %struct.TYPE_2__** %39
%50 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %49, i64 0, i32 0
%51 = load i64, i64* %50
%52 = load i64, i64* @AF_INET
%53 = icmp eq i64 %51, %52
br i1 %53, label %54, label %75
54: ; preds = %48
%55 = load i32, i32* @NI_MAXHOST
%56 = zext i32 %55 to i64
%57 = call i8* @llvm.stacksave()
%58 = alloca i8, i64 %56
%59 = load %struct.TYPE_2__*, %struct.TYPE_2__** %39
%60 = load i32, i32* @NI_MAXHOST
%61 = load i32, i32* @NI_NUMERICHOST
%62 = call i32 @getnameinfo(%struct.TYPE_2__* %59, i32 4, i8* %58, i32 %60, i32* null, i32 0, i32 %61)
%63 = icmp eq i32 %62, 0
br i1 %63, label %68, label %64
64: ; preds = %54
br i1 %5, label %65, label %79
65: ; preds = %64
%66 = call i8* @gai_strerror(i32 %62)
%67 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i8* %66)
br label %79
68: ; preds = %54
br i1 %5, label %71, label %69
69: ; preds = %68
%70 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %58)
br label %74
71: ; preds = %68
%72 = load i8*, i8** %43
%73 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %72, i8* %58)
br label %74
74: ; preds = %69, %71
br label %75
75: ; preds = %74, %42, %48, %37
%76 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %38, i64 0, i32 2
%77 = load %struct.ifaddrs*, %struct.ifaddrs** %76
%78 = icmp eq %struct.ifaddrs* %77, null
br i1 %78, label %83, label %37
79: ; preds = %65, %64
%80 = load %struct.ifaddrs*, %struct.ifaddrs** %3
%81 = call i32 @freeifaddrs(%struct.ifaddrs* %80)
%82 = load i32, i32* @EXIT_FAILURE
br label %89
83: ; preds = %75
%84 = load %struct.ifaddrs*, %struct.ifaddrs** %3
br label %85
85: ; preds = %83, %27
%86 = phi %struct.ifaddrs* [ %84, %83 ], [ null, %27 ]
%87 = call i32 @freeifaddrs(%struct.ifaddrs* %86)
%88 = load i32, i32* @EXIT_SUCCESS
br label %89
89: ; preds = %79, %85, %33
%90 = phi i32 [ %36, %33 ], [ %88, %85 ], [ %82, %79 ]
ret i32 %90
}