#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_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  unsigned int *s6_addr32;
};
struct sockaddr_in6 {
  TYPE_1__ sin6_addr;
};
struct ifaddrs {
  int ifa_flags;
  struct ifaddrs *ifa_next;
  TYPE_2__ *ifa_addr;
  TYPE_2__ *ifa_netmask;
  int /*<<< orphan*/ ifa_name;
};
struct hv_kvp_ipaddr_value {
  scalar_t__ sub_net;
  int /*<<< orphan*/ addr_family;
  scalar_t__ ip_addr;
};
struct TYPE_4__ {
  int sa_family;
};

/* Variables and functions */
int /*<<< orphan*/ ADDR_FAMILY_IPV4;
int /*<<< orphan*/ ADDR_FAMILY_IPV6;
int AF_INET;
int AF_INET6;
int HV_E_FAIL;
int IFF_LOOPBACK;
int KVP_OP_ENUMERATE;
int KVP_OP_GET_IP_INFO;
int /*<<< orphan*/ freeifaddrs(struct ifaddrs *);
scalar_t__ getifaddrs(struct ifaddrs **);
scalar_t__ hweight32(unsigned int *);
int /*<<< orphan*/ kvp_get_ipconfig_info(char *, struct hv_kvp_ipaddr_value *);
int kvp_process_ip_address(TYPE_2__ *, int, char *, unsigned int, int *);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
scalar_t__ strncmp(int /*<<< orphan*/, char *, int);
int kvp_get_ip_info(int family, char *if_name, int op, void *out_buffer,
                    unsigned int length) {
  struct ifaddrs *ifap;
  struct ifaddrs *curp;
  int offset = 0;
  int sn_offset = 0;
  int error = 0;
  char *buffer;
  struct hv_kvp_ipaddr_value *ip_buffer = NULL;
  char cidr_mask[5];
  int weight;
  int i;
  unsigned int *w;
  char *sn_str;
  struct sockaddr_in6 *addr6;
  if (op == KVP_OP_ENUMERATE) {
    buffer = out_buffer;
  } else {
    ip_buffer = out_buffer;
    buffer = (char *)ip_buffer->ip_addr;
    ip_buffer->addr_family = 0;
  }
  if (getifaddrs(&ifap)) {
    strcpy(buffer, "getifaddrs failed\n");
    return HV_E_FAIL;
  }
  curp = ifap;
  while (curp != NULL) {
    if (curp->ifa_addr == NULL) {
      curp = curp->ifa_next;
      continue;
    }
    if ((if_name != NULL) &&
        (strncmp(curp->ifa_name, if_name, strlen(if_name)))) {
      curp = curp->ifa_next;
      continue;
    }
    if ((((family != 0) && (curp->ifa_addr->sa_family != family))) ||
        (curp->ifa_flags & IFF_LOOPBACK)) {
      curp = curp->ifa_next;
      continue;
    }
    if ((curp->ifa_addr->sa_family != AF_INET) &&
        (curp->ifa_addr->sa_family != AF_INET6)) {
      curp = curp->ifa_next;
      continue;
    }
    if (op == KVP_OP_GET_IP_INFO) {
      if (curp->ifa_addr->sa_family == AF_INET) {
        ip_buffer->addr_family |= ADDR_FAMILY_IPV4;
        error = kvp_process_ip_address(curp->ifa_netmask, AF_INET,
                                       (char *)ip_buffer->sub_net, length,
                                       &sn_offset);
        if (error)
          goto gather_ipaddr;
      } else {
        ip_buffer->addr_family |= ADDR_FAMILY_IPV6;
        weight = 0;
        sn_str = (char *)ip_buffer->sub_net;
        addr6 = (struct sockaddr_in6 *)curp->ifa_netmask;
        w = addr6->sin6_addr.s6_addr32;
        for (i = 0; i < 4; i++)
          weight += hweight32(&w[i]);
        sprintf(cidr_mask, "/%d", weight);
        if (length < sn_offset + strlen(cidr_mask) + 1)
          goto gather_ipaddr;
        if (sn_offset == 0)
          strcpy(sn_str, cidr_mask);
        else {
          strcat((char *)ip_buffer->sub_net, ";");
          strcat(sn_str, cidr_mask);
        }
        sn_offset += strlen(sn_str) + 1;
      }
      kvp_get_ipconfig_info(if_name, ip_buffer);
    }
  gather_ipaddr:
    error = kvp_process_ip_address(curp->ifa_addr, curp->ifa_addr->sa_family,
                                   buffer, length, &offset);
    if (error)
      goto getaddr_done;
    curp = curp->ifa_next;
  }
getaddr_done:
  freeifaddrs(ifap);
  return error;
}


x86 assembly (clang, -O0):
<kvp_get_ip_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
movq   $0x0,-0x58(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2df4(%rip),%rcx
cmp    (%rcx),%eax
jne    11f9 <kvp_get_ip_info+0x59>
mov    -0x20(%rbp),%rax
mov    %rax,-0x50(%rbp)
jmp    1218 <kvp_get_ip_info+0x78>
mov    -0x20(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x50(%rbp)
mov    -0x58(%rbp),%rax
movl   $0x0,0x8(%rax)
lea    -0x30(%rbp),%rdi
call   1080 <getifaddrs@plt>
cmp    $0x0,%rax
je     124c <kvp_get_ip_info+0xac>
mov    -0x50(%rbp),%rdi
lea    0xdca(%rip),%rsi
call   1040 <strcpy@plt>
mov    0x2d6e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    155f <kvp_get_ip_info+0x3bf>
mov    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     154b <kvp_get_ip_info+0x3ab>
mov    -0x38(%rbp),%rax
cmpq   $0x0,0x10(%rax)
jne    127f <kvp_get_ip_info+0xdf>
mov    -0x38(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x38(%rbp)
jmp    1254 <kvp_get_ip_info+0xb4>
cmpq   $0x0,-0x10(%rbp)
je     12da <kvp_get_ip_info+0x13a>
mov    -0x38(%rbp),%rax
mov    0x20(%rax),%eax
mov    %eax,-0x8c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x8c(%rbp),%edi
mov    -0x88(%rbp),%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     12da <kvp_get_ip_info+0x13a>
mov    -0x38(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x38(%rbp)
jmp    1254 <kvp_get_ip_info+0xb4>
cmpl   $0x0,-0x8(%rbp)
je     12f7 <kvp_get_ip_info+0x157>
mov    -0x38(%rbp),%rax
mov    0x10(%rax),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jne    130f <kvp_get_ip_info+0x16f>
mov    -0x38(%rbp),%rax
mov    (%rax),%eax
mov    0x2cf4(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1320 <kvp_get_ip_info+0x180>
mov    -0x38(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x38(%rbp)
jmp    1254 <kvp_get_ip_info+0xb4>
mov    -0x38(%rbp),%rax
mov    0x10(%rax),%rax
mov    (%rax),%eax
mov    0x2caf(%rip),%rcx
cmp    (%rcx),%eax
je     1363 <kvp_get_ip_info+0x1c3>
mov    -0x38(%rbp),%rax
mov    0x10(%rax),%rax
mov    (%rax),%eax
mov    0x2c76(%rip),%rcx
cmp    (%rcx),%eax
je     1363 <kvp_get_ip_info+0x1c3>
mov    -0x38(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x38(%rbp)
jmp    1254 <kvp_get_ip_info+0xb4>
mov    -0x14(%rbp),%eax
mov    0x2c3b(%rip),%rcx
cmp    (%rcx),%eax
jne    1501 <kvp_get_ip_info+0x361>
mov    -0x38(%rbp),%rax
mov    0x10(%rax),%rax
mov    (%rax),%eax
mov    0x2c5a(%rip),%rcx
cmp    (%rcx),%eax
jne    13dc <kvp_get_ip_info+0x23c>
mov    0x2c3b(%rip),%rax
mov    (%rax),%ecx
mov    -0x58(%rbp),%rax
or     0x8(%rax),%ecx
mov    %ecx,0x8(%rax)
mov    -0x38(%rbp),%rax
mov    0x18(%rax),%rdi
mov    0x2c30(%rip),%rax
mov    (%rax),%esi
mov    -0x58(%rbp),%rax
mov    (%rax),%rdx
mov    -0x24(%rbp),%ecx
lea    -0x40(%rbp),%r8
call   1060 <kvp_process_ip_address@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
je     13d7 <kvp_get_ip_info+0x237>
jmp    1506 <kvp_get_ip_info+0x366>
jmp    14f4 <kvp_get_ip_info+0x354>
mov    0x2be5(%rip),%rax
mov    (%rax),%ecx
mov    -0x58(%rbp),%rax
or     0x8(%rax),%ecx
mov    %ecx,0x8(%rax)
movl   $0x0,-0x64(%rbp)
mov    -0x58(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x78(%rbp)
mov    -0x38(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x80(%rbp)
mov    -0x80(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x70(%rbp)
movl   $0x0,-0x68(%rbp)
cmpl   $0x4,-0x68(%rbp)
jge    1458 <kvp_get_ip_info+0x2b8>
mov    -0x70(%rbp),%rdi
movslq -0x68(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
call   1070 <hweight32@plt>
mov    %rax,%rcx
movslq -0x64(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x64(%rbp)
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    141f <kvp_get_ip_info+0x27f>
lea    -0x5d(%rbp),%rdi
mov    -0x64(%rbp),%edx
lea    0xbad(%rip),%rsi
call   10c0 <sprintf@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x90(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0x94(%rbp)
lea    -0x5d(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x94(%rbp),%ecx
mov    %eax,%edx
mov    -0x90(%rbp),%eax
add    %edx,%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jae    14a6 <kvp_get_ip_info+0x306>
jmp    1506 <kvp_get_ip_info+0x366>
cmpl   $0x0,-0x40(%rbp)
jne    14c2 <kvp_get_ip_info+0x322>
mov    -0x78(%rbp),%rdi
lea    -0x5d(%rbp),%rsi
call   1040 <strcpy@plt>
jmp    14e2 <kvp_get_ip_info+0x342>
mov    -0x58(%rbp),%rax
mov    (%rax),%rdi
lea    0xb47(%rip),%rsi
call   10b0 <strcat@plt>
mov    -0x78(%rbp),%rdi
lea    -0x5d(%rbp),%rsi
call   10b0 <strcat@plt>
mov    -0x78(%rbp),%rdi
call   1050 <strlen@plt>
add    $0x1,%eax
add    -0x40(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x58(%rbp),%rsi
call   10a0 <kvp_get_ipconfig_info@plt>
jmp    1506 <kvp_get_ip_info+0x366>
mov    -0x38(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x38(%rbp),%rax
mov    0x10(%rax),%rax
mov    (%rax),%esi
mov    -0x50(%rbp),%rdx
mov    -0x24(%rbp),%ecx
lea    -0x3c(%rbp),%r8
call   1060 <kvp_process_ip_address@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
je     153a <kvp_get_ip_info+0x39a>
jmp    1550 <kvp_get_ip_info+0x3b0>
mov    -0x38(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x38(%rbp)
jmp    1254 <kvp_get_ip_info+0xb4>
jmp    1550 <kvp_get_ip_info+0x3b0>
mov    -0x30(%rbp),%rdi
call   1090 <freeifaddrs@plt>
mov    -0x44(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kvp_get_ip_info>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r8d,%r13d
mov    %rcx,%r12
mov    %edx,%ebx
mov    %rsi,%rbp
mov    %edi,%r14d
movl   $0x0,0x24(%rsp)
movl   $0x0,0x4(%rsp)
mov    0x2e05(%rip),%rax
cmp    %edx,(%rax)
jne    11dc <kvp_get_ip_info+0x3c>
xor    %r15d,%r15d
jmp    11f0 <kvp_get_ip_info+0x50>
mov    %r12,%r15
mov    0x10(%r12),%rax
movl   $0x0,0x8(%r12)
mov    %rax,%r12
lea    0x30(%rsp),%rdi
call   1080 <getifaddrs@plt>
test   %rax,%rax
je     121c <kvp_get_ip_info+0x7c>
lea    0xdfa(%rip),%rsi
mov    %r12,%rdi
call   1040 <strcpy@plt>
mov    0x2d9b(%rip),%rax
mov    (%rax),%ebx
jmp    1416 <kvp_get_ip_info+0x276>
mov    %r15,0x10(%rsp)
mov    %ebx,0x20(%rsp)
mov    0x30(%rsp),%r15
test   %r15,%r15
jne    125d <kvp_get_ip_info+0xbd>
xor    %edi,%edi
xor    %ebx,%ebx
jmp    1411 <kvp_get_ip_info+0x271>
nopl   0x0(%rax,%rax,1)
mov    0x2db1(%rip),%rax
mov    (%rax),%eax
test   %eax,(%r15)
je     1296 <kvp_get_ip_info+0xf6>
xchg   %ax,%ax
mov    0x8(%r15),%r15
test   %r15,%r15
je     140a <kvp_get_ip_info+0x26a>
cmpq   $0x0,0x10(%r15)
je     1250 <kvp_get_ip_info+0xb0>
test   %rbp,%rbp
je     1286 <kvp_get_ip_info+0xe6>
mov    0x20(%r15),%ebx
mov    %rbp,%rdi
call   1050 <strlen@plt>
mov    %ebx,%edi
mov    %rbp,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    1250 <kvp_get_ip_info+0xb0>
test   %r14d,%r14d
je     1240 <kvp_get_ip_info+0xa0>
mov    0x10(%r15),%rax
cmp    %r14d,(%rax)
je     1240 <kvp_get_ip_info+0xa0>
jmp    1250 <kvp_get_ip_info+0xb0>
mov    0x10(%r15),%rax
mov    (%rax),%esi
mov    0x2d3d(%rip),%rax
mov    (%rax),%eax
cmp    %eax,%esi
je     12b4 <kvp_get_ip_info+0x114>
mov    0x2d10(%rip),%rcx
cmp    (%rcx),%esi
jne    1250 <kvp_get_ip_info+0xb0>
mov    0x20(%rsp),%ecx
mov    0x2ce9(%rip),%rdx
cmp    %ecx,(%rdx)
jne    13e8 <kvp_get_ip_info+0x248>
cmp    %eax,%esi
jne    12fd <kvp_get_ip_info+0x15d>
mov    0x2cfe(%rip),%rax
mov    (%rax),%eax
mov    0x10(%rsp),%rcx
or     %eax,0x8(%rcx)
mov    0x18(%r15),%rdi
mov    (%rcx),%rdx
mov    %r13d,%ecx
lea    0x4(%rsp),%r8
call   1060 <kvp_process_ip_address@plt>
test   %eax,%eax
jne    13e8 <kvp_get_ip_info+0x248>
jmp    13db <kvp_get_ip_info+0x23b>
mov    0x2cc4(%rip),%rax
mov    (%rax),%eax
mov    0x10(%rsp),%rcx
or     %eax,0x8(%rcx)
mov    (%rcx),%rax
mov    %rax,0x28(%rsp)
mov    0x18(%r15),%rax
mov    (%rax),%rbx
mov    %rbx,%rdi
call   1070 <hweight32@plt>
mov    %r13d,0x1c(%rsp)
mov    %rax,%r13
lea    0x4(%rbx),%rdi
call   1070 <hweight32@plt>
add    %eax,%r13d
lea    0x8(%rbx),%rdi
call   1070 <hweight32@plt>
add    %eax,%r13d
add    $0xc,%rbx
mov    %rbx,%rdi
call   1070 <hweight32@plt>
add    %eax,%r13d
lea    0xb(%rsp),%rdi
lea    0xcb3(%rip),%rsi
mov    %r13d,%edx
mov    0x1c(%rsp),%r13d
call   10c0 <sprintf@plt>
mov    0x4(%rsp),%ebx
lea    0xb(%rsp),%rdi
call   1050 <strlen@plt>
add    %ebx,%eax
add    $0x1,%eax
cmp    %r13d,%eax
ja     13e8 <kvp_get_ip_info+0x248>
cmpl   $0x0,0x4(%rsp)
je     13b4 <kvp_get_ip_info+0x214>
mov    0x10(%rsp),%rax
mov    (%rax),%rdi
lea    0xc7c(%rip),%rsi
call   10b0 <strcat@plt>
mov    0x28(%rsp),%rbx
mov    %rbx,%rdi
lea    0xb(%rsp),%rsi
call   10b0 <strcat@plt>
jmp    13c6 <kvp_get_ip_info+0x226>
mov    0x28(%rsp),%rbx
mov    %rbx,%rdi
lea    0xb(%rsp),%rsi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    0x4(%rsp),%ecx
add    %ecx,%eax
add    $0x1,%eax
mov    %eax,0x4(%rsp)
mov    %rbp,%rdi
mov    0x10(%rsp),%rsi
call   10a0 <kvp_get_ipconfig_info@plt>
mov    0x10(%r15),%rdi
mov    (%rdi),%esi
mov    %r12,%rdx
mov    %r13d,%ecx
lea    0x24(%rsp),%r8
call   1060 <kvp_process_ip_address@plt>
test   %eax,%eax
je     1250 <kvp_get_ip_info+0xb0>
mov    %eax,%ebx
jmp    140c <kvp_get_ip_info+0x26c>
xor    %ebx,%ebx
mov    0x30(%rsp),%rdi
call   1090 <freeifaddrs@plt>
mov    %ebx,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.ifaddrs = type { i32, %struct.ifaddrs*, %struct.TYPE_4__*, %struct.TYPE_4__*, i32 }
%struct.TYPE_4__ = type { i32 }
%struct.hv_kvp_ipaddr_value = type { i64, i32, i64 }
%struct.sockaddr_in6 = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i32* }
@KVP_OP_ENUMERATE = global i32 0
@.str = [19 x i8] c"getifaddrs failed\0A\00"
@HV_E_FAIL = global i32 0
@IFF_LOOPBACK = global i32 0
@AF_INET = global i32 0
@AF_INET6 = global i32 0
@KVP_OP_GET_IP_INFO = global i32 0
@ADDR_FAMILY_IPV4 = global i32 0
@ADDR_FAMILY_IPV6 = global i32 0
@.str.1 = [4 x i8] c"/%d\00"
@.str.2 = [2 x i8] c";\00"
define i32 @kvp_get_ip_info(i32 %0, i8* %1, i32 %2, i8* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
%12 = alloca %struct.ifaddrs*
%13 = alloca %struct.ifaddrs*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i8*
%18 = alloca %struct.hv_kvp_ipaddr_value*
%19 = alloca [5 x i8]
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32*
%23 = alloca i8*
%24 = alloca %struct.sockaddr_in6*
store i32 %0, i32* %7
store i8* %1, i8** %8
store i32 %2, i32* %9
store i8* %3, i8** %10
store i32 %4, i32* %11
store i32 0, i32* %14
store i32 0, i32* %15
store i32 0, i32* %16
store %struct.hv_kvp_ipaddr_value* null, %struct.hv_kvp_ipaddr_value** %18
%25 = load i32, i32* %9
%26 = load i32, i32* @KVP_OP_ENUMERATE
%27 = icmp eq i32 %25, %26
br i1 %27, label %28, label %30
28: ; preds = %5
%29 = load i8*, i8** %10
store i8* %29, i8** %17
br label %39
30: ; preds = %5
%31 = load i8*, i8** %10
%32 = bitcast i8* %31 to %struct.hv_kvp_ipaddr_value*
store %struct.hv_kvp_ipaddr_value* %32, %struct.hv_kvp_ipaddr_value** %18
%33 = load %struct.hv_kvp_ipaddr_value*, %struct.hv_kvp_ipaddr_value** %18
%34 = getelementptr inbounds %struct.hv_kvp_ipaddr_value, %struct.hv_kvp_ipaddr_value* %33, i32 0, i32 2
%35 = load i64, i64* %34
%36 = inttoptr i64 %35 to i8*
store i8* %36, i8** %17
%37 = load %struct.hv_kvp_ipaddr_value*, %struct.hv_kvp_ipaddr_value** %18
%38 = getelementptr inbounds %struct.hv_kvp_ipaddr_value, %struct.hv_kvp_ipaddr_value* %37, i32 0, i32 1
store i32 0, i32* %38
br label %39
39: ; preds = %30, %28
%40 = call i64 @getifaddrs(%struct.ifaddrs** %12)
%41 = icmp ne i64 %40, 0
br i1 %41, label %42, label %46
42: ; preds = %39
%43 = load i8*, i8** %17
%44 = call i32 @strcpy(i8* %43, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%45 = load i32, i32* @HV_E_FAIL
store i32 %45, i32* %6
br label %247
46: ; preds = %39
%47 = load %struct.ifaddrs*, %struct.ifaddrs** %12
store %struct.ifaddrs* %47, %struct.ifaddrs** %13
br label %48
48: ; preds = %238, %114, %94, %72, %56, %46
%49 = load %struct.ifaddrs*, %struct.ifaddrs** %13
%50 = icmp ne %struct.ifaddrs* %49, null
br i1 %50, label %51, label %242
51: ; preds = %48
%52 = load %struct.ifaddrs*, %struct.ifaddrs** %13
%53 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %52, i32 0, i32 2
%54 = load %struct.TYPE_4__*, %struct.TYPE_4__** %53
%55 = icmp eq %struct.TYPE_4__* %54, null
br i1 %55, label %56, label %60
56: ; preds = %51
%57 = load %struct.ifaddrs*, %struct.ifaddrs** %13
%58 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %57, i32 0, i32 1
%59 = load %struct.ifaddrs*, %struct.ifaddrs** %58
store %struct.ifaddrs* %59, %struct.ifaddrs** %13
br label %48
60: ; preds = %51
%61 = load i8*, i8** %8
%62 = icmp ne i8* %61, null
br i1 %62, label %63, label %76
63: ; preds = %60
%64 = load %struct.ifaddrs*, %struct.ifaddrs** %13
%65 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %64, i32 0, i32 4
%66 = load i32, i32* %65
%67 = load i8*, i8** %8
%68 = load i8*, i8** %8
%69 = call i32 @strlen(i8* %68)
%70 = call i64 @strncmp(i32 %66, i8* %67, i32 %69)
%71 = icmp ne i64 %70, 0
br i1 %71, label %72, label %76
72: ; preds = %63
%73 = load %struct.ifaddrs*, %struct.ifaddrs** %13
%74 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %73, i32 0, i32 1
%75 = load %struct.ifaddrs*, %struct.ifaddrs** %74
store %struct.ifaddrs* %75, %struct.ifaddrs** %13
br label %48
76: ; preds = %63, %60
%77 = load i32, i32* %7
%78 = icmp ne i32 %77, 0
br i1 %78, label %79, label %87
79: ; preds = %76
%80 = load %struct.ifaddrs*, %struct.ifaddrs** %13
%81 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %80, i32 0, i32 2
%82 = load %struct.TYPE_4__*, %struct.TYPE_4__** %81
%83 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %82, i32 0, i32 0
%84 = load i32, i32* %83
%85 = load i32, i32* %7
%86 = icmp ne i32 %84, %85
br i1 %86, label %94, label %87
87: ; preds = %79, %76
%88 = load %struct.ifaddrs*, %struct.ifaddrs** %13
%89 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %88, i32 0, i32 0
%90 = load i32, i32* %89
%91 = load i32, i32* @IFF_LOOPBACK
%92 = and i32 %90, %91
%93 = icmp ne i32 %92, 0
br i1 %93, label %94, label %98
94: ; preds = %87, %79
%95 = load %struct.ifaddrs*, %struct.ifaddrs** %13
%96 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %95, i32 0, i32 1
%97 = load %struct.ifaddrs*, %struct.ifaddrs** %96
store %struct.ifaddrs* %97, %struct.ifaddrs** %13
br label %48
98: ; preds = %87
%99 = load %struct.ifaddrs*, %struct.ifaddrs** %13
%100 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %99, i32 0, i32 2
%101 = load %struct.TYPE_4__*, %struct.TYPE_4__** %100
%102 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %101, i32 0, i32 0
%103 = load i32, i32* %102
%104 = load i32, i32* @AF_INET
%105 = icmp ne i32 %103, %104
br i1 %105, label %106, label %118
106: ; preds = %98
%107 = load %struct.ifaddrs*, %struct.ifaddrs** %13
%108 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %107, i32 0, i32 2
%109 = load %struct.TYPE_4__*, %struct.TYPE_4__** %108
%110 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %109, i32 0, i32 0
%111 = load i32, i32* %110
%112 = load i32, i32* @AF_INET6
%113 = icmp ne i32 %111, %112
br i1 %113, label %114, label %118
114: ; preds = %106
%115 = load %struct.ifaddrs*, %struct.ifaddrs** %13
%116 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %115, i32 0, i32 1
%117 = load %struct.ifaddrs*, %struct.ifaddrs** %116
store %struct.ifaddrs* %117, %struct.ifaddrs** %13
br label %48
118: ; preds = %106, %98
%119 = load i32, i32* %9
%120 = load i32, i32* @KVP_OP_GET_IP_INFO
%121 = icmp eq i32 %119, %120
br i1 %121, label %122, label %222
122: ; preds = %118
%123 = load %struct.ifaddrs*, %struct.ifaddrs** %13
%124 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %123, i32 0, i32 2
%125 = load %struct.TYPE_4__*, %struct.TYPE_4__** %124
%126 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %125, i32 0, i32 0
%127 = load i32, i32* %126
%128 = load i32, i32* @AF_INET
%129 = icmp eq i32 %127, %128
br i1 %129, label %130, label %150
130: ; preds = %122
%131 = load i32, i32* @ADDR_FAMILY_IPV4
%132 = load %struct.hv_kvp_ipaddr_value*, %struct.hv_kvp_ipaddr_value** %18
%133 = getelementptr inbounds %struct.hv_kvp_ipaddr_value, %struct.hv_kvp_ipaddr_value* %132, i32 0, i32 1
%134 = load i32, i32* %133
%135 = or i32 %134, %131
store i32 %135, i32* %133
%136 = load %struct.ifaddrs*, %struct.ifaddrs** %13
%137 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %136, i32 0, i32 3
%138 = load %struct.TYPE_4__*, %struct.TYPE_4__** %137
%139 = load i32, i32* @AF_INET
%140 = load %struct.hv_kvp_ipaddr_value*, %struct.hv_kvp_ipaddr_value** %18
%141 = getelementptr inbounds %struct.hv_kvp_ipaddr_value, %struct.hv_kvp_ipaddr_value* %140, i32 0, i32 0
%142 = load i64, i64* %141
%143 = inttoptr i64 %142 to i8*
%144 = load i32, i32* %11
%145 = call i32 @kvp_process_ip_address(%struct.TYPE_4__* %138, i32 %139, i8* %143, i32 %144, i32* %15)
store i32 %145, i32* %16
%146 = load i32, i32* %16
%147 = icmp ne i32 %146, 0
br i1 %147, label %148, label %149
148: ; preds = %130
br label %223
149: ; preds = %130
br label %218
150: ; preds = %122
%151 = load i32, i32* @ADDR_FAMILY_IPV6
%152 = load %struct.hv_kvp_ipaddr_value*, %struct.hv_kvp_ipaddr_value** %18
%153 = getelementptr inbounds %struct.hv_kvp_ipaddr_value, %struct.hv_kvp_ipaddr_value* %152, i32 0, i32 1
%154 = load i32, i32* %153
%155 = or i32 %154, %151
store i32 %155, i32* %153
store i32 0, i32* %20
%156 = load %struct.hv_kvp_ipaddr_value*, %struct.hv_kvp_ipaddr_value** %18
%157 = getelementptr inbounds %struct.hv_kvp_ipaddr_value, %struct.hv_kvp_ipaddr_value* %156, i32 0, i32 0
%158 = load i64, i64* %157
%159 = inttoptr i64 %158 to i8*
store i8* %159, i8** %23
%160 = load %struct.ifaddrs*, %struct.ifaddrs** %13
%161 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %160, i32 0, i32 3
%162 = load %struct.TYPE_4__*, %struct.TYPE_4__** %161
%163 = bitcast %struct.TYPE_4__* %162 to %struct.sockaddr_in6*
store %struct.sockaddr_in6* %163, %struct.sockaddr_in6** %24
%164 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %24
%165 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %164, i32 0, i32 0
%166 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %165, i32 0, i32 0
%167 = load i32*, i32** %166
store i32* %167, i32** %22
store i32 0, i32* %21
br label %168
168: ; preds = %181, %150
%169 = load i32, i32* %21
%170 = icmp slt i32 %169, 4
br i1 %170, label %171, label %184
171: ; preds = %168
%172 = load i32*, i32** %22
%173 = load i32, i32* %21
%174 = sext i32 %173 to i64
%175 = getelementptr inbounds i32, i32* %172, i64 %174
%176 = call i64 @hweight32(i32* %175)
%177 = load i32, i32* %20
%178 = sext i32 %177 to i64
%179 = add nsw i64 %178, %176
%180 = trunc i64 %179 to i32
store i32 %180, i32* %20
br label %181
181: ; preds = %171
%182 = load i32, i32* %21
%183 = add nsw i32 %182, 1
store i32 %183, i32* %21
br label %168
184: ; preds = %168
%185 = getelementptr inbounds [5 x i8], [5 x i8]* %19, i64 0, i64 0
%186 = load i32, i32* %20
%187 = call i32 @sprintf(i8* %185, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %186)
%188 = load i32, i32* %11
%189 = load i32, i32* %15
%190 = getelementptr inbounds [5 x i8], [5 x i8]* %19, i64 0, i64 0
%191 = call i32 @strlen(i8* %190)
%192 = add nsw i32 %189, %191
%193 = add nsw i32 %192, 1
%194 = icmp ult i32 %188, %193
br i1 %194, label %195, label %196
195: ; preds = %184
br label %223
196: ; preds = %184
%197 = load i32, i32* %15
%198 = icmp eq i32 %197, 0
br i1 %198, label %199, label %203
199: ; preds = %196
%200 = load i8*, i8** %23
%201 = getelementptr inbounds [5 x i8], [5 x i8]* %19, i64 0, i64 0
%202 = call i32 @strcpy(i8* %200, i8* %201)
br label %212
203: ; preds = %196
%204 = load %struct.hv_kvp_ipaddr_value*, %struct.hv_kvp_ipaddr_value** %18
%205 = getelementptr inbounds %struct.hv_kvp_ipaddr_value, %struct.hv_kvp_ipaddr_value* %204, i32 0, i32 0
%206 = load i64, i64* %205
%207 = inttoptr i64 %206 to i8*
%208 = call i32 @strcat(i8* %207, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%209 = load i8*, i8** %23
%210 = getelementptr inbounds [5 x i8], [5 x i8]* %19, i64 0, i64 0
%211 = call i32 @strcat(i8* %209, i8* %210)
br label %212
212: ; preds = %203, %199
%213 = load i8*, i8** %23
%214 = call i32 @strlen(i8* %213)
%215 = add nsw i32 %214, 1
%216 = load i32, i32* %15
%217 = add nsw i32 %216, %215
store i32 %217, i32* %15
br label %218
218: ; preds = %212, %149
%219 = load i8*, i8** %8
%220 = load %struct.hv_kvp_ipaddr_value*, %struct.hv_kvp_ipaddr_value** %18
%221 = call i32 @kvp_get_ipconfig_info(i8* %219, %struct.hv_kvp_ipaddr_value* %220)
br label %222
222: ; preds = %218, %118
br label %223
223: ; preds = %222, %195, %148
%224 = load %struct.ifaddrs*, %struct.ifaddrs** %13
%225 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %224, i32 0, i32 2
%226 = load %struct.TYPE_4__*, %struct.TYPE_4__** %225
%227 = load %struct.ifaddrs*, %struct.ifaddrs** %13
%228 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %227, i32 0, i32 2
%229 = load %struct.TYPE_4__*, %struct.TYPE_4__** %228
%230 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %229, i32 0, i32 0
%231 = load i32, i32* %230
%232 = load i8*, i8** %17
%233 = load i32, i32* %11
%234 = call i32 @kvp_process_ip_address(%struct.TYPE_4__* %226, i32 %231, i8* %232, i32 %233, i32* %14)
store i32 %234, i32* %16
%235 = load i32, i32* %16
%236 = icmp ne i32 %235, 0
br i1 %236, label %237, label %238
237: ; preds = %223
br label %243
238: ; preds = %223
%239 = load %struct.ifaddrs*, %struct.ifaddrs** %13
%240 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %239, i32 0, i32 1
%241 = load %struct.ifaddrs*, %struct.ifaddrs** %240
store %struct.ifaddrs* %241, %struct.ifaddrs** %13
br label %48
242: ; preds = %48
br label %243
243: ; preds = %242, %237
%244 = load %struct.ifaddrs*, %struct.ifaddrs** %12
%245 = call i32 @freeifaddrs(%struct.ifaddrs* %244)
%246 = load i32, i32* %16
store i32 %246, i32* %6
br label %247
247: ; preds = %243, %42
%248 = load i32, i32* %6
ret i32 %248
}

LLVM IR (-O2):
%struct.ifaddrs = type { i32, %struct.ifaddrs*, %struct.TYPE_4__*, %struct.TYPE_4__*, i32 }
%struct.TYPE_4__ = type { i32 }
%struct.hv_kvp_ipaddr_value = type { i64, i32, i64 }
%struct.sockaddr_in6 = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i32* }
@KVP_OP_ENUMERATE = global i32 0
@.str = [19 x i8] c"getifaddrs failed\0A\00"
@HV_E_FAIL = global i32 0
@IFF_LOOPBACK = global i32 0
@AF_INET = global i32 0
@AF_INET6 = global i32 0
@KVP_OP_GET_IP_INFO = global i32 0
@ADDR_FAMILY_IPV4 = global i32 0
@ADDR_FAMILY_IPV6 = global i32 0
@.str.1 = [4 x i8] c"/%d\00"
@.str.2 = [2 x i8] c";\00"
define i32 @kvp_get_ip_info(i32 %0, i8* %1, i32 %2, i8* %3, i32 %4) {
%6 = alloca %struct.ifaddrs*
%7 = alloca i32
%8 = alloca i32
%9 = alloca [5 x i8]
%10 = bitcast %struct.ifaddrs** %6 to i8*
%11 = bitcast i32* %7 to i8*
store i32 0, i32* %7
%12 = bitcast i32* %8 to i8*
store i32 0, i32* %8
%13 = getelementptr inbounds [5 x i8], [5 x i8]* %9, i64 0, i64 0
%14 = load i32, i32* @KVP_OP_ENUMERATE
%15 = icmp eq i32 %14, %2
br i1 %15, label %24, label %16
16: ; preds = %5
%17 = bitcast i8* %3 to %struct.hv_kvp_ipaddr_value*
%18 = getelementptr inbounds i8, i8* %3, i64 16
%19 = bitcast i8* %18 to i64*
%20 = load i64, i64* %19
%21 = inttoptr i64 %20 to i8*
%22 = getelementptr inbounds i8, i8* %3, i64 8
%23 = bitcast i8* %22 to i32*
store i32 0, i32* %23
br label %24
24: ; preds = %5, %16
%25 = phi i8* [ %21, %16 ], [ %3, %5 ]
%26 = phi %struct.hv_kvp_ipaddr_value* [ %17, %16 ], [ null, %5 ]
%27 = call i64 @getifaddrs(%struct.ifaddrs** %6)
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %37
29: ; preds = %24
%30 = load %struct.ifaddrs*, %struct.ifaddrs** %6
%31 = icmp eq %struct.ifaddrs* %30, null
br i1 %31, label %148, label %32
32: ; preds = %29
%33 = icmp eq i8* %1, null
%34 = icmp eq i32 %0, 0
%35 = getelementptr inbounds %struct.hv_kvp_ipaddr_value, %struct.hv_kvp_ipaddr_value* %26, i64 0, i32 1
%36 = getelementptr inbounds %struct.hv_kvp_ipaddr_value, %struct.hv_kvp_ipaddr_value* %26, i64 0, i32 0
br label %40
37: ; preds = %24
%38 = call i32 @strcpy(i8* %25, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%39 = load i32, i32* @HV_E_FAIL
br label %152
40: ; preds = %32, %45
%41 = phi %struct.ifaddrs* [ %30, %32 ], [ %47, %45 ]
%42 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %41, i64 0, i32 2
%43 = load %struct.TYPE_4__*, %struct.TYPE_4__** %42
%44 = icmp eq %struct.TYPE_4__* %43, null
br i1 %44, label %45, label %49
45: ; preds = %139, %68, %57, %62, %50, %40
%46 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %41, i64 0, i32 1
%47 = load %struct.ifaddrs*, %struct.ifaddrs** %46
%48 = icmp eq %struct.ifaddrs* %47, null
br i1 %48, label %145, label %40
49: ; preds = %40
br i1 %33, label %56, label %50
50: ; preds = %49
%51 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %41, i64 0, i32 4
%52 = load i32, i32* %51
%53 = call i32 @strlen(i8* %1)
%54 = call i64 @strncmp(i32 %52, i8* %1, i32 %53)
%55 = icmp eq i64 %54, 0
br i1 %55, label %56, label %45
56: ; preds = %50, %49
br i1 %34, label %62, label %57
57: ; preds = %56
%58 = load %struct.TYPE_4__*, %struct.TYPE_4__** %42
%59 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %58, i64 0, i32 0
%60 = load i32, i32* %59
%61 = icmp eq i32 %60, %0
br i1 %61, label %62, label %45
62: ; preds = %57, %56
%63 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %41, i64 0, i32 0
%64 = load i32, i32* %63
%65 = load i32, i32* @IFF_LOOPBACK
%66 = and i32 %65, %64
%67 = icmp eq i32 %66, 0
br i1 %67, label %68, label %45
68: ; preds = %62
%69 = load %struct.TYPE_4__*, %struct.TYPE_4__** %42
%70 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %69, i64 0, i32 0
%71 = load i32, i32* %70
%72 = load i32, i32* @AF_INET
%73 = icmp eq i32 %71, %72
%74 = load i32, i32* @AF_INET6
%75 = icmp eq i32 %71, %74
%76 = select i1 %73, i1 true, i1 %75
br i1 %76, label %77, label %45
77: ; preds = %68
%78 = load i32, i32* @KVP_OP_GET_IP_INFO
%79 = icmp eq i32 %78, %2
br i1 %79, label %80, label %139
80: ; preds = %77
br i1 %73, label %81, label %91
81: ; preds = %80
%82 = load i32, i32* @ADDR_FAMILY_IPV4
%83 = load i32, i32* %35
%84 = or i32 %83, %82
store i32 %84, i32* %35
%85 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %41, i64 0, i32 3
%86 = load %struct.TYPE_4__*, %struct.TYPE_4__** %85
%87 = load i64, i64* %36
%88 = inttoptr i64 %87 to i8*
%89 = call i32 @kvp_process_ip_address(%struct.TYPE_4__* %86, i32 %71, i8* %88, i32 %4, i32* %8)
%90 = icmp eq i32 %89, 0
br i1 %90, label %137, label %139
91: ; preds = %80
%92 = load i32, i32* @ADDR_FAMILY_IPV6
%93 = load i32, i32* %35
%94 = or i32 %93, %92
store i32 %94, i32* %35
%95 = load i64, i64* %36
%96 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %41, i64 0, i32 3
%97 = bitcast %struct.TYPE_4__** %96 to %struct.sockaddr_in6**
%98 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %97
%99 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %98, i64 0, i32 0, i32 0
%100 = load i32*, i32** %99
%101 = call i64 @hweight32(i32* %100)
%102 = trunc i64 %101 to i32
%103 = getelementptr inbounds i32, i32* %100, i64 1
%104 = call i64 @hweight32(i32* %103)
%105 = trunc i64 %104 to i32
%106 = add i32 %102, %105
%107 = getelementptr inbounds i32, i32* %100, i64 2
%108 = call i64 @hweight32(i32* %107)
%109 = trunc i64 %108 to i32
%110 = add i32 %106, %109
%111 = getelementptr inbounds i32, i32* %100, i64 3
%112 = call i64 @hweight32(i32* %111)
%113 = trunc i64 %112 to i32
%114 = add i32 %110, %113
%115 = inttoptr i64 %95 to i8*
%116 = call i32 @sprintf(i8* %13, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %114)
%117 = load i32, i32* %8
%118 = call i32 @strlen(i8* %13)
%119 = add i32 %117, 1
%120 = add i32 %119, %118
%121 = icmp ugt i32 %120, %4
br i1 %121, label %139, label %122
122: ; preds = %91
%123 = load i32, i32* %8
%124 = icmp eq i32 %123, 0
br i1 %124, label %125, label %127
125: ; preds = %122
%126 = call i32 @strcpy(i8* %115, i8* %13)
br label %132
127: ; preds = %122
%128 = load i64, i64* %36
%129 = inttoptr i64 %128 to i8*
%130 = call i32 @strcat(i8* %129, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%131 = call i32 @strcat(i8* %115, i8* %13)
br label %132
132: ; preds = %127, %125
%133 = call i32 @strlen(i8* %115)
%134 = add nsw i32 %133, 1
%135 = load i32, i32* %8
%136 = add nsw i32 %134, %135
store i32 %136, i32* %8
br label %137
137: ; preds = %81, %132
%138 = call i32 @kvp_get_ipconfig_info(i8* %1, %struct.hv_kvp_ipaddr_value* %26)
br label %139
139: ; preds = %77, %137, %91, %81
%140 = load %struct.TYPE_4__*, %struct.TYPE_4__** %42
%141 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %140, i64 0, i32 0
%142 = load i32, i32* %141
%143 = call i32 @kvp_process_ip_address(%struct.TYPE_4__* %140, i32 %142, i8* %25, i32 %4, i32* %7)
%144 = icmp eq i32 %143, 0
br i1 %144, label %45, label %145
145: ; preds = %45, %139
%146 = phi i32 [ %143, %139 ], [ 0, %45 ]
%147 = load %struct.ifaddrs*, %struct.ifaddrs** %6
br label %148
148: ; preds = %145, %29
%149 = phi %struct.ifaddrs* [ null, %29 ], [ %147, %145 ]
%150 = phi i32 [ 0, %29 ], [ %146, %145 ]
%151 = call i32 @freeifaddrs(%struct.ifaddrs* %149)
br label %152
152: ; preds = %148, %37
%153 = phi i32 [ %39, %37 ], [ %150, %148 ]
ret i32 %153
}