#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 /*<<< orphan*/ sin_port;
};
struct TYPE_2__ {
  scalar_t__ sa_family;
};
struct ifreq {
  int ifr_flags;
  TYPE_1__ ifr_addr;
};
struct ifconf {
  int ifc_len;
  char *ifc_buf;
  struct ifreq *ifc_req;
};
typedef int /*<<< orphan*/ buf;
typedef int /*<<< orphan*/ bool_t;

/* Variables and functions */
scalar_t__ AF_INET;
int BUFSIZ;
int /*<<< orphan*/ FALSE;
int IFF_LOOPBACK;
int IFF_UP;
int /*<<< orphan*/ PMAPPORT;
int /*<<< orphan*/ SIOCGIFCONF;
int /*<<< orphan*/ SIOCGIFFLAGS;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ TRUE;
char *_(char *);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ htons(int /*<<< orphan*/);
scalar_t__ ioctl(int, int /*<<< orphan*/, char *);
int /*<<< orphan*/ perror(char *);
int socket(scalar_t__, int /*<<< orphan*/, int /*<<< orphan*/);
bool_t __get_myaddress(struct sockaddr_in *addr) {
  int s;
  char buf[BUFSIZ];
  struct ifconf ifc;
  struct ifreq ifreq, *ifr;
  int len, loopback = 1;
  if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
    perror("__get_myaddress: socket");
    exit(1);
  }
  ifc.ifc_len = sizeof(buf);
  ifc.ifc_buf = buf;
  if (ioctl(s, SIOCGIFCONF, (char *)&ifc) < 0) {
    perror(_("__get_myaddress: ioctl (get interface configuration)"));
    exit(1);
  }
again:
  ifr = ifc.ifc_req;
  for (len = ifc.ifc_len; len; len -= sizeof ifreq) {
    ifreq = *ifr;
    if (ioctl(s, SIOCGIFFLAGS, (char *)&ifreq) < 0) {
      perror("__get_myaddress: ioctl");
      exit(1);
    }
    if ((ifreq.ifr_flags & IFF_UP) && (ifr->ifr_addr.sa_family == AF_INET) &&
        ((ifreq.ifr_flags & IFF_LOOPBACK) || (loopback == 0))) {
      *addr = *((struct sockaddr_in *)&ifr->ifr_addr);
      addr->sin_port = htons(PMAPPORT);
      close(s);
      return TRUE;
    }
    ifr++;
  }
  if (loopback == 1) {
    loopback = 0;
    goto again;
  }
  close(s);
  return FALSE;
}


x86 assembly (clang, -O0):
<__get_myaddress>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x10(%rbp)
mov    0x2e22(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0x78(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x70(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
movl   $0x1,-0x60(%rbp)
mov    0x2e23(%rip),%rax
mov    (%rax),%rdi
mov    0x2e09(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1090 <socket@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    11f2 <__get_myaddress+0x82>
lea    0xe1d(%rip),%rdi
call   1070 <perror@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x70(%rbp),%rax
mov    -0x78(%rbp),%rcx
mov    %ecx,-0x40(%rbp)
mov    %rax,-0x38(%rbp)
mov    -0x14(%rbp),%edi
mov    0x2d8d(%rip),%rax
mov    (%rax),%esi
lea    -0x40(%rbp),%rdx
call   1040 <ioctl@plt>
cmp    $0x0,%rax
jge    123e <__get_myaddress+0xce>
lea    0xdf1(%rip),%rdi
call   1060 <_@plt>
mov    %rax,%rdi
call   1070 <perror@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
jmp    1243 <__get_myaddress+0xd3>
mov    -0x30(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0x5c(%rbp)
cmpl   $0x0,-0x5c(%rbp)
je     134e <__get_myaddress+0x1de>
mov    -0x58(%rbp),%rax
mov    (%rax),%rcx
mov    %rcx,-0x50(%rbp)
mov    0x8(%rax),%rax
mov    %rax,-0x48(%rbp)
mov    -0x14(%rbp),%edi
mov    0x2d40(%rip),%rax
mov    (%rax),%esi
lea    -0x50(%rbp),%rdx
call   1040 <ioctl@plt>
cmp    $0x0,%rax
jge    12a3 <__get_myaddress+0x133>
lea    0xdb9(%rip),%rdi
call   1070 <perror@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x50(%rbp),%eax
mov    0x2d2b(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1332 <__get_myaddress+0x1c2>
mov    -0x58(%rbp),%rax
mov    0x8(%rax),%rax
mov    0x2d19(%rip),%rcx
cmp    (%rcx),%rax
jne    1332 <__get_myaddress+0x1c2>
mov    -0x50(%rbp),%eax
mov    0x2d1e(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
jne    12ef <__get_myaddress+0x17f>
cmpl   $0x0,-0x60(%rbp)
jne    1332 <__get_myaddress+0x1c2>
mov    -0x10(%rbp),%rax
mov    -0x58(%rbp),%rcx
mov    0x8(%rcx),%ecx
mov    %ecx,(%rax)
mov    0x2cbd(%rip),%rax
mov    (%rax),%edi
call   1030 <htons@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%edi
call   1050 <close@plt>
mov    0x2ca7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x64(%rbp)
jmp    137f <__get_myaddress+0x20f>
mov    -0x58(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x58(%rbp)
movslq -0x5c(%rbp),%rax
sub    $0x10,%rax
mov    %eax,-0x5c(%rbp)
jmp    1251 <__get_myaddress+0xe1>
cmpl   $0x1,-0x60(%rbp)
jne    1364 <__get_myaddress+0x1f4>
movl   $0x0,-0x60(%rbp)
jmp    1243 <__get_myaddress+0xd3>
mov    -0x14(%rbp),%edi
call   1050 <close@plt>
mov    0x2c2d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x64(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__get_myaddress>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rdi,%r15
mov    0x2e1d(%rip),%rax
mov    (%rax),%r14d
mov    %rsp,%rbx
lea    0xf(%r14),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    0x2e3a(%rip),%rax
mov    (%rax),%rdi
mov    0x2e20(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1090 <socket@plt>
test   %eax,%eax
js     1330 <__get_myaddress+0x1c0>
mov    %eax,%r12d
mov    %r14d,-0x58(%rbp)
mov    %rbx,-0x50(%rbp)
mov    0x2dc5(%rip),%rax
mov    (%rax),%esi
lea    -0x58(%rbp),%rdx
mov    %r12d,%edi
call   1040 <ioctl@plt>
test   %rax,%rax
js     1339 <__get_myaddress+0x1c9>
mov    -0x58(%rbp),%r13d
mov    0x2dab(%rip),%rbx
test   %r13d,%r13d
je     1301 <__get_myaddress+0x191>
mov    %r15,-0x60(%rbp)
mov    -0x48(%rbp),%r14
add    $0x8,%r14
lea    -0x40(%rbp),%r15
mov    0x2de3(%rip),%rbx
jmp    122a <__get_myaddress+0xba>
nopw   0x0(%rax,%rax,1)
add    $0x10,%r14
add    $0xfffffff0,%r13d
je     1273 <__get_myaddress+0x103>
movups -0x8(%r14),%xmm0
movaps %xmm0,-0x40(%rbp)
mov    0x2d7e(%rip),%rax
mov    (%rax),%esi
mov    %r12d,%edi
mov    %r15,%rdx
call   1040 <ioctl@plt>
test   %rax,%rax
js     131a <__get_myaddress+0x1aa>
mov    -0x40(%rbp),%eax
mov    0x2d7e(%rip),%rcx
test   %eax,(%rcx)
je     1220 <__get_myaddress+0xb0>
mov    (%r14),%rcx
mov    0x2d78(%rip),%rdx
cmp    (%rdx),%rcx
jne    1220 <__get_myaddress+0xb0>
test   %eax,(%rbx)
je     1220 <__get_myaddress+0xb0>
jmp    12d8 <__get_myaddress+0x168>
mov    -0x58(%rbp),%ebx
test   %ebx,%ebx
je     12fa <__get_myaddress+0x18a>
mov    -0x48(%rbp),%r14
add    $0x8,%r14
lea    -0x40(%rbp),%r15
jmp    1299 <__get_myaddress+0x129>
nopl   0x0(%rax)
add    $0x10,%r14
add    $0xfffffff0,%ebx
je     12fa <__get_myaddress+0x18a>
movups -0x8(%r14),%xmm0
movaps %xmm0,-0x40(%rbp)
mov    0x2d0f(%rip),%rax
mov    (%rax),%esi
mov    %r12d,%edi
mov    %r15,%rdx
call   1040 <ioctl@plt>
test   %rax,%rax
js     131a <__get_myaddress+0x1aa>
mov    0x2d16(%rip),%rax
mov    (%rax),%eax
test   %eax,-0x40(%rbp)
je     1290 <__get_myaddress+0x120>
mov    (%r14),%rax
mov    0x2d0d(%rip),%rcx
cmp    (%rcx),%rax
jne    1290 <__get_myaddress+0x120>
mov    (%r14),%eax
mov    -0x60(%rbp),%rbx
mov    %eax,(%rbx)
mov    0x2cd8(%rip),%rax
mov    (%rax),%edi
call   1030 <htons@plt>
mov    %eax,(%rbx)
mov    0x2cd0(%rip),%rbx
jmp    1301 <__get_myaddress+0x191>
mov    0x2c9f(%rip),%rbx
mov    %r12d,%edi
call   1050 <close@plt>
mov    (%rbx),%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd2c(%rip),%rdi
call   1070 <perror@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
lea    0xcc9(%rip),%rdi
jmp    1321 <__get_myaddress+0x1b1>
lea    0xcd8(%rip),%rdi
call   1060 <_@plt>
mov    %rax,%rdi
jmp    1321 <__get_myaddress+0x1b1>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32 }
%struct.ifconf = type { i32, i8*, %struct.ifreq* }
%struct.ifreq = type { i32, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i64 }
@BUFSIZ = global i32 0
@AF_INET = global i64 0
@SOCK_DGRAM = global i32 0
@.str = [24 x i8] c"__get_myaddress: socket\00"
@SIOCGIFCONF = global i32 0
@.str.1 = [53 x i8] c"__get_myaddress: ioctl (get interface configuration)\00"
@SIOCGIFFLAGS = global i32 0
@.str.2 = [23 x i8] c"__get_myaddress: ioctl\00"
@IFF_UP = global i32 0
@IFF_LOOPBACK = global i32 0
@PMAPPORT = global i32 0
@TRUE = global i32 0
@FALSE = global i32 0
define i32 @__get_myaddress(%struct.sockaddr_in* %0) {
%2 = alloca i32
%3 = alloca %struct.sockaddr_in*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
%7 = alloca %struct.ifconf
%8 = alloca %struct.ifreq
%9 = alloca %struct.ifreq*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store %struct.sockaddr_in* %0, %struct.sockaddr_in** %3
%13 = load i32, i32* @BUFSIZ
%14 = zext i32 %13 to i64
%15 = call i8* @llvm.stacksave()
store i8* %15, i8** %5
%16 = alloca i8, i64 %14
store i64 %14, i64* %6
store i32 1, i32* %11
%17 = load i64, i64* @AF_INET
%18 = load i32, i32* @SOCK_DGRAM
%19 = call i32 @socket(i64 %17, i32 %18, i32 0)
store i32 %19, i32* %4
%20 = icmp slt i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %1
%22 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%23 = call i32 @exit(i32 1)
unreachable
24: ; preds = %1
%25 = trunc i64 %14 to i32
%26 = getelementptr inbounds %struct.ifconf, %struct.ifconf* %7, i32 0, i32 0
store i32 %25, i32* %26
%27 = getelementptr inbounds %struct.ifconf, %struct.ifconf* %7, i32 0, i32 1
store i8* %16, i8** %27
%28 = load i32, i32* %4
%29 = load i32, i32* @SIOCGIFCONF
%30 = bitcast %struct.ifconf* %7 to i8*
%31 = call i64 @ioctl(i32 %28, i32 %29, i8* %30)
%32 = icmp slt i64 %31, 0
br i1 %32, label %33, label %37
33: ; preds = %24
%34 = call i8* @_(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0))
%35 = call i32 @perror(i8* %34)
%36 = call i32 @exit(i32 1)
unreachable
37: ; preds = %24
br label %38
38: ; preds = %105, %37
%39 = getelementptr inbounds %struct.ifconf, %struct.ifconf* %7, i32 0, i32 2
%40 = load %struct.ifreq*, %struct.ifreq** %39
store %struct.ifreq* %40, %struct.ifreq** %9
%41 = getelementptr inbounds %struct.ifconf, %struct.ifconf* %7, i32 0, i32 0
%42 = load i32, i32* %41
store i32 %42, i32* %10
br label %43
43: ; preds = %97, %38
%44 = load i32, i32* %10
%45 = icmp ne i32 %44, 0
br i1 %45, label %46, label %102
46: ; preds = %43
%47 = load %struct.ifreq*, %struct.ifreq** %9
%48 = bitcast %struct.ifreq* %8 to i8*
%49 = bitcast %struct.ifreq* %47 to i8*
%50 = load i32, i32* %4
%51 = load i32, i32* @SIOCGIFFLAGS
%52 = bitcast %struct.ifreq* %8 to i8*
%53 = call i64 @ioctl(i32 %50, i32 %51, i8* %52)
%54 = icmp slt i64 %53, 0
br i1 %54, label %55, label %58
55: ; preds = %46
%56 = call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%57 = call i32 @exit(i32 1)
unreachable
58: ; preds = %46
%59 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %8, i32 0, i32 0
%60 = load i32, i32* %59
%61 = load i32, i32* @IFF_UP
%62 = and i32 %60, %61
%63 = icmp ne i32 %62, 0
br i1 %63, label %64, label %94
64: ; preds = %58
%65 = load %struct.ifreq*, %struct.ifreq** %9
%66 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %65, i32 0, i32 1
%67 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %66, i32 0, i32 0
%68 = load i64, i64* %67
%69 = load i64, i64* @AF_INET
%70 = icmp eq i64 %68, %69
br i1 %70, label %71, label %94
71: ; preds = %64
%72 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %8, i32 0, i32 0
%73 = load i32, i32* %72
%74 = load i32, i32* @IFF_LOOPBACK
%75 = and i32 %73, %74
%76 = icmp ne i32 %75, 0
br i1 %76, label %80, label %77
77: ; preds = %71
%78 = load i32, i32* %11
%79 = icmp eq i32 %78, 0
br i1 %79, label %80, label %94
80: ; preds = %77, %71
%81 = load %struct.sockaddr_in*, %struct.sockaddr_in** %3
%82 = load %struct.ifreq*, %struct.ifreq** %9
%83 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %82, i32 0, i32 1
%84 = bitcast %struct.TYPE_2__* %83 to %struct.sockaddr_in*
%85 = bitcast %struct.sockaddr_in* %81 to i8*
%86 = bitcast %struct.sockaddr_in* %84 to i8*
%87 = load i32, i32* @PMAPPORT
%88 = call i32 @htons(i32 %87)
%89 = load %struct.sockaddr_in*, %struct.sockaddr_in** %3
%90 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %89, i32 0, i32 0
store i32 %88, i32* %90
%91 = load i32, i32* %4
%92 = call i32 @close(i32 %91)
%93 = load i32, i32* @TRUE
store i32 %93, i32* %2
store i32 1, i32* %12
br label %110
94: ; preds = %77, %64, %58
%95 = load %struct.ifreq*, %struct.ifreq** %9
%96 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %95, i32 1
store %struct.ifreq* %96, %struct.ifreq** %9
br label %97
97: ; preds = %94
%98 = load i32, i32* %10
%99 = sext i32 %98 to i64
%100 = sub i64 %99, 16
%101 = trunc i64 %100 to i32
store i32 %101, i32* %10
br label %43
102: ; preds = %43
%103 = load i32, i32* %11
%104 = icmp eq i32 %103, 1
br i1 %104, label %105, label %106
105: ; preds = %102
store i32 0, i32* %11
br label %38
106: ; preds = %102
%107 = load i32, i32* %4
%108 = call i32 @close(i32 %107)
%109 = load i32, i32* @FALSE
store i32 %109, i32* %2
store i32 1, i32* %12
br label %110
110: ; preds = %106, %80
%111 = load i8*, i8** %5
%112 = load i32, i32* %2
ret i32 %112
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32 }
%struct.ifconf = type { i32, i8*, %struct.ifreq* }
%struct.ifreq = type { i32, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i64 }
@BUFSIZ = global i32 0
@AF_INET = global i64 0
@SOCK_DGRAM = global i32 0
@.str = [24 x i8] c"__get_myaddress: socket\00"
@SIOCGIFCONF = global i32 0
@.str.1 = [53 x i8] c"__get_myaddress: ioctl (get interface configuration)\00"
@SIOCGIFFLAGS = global i32 0
@.str.2 = [23 x i8] c"__get_myaddress: ioctl\00"
@IFF_UP = global i32 0
@IFF_LOOPBACK = global i32 0
@PMAPPORT = global i32 0
@TRUE = global i32 0
@FALSE = global i32 0
define i32 @__get_myaddress(%struct.sockaddr_in* nocapture writeonly %0) {
%2 = alloca %struct.ifconf
%3 = alloca %struct.ifreq
%4 = load i32, i32* @BUFSIZ
%5 = zext i32 %4 to i64
%6 = alloca i8, i64 %5
%7 = bitcast %struct.ifconf* %2 to i8*
%8 = bitcast %struct.ifreq* %3 to i8*
%9 = load i64, i64* @AF_INET
%10 = load i32, i32* @SOCK_DGRAM
%11 = tail call i32 @socket(i64 %9, i32 %10, i32 0)
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %1
%14 = tail call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%15 = tail call i32 @exit(i32 1)
unreachable
16: ; preds = %1
%17 = getelementptr inbounds %struct.ifconf, %struct.ifconf* %2, i64 0, i32 0
store i32 %4, i32* %17
%18 = getelementptr inbounds %struct.ifconf, %struct.ifconf* %2, i64 0, i32 1
store i8* %6, i8** %18
%19 = load i32, i32* @SIOCGIFCONF
%20 = call i64 @ioctl(i32 %11, i32 %19, i8* %7)
%21 = icmp slt i64 %20, 0
br i1 %21, label %29, label %22
22: ; preds = %16
%23 = getelementptr inbounds %struct.ifconf, %struct.ifconf* %2, i64 0, i32 2
%24 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %3, i64 0, i32 0
%25 = load i32, i32* %17
%26 = icmp eq i32 %25, 0
br i1 %26, label %96, label %27
27: ; preds = %22
%28 = load %struct.ifreq*, %struct.ifreq** %23
br label %33
29: ; preds = %16
%30 = call i8* @_(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0))
%31 = call i32 @perror(i8* %30)
%32 = call i32 @exit(i32 1)
unreachable
33: ; preds = %27, %65
%34 = phi i32 [ %67, %65 ], [ %25, %27 ]
%35 = phi %struct.ifreq* [ %66, %65 ], [ %28, %27 ]
%36 = bitcast %struct.ifreq* %35 to i8*
%37 = load i32, i32* @SIOCGIFFLAGS
%38 = call i64 @ioctl(i32 %11, i32 %37, i8* %8)
%39 = icmp slt i64 %38, 0
br i1 %39, label %40, label %43
40: ; preds = %33, %74
%41 = call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%42 = call i32 @exit(i32 1)
unreachable
43: ; preds = %33
%44 = load i32, i32* %24
%45 = load i32, i32* @IFF_UP
%46 = and i32 %45, %44
%47 = icmp eq i32 %46, 0
br i1 %47, label %65, label %48
48: ; preds = %43
%49 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %35, i64 0, i32 1
%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 %65
54: ; preds = %48
%55 = load i32, i32* @IFF_LOOPBACK
%56 = and i32 %55, %44
%57 = icmp eq i32 %56, 0
br i1 %57, label %65, label %58
58: ; preds = %54, %86
%59 = phi %struct.TYPE_2__* [ %87, %86 ], [ %49, %54 ]
%60 = bitcast %struct.TYPE_2__* %59 to i32*
%61 = getelementptr %struct.sockaddr_in, %struct.sockaddr_in* %0, i64 0, i32 0
%62 = load i32, i32* %60
store i32 %62, i32* %61
%63 = load i32, i32* @PMAPPORT
%64 = call i32 @htons(i32 %63)
store i32 %64, i32* %61
br label %96
65: ; preds = %54, %48, %43
%66 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %35, i64 1
%67 = add i32 %34, -16
%68 = icmp eq i32 %67, 0
br i1 %68, label %69, label %33
69: ; preds = %65
%70 = load i32, i32* %17
%71 = icmp eq i32 %70, 0
br i1 %71, label %96, label %72
72: ; preds = %69
%73 = load %struct.ifreq*, %struct.ifreq** %23
br label %74
74: ; preds = %72, %92
%75 = phi i32 [ %94, %92 ], [ %70, %72 ]
%76 = phi %struct.ifreq* [ %93, %92 ], [ %73, %72 ]
%77 = bitcast %struct.ifreq* %76 to i8*
%78 = load i32, i32* @SIOCGIFFLAGS
%79 = call i64 @ioctl(i32 %11, i32 %78, i8* %8)
%80 = icmp slt i64 %79, 0
br i1 %80, label %40, label %81
81: ; preds = %74
%82 = load i32, i32* %24
%83 = load i32, i32* @IFF_UP
%84 = and i32 %83, %82
%85 = icmp eq i32 %84, 0
br i1 %85, label %92, label %86
86: ; preds = %81
%87 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %76, i64 0, i32 1
%88 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %87, i64 0, i32 0
%89 = load i64, i64* %88
%90 = load i64, i64* @AF_INET
%91 = icmp eq i64 %89, %90
br i1 %91, label %58, label %92
92: ; preds = %86, %81
%93 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %76, i64 1
%94 = add i32 %75, -16
%95 = icmp eq i32 %94, 0
br i1 %95, label %96, label %74
96: ; preds = %92, %69, %22, %58
%97 = phi i32* [ @TRUE, %58 ], [ @FALSE, %22 ], [ @FALSE, %69 ], [ @FALSE, %92 ]
%98 = call i32 @close(i32 %11)
%99 = load i32, i32* %97
ret i32 %99
}