#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 ifr_flags;
  int /*<<< orphan*/ ifr_name;
};

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int IFF_DEBUG;
int /*<<< orphan*/ IPPROTO_RAW;
int /*<<< orphan*/ SIOCGIFFLAGS;
int /*<<< orphan*/ SIOCSIFFLAGS;
int /*<<< orphan*/ SOCK_RAW;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
scalar_t__ ioctl(int, int /*<<< orphan*/, struct ifreq *);
int /*<<< orphan*/ printf(char *, char *, char *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(int /*<<< orphan*/, char *);
char *strerror(int /*<<< orphan*/);
int main(int argc, char **argv) {
  int action = -1, sock;
  struct ifreq req;
  char *actname;
  if (argc < 2) {
    fprintf(stderr, "%s: usage is \"%s <ifname> [<on|off|tell>]\"\n", argv[0],
            argv[0]);
    exit(1);
  }
  if (argc == 2)
    actname = "tell";
  else
    actname = argv[2];
  sock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
  if (sock < 0) {
    fprintf(stderr, "%s: socket(): %s\n", argv[0], strerror(errno));
    exit(1);
  }
  strcpy(req.ifr_name, argv[1]);
  if (ioctl(sock, SIOCGIFFLAGS, &req) < 0) {
    fprintf(stderr, " %s: ioctl(SIOCGIFFLAGS): %s\n", argv[0], strerror(errno));
    exit(1);
  }
  if (!strcmp(actname, "on") || !strcmp(actname, "+") || !strcmp(actname, "1"))
    action = IFF_DEBUG;
  if (!strcmp(actname, "off") || !strcmp(actname, "-") || !strcmp(actname, "0"))
    action = 0;
  if (!strcmp(actname, "tell") || actname[0] == 't') {
    printf("%s: debug is %s\n", argv[1],
           req.ifr_flags & IFF_DEBUG ? "on" : "off");
    exit(0);
  }
  req.ifr_flags &= ~IFF_DEBUG;
  req.ifr_flags |= action;
  if (ioctl(sock, SIOCSIFFLAGS, &req) < 0) {
    fprintf(stderr, " %s: ioctl(SIOCSIFFLAGS): %s\n", argv[0], strerror(errno));
    exit(1);
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x14(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11d4 <main+0x54>
mov    0x2e0a(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
lea    0xe3b(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
cmpl   $0x2,-0x8(%rbp)
jne    11ee <main+0x6e>
lea    0xe47(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    11fa <main+0x7a>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    0x2ddf(%rip),%rax
mov    (%rax),%edi
mov    0x2dce(%rip),%rax
mov    (%rax),%esi
mov    0x2d95(%rip),%rax
mov    (%rax),%edx
call   10a0 <socket@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    126c <main+0xec>
mov    0x2d8a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
mov    0x2d6b(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
mov    -0x34(%rbp),%edi
mov    -0x30(%rbp),%rdx
mov    %rax,%rcx
lea    0xdd4(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x1c(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%edi
mov    0x2d42(%rip),%rax
mov    (%rax),%esi
lea    -0x20(%rbp),%rdx
call   1050 <ioctl@plt>
cmp    $0x0,%rax
jge    12e0 <main+0x160>
mov    0x2d16(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
mov    0x2cf7(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
mov    -0x44(%rbp),%edi
mov    -0x40(%rbp),%rdx
mov    %rax,%rcx
lea    0xd72(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x28(%rbp),%rdi
lea    0xd76(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
je     132b <main+0x1ab>
mov    -0x28(%rbp),%rdi
lea    0xd60(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
je     132b <main+0x1ab>
mov    -0x28(%rbp),%rdi
lea    0xd49(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    1337 <main+0x1b7>
mov    0x2c9e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xd26(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
je     1382 <main+0x202>
mov    -0x28(%rbp),%rdi
lea    0xd11(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
je     1382 <main+0x202>
mov    -0x28(%rbp),%rdi
lea    0xcfa(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    1389 <main+0x209>
movl   $0x0,-0x14(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xc98(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
je     13b2 <main+0x232>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x74,%eax
jne    13ee <main+0x26e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x20(%rbp),%ecx
mov    0x2c0c(%rip),%rax
and    (%rax),%ecx
lea    0xc9b(%rip),%rdx
lea    0xc8d(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
lea    0xc8e(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1080 <exit@plt>
mov    0x2bdb(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
or     -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%edi
mov    0x2be5(%rip),%rax
mov    (%rax),%esi
lea    -0x20(%rbp),%rdx
call   1050 <ioctl@plt>
cmp    $0x0,%rax
jge    146d <main+0x2ed>
mov    0x2b89(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x54(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x50(%rbp)
mov    0x2b6a(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
mov    -0x54(%rbp),%edi
mov    -0x50(%rbp),%rdx
mov    %rax,%rcx
lea    0xc23(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
xor    %edi,%edi
call   1080 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x1,%edi
jg     11ae <main+0x2e>
mov    0x2e1e(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rcx
lea    0xe5a(%rip),%rsi
mov    %rcx,%rdx
jmp    1253 <main+0xd3>
cmp    $0x2,%edi
jne    11bc <main+0x3c>
lea    0xe72(%rip),%r14
jmp    11c0 <main+0x40>
mov    0x10(%rbx),%r14
mov    0x2e19(%rip),%rax
mov    (%rax),%edi
mov    0x2e08(%rip),%rax
mov    (%rax),%esi
mov    0x2dcf(%rip),%rax
mov    (%rax),%edx
call   10a0 <socket@plt>
test   %eax,%eax
jns    1207 <main+0x87>
mov    0x2dcd(%rip),%rax
mov    (%rax),%ebp
mov    (%rbx),%rbx
mov    0x2db9(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
lea    0xe2c(%rip),%rsi
jmp    124b <main+0xcb>
mov    %eax,%ebp
mov    0x8(%rbx),%rsi
call   1030 <strcpy@plt>
mov    0x2daf(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rdx
mov    %ebp,%edi
call   1050 <ioctl@plt>
test   %rax,%rax
jns    1262 <main+0xe2>
mov    0x2d87(%rip),%rax
mov    (%rax),%ebp
mov    (%rbx),%rbx
mov    0x2d73(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
lea    0xdf8(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
mov    %rax,%rcx
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
lea    0xdf8(%rip),%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <strcmp@plt>
test   %eax,%eax
je     12a4 <main+0x124>
lea    0xde5(%rip),%rsi
mov    %r14,%rdi
call   1060 <strcmp@plt>
test   %eax,%eax
je     12a4 <main+0x124>
lea    0xdd4(%rip),%rsi
mov    %r14,%rdi
call   1060 <strcmp@plt>
mov    $0xffffffff,%r13d
test   %eax,%eax
jne    12ae <main+0x12e>
mov    0x2d25(%rip),%rax
mov    (%rax),%r13d
lea    0xdb3(%rip),%r12
mov    %r14,%rdi
mov    %r12,%rsi
call   1060 <strcmp@plt>
test   %eax,%eax
je     12ea <main+0x16a>
lea    0xda1(%rip),%rsi
mov    %r14,%rdi
call   1060 <strcmp@plt>
test   %eax,%eax
je     12ea <main+0x16a>
lea    0xd90(%rip),%rsi
mov    %r14,%rdi
call   1060 <strcmp@plt>
test   %eax,%eax
jne    12ed <main+0x16d>
xor    %r13d,%r13d
lea    0xd38(%rip),%rsi
mov    %r14,%rdi
call   1060 <strcmp@plt>
test   %eax,%eax
je     1306 <main+0x186>
cmpb   $0x74,(%r14)
jne    1330 <main+0x1b0>
mov    0x8(%rbx),%rsi
mov    0x2cbf(%rip),%rax
mov    (%rax),%eax
and    (%rsp),%eax
cmove  %r12,%r15
lea    0xd4f(%rip),%rdi
mov    %r15,%rdx
call   1040 <printf@plt>
xor    %edi,%edi
call   1080 <exit@plt>
mov    0x2c99(%rip),%rax
mov    (%rax),%eax
not    %eax
and    (%rsp),%eax
or     %r13d,%eax
mov    %eax,(%rsp)
mov    0x2cad(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rdx
mov    %ebp,%edi
call   1050 <ioctl@plt>
test   %rax,%rax
jns    1382 <main+0x202>
mov    0x2c55(%rip),%rax
mov    (%rax),%ebp
mov    (%rbx),%rbx
mov    0x2c41(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
lea    0xd04(%rip),%rsi
jmp    124b <main+0xcb>
xor    %edi,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
%struct.ifreq = type { i32, i32 }
@stderr = global i32 0
@.str = [44 x i8] c"%s: usage is \22%s <ifname> [<on|off|tell>]\22\0A\00"
@.str.1 = [5 x i8] c"tell\00"
@AF_INET = global i32 0
@SOCK_RAW = global i32 0
@IPPROTO_RAW = global i32 0
@.str.2 = [18 x i8] c"%s: socket(): %s\0A\00"
@errno = global i32 0
@SIOCGIFFLAGS = global i32 0
@.str.3 = [30 x i8] c" %s: ioctl(SIOCGIFFLAGS): %s\0A\00"
@.str.4 = [3 x i8] c"on\00"
@.str.5 = [2 x i8] c"+\00"
@.str.6 = [2 x i8] c"1\00"
@IFF_DEBUG = global i32 0
@.str.7 = [4 x i8] c"off\00"
@.str.8 = [2 x i8] c"-\00"
@.str.9 = [2 x i8] c"0\00"
@.str.10 = [17 x i8] c"%s: debug is %s\0A\00"
@SIOCSIFFLAGS = global i32 0
@.str.11 = [30 x i8] c" %s: ioctl(SIOCSIFFLAGS): %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.ifreq
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 -1, i32* %6
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 2
br i1 %11, label %12, label %22
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %16, i8* %19)
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %2
%23 = load i32, i32* %4
%24 = icmp eq i32 %23, 2
br i1 %24, label %25, label %26
25: ; preds = %22
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %9
br label %30
26: ; preds = %22
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 2
%29 = load i8*, i8** %28
store i8* %29, i8** %9
br label %30
30: ; preds = %26, %25
%31 = load i32, i32* @AF_INET
%32 = load i32, i32* @SOCK_RAW
%33 = load i32, i32* @IPPROTO_RAW
%34 = call i32 @socket(i32 %31, i32 %32, i32 %33)
store i32 %34, i32* %7
%35 = load i32, i32* %7
%36 = icmp slt i32 %35, 0
br i1 %36, label %37, label %46
37: ; preds = %30
%38 = load i32, i32* @stderr
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 0
%41 = load i8*, i8** %40
%42 = load i32, i32* @errno
%43 = call i8* @strerror(i32 %42)
%44 = call i32 @fprintf(i32 %38, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %41, i8* %43)
%45 = call i32 @exit(i32 1)
unreachable
46: ; preds = %30
%47 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %8, i32 0, i32 1
%48 = load i32, i32* %47
%49 = load i8**, i8*** %5
%50 = getelementptr inbounds i8*, i8** %49, i64 1
%51 = load i8*, i8** %50
%52 = call i32 @strcpy(i32 %48, i8* %51)
%53 = load i32, i32* %7
%54 = load i32, i32* @SIOCGIFFLAGS
%55 = call i64 @ioctl(i32 %53, i32 %54, %struct.ifreq* %8)
%56 = icmp slt i64 %55, 0
br i1 %56, label %57, label %66
57: ; preds = %46
%58 = load i32, i32* @stderr
%59 = load i8**, i8*** %5
%60 = getelementptr inbounds i8*, i8** %59, i64 0
%61 = load i8*, i8** %60
%62 = load i32, i32* @errno
%63 = call i8* @strerror(i32 %62)
%64 = call i32 @fprintf(i32 %58, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i8* %61, i8* %63)
%65 = call i32 @exit(i32 1)
unreachable
66: ; preds = %46
%67 = load i8*, i8** %9
%68 = call i32 @strcmp(i8* %67, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%69 = icmp ne i32 %68, 0
br i1 %69, label %70, label %78
70: ; preds = %66
%71 = load i8*, i8** %9
%72 = call i32 @strcmp(i8* %71, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%73 = icmp ne i32 %72, 0
br i1 %73, label %74, label %78
74: ; preds = %70
%75 = load i8*, i8** %9
%76 = call i32 @strcmp(i8* %75, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%77 = icmp ne i32 %76, 0
br i1 %77, label %80, label %78
78: ; preds = %74, %70, %66
%79 = load i32, i32* @IFF_DEBUG
store i32 %79, i32* %6
br label %80
80: ; preds = %78, %74
%81 = load i8*, i8** %9
%82 = call i32 @strcmp(i8* %81, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%83 = icmp ne i32 %82, 0
br i1 %83, label %84, label %92
84: ; preds = %80
%85 = load i8*, i8** %9
%86 = call i32 @strcmp(i8* %85, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%87 = icmp ne i32 %86, 0
br i1 %87, label %88, label %92
88: ; preds = %84
%89 = load i8*, i8** %9
%90 = call i32 @strcmp(i8* %89, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%91 = icmp ne i32 %90, 0
br i1 %91, label %93, label %92
92: ; preds = %88, %84, %80
store i32 0, i32* %6
br label %93
93: ; preds = %92, %88
%94 = load i8*, i8** %9
%95 = call i32 @strcmp(i8* %94, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%96 = icmp ne i32 %95, 0
br i1 %96, label %97, label %103
97: ; preds = %93
%98 = load i8*, i8** %9
%99 = getelementptr inbounds i8, i8* %98, i64 0
%100 = load i8, i8* %99
%101 = sext i8 %100 to i32
%102 = icmp eq i32 %101, 116
br i1 %102, label %103, label %116
103: ; preds = %97, %93
%104 = load i8**, i8*** %5
%105 = getelementptr inbounds i8*, i8** %104, i64 1
%106 = load i8*, i8** %105
%107 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %8, i32 0, i32 0
%108 = load i32, i32* %107
%109 = load i32, i32* @IFF_DEBUG
%110 = and i32 %108, %109
%111 = icmp ne i32 %110, 0
%112 = zext i1 %111 to i64
%113 = select i1 %111, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0)
%114 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0), i8* %106, i8* %113)
%115 = call i32 @exit(i32 0)
unreachable
116: ; preds = %97
%117 = load i32, i32* @IFF_DEBUG
%118 = xor i32 %117, -1
%119 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %8, i32 0, i32 0
%120 = load i32, i32* %119
%121 = and i32 %120, %118
store i32 %121, i32* %119
%122 = load i32, i32* %6
%123 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %8, i32 0, i32 0
%124 = load i32, i32* %123
%125 = or i32 %124, %122
store i32 %125, i32* %123
%126 = load i32, i32* %7
%127 = load i32, i32* @SIOCSIFFLAGS
%128 = call i64 @ioctl(i32 %126, i32 %127, %struct.ifreq* %8)
%129 = icmp slt i64 %128, 0
br i1 %129, label %130, label %139
130: ; preds = %116
%131 = load i32, i32* @stderr
%132 = load i8**, i8*** %5
%133 = getelementptr inbounds i8*, i8** %132, i64 0
%134 = load i8*, i8** %133
%135 = load i32, i32* @errno
%136 = call i8* @strerror(i32 %135)
%137 = call i32 @fprintf(i32 %131, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.11, i64 0, i64 0), i8* %134, i8* %136)
%138 = call i32 @exit(i32 1)
unreachable
139: ; preds = %116
%140 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.ifreq = type { i32, i32 }
@stderr = global i32 0
@.str = [44 x i8] c"%s: usage is \22%s <ifname> [<on|off|tell>]\22\0A\00"
@.str.1 = [5 x i8] c"tell\00"
@AF_INET = global i32 0
@SOCK_RAW = global i32 0
@IPPROTO_RAW = global i32 0
@.str.2 = [18 x i8] c"%s: socket(): %s\0A\00"
@errno = global i32 0
@SIOCGIFFLAGS = global i32 0
@.str.3 = [30 x i8] c" %s: ioctl(SIOCGIFFLAGS): %s\0A\00"
@.str.4 = [3 x i8] c"on\00"
@.str.5 = [2 x i8] c"+\00"
@.str.6 = [2 x i8] c"1\00"
@IFF_DEBUG = global i32 0
@.str.7 = [4 x i8] c"off\00"
@.str.8 = [2 x i8] c"-\00"
@.str.9 = [2 x i8] c"0\00"
@.str.10 = [17 x i8] c"%s: debug is %s\0A\00"
@SIOCSIFFLAGS = global i32 0
@.str.11 = [30 x i8] c" %s: ioctl(SIOCSIFFLAGS): %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.ifreq
%4 = bitcast %struct.ifreq* %3 to i8*
%5 = icmp slt i32 %0, 2
br i1 %5, label %6, label %11
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %1
%9 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %8)
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %2
%12 = icmp eq i32 %0, 2
br i1 %12, label %16, label %13
13: ; preds = %11
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
br label %16
16: ; preds = %11, %13
%17 = phi i8* [ %15, %13 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), %11 ]
%18 = load i32, i32* @AF_INET
%19 = load i32, i32* @SOCK_RAW
%20 = load i32, i32* @IPPROTO_RAW
%21 = tail call i32 @socket(i32 %18, i32 %19, i32 %20)
%22 = icmp slt i32 %21, 0
br i1 %22, label %23, label %30
23: ; preds = %16
%24 = load i32, i32* @stderr
%25 = load i8*, i8** %1
%26 = load i32, i32* @errno
%27 = tail call i8* @strerror(i32 %26)
%28 = tail call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %25, i8* %27)
%29 = tail call i32 @exit(i32 1)
unreachable
30: ; preds = %16
%31 = getelementptr inbounds i8*, i8** %1, i64 1
%32 = load i8*, i8** %31
%33 = tail call i32 @strcpy(i32 undef, i8* %32)
%34 = load i32, i32* @SIOCGIFFLAGS
%35 = call i64 @ioctl(i32 %21, i32 %34, %struct.ifreq* %3)
%36 = icmp slt i64 %35, 0
br i1 %36, label %37, label %44
37: ; preds = %30
%38 = load i32, i32* @stderr
%39 = load i8*, i8** %1
%40 = load i32, i32* @errno
%41 = call i8* @strerror(i32 %40)
%42 = call i32 @fprintf(i32 %38, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i8* %39, i8* %41)
%43 = call i32 @exit(i32 1)
unreachable
44: ; preds = %30
%45 = call i32 @strcmp(i8* dereferenceable(1) %17, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%46 = icmp eq i32 %45, 0
br i1 %46, label %53, label %47
47: ; preds = %44
%48 = call i32 @strcmp(i8* dereferenceable(1) %17, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%49 = icmp eq i32 %48, 0
br i1 %49, label %53, label %50
50: ; preds = %47
%51 = call i32 @strcmp(i8* dereferenceable(1) %17, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%52 = icmp eq i32 %51, 0
br i1 %52, label %53, label %55
53: ; preds = %50, %47, %44
%54 = load i32, i32* @IFF_DEBUG
br label %55
55: ; preds = %53, %50
%56 = phi i32 [ -1, %50 ], [ %54, %53 ]
%57 = call i32 @strcmp(i8* dereferenceable(1) %17, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%58 = icmp eq i32 %57, 0
br i1 %58, label %65, label %59
59: ; preds = %55
%60 = call i32 @strcmp(i8* dereferenceable(1) %17, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%61 = icmp eq i32 %60, 0
br i1 %61, label %65, label %62
62: ; preds = %59
%63 = call i32 @strcmp(i8* dereferenceable(1) %17, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%64 = icmp eq i32 %63, 0
br i1 %64, label %65, label %66
65: ; preds = %62, %59, %55
br label %66
66: ; preds = %65, %62
%67 = phi i32 [ %56, %62 ], [ 0, %65 ]
%68 = call i32 @strcmp(i8* dereferenceable(1) %17, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%69 = icmp eq i32 %68, 0
br i1 %69, label %73, label %70
70: ; preds = %66
%71 = load i8, i8* %17
%72 = icmp eq i8 %71, 116
br i1 %72, label %73, label %83
73: ; preds = %70, %66
%74 = load i8*, i8** %31
%75 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %3, i64 0, i32 0
%76 = load i32, i32* %75
%77 = load i32, i32* @IFF_DEBUG
%78 = and i32 %77, %76
%79 = icmp eq i32 %78, 0
%80 = select i1 %79, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0)
%81 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0), i8* %74, i8* %80)
%82 = call i32 @exit(i32 0)
unreachable
83: ; preds = %70
%84 = load i32, i32* @IFF_DEBUG
%85 = xor i32 %84, -1
%86 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %3, i64 0, i32 0
%87 = load i32, i32* %86
%88 = and i32 %87, %85
%89 = or i32 %88, %67
store i32 %89, i32* %86
%90 = load i32, i32* @SIOCSIFFLAGS
%91 = call i64 @ioctl(i32 %21, i32 %90, %struct.ifreq* %3)
%92 = icmp slt i64 %91, 0
br i1 %92, label %93, label %100
93: ; preds = %83
%94 = load i32, i32* @stderr
%95 = load i8*, i8** %1
%96 = load i32, i32* @errno
%97 = call i8* @strerror(i32 %96)
%98 = call i32 @fprintf(i32 %94, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.11, i64 0, i64 0), i8* %95, i8* %97)
%99 = call i32 @exit(i32 1)
unreachable
100: ; preds = %83
%101 = call i32 @exit(i32 0)
unreachable
}