#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_4__ {
  int /*<<< orphan*/ s6_addr;
};
struct sockaddr_in6 {
  TYPE_2__ sin6_addr;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_addr;
};
struct ifaddrs {
  struct ifaddrs *ifa_next;
  TYPE_1__ *ifa_addr;
};
struct TYPE_3__ {
  int sa_family;
};

/* Variables and functions */
int AF_INET;
int /*<<< orphan*/ freeifaddrs(struct ifaddrs *);
scalar_t__ getifaddrs(struct ifaddrs **);
char *inet_ntop(int, int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char const *);
int kvp_get_ip_address(int family, char *buffer, int length) {
  struct ifaddrs *ifap;
  struct ifaddrs *curp;
  int ipv4_len = strlen("255.255.255.255") + 1;
  int ipv6_len = strlen("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff") + 1;
  int offset = 0;
  const char *str;
  char tmp[50];
  int error = 0;
  if (getifaddrs(&ifap)) {
    strcpy(buffer, "getifaddrs failed\n");
    return 1;
  }
  curp = ifap;
  while (curp != NULL) {
    if ((curp->ifa_addr != NULL) && (curp->ifa_addr->sa_family == family)) {
      if (family == AF_INET) {
        struct sockaddr_in *addr = (struct sockaddr_in *)curp->ifa_addr;
        str = inet_ntop(family, &addr->sin_addr, tmp, 50);
        if (str == NULL) {
          strcpy(buffer, "inet_ntop failed\n");
          error = 1;
          goto getaddr_done;
        }
        if (offset == 0)
          strcpy(buffer, tmp);
        else
          strcat(buffer, tmp);
        strcat(buffer, ";");
        offset += strlen(str) + 1;
        if ((length - offset) < (ipv4_len + 1))
          goto getaddr_done;
      } else {
        struct sockaddr_in6 *addr = (struct sockaddr_in6 *)curp->ifa_addr;
        str = inet_ntop(family, &addr->sin6_addr.s6_addr, tmp, 50);
        if (str == NULL) {
          strcpy(buffer, "inet_ntop failed\n");
          error = 1;
          goto getaddr_done;
        }
        if (offset == 0)
          strcpy(buffer, tmp);
        else
          strcat(buffer, tmp);
        strcat(buffer, ";");
        offset += strlen(str) + 1;
        if ((length - offset) < (ipv6_len + 1))
          goto getaddr_done;
      }
    }
    curp = curp->ifa_next;
  }
getaddr_done:
  freeifaddrs(ifap);
  return error;
}


x86 assembly (clang, -O0):
<kvp_get_ip_address>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
lea    0xe84(%rip),%rdi
call   1050 <strlen@plt>
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
lea    0xe82(%rip),%rdi
call   1050 <strlen@plt>
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x84(%rbp)
lea    -0x20(%rbp),%rdi
call   1060 <getifaddrs@plt>
cmp    $0x0,%rax
je     11d9 <kvp_get_ip_address+0x79>
mov    -0x10(%rbp),%rdi
lea    0xe70(%rip),%rsi
call   1040 <strcpy@plt>
movl   $0x1,-0x4(%rbp)
jmp    13c8 <kvp_get_ip_address+0x268>
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     13b1 <kvp_get_ip_address+0x251>
mov    -0x28(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     13a1 <kvp_get_ip_address+0x241>
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jne    13a1 <kvp_get_ip_address+0x241>
mov    -0x8(%rbp),%eax
mov    0x2dd0(%rip),%rcx
cmp    (%rcx),%eax
jne    12de <kvp_get_ip_address+0x17e>
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x90(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x90(%rbp),%rsi
lea    -0x80(%rbp),%rdx
mov    $0x32,%ecx
call   1030 <inet_ntop@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    1275 <kvp_get_ip_address+0x115>
mov    -0x10(%rbp),%rdi
lea    0xdea(%rip),%rsi
call   1040 <strcpy@plt>
movl   $0x1,-0x84(%rbp)
jmp    13b6 <kvp_get_ip_address+0x256>
cmpl   $0x0,-0x34(%rbp)
jne    1291 <kvp_get_ip_address+0x131>
mov    -0x10(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1040 <strcpy@plt>
jmp    129e <kvp_get_ip_address+0x13e>
mov    -0x10(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1080 <strcat@plt>
mov    -0x10(%rbp),%rdi
lea    0xdb4(%rip),%rsi
call   1080 <strcat@plt>
mov    -0x40(%rbp),%rdi
call   1050 <strlen@plt>
add    $0x1,%eax
add    -0x34(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x14(%rbp),%eax
sub    -0x34(%rbp),%eax
mov    -0x2c(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    12d9 <kvp_get_ip_address+0x179>
jmp    13b6 <kvp_get_ip_address+0x256>
jmp    139c <kvp_get_ip_address+0x23c>
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x98(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x98(%rbp),%rsi
lea    -0x80(%rbp),%rdx
mov    $0x32,%ecx
call   1030 <inet_ntop@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    1333 <kvp_get_ip_address+0x1d3>
mov    -0x10(%rbp),%rdi
lea    0xd2c(%rip),%rsi
call   1040 <strcpy@plt>
movl   $0x1,-0x84(%rbp)
jmp    13b6 <kvp_get_ip_address+0x256>
cmpl   $0x0,-0x34(%rbp)
jne    134f <kvp_get_ip_address+0x1ef>
mov    -0x10(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1040 <strcpy@plt>
jmp    135c <kvp_get_ip_address+0x1fc>
mov    -0x10(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1080 <strcat@plt>
mov    -0x10(%rbp),%rdi
lea    0xcf6(%rip),%rsi
call   1080 <strcat@plt>
mov    -0x40(%rbp),%rdi
call   1050 <strlen@plt>
add    $0x1,%eax
add    -0x34(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x14(%rbp),%eax
sub    -0x34(%rbp),%eax
mov    -0x30(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    1397 <kvp_get_ip_address+0x237>
jmp    13b6 <kvp_get_ip_address+0x256>
jmp    139c <kvp_get_ip_address+0x23c>
jmp    13a1 <kvp_get_ip_address+0x241>
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    11e1 <kvp_get_ip_address+0x81>
jmp    13b6 <kvp_get_ip_address+0x256>
mov    -0x20(%rbp),%rdi
call   1070 <freeifaddrs@plt>
mov    -0x84(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kvp_get_ip_address>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %edx,%r14d
mov    %rsi,%rbp
mov    %edi,%r13d
lea    0xe82(%rip),%rdi
call   1050 <strlen@plt>
mov    %eax,%r12d
lea    0xe83(%rip),%rdi
call   1050 <strlen@plt>
mov    %eax,%ebx
lea    0x18(%rsp),%rdi
call   1060 <getifaddrs@plt>
test   %rax,%rax
je     11bc <kvp_get_ip_address+0x5c>
lea    0xe8e(%rip),%rsi
mov    %rbp,%rdi
call   1040 <strcpy@plt>
mov    $0x1,%ebx
jmp    12e7 <kvp_get_ip_address+0x187>
mov    0x18(%rsp),%r15
test   %r15,%r15
je     12db <kvp_get_ip_address+0x17b>
add    $0x2,%ebx
mov    %ebx,0x10(%rsp)
add    $0x2,%r12d
mov    %r12d,0x14(%rsp)
xor    %r12d,%r12d
mov    %r13d,0xc(%rsp)
jmp    122c <kvp_get_ip_address+0xcc>
call   1080 <strcat@plt>
mov    %ebx,%r14d
mov    %rbp,%rdi
lea    0xe67(%rip),%rsi
call   1080 <strcat@plt>
mov    %r13,%rdi
call   1050 <strlen@plt>
add    %eax,%r12d
add    $0x1,%r12d
mov    %ebx,%eax
sub    %r12d,%eax
cmp    0x14(%rsp),%eax
mov    0xc(%rsp),%r13d
jl     12db <kvp_get_ip_address+0x17b>
xchg   %ax,%ax
mov    (%r15),%r15
test   %r15,%r15
je     12db <kvp_get_ip_address+0x17b>
mov    0x8(%r15),%rsi
test   %rsi,%rsi
je     1220 <kvp_get_ip_address+0xc0>
cmp    %r13d,(%rsi)
jne    1220 <kvp_get_ip_address+0xc0>
mov    %r14d,%ebx
mov    0x2da4(%rip),%rax
mov    (%rax),%r14d
mov    %r13d,%edi
lea    0x20(%rsp),%rdx
mov    $0x32,%ecx
call   1030 <inet_ntop@plt>
mov    %r13d,%ecx
mov    %rax,%r13
cmp    %ecx,%r14d
jne    1288 <kvp_get_ip_address+0x128>
test   %r13,%r13
je     12f8 <kvp_get_ip_address+0x198>
mov    %rbp,%rdi
lea    0x20(%rsp),%rsi
test   %r12d,%r12d
jne    11e4 <kvp_get_ip_address+0x84>
call   1040 <strcpy@plt>
jmp    11e9 <kvp_get_ip_address+0x89>
test   %r13,%r13
je     12f8 <kvp_get_ip_address+0x198>
mov    %rbp,%rdi
lea    0x20(%rsp),%rsi
test   %r12d,%r12d
je     12a1 <kvp_get_ip_address+0x141>
call   1080 <strcat@plt>
jmp    12a6 <kvp_get_ip_address+0x146>
call   1040 <strcpy@plt>
mov    %ebx,%r14d
mov    %rbp,%rdi
lea    0xdaa(%rip),%rsi
call   1080 <strcat@plt>
mov    %r13,%rdi
call   1050 <strlen@plt>
add    %eax,%r12d
add    $0x1,%r12d
mov    %ebx,%eax
sub    %r12d,%eax
cmp    0x10(%rsp),%eax
mov    0xc(%rsp),%r13d
jge    1220 <kvp_get_ip_address+0xc0>
xor    %ebx,%ebx
mov    0x18(%rsp),%rdi
call   1070 <freeifaddrs@plt>
mov    %ebx,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd4c(%rip),%rsi
mov    %rbp,%rdi
call   1040 <strcpy@plt>
mov    $0x1,%ebx
jmp    12dd <kvp_get_ip_address+0x17d>

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

LLVM IR (-O2):
%struct.ifaddrs = type { %struct.ifaddrs*, %struct.TYPE_3__* }
%struct.TYPE_3__ = type { i32 }
@.str = [16 x i8] c"255.255.255.255\00"
@.str.1 = [40 x i8] c"ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff\00"
@.str.2 = [19 x i8] c"getifaddrs failed\0A\00"
@AF_INET = global i32 0
@.str.3 = [18 x i8] c"inet_ntop failed\0A\00"
@.str.4 = [2 x i8] c";\00"
define i32 @kvp_get_ip_address(i32 %0, i8* %1, i32 %2) {
%4 = alloca %struct.ifaddrs*
%5 = alloca [50 x i8]
%6 = bitcast %struct.ifaddrs** %4 to i8*
%7 = tail call i32 @strlen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @strlen(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
%9 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%10 = call i64 @getifaddrs(%struct.ifaddrs** %4)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %18
12: ; preds = %3
%13 = load %struct.ifaddrs*, %struct.ifaddrs** %4
%14 = icmp eq %struct.ifaddrs* %13, null
br i1 %14, label %70, label %15
15: ; preds = %12
%16 = add nsw i32 %8, 2
%17 = add nsw i32 %7, 2
br label %20
18: ; preds = %3
%19 = call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %74
20: ; preds = %15, %63
%21 = phi %struct.ifaddrs* [ %13, %15 ], [ %66, %63 ]
%22 = phi i32 [ 0, %15 ], [ %64, %63 ]
%23 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %21, i64 0, i32 1
%24 = load %struct.TYPE_3__*, %struct.TYPE_3__** %23
%25 = icmp eq %struct.TYPE_3__* %24, null
br i1 %25, label %63, label %26
26: ; preds = %20
%27 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %24, i64 0, i32 0
%28 = load i32, i32* %27
%29 = icmp eq i32 %28, %0
br i1 %29, label %30, label %63
30: ; preds = %26
%31 = load i32, i32* @AF_INET
%32 = icmp eq i32 %31, %0
%33 = call i8* @inet_ntop(i32 %0, i32* %27, i8* %9, i32 50)
%34 = icmp eq i8* %33, null
br i1 %32, label %35, label %49
35: ; preds = %30
br i1 %34, label %68, label %36
36: ; preds = %35
%37 = icmp eq i32 %22, 0
br i1 %37, label %38, label %40
38: ; preds = %36
%39 = call i32 @strcpy(i8* %1, i8* %9)
br label %42
40: ; preds = %36
%41 = call i32 @strcat(i8* %1, i8* %9)
br label %42
42: ; preds = %40, %38
%43 = call i32 @strcat(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%44 = call i32 @strlen(i8* %33)
%45 = add i32 %22, 1
%46 = add i32 %45, %44
%47 = sub nsw i32 %2, %46
%48 = icmp slt i32 %47, %17
br i1 %48, label %70, label %63
49: ; preds = %30
br i1 %34, label %68, label %50
50: ; preds = %49
%51 = icmp eq i32 %22, 0
br i1 %51, label %52, label %54
52: ; preds = %50
%53 = call i32 @strcpy(i8* %1, i8* %9)
br label %56
54: ; preds = %50
%55 = call i32 @strcat(i8* %1, i8* %9)
br label %56
56: ; preds = %54, %52
%57 = call i32 @strcat(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%58 = call i32 @strlen(i8* %33)
%59 = add i32 %22, 1
%60 = add i32 %59, %58
%61 = sub nsw i32 %2, %60
%62 = icmp slt i32 %61, %16
br i1 %62, label %70, label %63
63: ; preds = %56, %42, %26, %20
%64 = phi i32 [ %22, %26 ], [ %22, %20 ], [ %46, %42 ], [ %60, %56 ]
%65 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %21, i64 0, i32 0
%66 = load %struct.ifaddrs*, %struct.ifaddrs** %65
%67 = icmp eq %struct.ifaddrs* %66, null
br i1 %67, label %70, label %20
68: ; preds = %49, %35
%69 = call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
br label %70
70: ; preds = %63, %42, %56, %68, %12
%71 = phi i32 [ 0, %12 ], [ 1, %68 ], [ 0, %56 ], [ 0, %42 ], [ 0, %63 ]
%72 = load %struct.ifaddrs*, %struct.ifaddrs** %4
%73 = call i32 @freeifaddrs(%struct.ifaddrs* %72)
br label %74
74: ; preds = %70, %18
%75 = phi i32 [ 1, %18 ], [ %71, %70 ]
ret i32 %75
}