#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 TYPE_2__ {
  unsigned int s_addr;
};
struct sockaddr_in {
  TYPE_1__ sin_addr;
};
struct ifreq {
  char *ifr_name;
  unsigned int ifr_flags;
  int /*<<< orphan*/ ifr_addr;
};

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ EINVAL;
unsigned int IFF_BROADCAST;
unsigned int IFF_LOOPBACK;
unsigned int IFF_MULTICAST;
unsigned int IFF_POINTOPOINT;
unsigned int IFF_RUNNING;
unsigned int IFF_UP;
int IFNAMSIZ;
int /*<<< orphan*/ SIOCGIFADDR;
int /*<<< orphan*/ SIOCGIFFLAGS;
int /*<<< orphan*/ SIOCGIFNETMASK;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ die(char *);
int /*<<< orphan*/ errno;
scalar_t__ ioctl(int, int /*<<< orphan*/, struct ifreq *);
scalar_t__ isdigit(char);
int /*<<< orphan*/ memset(struct ifreq *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char const *, char const *, char const *,
                          ...);
int /*<<< orphan*/ setaddr(int, struct ifreq *, char *);
int /*<<< orphan*/ setdstaddr(int, struct ifreq *, char *);
int /*<<< orphan*/ setflags(int, struct ifreq *, unsigned int, unsigned int);
int /*<<< orphan*/ setmtu(int, struct ifreq *, char *);
int /*<<< orphan*/ setnetmask(int, struct ifreq *, char *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, unsigned int, unsigned int,
                           unsigned int, unsigned int);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int main(int argc, char *argv[]) {
  struct ifreq ifr;
  int s;
  unsigned int addr, mask, flags;
  char astring[20];
  char mstring[20];
  const char *updown, *brdcst, *loopbk, *ppp, *running, *multi;
  argc--;
  argv++;
  if (argc == 0)
    return 0;
  memset(&ifr, 0, sizeof(struct ifreq));
  strncpy(ifr.ifr_name, argv[0], IFNAMSIZ);
  ifr.ifr_name[IFNAMSIZ - 1] = 0;
  argc--, argv++;
  if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
    die("cannot open control socket\n");
  }
  if (argc == 0) {
    if (ioctl(s, SIOCGIFADDR, &ifr) < 0) {
      perror(ifr.ifr_name);
      return -1;
    } else
      addr = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr;
    if (ioctl(s, SIOCGIFNETMASK, &ifr) < 0) {
      perror(ifr.ifr_name);
      return -1;
    } else
      mask = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr;
    if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0) {
      perror(ifr.ifr_name);
      return -1;
    } else
      flags = ifr.ifr_flags;
    sprintf(astring, "%d.%d.%d.%d", addr & 0xff, ((addr >> 8) & 0xff),
            ((addr >> 16) & 0xff), ((addr >> 24) & 0xff));
    sprintf(mstring, "%d.%d.%d.%d", mask & 0xff, ((mask >> 8) & 0xff),
            ((mask >> 16) & 0xff), ((mask >> 24) & 0xff));
    printf("%s: ip %s mask %s flags [", ifr.ifr_name, astring, mstring);
    updown = (flags & IFF_UP) ? "up" : "down";
    brdcst = (flags & IFF_BROADCAST) ? " broadcast" : "";
    loopbk = (flags & IFF_LOOPBACK) ? " loopback" : "";
    ppp = (flags & IFF_POINTOPOINT) ? " point-to-point" : "";
    running = (flags & IFF_RUNNING) ? " running" : "";
    multi = (flags & IFF_MULTICAST) ? " multicast" : "";
    printf("%s%s%s%s%s%s]\n", updown, brdcst, loopbk, ppp, running, multi);
    return 0;
  }
  while (argc > 0) {
    if (!strcmp(argv[0], "up")) {
      setflags(s, &ifr, IFF_UP, 0);
    } else if (!strcmp(argv[0], "mtu")) {
      argc--, argv++;
      if (!argc) {
        errno = EINVAL;
        die("expecting a value for parameter \"mtu\"");
      }
      setmtu(s, &ifr, argv[0]);
    } else if (!strcmp(argv[0], "-pointopoint")) {
      setflags(s, &ifr, IFF_POINTOPOINT, 1);
    } else if (!strcmp(argv[0], "pointopoint")) {
      argc--, argv++;
      if (!argc) {
        errno = EINVAL;
        die("expecting an IP address for parameter \"pointtopoint\"");
      }
      setdstaddr(s, &ifr, argv[0]);
      setflags(s, &ifr, IFF_POINTOPOINT, 0);
    } else if (!strcmp(argv[0], "down")) {
      setflags(s, &ifr, 0, IFF_UP);
    } else if (!strcmp(argv[0], "netmask")) {
      argc--, argv++;
      if (!argc) {
        errno = EINVAL;
        die("expecting an IP address for parameter \"netmask\"");
      }
      setnetmask(s, &ifr, argv[0]);
    } else if (isdigit(argv[0][0])) {
      setaddr(s, &ifr, argv[0]);
      setflags(s, &ifr, IFF_UP, 0);
    }
    argc--, argv++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1234 <main+0x44>
movl   $0x0,-0x4(%rbp)
jmp    17e4 <main+0x5f4>
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1080 <memset@plt>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    0x2d3a(%rip),%rax
mov    (%rax),%edx
call   1030 <strncpy@plt>
mov    -0x20(%rbp),%rax
mov    0x2d28(%rip),%rcx
mov    (%rcx),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    0x2d48(%rip),%rax
mov    (%rax),%edi
mov    0x2d0f(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
mov    %eax,-0x24(%rbp)
cmp    $0x0,%eax
jge    12ba <main+0xca>
lea    0xd4b(%rip),%rdi
call   10c0 <die@plt>
cmpl   $0x0,-0x8(%rbp)
jne    153e <main+0x34e>
mov    -0x24(%rbp),%edi
mov    0x2d12(%rip),%rax
mov    (%rax),%esi
lea    -0x20(%rbp),%rdx
call   1090 <ioctl@plt>
cmp    $0x0,%rax
jge    12f8 <main+0x108>
mov    -0x20(%rbp),%rdi
call   10d0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    17e4 <main+0x5f4>
mov    -0x14(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%edi
mov    0x2cc8(%rip),%rax
mov    (%rax),%esi
lea    -0x20(%rbp),%rdx
call   1090 <ioctl@plt>
cmp    $0x0,%rax
jge    1332 <main+0x142>
mov    -0x20(%rbp),%rdi
call   10d0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    17e4 <main+0x5f4>
mov    -0x14(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x24(%rbp),%edi
mov    0x2c5e(%rip),%rax
mov    (%rax),%esi
lea    -0x20(%rbp),%rdx
call   1090 <ioctl@plt>
cmp    $0x0,%rax
jge    136c <main+0x17c>
mov    -0x20(%rbp),%rdi
call   10d0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    17e4 <main+0x5f4>
mov    -0x18(%rbp),%eax
mov    %eax,-0x30(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x28(%rbp),%edx
and    $0xff,%edx
mov    -0x28(%rbp),%ecx
shr    $0x8,%ecx
and    $0xff,%ecx
mov    -0x28(%rbp),%r8d
shr    $0x10,%r8d
and    $0xff,%r8d
mov    -0x28(%rbp),%r9d
shr    $0x18,%r9d
and    $0xff,%r9d
lea    0xc6c(%rip),%rsi
call   10f0 <sprintf@plt>
lea    -0x70(%rbp),%rdi
mov    -0x2c(%rbp),%edx
and    $0xff,%edx
mov    -0x2c(%rbp),%ecx
shr    $0x8,%ecx
and    $0xff,%ecx
mov    -0x2c(%rbp),%r8d
shr    $0x10,%r8d
and    $0xff,%r8d
mov    -0x2c(%rbp),%r9d
shr    $0x18,%r9d
and    $0xff,%r9d
lea    0xc29(%rip),%rsi
call   10f0 <sprintf@plt>
mov    -0x20(%rbp),%rsi
lea    -0x50(%rbp),%rdx
lea    -0x70(%rbp),%rcx
lea    0xc1d(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x30(%rbp),%edx
mov    0x2b94(%rip),%rax
and    (%rax),%edx
lea    0xc20(%rip),%rax
lea    0xc16(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0x78(%rbp)
mov    -0x30(%rbp),%edx
mov    0x2b37(%rip),%rax
and    (%rax),%edx
lea    0xc47(%rip),%rax
lea    0xbf9(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0x80(%rbp)
mov    -0x30(%rbp),%edx
mov    0x2b92(%rip),%rax
and    (%rax),%edx
lea    0xc22(%rip),%rax
lea    0xbdf(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0x88(%rbp)
mov    -0x30(%rbp),%edx
mov    0x2b32(%rip),%rax
and    (%rax),%edx
lea    0xbfa(%rip),%rax
lea    0xbc1(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0x90(%rbp)
mov    -0x30(%rbp),%edx
mov    0x2b02(%rip),%rax
and    (%rax),%edx
lea    0xbd2(%rip),%rax
lea    0xba9(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0x98(%rbp)
mov    -0x30(%rbp),%edx
mov    0x2aea(%rip),%rax
and    (%rax),%edx
lea    0xbaa(%rip),%rax
lea    0xb8a(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0xa0(%rbp)
mov    -0x78(%rbp),%rsi
mov    -0x80(%rbp),%rdx
mov    -0x88(%rbp),%rcx
mov    -0x90(%rbp),%r8
mov    -0x98(%rbp),%r9
mov    -0xa0(%rbp),%rax
lea    0xb5c(%rip),%rdi
mov    %rax,(%rsp)
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    17e4 <main+0x5f4>
jmp    1543 <main+0x353>
cmpl   $0x0,-0x8(%rbp)
jle    17dd <main+0x5ed>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xae7(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%eax
jne    1585 <main+0x395>
mov    -0x24(%rbp),%edi
mov    0x2a3d(%rip),%rax
mov    (%rax),%edx
lea    -0x20(%rbp),%rsi
xor    %ecx,%ecx
call   1100 <setflags@plt>
jmp    17c3 <main+0x5d3>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xaff(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%eax
jne    15f6 <main+0x406>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    15de <main+0x3ee>
mov    0x29b9(%rip),%rax
mov    (%rax),%ecx
mov    0x29b8(%rip),%rax
mov    %ecx,(%rax)
lea    0xabd(%rip),%rdi
call   10c0 <die@plt>
mov    -0x24(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    -0x20(%rbp),%rsi
call   10e0 <setmtu@plt>
jmp    17be <main+0x5ce>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xab8(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%eax
jne    1631 <main+0x441>
mov    -0x24(%rbp),%edi
mov    0x29a4(%rip),%rax
mov    (%rax),%edx
lea    -0x20(%rbp),%rsi
mov    $0x1,%ecx
call   1100 <setflags@plt>
jmp    17b9 <main+0x5c9>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xa7e(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%eax
jne    16b9 <main+0x4c9>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    168a <main+0x49a>
mov    0x290d(%rip),%rax
mov    (%rax),%ecx
mov    0x290c(%rip),%rax
mov    %ecx,(%rax)
lea    0xa44(%rip),%rdi
call   10c0 <die@plt>
mov    -0x24(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    -0x20(%rbp),%rsi
call   10b0 <setdstaddr@plt>
mov    -0x24(%rbp),%edi
mov    0x2919(%rip),%rax
mov    (%rax),%edx
lea    -0x20(%rbp),%rsi
xor    %ecx,%ecx
call   1100 <setflags@plt>
jmp    17b4 <main+0x5c4>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0x97e(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%eax
jne    16f1 <main+0x501>
mov    -0x24(%rbp),%edi
mov    0x28d1(%rip),%rax
mov    (%rax),%ecx
lea    -0x20(%rbp),%rsi
xor    %edx,%edx
call   1100 <setflags@plt>
jmp    17af <main+0x5bf>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0x9ff(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%eax
jne    1762 <main+0x572>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    174a <main+0x55a>
mov    0x284d(%rip),%rax
mov    (%rax),%ecx
mov    0x284c(%rip),%rax
mov    %ecx,(%rax)
lea    0x9c1(%rip),%rdi
call   10c0 <die@plt>
mov    -0x24(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    -0x20(%rbp),%rsi
call   1050 <setnetmask@plt>
jmp    17aa <main+0x5ba>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%edi
call   1040 <isdigit@plt>
cmp    $0x0,%rax
je     17a5 <main+0x5b5>
mov    -0x24(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    -0x20(%rbp),%rsi
call   1060 <setaddr@plt>
mov    -0x24(%rbp),%edi
mov    0x2818(%rip),%rax
mov    (%rax),%edx
lea    -0x20(%rbp),%rsi
xor    %ecx,%ecx
call   1100 <setflags@plt>
jmp    17aa <main+0x5ba>
jmp    17af <main+0x5bf>
jmp    17b4 <main+0x5c4>
jmp    17b9 <main+0x5c9>
jmp    17be <main+0x5ce>
jmp    17c3 <main+0x5d3>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    1543 <main+0x353>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
xor    %r14d,%r14d
cmp    $0x1,%edi
je     15f5 <main+0x405>
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0x10(%rsp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1080 <memset@plt>
mov    0x10(%rsp),%rdi
mov    0x8(%rbx),%rsi
mov    0x2d60(%rip),%r14
mov    (%r14),%edx
call   1030 <strncpy@plt>
mov    0x10(%rsp),%rax
movslq (%r14),%rcx
movb   $0x0,-0x1(%rcx,%rax,1)
lea    -0x2(%rbp),%r12d
mov    0x2d88(%rip),%rax
mov    (%rax),%edi
mov    0x2d4f(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
mov    %eax,%r13d
test   %eax,%eax
js     145e <main+0x26e>
test   %r12d,%r12d
je     1473 <main+0x283>
xor    %r14d,%r14d
cmp    $0x3,%ebp
jl     15f5 <main+0x405>
add    $0x10,%rbx
lea    0xdb5(%rip),%r14
lea    0x10(%rsp),%r15
jmp    12c3 <main+0xd3>
mov    0x2d25(%rip),%rax
mov    (%rax),%edx
mov    %r13d,%edi
mov    %r15,%rsi
mov    $0x1,%ecx
call   1100 <setflags@plt>
lea    -0x1(%r12),%eax
add    $0x8,%rbx
cmp    $0x1,%r12d
mov    %eax,%r12d
jle    15f2 <main+0x402>
mov    (%rbx),%rbp
mov    %rbp,%rdi
mov    %r14,%rsi
call   10a0 <strcmp@plt>
test   %eax,%eax
je     1370 <main+0x180>
mov    %rbp,%rdi
lea    0xdaf(%rip),%rsi
call   10a0 <strcmp@plt>
test   %eax,%eax
je     1390 <main+0x1a0>
mov    %rbp,%rdi
lea    0xdc2(%rip),%rsi
call   10a0 <strcmp@plt>
test   %eax,%eax
je     1294 <main+0xa4>
mov    %rbp,%rdi
lea    0xdb0(%rip),%rsi
call   10a0 <strcmp@plt>
test   %eax,%eax
je     13cb <main+0x1db>
mov    %rbp,%rdi
lea    0xd21(%rip),%rsi
call   10a0 <strcmp@plt>
test   %eax,%eax
je     140d <main+0x21d>
mov    %rbp,%rdi
lea    0xdc3(%rip),%rsi
call   10a0 <strcmp@plt>
test   %eax,%eax
je     1423 <main+0x233>
movsbl 0x0(%rbp),%edi
call   1040 <isdigit@plt>
test   %rax,%rax
je     12ad <main+0xbd>
mov    (%rbx),%rdx
mov    %r13d,%edi
mov    %r15,%rsi
call   1060 <setaddr@plt>
nopl   0x0(%rax,%rax,1)
mov    0x2c39(%rip),%rax
mov    (%rax),%edx
mov    %r13d,%edi
mov    %r15,%rsi
xor    %ecx,%ecx
jmp    12a8 <main+0xb8>
cs nopw 0x0(%rax,%rax,1)
add    $0x8,%rbx
add    $0xffffffff,%r12d
jne    13b8 <main+0x1c8>
mov    0x2bdf(%rip),%rax
mov    (%rax),%eax
mov    0x2bde(%rip),%rcx
mov    %eax,(%rcx)
lea    0xce3(%rip),%rdi
call   10c0 <die@plt>
mov    (%rbx),%rdx
mov    %r13d,%edi
mov    %r15,%rsi
call   10e0 <setmtu@plt>
jmp    12ad <main+0xbd>
add    $0x8,%rbx
add    $0xffffffff,%r12d
jne    13f3 <main+0x203>
mov    0x2ba4(%rip),%rax
mov    (%rax),%eax
mov    0x2ba3(%rip),%rcx
mov    %eax,(%rcx)
lea    0xcdb(%rip),%rdi
call   10c0 <die@plt>
mov    (%rbx),%rdx
mov    %r13d,%edi
mov    %r15,%rsi
call   10b0 <setdstaddr@plt>
mov    0x2bb8(%rip),%rax
jmp    1377 <main+0x187>
mov    0x2b9c(%rip),%rax
mov    (%rax),%ecx
mov    %r13d,%edi
mov    %r15,%rsi
xor    %edx,%edx
jmp    12a8 <main+0xb8>
add    $0x8,%rbx
add    $0xffffffff,%r12d
jne    144b <main+0x25b>
mov    0x2b4c(%rip),%rax
mov    (%rax),%eax
mov    0x2b4b(%rip),%rcx
mov    %eax,(%rcx)
lea    0xcc0(%rip),%rdi
call   10c0 <die@plt>
mov    (%rbx),%rdx
mov    %r13d,%edi
mov    %r15,%rsi
call   1050 <setnetmask@plt>
jmp    12ad <main+0xbd>
lea    0xb9b(%rip),%rdi
call   10c0 <die@plt>
test   %r12d,%r12d
jne    1276 <main+0x86>
mov    0x2b66(%rip),%rax
mov    (%rax),%esi
lea    0x10(%rsp),%rdx
mov    %r13d,%edi
call   1090 <ioctl@plt>
test   %rax,%rax
js     1607 <main+0x417>
mov    0x1c(%rsp),%ebx
mov    0x2b33(%rip),%rax
mov    (%rax),%esi
lea    0x10(%rsp),%rdx
mov    %r13d,%edi
call   1090 <ioctl@plt>
test   %rax,%rax
js     1607 <main+0x417>
mov    0x1c(%rsp),%r12d
mov    0x2adf(%rip),%rax
mov    (%rax),%esi
lea    0x10(%rsp),%rdx
mov    %r13d,%edi
call   1090 <ioctl@plt>
test   %rax,%rax
js     1607 <main+0x417>
mov    0x18(%rsp),%ebp
movzbl %bl,%edx
movzbl %bh,%ecx
mov    %ebx,%eax
shr    $0x10,%eax
movzbl %al,%r8d
shr    $0x18,%ebx
lea    0xb26(%rip),%r14
lea    0x40(%rsp),%r15
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebx,%r9d
call   10f0 <sprintf@plt>
mov    %r12d,%ebx
movzbl %bl,%edx
movzbl %bh,%ecx
mov    %r12d,%eax
shr    $0x10,%eax
movzbl %al,%r8d
shr    $0x18,%ebx
lea    0x20(%rsp),%r12
mov    %r12,%rdi
mov    %r14,%rsi
mov    %ebx,%r9d
call   10f0 <sprintf@plt>
mov    0x10(%rsp),%rsi
lea    0xaea(%rip),%rdi
xor    %r14d,%r14d
mov    %r15,%rdx
mov    %r12,%rcx
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x2a5b(%rip),%rax
mov    (%rax),%eax
and    %ebp,%eax
lea    0xae5(%rip),%rax
lea    0xadb(%rip),%rsi
cmove  %rax,%rsi
mov    0x2a06(%rip),%rax
mov    (%rax),%eax
and    %ebp,%eax
lea    0xb14(%rip),%rax
lea    0xac6(%rip),%rdx
cmove  %rax,%rdx
mov    0x2a69(%rip),%rcx
mov    (%rcx),%ecx
and    %ebp,%ecx
lea    0xabb(%rip),%rcx
cmove  %rax,%rcx
mov    0x2a1b(%rip),%rdi
mov    (%rdi),%edi
and    %ebp,%edi
lea    0xaaf(%rip),%r8
cmove  %rax,%r8
mov    0x29fd(%rip),%rdi
mov    (%rdi),%edi
and    %ebp,%edi
lea    0xaa9(%rip),%r9
cmove  %rax,%r9
mov    0x29f7(%rip),%rdi
and    (%rdi),%ebp
lea    0xa9e(%rip),%rdi
cmove  %rax,%rdi
mov    %rdi,(%rsp)
lea    0xa9a(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
jmp    15f5 <main+0x405>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x10(%rsp),%rdi
call   10d0 <perror@plt>
mov    $0xffffffff,%r14d
jmp    15f5 <main+0x405>

LLVM IR (-O0):
%struct.ifreq = type { i8*, i32, i32 }
%struct.sockaddr_in = type { %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32 }
@IFNAMSIZ = global i32 0
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str = [28 x i8] c"cannot open control socket\0A\00"
@SIOCGIFADDR = global i32 0
@SIOCGIFNETMASK = global i32 0
@SIOCGIFFLAGS = global i32 0
@.str.1 = [12 x i8] c"%d.%d.%d.%d\00"
@.str.2 = [26 x i8] c"%s: ip %s mask %s flags [\00"
@IFF_UP = global i32 0
@.str.3 = [3 x i8] c"up\00"
@.str.4 = [5 x i8] c"down\00"
@IFF_BROADCAST = global i32 0
@.str.5 = [11 x i8] c" broadcast\00"
@.str.6 = [1 x i8] zeroinitializer
@IFF_LOOPBACK = global i32 0
@.str.7 = [10 x i8] c" loopback\00"
@IFF_POINTOPOINT = global i32 0
@.str.8 = [16 x i8] c" point-to-point\00"
@IFF_RUNNING = global i32 0
@.str.9 = [9 x i8] c" running\00"
@IFF_MULTICAST = global i32 0
@.str.10 = [11 x i8] c" multicast\00"
@.str.11 = [15 x i8] c"%s%s%s%s%s%s]\0A\00"
@.str.12 = [4 x i8] c"mtu\00"
@EINVAL = global i32 0
@errno = global i32 0
@.str.13 = [38 x i8] c"expecting a value for parameter \22mtu\22\00"
@.str.14 = [13 x i8] c"-pointopoint\00"
@.str.15 = [12 x i8] c"pointopoint\00"
@.str.16 = [53 x i8] c"expecting an IP address for parameter \22pointtopoint\22\00"
@.str.17 = [8 x i8] c"netmask\00"
@.str.18 = [48 x i8] c"expecting an IP address for parameter \22netmask\22\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.ifreq
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca [20 x i8]
%12 = alloca [20 x i8]
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca i8*
%18 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%19 = load i32, i32* %4
%20 = add nsw i32 %19, -1
store i32 %20, i32* %4
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i32 1
store i8** %22, i8*** %5
%23 = load i32, i32* %4
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %2
store i32 0, i32* %3
br label %303
26: ; preds = %2
%27 = call i32 @memset(%struct.ifreq* %6, i32 0, i32 16)
%28 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %6, i32 0, i32 0
%29 = load i8*, i8** %28
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 0
%32 = load i8*, i8** %31
%33 = load i32, i32* @IFNAMSIZ
%34 = call i32 @strncpy(i8* %29, i8* %32, i32 %33)
%35 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %6, i32 0, i32 0
%36 = load i8*, i8** %35
%37 = load i32, i32* @IFNAMSIZ
%38 = sub nsw i32 %37, 1
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8, i8* %36, i64 %39
store i8 0, i8* %40
%41 = load i32, i32* %4
%42 = add nsw i32 %41, -1
store i32 %42, i32* %4
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i32 1
store i8** %44, i8*** %5
%45 = load i32, i32* @AF_INET
%46 = load i32, i32* @SOCK_DGRAM
%47 = call i32 @socket(i32 %45, i32 %46, i32 0)
store i32 %47, i32* %7
%48 = icmp slt i32 %47, 0
br i1 %48, label %49, label %51
49: ; preds = %26
%50 = call i32 @die(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %51
51: ; preds = %49, %26
%52 = load i32, i32* %4
%53 = icmp eq i32 %52, 0
br i1 %53, label %54, label %171
54: ; preds = %51
%55 = load i32, i32* %7
%56 = load i32, i32* @SIOCGIFADDR
%57 = call i64 @ioctl(i32 %55, i32 %56, %struct.ifreq* %6)
%58 = icmp slt i64 %57, 0
br i1 %58, label %59, label %63
59: ; preds = %54
%60 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %6, i32 0, i32 0
%61 = load i8*, i8** %60
%62 = call i32 @perror(i8* %61)
store i32 -1, i32* %3
br label %303
63: ; preds = %54
%64 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %6, i32 0, i32 2
%65 = bitcast i32* %64 to %struct.sockaddr_in*
%66 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %65, i32 0, i32 0
%67 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %66, i32 0, i32 0
%68 = load i32, i32* %67
store i32 %68, i32* %8
br label %69
69: ; preds = %63
%70 = load i32, i32* %7
%71 = load i32, i32* @SIOCGIFNETMASK
%72 = call i64 @ioctl(i32 %70, i32 %71, %struct.ifreq* %6)
%73 = icmp slt i64 %72, 0
br i1 %73, label %74, label %78
74: ; preds = %69
%75 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %6, i32 0, i32 0
%76 = load i8*, i8** %75
%77 = call i32 @perror(i8* %76)
store i32 -1, i32* %3
br label %303
78: ; preds = %69
%79 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %6, i32 0, i32 2
%80 = bitcast i32* %79 to %struct.sockaddr_in*
%81 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %80, i32 0, i32 0
%82 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %81, i32 0, i32 0
%83 = load i32, i32* %82
store i32 %83, i32* %9
br label %84
84: ; preds = %78
%85 = load i32, i32* %7
%86 = load i32, i32* @SIOCGIFFLAGS
%87 = call i64 @ioctl(i32 %85, i32 %86, %struct.ifreq* %6)
%88 = icmp slt i64 %87, 0
br i1 %88, label %89, label %93
89: ; preds = %84
%90 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %6, i32 0, i32 0
%91 = load i8*, i8** %90
%92 = call i32 @perror(i8* %91)
store i32 -1, i32* %3
br label %303
93: ; preds = %84
%94 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %6, i32 0, i32 1
%95 = load i32, i32* %94
store i32 %95, i32* %10
br label %96
96: ; preds = %93
%97 = getelementptr inbounds [20 x i8], [20 x i8]* %11, i64 0, i64 0
%98 = load i32, i32* %8
%99 = and i32 %98, 255
%100 = load i32, i32* %8
%101 = lshr i32 %100, 8
%102 = and i32 %101, 255
%103 = load i32, i32* %8
%104 = lshr i32 %103, 16
%105 = and i32 %104, 255
%106 = load i32, i32* %8
%107 = lshr i32 %106, 24
%108 = and i32 %107, 255
%109 = call i32 @sprintf(i8* %97, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %99, i32 %102, i32 %105, i32 %108)
%110 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%111 = load i32, i32* %9
%112 = and i32 %111, 255
%113 = load i32, i32* %9
%114 = lshr i32 %113, 8
%115 = and i32 %114, 255
%116 = load i32, i32* %9
%117 = lshr i32 %116, 16
%118 = and i32 %117, 255
%119 = load i32, i32* %9
%120 = lshr i32 %119, 24
%121 = and i32 %120, 255
%122 = call i32 @sprintf(i8* %110, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %112, i32 %115, i32 %118, i32 %121)
%123 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %6, i32 0, i32 0
%124 = load i8*, i8** %123
%125 = getelementptr inbounds [20 x i8], [20 x i8]* %11, i64 0, i64 0
%126 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%127 = call i32 (i8*, i8*, i8*, i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* %124, i8* %125, i8* %126)
%128 = load i32, i32* %10
%129 = load i32, i32* @IFF_UP
%130 = and i32 %128, %129
%131 = icmp ne i32 %130, 0
%132 = zext i1 %131 to i64
%133 = select i1 %131, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0)
store i8* %133, i8** %13
%134 = load i32, i32* %10
%135 = load i32, i32* @IFF_BROADCAST
%136 = and i32 %134, %135
%137 = icmp ne i32 %136, 0
%138 = zext i1 %137 to i64
%139 = select i1 %137, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0)
store i8* %139, i8** %14
%140 = load i32, i32* %10
%141 = load i32, i32* @IFF_LOOPBACK
%142 = and i32 %140, %141
%143 = icmp ne i32 %142, 0
%144 = zext i1 %143 to i64
%145 = select i1 %143, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0)
store i8* %145, i8** %15
%146 = load i32, i32* %10
%147 = load i32, i32* @IFF_POINTOPOINT
%148 = and i32 %146, %147
%149 = icmp ne i32 %148, 0
%150 = zext i1 %149 to i64
%151 = select i1 %149, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0)
store i8* %151, i8** %16
%152 = load i32, i32* %10
%153 = load i32, i32* @IFF_RUNNING
%154 = and i32 %152, %153
%155 = icmp ne i32 %154, 0
%156 = zext i1 %155 to i64
%157 = select i1 %155, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0)
store i8* %157, i8** %17
%158 = load i32, i32* %10
%159 = load i32, i32* @IFF_MULTICAST
%160 = and i32 %158, %159
%161 = icmp ne i32 %160, 0
%162 = zext i1 %161 to i64
%163 = select i1 %161, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0)
store i8* %163, i8** %18
%164 = load i8*, i8** %13
%165 = load i8*, i8** %14
%166 = load i8*, i8** %15
%167 = load i8*, i8** %16
%168 = load i8*, i8** %17
%169 = load i8*, i8** %18
%170 = call i32 (i8*, i8*, i8*, i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0), i8* %164, i8* %165, i8* %166, i8* %167, i8* %168, i8* %169)
store i32 0, i32* %3
br label %303
171: ; preds = %51
br label %172
172: ; preds = %297, %171
%173 = load i32, i32* %4
%174 = icmp sgt i32 %173, 0
br i1 %174, label %175, label %302
175: ; preds = %172
%176 = load i8**, i8*** %5
%177 = getelementptr inbounds i8*, i8** %176, i64 0
%178 = load i8*, i8** %177
%179 = call i32 @strcmp(i8* %178, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%180 = icmp ne i32 %179, 0
br i1 %180, label %185, label %181
181: ; preds = %175
%182 = load i32, i32* %7
%183 = load i32, i32* @IFF_UP
%184 = call i32 @setflags(i32 %182, %struct.ifreq* %6, i32 %183, i32 0)
br label %297
185: ; preds = %175
%186 = load i8**, i8*** %5
%187 = getelementptr inbounds i8*, i8** %186, i64 0
%188 = load i8*, i8** %187
%189 = call i32 @strcmp(i8* %188, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0))
%190 = icmp ne i32 %189, 0
br i1 %190, label %207, label %191
191: ; preds = %185
%192 = load i32, i32* %4
%193 = add nsw i32 %192, -1
store i32 %193, i32* %4
%194 = load i8**, i8*** %5
%195 = getelementptr inbounds i8*, i8** %194, i32 1
store i8** %195, i8*** %5
%196 = load i32, i32* %4
%197 = icmp ne i32 %196, 0
br i1 %197, label %201, label %198
198: ; preds = %191
%199 = load i32, i32* @EINVAL
store i32 %199, i32* @errno
%200 = call i32 @die(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.13, i64 0, i64 0))
br label %201
201: ; preds = %198, %191
%202 = load i32, i32* %7
%203 = load i8**, i8*** %5
%204 = getelementptr inbounds i8*, i8** %203, i64 0
%205 = load i8*, i8** %204
%206 = call i32 @setmtu(i32 %202, %struct.ifreq* %6, i8* %205)
br label %296
207: ; preds = %185
%208 = load i8**, i8*** %5
%209 = getelementptr inbounds i8*, i8** %208, i64 0
%210 = load i8*, i8** %209
%211 = call i32 @strcmp(i8* %210, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0))
%212 = icmp ne i32 %211, 0
br i1 %212, label %217, label %213
213: ; preds = %207
%214 = load i32, i32* %7
%215 = load i32, i32* @IFF_POINTOPOINT
%216 = call i32 @setflags(i32 %214, %struct.ifreq* %6, i32 %215, i32 1)
br label %295
217: ; preds = %207
%218 = load i8**, i8*** %5
%219 = getelementptr inbounds i8*, i8** %218, i64 0
%220 = load i8*, i8** %219
%221 = call i32 @strcmp(i8* %220, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.15, i64 0, i64 0))
%222 = icmp ne i32 %221, 0
br i1 %222, label %242, label %223
223: ; preds = %217
%224 = load i32, i32* %4
%225 = add nsw i32 %224, -1
store i32 %225, i32* %4
%226 = load i8**, i8*** %5
%227 = getelementptr inbounds i8*, i8** %226, i32 1
store i8** %227, i8*** %5
%228 = load i32, i32* %4
%229 = icmp ne i32 %228, 0
br i1 %229, label %233, label %230
230: ; preds = %223
%231 = load i32, i32* @EINVAL
store i32 %231, i32* @errno
%232 = call i32 @die(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.16, i64 0, i64 0))
br label %233
233: ; preds = %230, %223
%234 = load i32, i32* %7
%235 = load i8**, i8*** %5
%236 = getelementptr inbounds i8*, i8** %235, i64 0
%237 = load i8*, i8** %236
%238 = call i32 @setdstaddr(i32 %234, %struct.ifreq* %6, i8* %237)
%239 = load i32, i32* %7
%240 = load i32, i32* @IFF_POINTOPOINT
%241 = call i32 @setflags(i32 %239, %struct.ifreq* %6, i32 %240, i32 0)
br label %294
242: ; preds = %217
%243 = load i8**, i8*** %5
%244 = getelementptr inbounds i8*, i8** %243, i64 0
%245 = load i8*, i8** %244
%246 = call i32 @strcmp(i8* %245, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%247 = icmp ne i32 %246, 0
br i1 %247, label %252, label %248
248: ; preds = %242
%249 = load i32, i32* %7
%250 = load i32, i32* @IFF_UP
%251 = call i32 @setflags(i32 %249, %struct.ifreq* %6, i32 0, i32 %250)
br label %293
252: ; preds = %242
%253 = load i8**, i8*** %5
%254 = getelementptr inbounds i8*, i8** %253, i64 0
%255 = load i8*, i8** %254
%256 = call i32 @strcmp(i8* %255, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i64 0, i64 0))
%257 = icmp ne i32 %256, 0
br i1 %257, label %274, label %258
258: ; preds = %252
%259 = load i32, i32* %4
%260 = add nsw i32 %259, -1
store i32 %260, i32* %4
%261 = load i8**, i8*** %5
%262 = getelementptr inbounds i8*, i8** %261, i32 1
store i8** %262, i8*** %5
%263 = load i32, i32* %4
%264 = icmp ne i32 %263, 0
br i1 %264, label %268, label %265
265: ; preds = %258
%266 = load i32, i32* @EINVAL
store i32 %266, i32* @errno
%267 = call i32 @die(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.18, i64 0, i64 0))
br label %268
268: ; preds = %265, %258
%269 = load i32, i32* %7
%270 = load i8**, i8*** %5
%271 = getelementptr inbounds i8*, i8** %270, i64 0
%272 = load i8*, i8** %271
%273 = call i32 @setnetmask(i32 %269, %struct.ifreq* %6, i8* %272)
br label %292
274: ; preds = %252
%275 = load i8**, i8*** %5
%276 = getelementptr inbounds i8*, i8** %275, i64 0
%277 = load i8*, i8** %276
%278 = getelementptr inbounds i8, i8* %277, i64 0
%279 = load i8, i8* %278
%280 = call i64 @isdigit(i8 signext %279)
%281 = icmp ne i64 %280, 0
br i1 %281, label %282, label %291
282: ; preds = %274
%283 = load i32, i32* %7
%284 = load i8**, i8*** %5
%285 = getelementptr inbounds i8*, i8** %284, i64 0
%286 = load i8*, i8** %285
%287 = call i32 @setaddr(i32 %283, %struct.ifreq* %6, i8* %286)
%288 = load i32, i32* %7
%289 = load i32, i32* @IFF_UP
%290 = call i32 @setflags(i32 %288, %struct.ifreq* %6, i32 %289, i32 0)
br label %291
291: ; preds = %282, %274
br label %292
292: ; preds = %291, %268
br label %293
293: ; preds = %292, %248
br label %294
294: ; preds = %293, %233
br label %295
295: ; preds = %294, %213
br label %296
296: ; preds = %295, %201
br label %297
297: ; preds = %296, %181
%298 = load i32, i32* %4
%299 = add nsw i32 %298, -1
store i32 %299, i32* %4
%300 = load i8**, i8*** %5
%301 = getelementptr inbounds i8*, i8** %300, i32 1
store i8** %301, i8*** %5
br label %172
302: ; preds = %172
store i32 0, i32* %3
br label %303
303: ; preds = %302, %96, %89, %74, %59, %25
%304 = load i32, i32* %3
ret i32 %304
}

LLVM IR (-O2):
%struct.ifreq = type { i8*, i32, i32 }
@IFNAMSIZ = global i32 0
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str = [28 x i8] c"cannot open control socket\0A\00"
@SIOCGIFADDR = global i32 0
@SIOCGIFNETMASK = global i32 0
@SIOCGIFFLAGS = global i32 0
@.str.1 = [12 x i8] c"%d.%d.%d.%d\00"
@.str.2 = [26 x i8] c"%s: ip %s mask %s flags [\00"
@IFF_UP = global i32 0
@.str.3 = [3 x i8] c"up\00"
@.str.4 = [5 x i8] c"down\00"
@IFF_BROADCAST = global i32 0
@.str.5 = [11 x i8] c" broadcast\00"
@.str.6 = [1 x i8] zeroinitializer
@IFF_LOOPBACK = global i32 0
@.str.7 = [10 x i8] c" loopback\00"
@IFF_POINTOPOINT = global i32 0
@.str.8 = [16 x i8] c" point-to-point\00"
@IFF_RUNNING = global i32 0
@.str.9 = [9 x i8] c" running\00"
@IFF_MULTICAST = global i32 0
@.str.10 = [11 x i8] c" multicast\00"
@.str.11 = [15 x i8] c"%s%s%s%s%s%s]\0A\00"
@.str.12 = [4 x i8] c"mtu\00"
@EINVAL = global i32 0
@errno = global i32 0
@.str.13 = [38 x i8] c"expecting a value for parameter \22mtu\22\00"
@.str.14 = [13 x i8] c"-pointopoint\00"
@.str.15 = [12 x i8] c"pointopoint\00"
@.str.16 = [53 x i8] c"expecting an IP address for parameter \22pointtopoint\22\00"
@.str.17 = [8 x i8] c"netmask\00"
@.str.18 = [48 x i8] c"expecting an IP address for parameter \22netmask\22\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.ifreq
%4 = alloca [20 x i8]
%5 = alloca [20 x i8]
%6 = bitcast %struct.ifreq* %3 to i8*
%7 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%9 = icmp eq i32 %0, 1
br i1 %9, label %180, label %10
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = call i32 @memset(%struct.ifreq* %3, i32 0, i32 16)
%13 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %3, i64 0, i32 0
%14 = load i8*, i8** %13
%15 = load i8*, i8** %11
%16 = load i32, i32* @IFNAMSIZ
%17 = call i32 @strncpy(i8* %14, i8* %15, i32 %16)
%18 = load i8*, i8** %13
%19 = load i32, i32* @IFNAMSIZ
%20 = add nsw i32 %19, -1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %18, i64 %21
store i8 0, i8* %22
%23 = add nsw i32 %0, -2
%24 = getelementptr inbounds i8*, i8** %1, i64 2
%25 = load i32, i32* @AF_INET
%26 = load i32, i32* @SOCK_DGRAM
%27 = call i32 @socket(i32 %25, i32 %26, i32 0)
%28 = icmp slt i32 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %10
%30 = call i32 @die(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %31
31: ; preds = %29, %10
%32 = icmp eq i32 %23, 0
br i1 %32, label %35, label %33
33: ; preds = %31
%34 = icmp sgt i32 %0, 2
br i1 %34, label %103, label %180
35: ; preds = %31
%36 = load i32, i32* @SIOCGIFADDR
%37 = call i64 @ioctl(i32 %27, i32 %36, %struct.ifreq* %3)
%38 = icmp slt i64 %37, 0
br i1 %38, label %39, label %42
39: ; preds = %35
%40 = load i8*, i8** %13
%41 = call i32 @perror(i8* %40)
br label %180
42: ; preds = %35
%43 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %3, i64 0, i32 2
%44 = load i32, i32* %43
%45 = load i32, i32* @SIOCGIFNETMASK
%46 = call i64 @ioctl(i32 %27, i32 %45, %struct.ifreq* %3)
%47 = icmp slt i64 %46, 0
br i1 %47, label %48, label %51
48: ; preds = %42
%49 = load i8*, i8** %13
%50 = call i32 @perror(i8* %49)
br label %180
51: ; preds = %42
%52 = load i32, i32* %43
%53 = load i32, i32* @SIOCGIFFLAGS
%54 = call i64 @ioctl(i32 %27, i32 %53, %struct.ifreq* %3)
%55 = icmp slt i64 %54, 0
br i1 %55, label %56, label %59
56: ; preds = %51
%57 = load i8*, i8** %13
%58 = call i32 @perror(i8* %57)
br label %180
59: ; preds = %51
%60 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %3, i64 0, i32 1
%61 = load i32, i32* %60
%62 = and i32 %44, 255
%63 = lshr i32 %44, 8
%64 = and i32 %63, 255
%65 = lshr i32 %44, 16
%66 = and i32 %65, 255
%67 = lshr i32 %44, 24
%68 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %62, i32 %64, i32 %66, i32 %67)
%69 = and i32 %52, 255
%70 = lshr i32 %52, 8
%71 = and i32 %70, 255
%72 = lshr i32 %52, 16
%73 = and i32 %72, 255
%74 = lshr i32 %52, 24
%75 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %69, i32 %71, i32 %73, i32 %74)
%76 = load i8*, i8** %13
%77 = call i32 (i8*, i8*, i8*, i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* %76, i8* %7, i8* %8)
%78 = load i32, i32* @IFF_UP
%79 = and i32 %78, %61
%80 = icmp eq i32 %79, 0
%81 = select i1 %80, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%82 = load i32, i32* @IFF_BROADCAST
%83 = and i32 %82, %61
%84 = icmp eq i32 %83, 0
%85 = select i1 %84, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0)
%86 = load i32, i32* @IFF_LOOPBACK
%87 = and i32 %86, %61
%88 = icmp eq i32 %87, 0
%89 = select i1 %88, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0)
%90 = load i32, i32* @IFF_POINTOPOINT
%91 = and i32 %90, %61
%92 = icmp eq i32 %91, 0
%93 = select i1 %92, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0)
%94 = load i32, i32* @IFF_RUNNING
%95 = and i32 %94, %61
%96 = icmp eq i32 %95, 0
%97 = select i1 %96, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0)
%98 = load i32, i32* @IFF_MULTICAST
%99 = and i32 %98, %61
%100 = icmp eq i32 %99, 0
%101 = select i1 %100, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0)
%102 = call i32 (i8*, i8*, i8*, i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0), i8* %81, i8* %85, i8* %89, i8* %93, i8* %97, i8* %101)
br label %180
103: ; preds = %33, %174
%104 = phi i32 [ %177, %174 ], [ %23, %33 ]
%105 = phi i8** [ %178, %174 ], [ %24, %33 ]
%106 = load i8*, i8** %105
%107 = call i32 @strcmp(i8* dereferenceable(1) %106, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%108 = icmp eq i32 %107, 0
br i1 %108, label %109, label %112
109: ; preds = %103
%110 = load i32, i32* @IFF_UP
%111 = call i32 @setflags(i32 %27, %struct.ifreq* %3, i32 %110, i32 0)
br label %174
112: ; preds = %103
%113 = call i32 @strcmp(i8* dereferenceable(1) %106, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0))
%114 = icmp eq i32 %113, 0
br i1 %114, label %115, label %125
115: ; preds = %112
%116 = add nsw i32 %104, -1
%117 = getelementptr inbounds i8*, i8** %105, i64 1
%118 = icmp eq i32 %116, 0
br i1 %118, label %119, label %122
119: ; preds = %115
%120 = load i32, i32* @EINVAL
store i32 %120, i32* @errno
%121 = call i32 @die(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.13, i64 0, i64 0))
br label %122
122: ; preds = %119, %115
%123 = load i8*, i8** %117
%124 = call i32 @setmtu(i32 %27, %struct.ifreq* %3, i8* %123)
br label %174
125: ; preds = %112
%126 = call i32 @strcmp(i8* dereferenceable(1) %106, i8* dereferenceable(13) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0))
%127 = icmp eq i32 %126, 0
br i1 %127, label %128, label %131
128: ; preds = %125
%129 = load i32, i32* @IFF_POINTOPOINT
%130 = call i32 @setflags(i32 %27, %struct.ifreq* %3, i32 %129, i32 1)
br label %174
131: ; preds = %125
%132 = call i32 @strcmp(i8* dereferenceable(1) %106, i8* dereferenceable(12) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.15, i64 0, i64 0))
%133 = icmp eq i32 %132, 0
br i1 %133, label %134, label %146
134: ; preds = %131
%135 = add nsw i32 %104, -1
%136 = getelementptr inbounds i8*, i8** %105, i64 1
%137 = icmp eq i32 %135, 0
br i1 %137, label %138, label %141
138: ; preds = %134
%139 = load i32, i32* @EINVAL
store i32 %139, i32* @errno
%140 = call i32 @die(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.16, i64 0, i64 0))
br label %141
141: ; preds = %138, %134
%142 = load i8*, i8** %136
%143 = call i32 @setdstaddr(i32 %27, %struct.ifreq* %3, i8* %142)
%144 = load i32, i32* @IFF_POINTOPOINT
%145 = call i32 @setflags(i32 %27, %struct.ifreq* %3, i32 %144, i32 0)
br label %174
146: ; preds = %131
%147 = call i32 @strcmp(i8* dereferenceable(1) %106, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%148 = icmp eq i32 %147, 0
br i1 %148, label %149, label %152
149: ; preds = %146
%150 = load i32, i32* @IFF_UP
%151 = call i32 @setflags(i32 %27, %struct.ifreq* %3, i32 0, i32 %150)
br label %174
152: ; preds = %146
%153 = call i32 @strcmp(i8* dereferenceable(1) %106, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i64 0, i64 0))
%154 = icmp eq i32 %153, 0
br i1 %154, label %155, label %165
155: ; preds = %152
%156 = add nsw i32 %104, -1
%157 = getelementptr inbounds i8*, i8** %105, i64 1
%158 = icmp eq i32 %156, 0
br i1 %158, label %159, label %162
159: ; preds = %155
%160 = load i32, i32* @EINVAL
store i32 %160, i32* @errno
%161 = call i32 @die(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.18, i64 0, i64 0))
br label %162
162: ; preds = %159, %155
%163 = load i8*, i8** %157
%164 = call i32 @setnetmask(i32 %27, %struct.ifreq* %3, i8* %163)
br label %174
165: ; preds = %152
%166 = load i8, i8* %106
%167 = call i64 @isdigit(i8 signext %166)
%168 = icmp eq i64 %167, 0
br i1 %168, label %174, label %169
169: ; preds = %165
%170 = load i8*, i8** %105
%171 = call i32 @setaddr(i32 %27, %struct.ifreq* %3, i8* %170)
%172 = load i32, i32* @IFF_UP
%173 = call i32 @setflags(i32 %27, %struct.ifreq* %3, i32 %172, i32 0)
br label %174
174: ; preds = %122, %141, %162, %169, %165, %149, %128, %109
%175 = phi i8** [ %105, %169 ], [ %105, %165 ], [ %157, %162 ], [ %105, %149 ], [ %136, %141 ], [ %105, %128 ], [ %117, %122 ], [ %105, %109 ]
%176 = phi i32 [ %104, %169 ], [ %104, %165 ], [ %156, %162 ], [ %104, %149 ], [ %135, %141 ], [ %104, %128 ], [ %116, %122 ], [ %104, %109 ]
%177 = add nsw i32 %176, -1
%178 = getelementptr inbounds i8*, i8** %175, i64 1
%179 = icmp sgt i32 %176, 1
br i1 %179, label %103, label %180
180: ; preds = %174, %33, %2, %59, %56, %48, %39
%181 = phi i32 [ -1, %39 ], [ -1, %48 ], [ -1, %56 ], [ 0, %59 ], [ 0, %2 ], [ 0, %33 ], [ 0, %174 ]
ret i32 %181
}