#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 */

/* Type definitions */
struct ifreq {
  int ifc_len;
  scalar_t__ ifr_ifindex;
  int /*<<< orphan*/ ifr_name;
  int /*<<< orphan*/ *ifc_req;
  scalar_t__ ifc_buf;
};
struct ifconf {
  int ifc_len;
  scalar_t__ ifr_ifindex;
  int /*<<< orphan*/ ifr_name;
  int /*<<< orphan*/ *ifc_req;
  scalar_t__ ifc_buf;
};
struct if_nameindex {
  char *if_name;
  scalar_t__ if_index;
};

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ AF_INET6;
int IFNAMSIZ;
int /*<<< orphan*/ SIOCGIFCONF;
int /*<<< orphan*/ SIOCGIFINDEX;
int /*<<< orphan*/ SOCK_DGRAM;
scalar_t__ alloca(size_t);
int /*<<< orphan*/ close(int);
int ioctl(int, int /*<<< orphan*/, struct ifreq *);
scalar_t__ malloc(int);
int /*<<< orphan*/ memcpy(char *, int /*<<< orphan*/, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
struct if_nameindex *if_nameindex(void) {
  struct ifconf ic;
  int fd, len, i;
  struct if_nameindex *x = 0, *y;
  char *dest;
  fd = socket(AF_INET6, SOCK_DGRAM, 0);
  if (fd < 0)
    fd = socket(AF_INET, SOCK_DGRAM, 0);
  ic.ifc_buf = 0;
  ic.ifc_len = 0;
  if (ioctl(fd, SIOCGIFCONF, &ic) < 0)
    goto b0rken;
  ic.ifc_buf = alloca((size_t)ic.ifc_len);
  if (ioctl(fd, SIOCGIFCONF, &ic) < 0)
    goto b0rken;
  len = (ic.ifc_len / sizeof(struct ifreq));
  x = (struct if_nameindex *)malloc((len + 1) * sizeof(struct if_nameindex) +
                                    len * IFNAMSIZ);
  if (!x)
    goto b0rken;
  dest = (char *)(x + len + 1);
  y = x;
  for (i = 0; i < len; ++i) {
    struct ifreq *ir = (struct ifreq *)&ic.ifc_req[i];
    y->if_name = dest;
    memcpy(dest, ir->ifr_name, IFNAMSIZ);
    if (ioctl(fd, SIOCGIFINDEX, ir) == -1)
      continue;
    y->if_index = ir->ifr_ifindex;
    dest += IFNAMSIZ;
    ++y;
  }
  y->if_name = 0;
  y->if_index = 0;
b0rken:
  close(fd);
  return x;
}


x86 assembly (clang, -O0):
<if_nameindex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movq   $0x0,-0x40(%rbp)
mov    0x2e61(%rip),%rax
mov    (%rax),%edi
mov    0x2e60(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1080 <socket@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jge    11b2 <if_nameindex+0x52>
mov    0x2e4b(%rip),%rax
mov    (%rax),%edi
mov    0x2e3a(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1080 <socket@plt>
mov    %eax,-0x2c(%rbp)
movq   $0x0,-0x8(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x2c(%rbp),%edi
mov    0x2df5(%rip),%rax
mov    (%rax),%esi
lea    -0x28(%rbp),%rdx
call   1030 <ioctl@plt>
cmp    $0x0,%eax
jge    11e4 <if_nameindex+0x84>
jmp    1343 <if_nameindex+0x1e3>
movslq -0x28(%rbp),%rdi
call   1050 <alloca@plt>
mov    %rax,-0x8(%rbp)
mov    -0x2c(%rbp),%edi
mov    0x2dc5(%rip),%rax
mov    (%rax),%esi
lea    -0x28(%rbp),%rdx
call   1030 <ioctl@plt>
cmp    $0x0,%eax
jge    1214 <if_nameindex+0xb4>
jmp    1343 <if_nameindex+0x1e3>
movslq -0x28(%rbp),%rax
mov    $0x28,%ecx
xor    %edx,%edx
div    %rcx
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x4,%rax
mov    -0x30(%rbp),%ecx
mov    0x2d8d(%rip),%rdx
imul   (%rdx),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    125f <if_nameindex+0xff>
jmp    1343 <if_nameindex+0x1e3>
mov    -0x40(%rbp),%rax
movslq -0x30(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
add    $0x10,%rax
mov    %rax,-0x50(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x48(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    132c <if_nameindex+0x1cc>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x58(%rbp)
mov    -0x50(%rbp),%rcx
mov    -0x48(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x50(%rbp),%rdi
mov    -0x58(%rbp),%rax
mov    0x10(%rax),%esi
mov    0x2d07(%rip),%rax
mov    (%rax),%edx
call   1060 <memcpy@plt>
mov    -0x2c(%rbp),%edi
mov    0x2cde(%rip),%rax
mov    (%rax),%esi
mov    -0x58(%rbp),%rdx
call   1030 <ioctl@plt>
cmp    $0xffffffff,%eax
jne    12eb <if_nameindex+0x18b>
jmp    131e <if_nameindex+0x1be>
mov    -0x58(%rbp),%rax
mov    0x8(%rax),%rcx
mov    -0x48(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    0x2cc6(%rip),%rax
mov    (%rax),%ecx
mov    -0x50(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x50(%rbp)
mov    -0x48(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x48(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1285 <if_nameindex+0x125>
mov    -0x48(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x48(%rbp),%rax
movq   $0x0,0x8(%rax)
mov    -0x2c(%rbp),%edi
call   1040 <close@plt>
mov    -0x40(%rbp),%rax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<if_nameindex>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    0x2e63(%rip),%rax
mov    (%rax),%edi
mov    0x2e62(%rip),%rbx
mov    (%rbx),%esi
xor    %edx,%edx
call   1080 <socket@plt>
mov    %eax,%ebp
test   %eax,%eax
jns    11a1 <if_nameindex+0x41>
mov    0x2e54(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%esi
xor    %edx,%edx
call   1080 <socket@plt>
mov    %eax,%ebp
movq   $0x0,0x40(%rsp)
movl   $0x0,0x20(%rsp)
mov    0x2e07(%rip),%rbx
mov    (%rbx),%esi
lea    0x20(%rsp),%rdx
mov    %ebp,%edi
call   1030 <ioctl@plt>
test   %eax,%eax
js     12d6 <if_nameindex+0x176>
movslq 0x20(%rsp),%rdi
call   1050 <alloca@plt>
mov    %rax,0x40(%rsp)
mov    (%rbx),%esi
lea    0x20(%rsp),%rdx
mov    %ebp,%edi
call   1030 <ioctl@plt>
test   %eax,%eax
js     12d6 <if_nameindex+0x176>
movslq 0x20(%rsp),%rax
movabs $0xcccccccccccccccd,%rcx
mul    %rcx
mov    %rdx,%r15
shr    $0x5,%r15
mov    %r15,%rbx
shl    $0x20,%rbx
movabs $0x100000000,%rdi
add    %rbx,%rdi
shr    $0x1c,%rdi
mov    0x2d9c(%rip),%rax
mov    %rax,%r12
mov    (%rax),%eax
imul   %r15d,%eax
add    %eax,%edi
call   1070 <malloc@plt>
test   %rax,%rax
je     12d6 <if_nameindex+0x176>
mov    %ebp,0xc(%rsp)
test   %r15d,%r15d
mov    %rax,0x10(%rsp)
jle    12da <if_nameindex+0x17a>
sar    $0x1c,%rbx
add    %rax,%rbx
add    $0x10,%rbx
mov    %r15d,%ecx
shl    $0x2,%rcx
mov    %rcx,0x18(%rsp)
xor    %r13d,%r13d
mov    %rax,%r14
mov    %r12,%r15
jmp    128b <if_nameindex+0x12b>
nopl   0x0(%rax)
add    $0x4,%r13
cmp    %r13,0x18(%rsp)
je     12dd <if_nameindex+0x17d>
mov    0x38(%rsp),%r12
lea    (%r12,%r13,1),%rbp
mov    %rbx,(%r14)
mov    0x10(%r12,%r13,1),%esi
mov    (%r15),%edx
mov    %rbx,%rdi
call   1060 <memcpy@plt>
mov    0x2d02(%rip),%rax
mov    (%rax),%esi
mov    0xc(%rsp),%edi
mov    %rbp,%rdx
call   1030 <ioctl@plt>
cmp    $0xffffffff,%eax
je     1280 <if_nameindex+0x120>
mov    0x8(%r12,%r13,1),%rax
mov    %rax,0x8(%r14)
movslq (%r15),%rax
add    %rax,%rbx
add    $0x10,%r14
jmp    1280 <if_nameindex+0x120>
xor    %ebx,%ebx
jmp    12ed <if_nameindex+0x18d>
mov    %rax,%r14
xorps  %xmm0,%xmm0
movups %xmm0,(%r14)
mov    0xc(%rsp),%ebp
mov    0x10(%rsp),%rbx
mov    %ebp,%edi
call   1040 <close@plt>
mov    %rbx,%rax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.if_nameindex = type { i8*, i64 }
%struct.ifconf = type { i32, i64, i32, i32*, i64 }
%struct.ifreq = type { i32, i64, i32, i32*, i64 }
@AF_INET6 = global i32 0
@SOCK_DGRAM = global i32 0
@AF_INET = global i32 0
@SIOCGIFCONF = global i32 0
@IFNAMSIZ = global i32 0
@SIOCGIFINDEX = global i32 0
define %struct.if_nameindex* @if_nameindex() {
%1 = alloca %struct.ifconf
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.if_nameindex*
%6 = alloca %struct.if_nameindex*
%7 = alloca i8*
%8 = alloca %struct.ifreq*
store %struct.if_nameindex* null, %struct.if_nameindex** %5
%9 = load i32, i32* @AF_INET6
%10 = load i32, i32* @SOCK_DGRAM
%11 = call i32 @socket(i32 %9, i32 %10, i32 0)
store i32 %11, i32* %2
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %0
%15 = load i32, i32* @AF_INET
%16 = load i32, i32* @SOCK_DGRAM
%17 = call i32 @socket(i32 %15, i32 %16, i32 0)
store i32 %17, i32* %2
br label %18
18: ; preds = %14, %0
%19 = getelementptr inbounds %struct.ifconf, %struct.ifconf* %1, i32 0, i32 4
store i64 0, i64* %19
%20 = getelementptr inbounds %struct.ifconf, %struct.ifconf* %1, i32 0, i32 0
store i32 0, i32* %20
%21 = load i32, i32* %2
%22 = load i32, i32* @SIOCGIFCONF
%23 = bitcast %struct.ifconf* %1 to %struct.ifreq*
%24 = call i32 @ioctl(i32 %21, i32 %22, %struct.ifreq* %23)
%25 = icmp slt i32 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %18
br label %114
27: ; preds = %18
%28 = getelementptr inbounds %struct.ifconf, %struct.ifconf* %1, i32 0, i32 0
%29 = load i32, i32* %28
%30 = sext i32 %29 to i64
%31 = call i64 @alloca(i64 %30)
%32 = getelementptr inbounds %struct.ifconf, %struct.ifconf* %1, i32 0, i32 4
store i64 %31, i64* %32
%33 = load i32, i32* %2
%34 = load i32, i32* @SIOCGIFCONF
%35 = bitcast %struct.ifconf* %1 to %struct.ifreq*
%36 = call i32 @ioctl(i32 %33, i32 %34, %struct.ifreq* %35)
%37 = icmp slt i32 %36, 0
br i1 %37, label %38, label %39
38: ; preds = %27
br label %114
39: ; preds = %27
%40 = getelementptr inbounds %struct.ifconf, %struct.ifconf* %1, i32 0, i32 0
%41 = load i32, i32* %40
%42 = sext i32 %41 to i64
%43 = udiv i64 %42, 40
%44 = trunc i64 %43 to i32
store i32 %44, i32* %3
%45 = load i32, i32* %3
%46 = add nsw i32 %45, 1
%47 = sext i32 %46 to i64
%48 = mul i64 %47, 16
%49 = load i32, i32* %3
%50 = load i32, i32* @IFNAMSIZ
%51 = mul nsw i32 %49, %50
%52 = sext i32 %51 to i64
%53 = add i64 %48, %52
%54 = trunc i64 %53 to i32
%55 = call i64 @malloc(i32 %54)
%56 = inttoptr i64 %55 to %struct.if_nameindex*
store %struct.if_nameindex* %56, %struct.if_nameindex** %5
%57 = load %struct.if_nameindex*, %struct.if_nameindex** %5
%58 = icmp ne %struct.if_nameindex* %57, null
br i1 %58, label %60, label %59
59: ; preds = %39
br label %114
60: ; preds = %39
%61 = load %struct.if_nameindex*, %struct.if_nameindex** %5
%62 = load i32, i32* %3
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds %struct.if_nameindex, %struct.if_nameindex* %61, i64 %63
%65 = getelementptr inbounds %struct.if_nameindex, %struct.if_nameindex* %64, i64 1
%66 = bitcast %struct.if_nameindex* %65 to i8*
store i8* %66, i8** %7
%67 = load %struct.if_nameindex*, %struct.if_nameindex** %5
store %struct.if_nameindex* %67, %struct.if_nameindex** %6
store i32 0, i32* %4
br label %68
68: ; preds = %106, %60
%69 = load i32, i32* %4
%70 = load i32, i32* %3
%71 = icmp slt i32 %69, %70
br i1 %71, label %72, label %109
72: ; preds = %68
%73 = getelementptr inbounds %struct.ifconf, %struct.ifconf* %1, i32 0, i32 3
%74 = load i32*, i32** %73
%75 = load i32, i32* %4
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds i32, i32* %74, i64 %76
%78 = bitcast i32* %77 to %struct.ifreq*
store %struct.ifreq* %78, %struct.ifreq** %8
%79 = load i8*, i8** %7
%80 = load %struct.if_nameindex*, %struct.if_nameindex** %6
%81 = getelementptr inbounds %struct.if_nameindex, %struct.if_nameindex* %80, i32 0, i32 0
store i8* %79, i8** %81
%82 = load i8*, i8** %7
%83 = load %struct.ifreq*, %struct.ifreq** %8
%84 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %83, i32 0, i32 2
%85 = load i32, i32* %84
%86 = load i32, i32* @IFNAMSIZ
%87 = call i32 @memcpy(i8* %82, i32 %85, i32 %86)
%88 = load i32, i32* %2
%89 = load i32, i32* @SIOCGIFINDEX
%90 = load %struct.ifreq*, %struct.ifreq** %8
%91 = call i32 @ioctl(i32 %88, i32 %89, %struct.ifreq* %90)
%92 = icmp eq i32 %91, -1
br i1 %92, label %93, label %94
93: ; preds = %72
br label %106
94: ; preds = %72
%95 = load %struct.ifreq*, %struct.ifreq** %8
%96 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %95, i32 0, i32 1
%97 = load i64, i64* %96
%98 = load %struct.if_nameindex*, %struct.if_nameindex** %6
%99 = getelementptr inbounds %struct.if_nameindex, %struct.if_nameindex* %98, i32 0, i32 1
store i64 %97, i64* %99
%100 = load i32, i32* @IFNAMSIZ
%101 = load i8*, i8** %7
%102 = sext i32 %100 to i64
%103 = getelementptr inbounds i8, i8* %101, i64 %102
store i8* %103, i8** %7
%104 = load %struct.if_nameindex*, %struct.if_nameindex** %6
%105 = getelementptr inbounds %struct.if_nameindex, %struct.if_nameindex* %104, i32 1
store %struct.if_nameindex* %105, %struct.if_nameindex** %6
br label %106
106: ; preds = %94, %93
%107 = load i32, i32* %4
%108 = add nsw i32 %107, 1
store i32 %108, i32* %4
br label %68
109: ; preds = %68
%110 = load %struct.if_nameindex*, %struct.if_nameindex** %6
%111 = getelementptr inbounds %struct.if_nameindex, %struct.if_nameindex* %110, i32 0, i32 0
store i8* null, i8** %111
%112 = load %struct.if_nameindex*, %struct.if_nameindex** %6
%113 = getelementptr inbounds %struct.if_nameindex, %struct.if_nameindex* %112, i32 0, i32 1
store i64 0, i64* %113
br label %114
114: ; preds = %109, %59, %38, %26
%115 = load i32, i32* %2
%116 = call i32 @close(i32 %115)
%117 = load %struct.if_nameindex*, %struct.if_nameindex** %5
ret %struct.if_nameindex* %117
}

LLVM IR (-O2):
%struct.if_nameindex = type { i8*, i64 }
%struct.ifconf = type { i32, i64, i32, i32*, i64 }
%struct.ifreq = type { i32, i64, i32, i32*, i64 }
@AF_INET6 = global i32 0
@SOCK_DGRAM = global i32 0
@AF_INET = global i32 0
@SIOCGIFCONF = global i32 0
@IFNAMSIZ = global i32 0
@SIOCGIFINDEX = global i32 0
define %struct.if_nameindex* @if_nameindex() {
%1 = alloca %struct.ifconf
%2 = bitcast %struct.ifconf* %1 to i8*
%3 = load i32, i32* @AF_INET6
%4 = load i32, i32* @SOCK_DGRAM
%5 = tail call i32 @socket(i32 %3, i32 %4, i32 0)
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %0
%8 = load i32, i32* @AF_INET
%9 = load i32, i32* @SOCK_DGRAM
%10 = tail call i32 @socket(i32 %8, i32 %9, i32 0)
br label %11
11: ; preds = %7, %0
%12 = phi i32 [ %10, %7 ], [ %5, %0 ]
%13 = getelementptr inbounds %struct.ifconf, %struct.ifconf* %1, i64 0, i32 4
store i64 0, i64* %13
%14 = getelementptr inbounds %struct.ifconf, %struct.ifconf* %1, i64 0, i32 0
store i32 0, i32* %14
%15 = load i32, i32* @SIOCGIFCONF
%16 = bitcast %struct.ifconf* %1 to %struct.ifreq*
%17 = call i32 @ioctl(i32 %12, i32 %15, %struct.ifreq* %16)
%18 = icmp slt i32 %17, 0
br i1 %18, label %82, label %19
19: ; preds = %11
%20 = load i32, i32* %14
%21 = sext i32 %20 to i64
%22 = call i64 @alloca(i64 %21)
store i64 %22, i64* %13
%23 = load i32, i32* @SIOCGIFCONF
%24 = call i32 @ioctl(i32 %12, i32 %23, %struct.ifreq* %16)
%25 = icmp slt i32 %24, 0
br i1 %25, label %82, label %26
26: ; preds = %19
%27 = load i32, i32* %14
%28 = sext i32 %27 to i64
%29 = udiv i64 %28, 40
%30 = trunc i64 %29 to i32
%31 = shl i64 %29, 32
%32 = add i64 %31, 4294967296
%33 = lshr exact i64 %32, 28
%34 = load i32, i32* @IFNAMSIZ
%35 = mul nsw i32 %34, %30
%36 = trunc i64 %33 to i32
%37 = add i32 %35, %36
%38 = call i64 @malloc(i32 %37)
%39 = inttoptr i64 %38 to %struct.if_nameindex*
%40 = icmp eq i64 %38, 0
br i1 %40, label %82, label %41
41: ; preds = %26
%42 = icmp sgt i32 %30, 0
br i1 %42, label %43, label %79
43: ; preds = %41
%44 = ashr exact i64 %31, 32
%45 = getelementptr inbounds %struct.if_nameindex, %struct.if_nameindex* %39, i64 %44
%46 = getelementptr inbounds %struct.if_nameindex, %struct.if_nameindex* %45, i64 1
%47 = bitcast %struct.if_nameindex* %46 to i8*
%48 = getelementptr inbounds %struct.ifconf, %struct.ifconf* %1, i64 0, i32 3
%49 = and i64 %29, 4294967295
br label %50
50: ; preds = %43, %74
%51 = phi i64 [ 0, %43 ], [ %77, %74 ]
%52 = phi i8* [ %47, %43 ], [ %76, %74 ]
%53 = phi %struct.if_nameindex* [ %39, %43 ], [ %75, %74 ]
%54 = load i32*, i32** %48
%55 = getelementptr inbounds i32, i32* %54, i64 %51
%56 = bitcast i32* %55 to %struct.ifreq*
%57 = getelementptr inbounds %struct.if_nameindex, %struct.if_nameindex* %53, i64 0, i32 0
store i8* %52, i8** %57
%58 = getelementptr inbounds i32, i32* %55, i64 4
%59 = load i32, i32* %58
%60 = load i32, i32* @IFNAMSIZ
%61 = call i32 @memcpy(i8* %52, i32 %59, i32 %60)
%62 = load i32, i32* @SIOCGIFINDEX
%63 = call i32 @ioctl(i32 %12, i32 %62, %struct.ifreq* %56)
%64 = icmp eq i32 %63, -1
br i1 %64, label %74, label %65
65: ; preds = %50
%66 = getelementptr inbounds i32, i32* %55, i64 2
%67 = bitcast i32* %66 to i64*
%68 = load i64, i64* %67
%69 = getelementptr inbounds %struct.if_nameindex, %struct.if_nameindex* %53, i64 0, i32 1
store i64 %68, i64* %69
%70 = load i32, i32* @IFNAMSIZ
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds i8, i8* %52, i64 %71
%73 = getelementptr inbounds %struct.if_nameindex, %struct.if_nameindex* %53, i64 1
br label %74
74: ; preds = %50, %65
%75 = phi %struct.if_nameindex* [ %73, %65 ], [ %53, %50 ]
%76 = phi i8* [ %72, %65 ], [ %52, %50 ]
%77 = add nuw nsw i64 %51, 1
%78 = icmp eq i64 %77, %49
br i1 %78, label %79, label %50
79: ; preds = %74, %41
%80 = phi %struct.if_nameindex* [ %39, %41 ], [ %75, %74 ]
%81 = bitcast %struct.if_nameindex* %80 to i8*
br label %82
82: ; preds = %26, %19, %11, %79
%83 = phi %struct.if_nameindex* [ null, %11 ], [ null, %19 ], [ %39, %79 ], [ null, %26 ]
%84 = call i32 @close(i32 %12)
ret %struct.if_nameindex* %83
}