#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 in_addr {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  struct in_addr sin_addr;
};
struct TYPE_2__ {
  void *sa_family;
};
struct ifreq {
  TYPE_1__ ifr_addr;
  int /*<<< orphan*/ ifr_name;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
void *AF_INET;
int /*<<< orphan*/ IFNAMSIZ;
int /*<<< orphan*/ SIOCGIFADDR;
int /*<<< orphan*/ SIOCGIFBRDADDR;
int /*<<< orphan*/ SIOCGIFNETMASK;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ inet_addr(char *);
scalar_t__ ioctl(int, int /*<<< orphan*/, struct ifreq *);
int /*<<< orphan*/ pclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *popen(char *, char *);
int socket(void *, int /*<<< orphan*/, int /*<<< orphan*/);
int sscanf(char *, char *, char *);
int /*<<< orphan*/ strncpy(int /*<<< orphan*/, char *, int /*<<< orphan*/);
int armnet_get_host_params(char *ifname, struct in_addr *addr,
                           struct in_addr *netmask, struct in_addr *broadcast,
                           struct in_addr *gateway) {
  int sock = 0;
  struct sockaddr_in *sin;
  struct ifreq ifr;
  FILE *inf;
  int saw_gw;
  char buf[1000], gwbuf[1000];
  if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
    return (-1);
  strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
  ifr.ifr_addr.sa_family = AF_INET;
  if (ioctl(sock, SIOCGIFADDR, &ifr) < 0)
    goto bad;
  sin = (struct sockaddr_in *)&ifr.ifr_addr;
  *addr = sin->sin_addr;
  strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
  ifr.ifr_addr.sa_family = AF_INET;
  if (ioctl(sock, SIOCGIFNETMASK, &ifr) < 0)
    goto bad;
  sin = (struct sockaddr_in *)&ifr.ifr_addr;
  *netmask = sin->sin_addr;
  strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
  ifr.ifr_addr.sa_family = AF_INET;
  if (ioctl(sock, SIOCGIFBRDADDR, &ifr) < 0)
    goto bad;
  sin = (struct sockaddr_in *)&ifr.ifr_addr;
  *broadcast = sin->sin_addr;
  close(sock);
  if ((inf = popen("netstat -rn", "r")) == NULL)
    goto bad;
  saw_gw = 0;
  while (fgets(buf, sizeof buf, inf) != NULL) {
    if (sscanf(buf, "0.0.0.0 %s", gwbuf) == 1) {
      gateway->s_addr = inet_addr(gwbuf);
      saw_gw = 1;
      break;
    }
  }
  pclose(inf);
  if (saw_gw == 0)
    goto bad;
  return (0);
bad:
  close(sock);
  return (-1);
}


x86 assembly (clang, -O0):
<armnet_get_host_params>:
push   %rbp
mov    %rsp,%rbp
sub    $0x840,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    0x2e23(%rip),%rax
mov    (%rax),%rdi
mov    0x2e09(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10b0 <socket@plt>
mov    %eax,-0x34(%rbp)
cmp    $0x0,%eax
jge    11e8 <armnet_get_host_params+0x58>
movl   $0xffffffff,-0x4(%rbp)
jmp    13c8 <armnet_get_host_params+0x238>
mov    -0x48(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    0x2dca(%rip),%rax
mov    (%rax),%edx
call   1030 <strncpy@plt>
mov    0x2ddc(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x50(%rbp)
mov    -0x34(%rbp),%edi
mov    0x2dd3(%rip),%rax
mov    (%rax),%esi
lea    -0x50(%rbp),%rdx
call   1050 <ioctl@plt>
cmp    $0x0,%rax
jge    122f <armnet_get_host_params+0x9f>
jmp    13b9 <armnet_get_host_params+0x229>
lea    -0x50(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x40(%rbp),%rcx
mov    (%rcx),%ecx
mov    %ecx,(%rax)
mov    -0x48(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    0x2d6f(%rip),%rax
mov    (%rax),%edx
call   1030 <strncpy@plt>
mov    0x2d81(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x50(%rbp)
mov    -0x34(%rbp),%edi
mov    0x2d68(%rip),%rax
mov    (%rax),%esi
lea    -0x50(%rbp),%rdx
call   1050 <ioctl@plt>
cmp    $0x0,%rax
jge    128a <armnet_get_host_params+0xfa>
jmp    13b9 <armnet_get_host_params+0x229>
lea    -0x50(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%rcx
mov    (%rcx),%ecx
mov    %ecx,(%rax)
mov    -0x48(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    0x2d14(%rip),%rax
mov    (%rax),%edx
call   1030 <strncpy@plt>
mov    0x2d26(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x50(%rbp)
mov    -0x34(%rbp),%edi
mov    0x2ced(%rip),%rax
mov    (%rax),%esi
lea    -0x50(%rbp),%rdx
call   1050 <ioctl@plt>
cmp    $0x0,%rax
jge    12e5 <armnet_get_host_params+0x155>
jmp    13b9 <armnet_get_host_params+0x229>
lea    -0x50(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%rcx
mov    (%rcx),%ecx
mov    %ecx,(%rax)
mov    -0x34(%rbp),%edi
call   1060 <close@plt>
lea    0xcf8(%rip),%rdi
lea    0xcfd(%rip),%rsi
call   10a0 <popen@plt>
mov    %rax,-0x58(%rbp)
cmp    $0x0,%rax
jne    1327 <armnet_get_host_params+0x197>
jmp    13b9 <armnet_get_host_params+0x229>
movl   $0x0,-0x5c(%rbp)
lea    -0x450(%rbp),%rdi
mov    -0x58(%rbp),%rdx
mov    $0x3e8,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
je     1395 <armnet_get_host_params+0x205>
lea    -0x450(%rbp),%rdi
lea    -0x840(%rbp),%rdx
lea    0xcac(%rip),%rsi
call   1090 <sscanf@plt>
cmp    $0x1,%eax
jne    1390 <armnet_get_host_params+0x200>
lea    -0x840(%rbp),%rdi
call   1080 <inet_addr@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x5c(%rbp)
jmp    1395 <armnet_get_host_params+0x205>
jmp    132e <armnet_get_host_params+0x19e>
mov    -0x58(%rbp),%rdi
call   1040 <pclose@plt>
cmpl   $0x0,-0x5c(%rbp)
jne    13ad <armnet_get_host_params+0x21d>
jmp    13b9 <armnet_get_host_params+0x229>
movl   $0x0,-0x4(%rbp)
jmp    13c8 <armnet_get_host_params+0x238>
mov    -0x34(%rbp),%edi
call   1060 <close@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x840,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<armnet_get_host_params>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x7f8,%rsp
mov    %r8,0x10(%rsp)
mov    %rcx,0x18(%rsp)
mov    %rdx,%r13
mov    %rsi,%r14
mov    %rdi,%rbp
mov    0x2e25(%rip),%rbx
mov    (%rbx),%rdi
mov    0x2e0b(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10b0 <socket@plt>
mov    $0xffffffff,%r12d
test   %eax,%eax
js     1336 <armnet_get_host_params+0x1a6>
mov    %eax,%r15d
mov    0x2dda(%rip),%rax
mov    (%rax),%edx
mov    %rbp,%rsi
call   1030 <strncpy@plt>
mov    (%rbx),%rax
mov    %rax,(%rsp)
mov    0x2dea(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rdx
mov    %r15d,%edi
call   1050 <ioctl@plt>
test   %rax,%rax
js     132e <armnet_get_host_params+0x19e>
mov    (%rsp),%eax
mov    %eax,(%r14)
mov    0x8(%rsp),%edi
mov    0x2d9b(%rip),%rax
mov    (%rax),%edx
mov    %rbp,%rsi
call   1030 <strncpy@plt>
mov    (%rbx),%rax
mov    %rax,(%rsp)
mov    0x2d9b(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rdx
mov    %r15d,%edi
call   1050 <ioctl@plt>
test   %rax,%rax
js     132e <armnet_get_host_params+0x19e>
mov    (%rsp),%eax
mov    %eax,0x0(%r13)
mov    0x8(%rsp),%edi
mov    0x2d5b(%rip),%rax
mov    (%rax),%edx
mov    %rbp,%rsi
call   1030 <strncpy@plt>
mov    (%rbx),%rax
mov    %rax,(%rsp)
mov    0x2d3b(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rdx
mov    %r15d,%edi
call   1050 <ioctl@plt>
test   %rax,%rax
js     132e <armnet_get_host_params+0x19e>
mov    (%rsp),%eax
mov    0x18(%rsp),%rcx
mov    %eax,(%rcx)
mov    %r15d,%edi
call   1060 <close@plt>
lea    0xd54(%rip),%rdi
lea    0xd59(%rip),%rsi
call   10a0 <popen@plt>
test   %rax,%rax
je     132e <armnet_get_host_params+0x19e>
mov    %rax,%rbp
lea    0x410(%rsp),%rbx
lea    0xd3f(%rip),%r14
lea    0x20(%rsp),%r13
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
mov    $0x3e8,%esi
mov    %rbp,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     1326 <armnet_get_host_params+0x196>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r13,%rdx
call   1090 <sscanf@plt>
cmp    $0x1,%eax
jne    12e0 <armnet_get_host_params+0x150>
lea    0x20(%rsp),%rdi
call   1080 <inet_addr@plt>
mov    0x10(%rsp),%rcx
mov    %eax,(%rcx)
mov    %rbp,%rdi
call   1040 <pclose@plt>
xor    %r12d,%r12d
jmp    1336 <armnet_get_host_params+0x1a6>
mov    %rbp,%rdi
call   1040 <pclose@plt>
mov    %r15d,%edi
call   1060 <close@plt>
mov    %r12d,%eax
add    $0x7f8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.in_addr = type { i32 }
%struct.sockaddr_in = type { %struct.in_addr }
%struct.ifreq = type { %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i8* }
@AF_INET = global i8* null
@SOCK_DGRAM = global i32 0
@IFNAMSIZ = global i32 0
@SIOCGIFADDR = global i32 0
@SIOCGIFNETMASK = global i32 0
@SIOCGIFBRDADDR = global i32 0
@.str = [12 x i8] c"netstat -rn\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [11 x i8] c"0.0.0.0 %s\00"
define i32 @armnet_get_host_params(i8* %0, %struct.in_addr* %1, %struct.in_addr* %2, %struct.in_addr* %3, %struct.in_addr* %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca %struct.in_addr*
%9 = alloca %struct.in_addr*
%10 = alloca %struct.in_addr*
%11 = alloca %struct.in_addr*
%12 = alloca i32
%13 = alloca %struct.sockaddr_in*
%14 = alloca %struct.ifreq
%15 = alloca i32*
%16 = alloca i32
%17 = alloca [1000 x i8]
%18 = alloca [1000 x i8]
store i8* %0, i8** %7
store %struct.in_addr* %1, %struct.in_addr** %8
store %struct.in_addr* %2, %struct.in_addr** %9
store %struct.in_addr* %3, %struct.in_addr** %10
store %struct.in_addr* %4, %struct.in_addr** %11
store i32 0, i32* %12
%19 = load i8*, i8** @AF_INET
%20 = load i32, i32* @SOCK_DGRAM
%21 = call i32 @socket(i8* %19, i32 %20, i32 0)
store i32 %21, i32* %12
%22 = icmp slt i32 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %5
store i32 -1, i32* %6
br label %120
24: ; preds = %5
%25 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %14, i32 0, i32 1
%26 = load i32, i32* %25
%27 = load i8*, i8** %7
%28 = load i32, i32* @IFNAMSIZ
%29 = call i32 @strncpy(i32 %26, i8* %27, i32 %28)
%30 = load i8*, i8** @AF_INET
%31 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %14, i32 0, i32 0
%32 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %31, i32 0, i32 0
store i8* %30, i8** %32
%33 = load i32, i32* %12
%34 = load i32, i32* @SIOCGIFADDR
%35 = call i64 @ioctl(i32 %33, i32 %34, %struct.ifreq* %14)
%36 = icmp slt i64 %35, 0
br i1 %36, label %37, label %38
37: ; preds = %24
br label %117
38: ; preds = %24
%39 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %14, i32 0, i32 0
%40 = bitcast %struct.TYPE_2__* %39 to %struct.sockaddr_in*
store %struct.sockaddr_in* %40, %struct.sockaddr_in** %13
%41 = load %struct.in_addr*, %struct.in_addr** %8
%42 = load %struct.sockaddr_in*, %struct.sockaddr_in** %13
%43 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %42, i32 0, i32 0
%44 = bitcast %struct.in_addr* %41 to i8*
%45 = bitcast %struct.in_addr* %43 to i8*
%46 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %14, i32 0, i32 1
%47 = load i32, i32* %46
%48 = load i8*, i8** %7
%49 = load i32, i32* @IFNAMSIZ
%50 = call i32 @strncpy(i32 %47, i8* %48, i32 %49)
%51 = load i8*, i8** @AF_INET
%52 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %14, i32 0, i32 0
%53 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %52, i32 0, i32 0
store i8* %51, i8** %53
%54 = load i32, i32* %12
%55 = load i32, i32* @SIOCGIFNETMASK
%56 = call i64 @ioctl(i32 %54, i32 %55, %struct.ifreq* %14)
%57 = icmp slt i64 %56, 0
br i1 %57, label %58, label %59
58: ; preds = %38
br label %117
59: ; preds = %38
%60 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %14, i32 0, i32 0
%61 = bitcast %struct.TYPE_2__* %60 to %struct.sockaddr_in*
store %struct.sockaddr_in* %61, %struct.sockaddr_in** %13
%62 = load %struct.in_addr*, %struct.in_addr** %9
%63 = load %struct.sockaddr_in*, %struct.sockaddr_in** %13
%64 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %63, i32 0, i32 0
%65 = bitcast %struct.in_addr* %62 to i8*
%66 = bitcast %struct.in_addr* %64 to i8*
%67 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %14, i32 0, i32 1
%68 = load i32, i32* %67
%69 = load i8*, i8** %7
%70 = load i32, i32* @IFNAMSIZ
%71 = call i32 @strncpy(i32 %68, i8* %69, i32 %70)
%72 = load i8*, i8** @AF_INET
%73 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %14, i32 0, i32 0
%74 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %73, i32 0, i32 0
store i8* %72, i8** %74
%75 = load i32, i32* %12
%76 = load i32, i32* @SIOCGIFBRDADDR
%77 = call i64 @ioctl(i32 %75, i32 %76, %struct.ifreq* %14)
%78 = icmp slt i64 %77, 0
br i1 %78, label %79, label %80
79: ; preds = %59
br label %117
80: ; preds = %59
%81 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %14, i32 0, i32 0
%82 = bitcast %struct.TYPE_2__* %81 to %struct.sockaddr_in*
store %struct.sockaddr_in* %82, %struct.sockaddr_in** %13
%83 = load %struct.in_addr*, %struct.in_addr** %10
%84 = load %struct.sockaddr_in*, %struct.sockaddr_in** %13
%85 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %84, i32 0, i32 0
%86 = bitcast %struct.in_addr* %83 to i8*
%87 = bitcast %struct.in_addr* %85 to i8*
%88 = load i32, i32* %12
%89 = call i32 @close(i32 %88)
%90 = call i32* @popen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %90, i32** %15
%91 = icmp eq i32* %90, null
br i1 %91, label %92, label %93
92: ; preds = %80
br label %117
93: ; preds = %80
store i32 0, i32* %16
br label %94
94: ; preds = %109, %93
%95 = getelementptr inbounds [1000 x i8], [1000 x i8]* %17, i64 0, i64 0
%96 = load i32*, i32** %15
%97 = call i32* @fgets(i8* %95, i32 1000, i32* %96)
%98 = icmp ne i32* %97, null
br i1 %98, label %99, label %110
99: ; preds = %94
%100 = getelementptr inbounds [1000 x i8], [1000 x i8]* %17, i64 0, i64 0
%101 = getelementptr inbounds [1000 x i8], [1000 x i8]* %18, i64 0, i64 0
%102 = call i32 @sscanf(i8* %100, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %101)
%103 = icmp eq i32 %102, 1
br i1 %103, label %104, label %109
104: ; preds = %99
%105 = getelementptr inbounds [1000 x i8], [1000 x i8]* %18, i64 0, i64 0
%106 = call i32 @inet_addr(i8* %105)
%107 = load %struct.in_addr*, %struct.in_addr** %11
%108 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %107, i32 0, i32 0
store i32 %106, i32* %108
store i32 1, i32* %16
br label %110
109: ; preds = %99
br label %94
110: ; preds = %104, %94
%111 = load i32*, i32** %15
%112 = call i32 @pclose(i32* %111)
%113 = load i32, i32* %16
%114 = icmp eq i32 %113, 0
br i1 %114, label %115, label %116
115: ; preds = %110
br label %117
116: ; preds = %110
store i32 0, i32* %6
br label %120
117: ; preds = %115, %92, %79, %58, %37
%118 = load i32, i32* %12
%119 = call i32 @close(i32 %118)
store i32 -1, i32* %6
br label %120
120: ; preds = %117, %116, %23
%121 = load i32, i32* %6
ret i32 %121
}

LLVM IR (-O2):
%struct.in_addr = type { i32 }
%struct.ifreq = type { %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i8* }
@AF_INET = global i8* null
@SOCK_DGRAM = global i32 0
@IFNAMSIZ = global i32 0
@SIOCGIFADDR = global i32 0
@SIOCGIFNETMASK = global i32 0
@SIOCGIFBRDADDR = global i32 0
@.str = [12 x i8] c"netstat -rn\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [11 x i8] c"0.0.0.0 %s\00"
define i32 @armnet_get_host_params(i8* %0, %struct.in_addr* nocapture writeonly %1, %struct.in_addr* nocapture writeonly %2, %struct.in_addr* nocapture writeonly %3, %struct.in_addr* nocapture writeonly %4) {
%6 = alloca %struct.ifreq
%7 = alloca [1000 x i8]
%8 = alloca [1000 x i8]
%9 = bitcast %struct.ifreq* %6 to i8*
%10 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 0
%11 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 0
%12 = load i8*, i8** @AF_INET
%13 = load i32, i32* @SOCK_DGRAM
%14 = tail call i32 @socket(i8* %12, i32 %13, i32 0)
%15 = icmp slt i32 %14, 0
br i1 %15, label %66, label %16
16: ; preds = %5
%17 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %6, i64 0, i32 1
%18 = load i32, i32* @IFNAMSIZ
%19 = tail call i32 @strncpy(i32 undef, i8* %0, i32 %18)
%20 = load i8*, i8** @AF_INET
%21 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %6, i64 0, i32 0, i32 0
store i8* %20, i8** %21
%22 = load i32, i32* @SIOCGIFADDR
%23 = call i64 @ioctl(i32 %14, i32 %22, %struct.ifreq* %6)
%24 = icmp slt i64 %23, 0
br i1 %24, label %64, label %25
25: ; preds = %16
%26 = bitcast %struct.ifreq* %6 to i32*
%27 = getelementptr %struct.in_addr, %struct.in_addr* %1, i64 0, i32 0
%28 = load i32, i32* %26
store i32 %28, i32* %27
%29 = load i32, i32* %17
%30 = load i32, i32* @IFNAMSIZ
%31 = call i32 @strncpy(i32 %29, i8* %0, i32 %30)
%32 = load i8*, i8** @AF_INET
store i8* %32, i8** %21
%33 = load i32, i32* @SIOCGIFNETMASK
%34 = call i64 @ioctl(i32 %14, i32 %33, %struct.ifreq* %6)
%35 = icmp slt i64 %34, 0
br i1 %35, label %64, label %36
36: ; preds = %25
%37 = getelementptr %struct.in_addr, %struct.in_addr* %2, i64 0, i32 0
%38 = load i32, i32* %26
store i32 %38, i32* %37
%39 = load i32, i32* %17
%40 = load i32, i32* @IFNAMSIZ
%41 = call i32 @strncpy(i32 %39, i8* %0, i32 %40)
%42 = load i8*, i8** @AF_INET
store i8* %42, i8** %21
%43 = load i32, i32* @SIOCGIFBRDADDR
%44 = call i64 @ioctl(i32 %14, i32 %43, %struct.ifreq* %6)
%45 = icmp slt i64 %44, 0
br i1 %45, label %64, label %46
46: ; preds = %36
%47 = getelementptr %struct.in_addr, %struct.in_addr* %3, i64 0, i32 0
%48 = load i32, i32* %26
store i32 %48, i32* %47
%49 = call i32 @close(i32 %14)
%50 = call i32* @popen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%51 = icmp eq i32* %50, null
br i1 %51, label %64, label %52
52: ; preds = %46, %55
%53 = call i32* @fgets(i8* %10, i32 1000, i32* %50)
%54 = icmp eq i32* %53, null
br i1 %54, label %62, label %55
55: ; preds = %52
%56 = call i32 @sscanf(i8* %10, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %11)
%57 = icmp eq i32 %56, 1
br i1 %57, label %58, label %52
58: ; preds = %55
%59 = call i32 @inet_addr(i8* %11)
%60 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %4, i64 0, i32 0
store i32 %59, i32* %60
%61 = call i32 @pclose(i32* %50)
br label %66
62: ; preds = %52
%63 = call i32 @pclose(i32* %50)
br label %64
64: ; preds = %62, %46, %36, %25, %16
%65 = call i32 @close(i32 %14)
br label %66
66: ; preds = %58, %5, %64
%67 = phi i32 [ -1, %64 ], [ -1, %5 ], [ 0, %58 ]
ret i32 %67
}