#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;
  char *ifr_name;
  int /*<<< orphan*/ ifr_flags;
  struct ifreq *ifc_req;
};
struct ifconf {
  int ifc_len;
  char *ifr_name;
  int /*<<< orphan*/ ifr_flags;
  struct ifconf *ifc_req;
};
typedef int /*<<< orphan*/ ifr;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ IFF_UP;
int /*<<< orphan*/ SIOCGIFCONF;
int /*<<< orphan*/ SIOCSIFFLAGS;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ ioctl(int, int /*<<< orphan*/, struct ifreq *);
int /*<<< orphan*/ perror(char *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *strchr(char *, char);
scalar_t__ strcmp(char *, char *);
scalar_t__ strncmp(char *, char *, int);
int ifdown(void) {
  struct ifreq ifr[64];
  struct ifconf ifc;
  int i, fd;
  int numif;
  int shaper;
  if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
    fprintf(stderr, "ifdown: ");
    perror("socket");
    return -1;
  }
  ifc.ifc_len = sizeof(ifr);
  ifc.ifc_req = ifr;
  if (ioctl(fd, SIOCGIFCONF, &ifc) < 0) {
    fprintf(stderr, "ifdown: ");
    perror("SIOCGIFCONF");
    close(fd);
    return -1;
  }
  numif = ifc.ifc_len / sizeof(struct ifreq);
  for (shaper = 1; shaper >= 0; shaper--) {
    for (i = 0; i < numif; i++) {
      if ((strncmp(ifr[i].ifr_name, "shaper", 6) == 0) != shaper)
        continue;
      if (strcmp(ifr[i].ifr_name, "lo") == 0)
        continue;
      if (strchr(ifr[i].ifr_name, ':') != NULL)
        continue;
      ifr[i].ifr_flags &= ~(IFF_UP);
      if (ioctl(fd, SIOCSIFFLAGS, &ifr[i]) < 0) {
        fprintf(stderr, "ifdown: shutdown ");
        perror(ifr[i].ifr_name);
      }
    }
  }
  close(fd);
  return 0;
}


x86 assembly (clang, -O0):
<ifdown>:
push   %rbp
mov    %rsp,%rbp
sub    $0x840,%rsp
mov    0x2e4e(%rip),%rax
mov    (%rax),%edi
mov    0x2e35(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10a0 <socket@plt>
mov    %eax,-0x838(%rbp)
cmp    $0x0,%eax
jge    11e0 <ifdown+0x60>
mov    0x2e06(%rip),%rax
mov    (%rax),%edi
lea    0xe3d(%rip),%rsi
call   1080 <fprintf@plt>
lea    0xe3a(%rip),%rdi
call   1090 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1417 <ifdown+0x297>
movl   $0x800,-0x830(%rbp)
lea    -0x810(%rbp),%rax
mov    %rax,-0x818(%rbp)
mov    -0x838(%rbp),%edi
mov    0x2db3(%rip),%rax
mov    (%rax),%esi
lea    -0x830(%rbp),%rdx
call   1050 <ioctl@plt>
cmp    $0x0,%rax
jge    1255 <ifdown+0xd5>
mov    0x2d9c(%rip),%rax
mov    (%rax),%edi
lea    0xdd3(%rip),%rsi
call   1080 <fprintf@plt>
lea    0xdd7(%rip),%rdi
call   1090 <perror@plt>
mov    -0x838(%rbp),%edi
call   1060 <close@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1417 <ifdown+0x297>
movslq -0x830(%rbp),%rax
shr    $0x5,%rax
mov    %eax,-0x83c(%rbp)
movl   $0x1,-0x840(%rbp)
cmpl   $0x0,-0x840(%rbp)
jl     1405 <ifdown+0x285>
movl   $0x0,-0x834(%rbp)
mov    -0x834(%rbp),%eax
cmp    -0x83c(%rbp),%eax
jge    13ec <ifdown+0x26c>
movslq -0x834(%rbp),%rcx
lea    -0x810(%rbp),%rax
shl    $0x5,%rcx
add    %rcx,%rax
mov    0x8(%rax),%rdi
lea    0xd63(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
cmp    -0x840(%rbp),%eax
je     12e0 <ifdown+0x160>
jmp    13d8 <ifdown+0x258>
movslq -0x834(%rbp),%rcx
lea    -0x810(%rbp),%rax
shl    $0x5,%rcx
add    %rcx,%rax
mov    0x8(%rax),%rdi
lea    0xd23(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1314 <ifdown+0x194>
jmp    13d8 <ifdown+0x258>
movslq -0x834(%rbp),%rcx
lea    -0x810(%rbp),%rax
shl    $0x5,%rcx
add    %rcx,%rax
mov    0x8(%rax),%rdi
mov    $0x3a,%esi
call   1040 <strchr@plt>
cmp    $0x0,%rax
je     1346 <ifdown+0x1c6>
jmp    13d8 <ifdown+0x258>
mov    0x2c8b(%rip),%rax
mov    (%rax),%ecx
xor    $0xffffffff,%ecx
movslq -0x834(%rbp),%rdx
lea    -0x810(%rbp),%rax
shl    $0x5,%rdx
add    %rdx,%rax
and    0x10(%rax),%ecx
mov    %ecx,0x10(%rax)
mov    -0x838(%rbp),%edi
mov    0x2c7e(%rip),%rax
mov    (%rax),%esi
movslq -0x834(%rbp),%rax
lea    -0x810(%rbp),%rdx
shl    $0x5,%rax
add    %rax,%rdx
call   1050 <ioctl@plt>
cmp    $0x0,%rax
jge    13d3 <ifdown+0x253>
mov    0x2c19(%rip),%rax
mov    (%rax),%edi
lea    0xc76(%rip),%rsi
call   1080 <fprintf@plt>
movslq -0x834(%rbp),%rcx
lea    -0x810(%rbp),%rax
shl    $0x5,%rcx
add    %rcx,%rax
mov    0x8(%rax),%rdi
call   1090 <perror@plt>
jmp    13d8 <ifdown+0x258>
mov    -0x834(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x834(%rbp)
jmp    1287 <ifdown+0x107>
jmp    13f1 <ifdown+0x271>
mov    -0x840(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x840(%rbp)
jmp    1270 <ifdown+0xf0>
mov    -0x838(%rbp),%edi
call   1060 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x840,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ifdown>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x838,%rsp
mov    0x2e48(%rip),%rax
mov    (%rax),%edi
mov    0x2e2f(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10a0 <socket@plt>
test   %eax,%eax
js     1384 <ifdown+0x204>
mov    %eax,%ebp
movl   $0x800,0x10(%rsp)
lea    0x30(%rsp),%rbx
mov    %rbx,0x28(%rsp)
mov    0x2deb(%rip),%rax
mov    (%rax),%esi
lea    0x10(%rsp),%rdx
mov    %ebp,%edi
call   1050 <ioctl@plt>
test   %rax,%rax
js     13ac <ifdown+0x22c>
mov    0x10(%rsp),%r12d
mov    %r12d,%ecx
sar    $0x5,%ecx
cmp    $0x2,%ecx
mov    $0x1,%eax
cmovge %ecx,%eax
cmp    $0x20,%r12d
jl     1369 <ifdown+0x1e9>
mov    %ebp,0xc(%rsp)
mov    %eax,%r14d
lea    0xe0a(%rip),%r13
lea    0xe0a(%rip),%r15
mov    %r14,%rbp
jmp    122e <ifdown+0xae>
xchg   %ax,%ax
add    $0x20,%rbx
add    $0xffffffffffffffff,%rbp
je     12b3 <ifdown+0x133>
mov    0x8(%rbx),%rdi
mov    %r13,%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    1220 <ifdown+0xa0>
mov    0x8(%rbx),%rdi
mov    %r15,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1220 <ifdown+0xa0>
mov    0x8(%rbx),%rdi
mov    $0x3a,%esi
call   1040 <strchr@plt>
test   %rax,%rax
jne    1220 <ifdown+0xa0>
mov    0x2d69(%rip),%rax
mov    (%rax),%eax
not    %eax
and    %eax,0x10(%rbx)
mov    0x2d7b(%rip),%rax
mov    (%rax),%esi
mov    0xc(%rsp),%edi
mov    %rbx,%rdx
call   1050 <ioctl@plt>
test   %rax,%rax
jns    1220 <ifdown+0xa0>
mov    0x2d29(%rip),%rax
mov    (%rax),%edi
lea    0xd86(%rip),%rsi
call   1080 <fprintf@plt>
mov    0x8(%rbx),%rdi
call   1090 <perror@plt>
jmp    1220 <ifdown+0xa0>
cmp    $0x20,%r12d
mov    0xc(%rsp),%ebp
jl     1369 <ifdown+0x1e9>
lea    0x30(%rsp),%rbx
lea    0xd4f(%rip),%r13
lea    0xd4f(%rip),%r15
lea    0xd4b(%rip),%r12
jmp    12ea <ifdown+0x16a>
nopl   (%rax)
add    $0x20,%rbx
add    $0xffffffffffffffff,%r14
je     1369 <ifdown+0x1e9>
mov    0x8(%rbx),%rdi
mov    %r13,%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     12e0 <ifdown+0x160>
mov    0x8(%rbx),%rdi
mov    %r15,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     12e0 <ifdown+0x160>
mov    0x8(%rbx),%rdi
mov    $0x3a,%esi
call   1040 <strchr@plt>
test   %rax,%rax
jne    12e0 <ifdown+0x160>
mov    0x2cad(%rip),%rax
mov    (%rax),%eax
not    %eax
and    %eax,0x10(%rbx)
mov    0x2cbf(%rip),%rax
mov    (%rax),%esi
mov    %ebp,%edi
mov    %rbx,%rdx
call   1050 <ioctl@plt>
test   %rax,%rax
jns    12e0 <ifdown+0x160>
mov    0x2c6f(%rip),%rax
mov    (%rax),%edi
mov    %r12,%rsi
call   1080 <fprintf@plt>
mov    0x8(%rbx),%rdi
call   1090 <perror@plt>
jmp    12e0 <ifdown+0x160>
mov    %ebp,%edi
call   1060 <close@plt>
xor    %eax,%eax
add    $0x838,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c35(%rip),%rax
mov    (%rax),%edi
lea    0xc6c(%rip),%rsi
call   1080 <fprintf@plt>
lea    0xc69(%rip),%rdi
call   1090 <perror@plt>
mov    $0xffffffff,%eax
jmp    1372 <ifdown+0x1f2>
mov    0x2c0d(%rip),%rax
mov    (%rax),%edi
lea    0xc44(%rip),%rsi
call   1080 <fprintf@plt>
lea    0xc48(%rip),%rdi
call   1090 <perror@plt>
mov    %ebp,%edi
call   1060 <close@plt>
mov    $0xffffffff,%eax
jmp    1372 <ifdown+0x1f2>

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

LLVM IR (-O2):
%struct.ifreq = type { i32, i8*, i32, %struct.ifreq* }
%struct.ifconf = type { i32, i8*, i32, %struct.ifconf* }
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@stderr = global i32 0
@.str = [9 x i8] c"ifdown: \00"
@.str.1 = [7 x i8] c"socket\00"
@SIOCGIFCONF = global i32 0
@.str.2 = [12 x i8] c"SIOCGIFCONF\00"
@.str.3 = [7 x i8] c"shaper\00"
@.str.4 = [3 x i8] c"lo\00"
@IFF_UP = global i32 0
@SIOCSIFFLAGS = global i32 0
@.str.5 = [18 x i8] c"ifdown: shutdown \00"
define i32 @ifdown() {
%1 = alloca [64 x %struct.ifreq]
%2 = alloca %struct.ifconf
%3 = bitcast [64 x %struct.ifreq]* %1 to i8*
%4 = bitcast %struct.ifconf* %2 to i8*
%5 = load i32, i32* @AF_INET
%6 = load i32, i32* @SOCK_DGRAM
%7 = tail call i32 @socket(i32 %5, i32 %6, i32 0)
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %0
%10 = load i32, i32* @stderr
%11 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%12 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %102
13: ; preds = %0
%14 = getelementptr inbounds %struct.ifconf, %struct.ifconf* %2, i64 0, i32 0
store i32 2048, i32* %14
%15 = getelementptr inbounds %struct.ifconf, %struct.ifconf* %2, i64 0, i32 3
%16 = bitcast %struct.ifconf** %15 to [64 x %struct.ifreq]**
store [64 x %struct.ifreq]* %1, [64 x %struct.ifreq]** %16
%17 = load i32, i32* @SIOCGIFCONF
%18 = bitcast %struct.ifconf* %2 to %struct.ifreq*
%19 = call i64 @ioctl(i32 %7, i32 %17, %struct.ifreq* %18)
%20 = icmp slt i64 %19, 0
br i1 %20, label %21, label %26
21: ; preds = %13
%22 = load i32, i32* @stderr
%23 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%24 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%25 = call i32 @close(i32 %7)
br label %102
26: ; preds = %13
%27 = load i32, i32* %14
%28 = ashr i32 %27, 5
%29 = icmp sgt i32 %27, 31
%30 = call i32 @llvm.smax.i32(i32 %28, i32 1)
br i1 %29, label %31, label %100
31: ; preds = %26
%32 = zext i32 %30 to i64
br label %33
33: ; preds = %31, %62
%34 = phi i64 [ 0, %31 ], [ %63, %62 ]
%35 = getelementptr inbounds [64 x %struct.ifreq], [64 x %struct.ifreq]* %1, i64 0, i64 %34
%36 = getelementptr inbounds [64 x %struct.ifreq], [64 x %struct.ifreq]* %1, i64 0, i64 %34, i32 1
%37 = load i8*, i8** %36
%38 = call i64 @strncmp(i8* %37, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 6)
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %62
40: ; preds = %33
%41 = load i8*, i8** %36
%42 = call i64 @strcmp(i8* %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%43 = icmp eq i64 %42, 0
br i1 %43, label %62, label %44
44: ; preds = %40
%45 = load i8*, i8** %36
%46 = call i32* @strchr(i8* %45, i8 signext 58)
%47 = icmp eq i32* %46, null
br i1 %47, label %48, label %62
48: ; preds = %44
%49 = load i32, i32* @IFF_UP
%50 = xor i32 %49, -1
%51 = getelementptr inbounds [64 x %struct.ifreq], [64 x %struct.ifreq]* %1, i64 0, i64 %34, i32 2
%52 = load i32, i32* %51
%53 = and i32 %52, %50
store i32 %53, i32* %51
%54 = load i32, i32* @SIOCSIFFLAGS
%55 = call i64 @ioctl(i32 %7, i32 %54, %struct.ifreq* %35)
%56 = icmp slt i64 %55, 0
br i1 %56, label %57, label %62
57: ; preds = %48
%58 = load i32, i32* @stderr
%59 = call i32 @fprintf(i32 %58, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%60 = load i8*, i8** %36
%61 = call i32 @perror(i8* %60)
br label %62
62: ; preds = %48, %57, %44, %40, %33
%63 = add nuw nsw i64 %34, 1
%64 = icmp eq i64 %63, %32
br i1 %64, label %65, label %33
65: ; preds = %62
br i1 %29, label %66, label %100
66: ; preds = %65
%67 = zext i32 %30 to i64
br label %68
68: ; preds = %97, %66
%69 = phi i64 [ 0, %66 ], [ %98, %97 ]
%70 = getelementptr inbounds [64 x %struct.ifreq], [64 x %struct.ifreq]* %1, i64 0, i64 %69
%71 = getelementptr inbounds [64 x %struct.ifreq], [64 x %struct.ifreq]* %1, i64 0, i64 %69, i32 1
%72 = load i8*, i8** %71
%73 = call i64 @strncmp(i8* %72, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 6)
%74 = icmp eq i64 %73, 0
br i1 %74, label %97, label %75
75: ; preds = %68
%76 = load i8*, i8** %71
%77 = call i64 @strcmp(i8* %76, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%78 = icmp eq i64 %77, 0
br i1 %78, label %97, label %79
79: ; preds = %75
%80 = load i8*, i8** %71
%81 = call i32* @strchr(i8* %80, i8 signext 58)
%82 = icmp eq i32* %81, null
br i1 %82, label %83, label %97
83: ; preds = %79
%84 = load i32, i32* @IFF_UP
%85 = xor i32 %84, -1
%86 = getelementptr inbounds [64 x %struct.ifreq], [64 x %struct.ifreq]* %1, i64 0, i64 %69, i32 2
%87 = load i32, i32* %86
%88 = and i32 %87, %85
store i32 %88, i32* %86
%89 = load i32, i32* @SIOCSIFFLAGS
%90 = call i64 @ioctl(i32 %7, i32 %89, %struct.ifreq* %70)
%91 = icmp slt i64 %90, 0
br i1 %91, label %92, label %97
92: ; preds = %83
%93 = load i32, i32* @stderr
%94 = call i32 @fprintf(i32 %93, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%95 = load i8*, i8** %71
%96 = call i32 @perror(i8* %95)
br label %97
97: ; preds = %92, %83, %79, %75, %68
%98 = add nuw nsw i64 %69, 1
%99 = icmp eq i64 %98, %67
br i1 %99, label %100, label %68
100: ; preds = %97, %26, %65
%101 = call i32 @close(i32 %7)
br label %102
102: ; preds = %100, %21, %9
%103 = phi i32 [ -1, %9 ], [ -1, %21 ], [ 0, %100 ]
ret i32 %103
}