#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 {
  int /*<<< orphan*/ ifa_name;
  TYPE_1__ *ifa_addr;
  struct ifaddrs *ifa_next;
};
struct TYPE_2__ {
  int sa_family;
};

/* Variables and functions */
int AF_INET;
int EXIT_FAILURE;
int NI_MAXHOST;
int /*<<< orphan*/ NI_NUMERICHOST;
int /*<<< orphan*/ exit(int);
int getifaddrs(struct ifaddrs **);
int getnameinfo(TYPE_1__ *, int, char *, int, int /*<<< orphan*/ *,
                int /*<<< orphan*/, int /*<<< orphan*/);
char *malloc(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
scalar_t__ scanf(char *, char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int /*<<< orphan*/ *strstr(int /*<<< orphan*/, char *);
char *getMeALocalAddr() {
  int moreThanOneIF = 0;
  int moreThanOneWIF = 0;
  char *wlan = NULL;
  char *lan = NULL;
  struct ifaddrs *ifaddr, *ifa;
  int family, saa;
  char host[NI_MAXHOST];
  if (getifaddrs(&ifaddr) == -1) {
    perror("getifaddrs");
    exit(EXIT_FAILURE);
  }
  for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
    family = ifa->ifa_addr->sa_family;
    if (family == AF_INET) {
      saa = getnameinfo(ifa->ifa_addr, sizeof(struct sockaddr_in), host,
                        NI_MAXHOST, NULL, 0, NI_NUMERICHOST);
      if (saa != 0) {
        exit(EXIT_FAILURE);
      }
      if (strstr(ifa->ifa_name, "eth") != NULL) {
        if (lan != NULL) {
          moreThanOneIF = 1;
        }
        lan = malloc(50 * sizeof(char));
        strncpy(lan, host, 50);
      }
      if (strstr(ifa->ifa_name, "wlan") != NULL) {
        if (wlan != NULL) {
          moreThanOneWIF = 1;
        }
        wlan = malloc(50 * sizeof(char));
        strncpy(wlan, host, 50);
      }
    }
  }
  if (moreThanOneIF == 0 && lan != NULL) {
    return lan;
  } else if (moreThanOneWIF == 0 && lan == NULL && wlan != NULL) {
    return wlan;
  } else {
    if (moreThanOneIF == 1) {
      return lan;
    } else if (moreThanOneWIF == 1) {
      return wlan;
    } else {
      printf("I found several potential local interfaces to use, please write "
             "the local ip to use:\n");
      if (scanf("%s", lan) < 0) {
        exit(1);
      }
      return lan;
    }
  }
}


x86 assembly (clang, -O0):
<getMeALocalAddr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    0x2e0b(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x58(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x48(%rbp)
lea    -0x28(%rbp),%rdi
call   1070 <getifaddrs@plt>
cmp    $0xffffffff,%eax
jne    120e <getMeALocalAddr+0x7e>
lea    0xe05(%rip),%rdi
call   1090 <perror@plt>
mov    0x2dc9(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     134b <getMeALocalAddr+0x1bb>
mov    -0x30(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    0x2db0(%rip),%rcx
cmp    (%rcx),%eax
jne    1335 <getMeALocalAddr+0x1a5>
mov    -0x58(%rbp),%rdx
mov    -0x30(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2d75(%rip),%rax
mov    (%rax),%ecx
mov    0x2d7c(%rip),%rax
mov    (%rax),%eax
mov    $0x4,%esi
xor    %r8d,%r8d
xor    %r9d,%r9d
sub    $0x10,%rsp
mov    %eax,(%rsp)
call   1050 <getnameinfo@plt>
add    $0x10,%rsp
mov    %eax,-0x38(%rbp)
cmpl   $0x0,-0x38(%rbp)
je     1294 <getMeALocalAddr+0x104>
mov    0x2d43(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    -0x30(%rbp),%rax
mov    (%rax),%edi
lea    0xd6a(%rip),%rsi
call   10b0 <strstr@plt>
cmp    $0x0,%rax
je     12e2 <getMeALocalAddr+0x152>
cmpq   $0x0,-0x20(%rbp)
je     12c2 <getMeALocalAddr+0x132>
movl   $0x1,-0xc(%rbp)
mov    $0x32,%edi
call   1060 <malloc@plt>
mov    -0x58(%rbp),%rsi
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x32,%edx
call   1030 <strncpy@plt>
mov    -0x30(%rbp),%rax
mov    (%rax),%edi
lea    0xd20(%rip),%rsi
call   10b0 <strstr@plt>
cmp    $0x0,%rax
je     1330 <getMeALocalAddr+0x1a0>
cmpq   $0x0,-0x18(%rbp)
je     1310 <getMeALocalAddr+0x180>
movl   $0x1,-0x10(%rbp)
mov    $0x32,%edi
call   1060 <malloc@plt>
mov    -0x58(%rbp),%rsi
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x32,%edx
call   1030 <strncpy@plt>
jmp    1335 <getMeALocalAddr+0x1a5>
jmp    133a <getMeALocalAddr+0x1aa>
mov    -0x30(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x30(%rbp)
jmp    1216 <getMeALocalAddr+0x86>
cmpl   $0x0,-0xc(%rbp)
jne    1374 <getMeALocalAddr+0x1e4>
cmpq   $0x0,-0x20(%rbp)
je     1374 <getMeALocalAddr+0x1e4>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
movl   $0x1,-0x4c(%rbp)
jmp    1423 <getMeALocalAddr+0x293>
cmpl   $0x0,-0x10(%rbp)
jne    13a8 <getMeALocalAddr+0x218>
cmpq   $0x0,-0x20(%rbp)
jne    13a8 <getMeALocalAddr+0x218>
cmpq   $0x0,-0x18(%rbp)
je     13a8 <getMeALocalAddr+0x218>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
movl   $0x1,-0x4c(%rbp)
jmp    1423 <getMeALocalAddr+0x293>
cmpl   $0x1,-0xc(%rbp)
jne    13c6 <getMeALocalAddr+0x236>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
movl   $0x1,-0x4c(%rbp)
jmp    1423 <getMeALocalAddr+0x293>
cmpl   $0x1,-0x10(%rbp)
jne    13e4 <getMeALocalAddr+0x254>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
movl   $0x1,-0x4c(%rbp)
jmp    1423 <getMeALocalAddr+0x293>
lea    0xc29(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xc6f(%rip),%rdi
call   1080 <scanf@plt>
cmp    $0x0,%rax
jge    1414 <getMeALocalAddr+0x284>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
movl   $0x1,-0x4c(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,%rsp
mov    -0x8(%rbp),%rax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getMeALocalAddr>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsp,%r14
mov    0x2e1d(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
lea    -0x48(%rbp),%rdi
call   1070 <getifaddrs@plt>
cmp    $0xffffffff,%eax
je     1353 <getMeALocalAddr+0x1c3>
mov    -0x48(%rbp),%r12
xor    %eax,%eax
mov    %rax,-0x40(%rbp)
test   %r12,%r12
je     130d <getMeALocalAddr+0x17d>
mov    %r14,-0x38(%rbp)
mov    0x2dfa(%rip),%r14
movl   $0x0,-0x2c(%rbp)
xor    %r15d,%r15d
xor    %r13d,%r13d
jmp    120e <getMeALocalAddr+0x7e>
nopl   (%rax)
mov    0x10(%r12),%r12
test   %r12,%r12
je     12e1 <getMeALocalAddr+0x151>
mov    0x8(%r12),%rdi
mov    (%rdi),%eax
cmp    (%r14),%eax
jne    1200 <getMeALocalAddr+0x70>
mov    0x2da7(%rip),%rax
mov    (%rax),%ecx
mov    0x2dae(%rip),%rax
mov    (%rax),%eax
sub    $0x8,%rsp
mov    $0x4,%esi
mov    %rbx,%rdx
xor    %r8d,%r8d
xor    %r9d,%r9d
push   %rax
call   1050 <getnameinfo@plt>
add    $0x10,%rsp
test   %eax,%eax
jne    135f <getMeALocalAddr+0x1cf>
mov    (%r12),%edi
lea    0xdb0(%rip),%rsi
call   10b0 <strstr@plt>
test   %rax,%rax
je     1295 <getMeALocalAddr+0x105>
test   %r13,%r13
mov    -0x40(%rbp),%rax
mov    $0x1,%ecx
cmovne %ecx,%eax
mov    %rax,-0x40(%rbp)
mov    $0x32,%edi
call   1060 <malloc@plt>
mov    %rax,%r13
mov    %rax,%rdi
mov    %rbx,%rsi
mov    $0x32,%edx
call   1030 <strncpy@plt>
mov    (%r12),%edi
lea    0xd6f(%rip),%rsi
call   10b0 <strstr@plt>
test   %rax,%rax
je     1200 <getMeALocalAddr+0x70>
test   %r15,%r15
mov    -0x2c(%rbp),%eax
mov    $0x1,%ecx
cmovne %ecx,%eax
mov    %eax,-0x2c(%rbp)
mov    $0x32,%edi
call   1060 <malloc@plt>
mov    %rax,%r15
mov    %rax,%rdi
mov    %rbx,%rsi
mov    $0x32,%edx
call   1030 <strncpy@plt>
jmp    1200 <getMeALocalAddr+0x70>
mov    -0x40(%rbp),%rcx
test   %ecx,%ecx
jne    12ee <getMeALocalAddr+0x15e>
test   %r13,%r13
jne    1304 <getMeALocalAddr+0x174>
mov    -0x2c(%rbp),%eax
test   %eax,%eax
jne    12ff <getMeALocalAddr+0x16f>
test   %r13,%r13
jne    12ff <getMeALocalAddr+0x16f>
test   %r15,%r15
jne    1307 <getMeALocalAddr+0x177>
cmp    $0x1,%ecx
jne    1348 <getMeALocalAddr+0x1b8>
mov    %r13,%r15
mov    -0x38(%rbp),%r14
jmp    1333 <getMeALocalAddr+0x1a3>
xor    %r13d,%r13d
lea    0xd00(%rip),%rdi
call   1040 <puts@plt>
lea    0xcf1(%rip),%rdi
mov    %r13,%rsi
call   1080 <scanf@plt>
mov    %r13,%r15
test   %rax,%rax
js     136d <getMeALocalAddr+0x1dd>
mov    %r14,%rsp
mov    %r15,%rax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
cmp    $0x1,%eax
mov    -0x38(%rbp),%r14
jne    1310 <getMeALocalAddr+0x180>
jmp    1333 <getMeALocalAddr+0x1a3>
lea    0xca6(%rip),%rdi
call   1090 <perror@plt>
mov    0x2c6a(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>

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

LLVM IR (-O2):
%struct.ifaddrs = type { i32, %struct.TYPE_2__*, %struct.ifaddrs* }
%struct.TYPE_2__ = type { i32 }
@NI_MAXHOST = global i32 0
@.str = [11 x i8] c"getifaddrs\00"
@EXIT_FAILURE = global i32 0
@AF_INET = global i32 0
@NI_NUMERICHOST = global i32 0
@.str.1 = [4 x i8] c"eth\00"
@.str.2 = [5 x i8] c"wlan\00"
@.str.4 = [3 x i8] c"%s\00"
@str = [85 x i8] c"I found several potential local interfaces to use, please write the local ip to use:\00"
define i8* @getMeALocalAddr() {
%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 %79, 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, %57
%17 = phi %struct.ifaddrs* [ %63, %57 ], [ %10, %9 ]
%18 = phi i32 [ %61, %57 ], [ 0, %9 ]
%19 = phi i32 [ %60, %57 ], [ 0, %9 ]
%20 = phi i8* [ %59, %57 ], [ null, %9 ]
%21 = phi i8* [ %58, %57 ], [ null, %9 ]
%22 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %17, i64 0, i32 1
%23 = load %struct.TYPE_2__*, %struct.TYPE_2__** %22
%24 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %23, i64 0, i32 0
%25 = load i32, i32* %24
%26 = load i32, i32* @AF_INET
%27 = icmp eq i32 %25, %26
br i1 %27, label %28, label %57
28: ; preds = %16
%29 = load i32, i32* @NI_MAXHOST
%30 = load i32, i32* @NI_NUMERICHOST
%31 = call i32 @getnameinfo(%struct.TYPE_2__* %23, i32 4, i8* %6, i32 %29, i32* null, i32 0, i32 %30)
%32 = icmp eq i32 %31, 0
br i1 %32, label %36, label %33
33: ; preds = %28
%34 = load i32, i32* @EXIT_FAILURE
%35 = call i32 @exit(i32 %34)
unreachable
36: ; preds = %28
%37 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %17, i64 0, i32 0
%38 = load i32, i32* %37
%39 = call i32* @strstr(i32 %38, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%40 = icmp eq i32* %39, null
br i1 %40, label %46, label %41
41: ; preds = %36
%42 = icmp eq i8* %21, null
%43 = select i1 %42, i32 %18, i32 1
%44 = call dereferenceable_or_null(50) i8* @malloc(i32 50)
%45 = call i32 @strncpy(i8* %44, i8* %6, i32 50)
br label %46
46: ; preds = %41, %36
%47 = phi i8* [ %44, %41 ], [ %21, %36 ]
%48 = phi i32 [ %43, %41 ], [ %18, %36 ]
%49 = load i32, i32* %37
%50 = call i32* @strstr(i32 %49, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%51 = icmp eq i32* %50, null
br i1 %51, label %57, label %52
52: ; preds = %46
%53 = icmp eq i8* %20, null
%54 = select i1 %53, i32 %19, i32 1
%55 = call dereferenceable_or_null(50) i8* @malloc(i32 50)
%56 = call i32 @strncpy(i8* %55, i8* %6, i32 50)
br label %57
57: ; preds = %16, %52, %46
%58 = phi i8* [ %47, %52 ], [ %47, %46 ], [ %21, %16 ]
%59 = phi i8* [ %55, %52 ], [ %20, %46 ], [ %20, %16 ]
%60 = phi i32 [ %54, %52 ], [ %19, %46 ], [ %19, %16 ]
%61 = phi i32 [ %48, %52 ], [ %48, %46 ], [ %18, %16 ]
%62 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %17, i64 0, i32 2
%63 = load %struct.ifaddrs*, %struct.ifaddrs** %62
%64 = icmp eq %struct.ifaddrs* %63, null
br i1 %64, label %65, label %16
65: ; preds = %57
%66 = icmp eq i32 %61, 0
%67 = icmp ne i8* %58, null
%68 = select i1 %66, i1 %67, i1 false
br i1 %68, label %86, label %69
69: ; preds = %65
%70 = icmp eq i32 %60, 0
%71 = icmp eq i8* %58, null
%72 = select i1 %70, i1 %71, i1 false
%73 = icmp ne i8* %59, null
%74 = select i1 %72, i1 %73, i1 false
br i1 %74, label %86, label %75
75: ; preds = %69
%76 = icmp eq i32 %61, 1
br i1 %76, label %86, label %77
77: ; preds = %75
%78 = icmp eq i32 %60, 1
br i1 %78, label %86, label %79
79: ; preds = %9, %77
%80 = phi i8* [ %58, %77 ], [ null, %9 ]
%81 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([85 x i8], [85 x i8]* @str, i64 0, i64 0))
%82 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %80)
%83 = icmp slt i64 %82, 0
br i1 %83, label %84, label %86
84: ; preds = %79
%85 = call i32 @exit(i32 1)
unreachable
86: ; preds = %79, %77, %75, %69, %65
%87 = phi i8* [ %58, %65 ], [ %59, %69 ], [ %58, %75 ], [ %59, %77 ], [ %80, %79 ]
ret i8* %87
}