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

/* Variables and functions */
int /*<<< orphan*/ O_RDWR;
int atoi(char *);
int /*<<< orphan*/ close(int);
scalar_t__ geteuid();
int /*<<< orphan*/ ioctl(int, int, ...);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  if (geteuid() != 0) {
    printf("This program must be ran as root\n");
    return -1;
  }
  if (argc == 1 || argc > 3) {
    printf("Error, only 1 argument supported.\n");
    return 1;
  }
  printf("hdfw_mgr: %s\n", argv[1]);
  if (!strcmp(argv[1], "on")) {
    int device = open("/dev/hdfw_mgmt", O_RDWR);
    ioctl(device, 0x00000001);
    close(device);
    printf("Manager enabled, don't forget to turn it off again.\n");
    return 0;
  } else if (!strcmp(argv[1], "off")) {
    int device = open("/dev/hdfw_mgmt", O_RDWR);
    ioctl(device, 0x00000004);
    close(device);
    printf("Manager shut off.\n");
    return 0;
  } else if (!strcmp(argv[1], "wl.add") && argc == 3) {
    int device = open("/dev/hdfw_mgmt", O_RDWR);
    ioctl(device, 0x00030300, argv[2]);
    close(device);
    printf("Added to Whitelist: %s\n", argv[2]);
  } else if (!strcmp(argv[1], "wl.del") && argc == 3) {
    int device = open("/dev/hdfw_mgmt", O_RDWR);
    ioctl(device, 0x34324342, argv[2]);
    close(device);
    printf("Removed from Whitelist: %s\n", argv[2]);
  } else if (!strcmp(argv[1], "wl.list")) {
    int device = open("/dev/hdfw_mgmt", O_RDWR);
    ioctl(device, 0x00001234);
    close(device);
    printf("See the proper logging for the listing.\n");
  } else {
    int time = atoi(argv[1]);
    if (time <= 0) {
      printf("Parameter should be either on, off or a time > 0.\n");
    } else {
      int device = open("/dev/hdfw_mgmt", O_RDWR);
      ioctl(device, 0x00000001);
      sleep(time);
      ioctl(device, 0x00000004);
      close(device);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <geteuid@plt>
cmp    $0x0,%rax
je     11c1 <main+0x41>
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14b5 <main+0x335>
cmpl   $0x1,-0x8(%rbp)
je     11d5 <main+0x55>
cmpl   $0x3,-0x8(%rbp)
jle    11ef <main+0x6f>
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14b5 <main+0x335>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe3f(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    126b <main+0xeb>
mov    0x2dbf(%rip),%rax
mov    (%rax),%esi
lea    0xe24(%rip),%rdi
call   1080 <open@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    $0x1,%esi
mov    $0x0,%al
call   1050 <ioctl@plt>
mov    -0x14(%rbp),%edi
call   1060 <close@plt>
lea    0xe0d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    14b5 <main+0x335>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe20(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    12d1 <main+0x151>
mov    0x2d59(%rip),%rax
mov    (%rax),%esi
lea    0xdbe(%rip),%rdi
call   1080 <open@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
mov    $0x4,%esi
mov    $0x0,%al
call   1050 <ioctl@plt>
mov    -0x18(%rbp),%edi
call   1060 <close@plt>
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    14b5 <main+0x335>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdd1(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    134a <main+0x1ca>
cmpl   $0x3,-0x8(%rbp)
jne    134a <main+0x1ca>
mov    0x2ce9(%rip),%rax
mov    (%rax),%esi
lea    0xd4e(%rip),%rdi
call   1080 <open@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
mov    $0x30300,%esi
mov    $0x0,%al
call   1050 <ioctl@plt>
mov    -0x1c(%rbp),%edi
call   1060 <close@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xd7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14a4 <main+0x324>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd77(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    13c3 <main+0x243>
cmpl   $0x3,-0x8(%rbp)
jne    13c3 <main+0x243>
mov    0x2c70(%rip),%rax
mov    (%rax),%esi
lea    0xcd5(%rip),%rdi
call   1080 <open@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
mov    $0x34324342,%esi
mov    $0x0,%al
call   1050 <ioctl@plt>
mov    -0x20(%rbp),%edi
call   1060 <close@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xd20(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    149f <main+0x31f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd21(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    1422 <main+0x2a2>
mov    0x2c01(%rip),%rax
mov    (%rax),%esi
lea    0xc66(%rip),%rdi
call   1080 <open@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
mov    $0x1234,%esi
mov    $0x0,%al
call   1050 <ioctl@plt>
mov    -0x24(%rbp),%edi
call   1060 <close@plt>
lea    0xce5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    149a <main+0x31a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
jg     144f <main+0x2cf>
lea    0xce1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1495 <main+0x315>
mov    0x2b92(%rip),%rax
mov    (%rax),%esi
lea    0xbf7(%rip),%rdi
call   1080 <open@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%edi
mov    $0x1,%esi
mov    $0x0,%al
call   1050 <ioctl@plt>
mov    -0x28(%rbp),%edi
call   10a0 <sleep@plt>
mov    -0x2c(%rbp),%edi
mov    $0x4,%esi
mov    $0x0,%al
call   1050 <ioctl@plt>
mov    -0x2c(%rbp),%edi
call   1060 <close@plt>
jmp    149a <main+0x31a>
jmp    149f <main+0x31f>
jmp    14a4 <main+0x324>
jmp    14a9 <main+0x329>
jmp    14ae <main+0x32e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%ebp
xor    %eax,%eax
call   1050 <geteuid@plt>
test   %rax,%rax
je     11be <main+0x2e>
lea    0xf81(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%ebx
jmp    1363 <main+0x1d3>
cmp    $0x1,%ebp
je     1278 <main+0xe8>
cmp    $0x4,%ebp
jge    1278 <main+0xe8>
mov    0x8(%r14),%rsi
lea    0xe25(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%r14),%r15
lea    0xe1f(%rip),%rsi
mov    %r15,%rdi
call   1080 <strcmp@plt>
test   %eax,%eax
je     128e <main+0xfe>
lea    0xe1a(%rip),%rsi
mov    %r15,%rdi
call   1080 <strcmp@plt>
test   %eax,%eax
je     12cb <main+0x13b>
lea    0xe07(%rip),%rsi
mov    %r15,%rdi
call   1080 <strcmp@plt>
cmp    $0x3,%ebp
jne    1307 <main+0x177>
test   %eax,%eax
jne    1307 <main+0x177>
mov    0x2dab(%rip),%rax
mov    (%rax),%esi
lea    0xdcb(%rip),%rdi
call   1090 <open@plt>
mov    %eax,%ebp
mov    0x10(%r14),%rdx
xor    %ebx,%ebx
mov    %eax,%edi
mov    $0x30300,%esi
xor    %eax,%eax
call   1060 <ioctl@plt>
mov    %ebp,%edi
call   1070 <close@plt>
mov    0x10(%r14),%rsi
lea    0xdb8(%rip),%rdi
jmp    135c <main+0x1cc>
lea    0xe8f(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
jmp    1363 <main+0x1d3>
mov    0x2d53(%rip),%rax
mov    (%rax),%esi
lea    0xd73(%rip),%rdi
call   1090 <open@plt>
mov    %eax,%ebp
mov    %eax,%edi
mov    $0x1,%esi
xor    %eax,%eax
call   1060 <ioctl@plt>
mov    %ebp,%edi
call   1070 <close@plt>
lea    0xdad(%rip),%rdi
call   1030 <puts@plt>
jmp    1363 <main+0x1d3>
mov    0x2d16(%rip),%rax
mov    (%rax),%esi
lea    0xd36(%rip),%rdi
call   1090 <open@plt>
mov    %eax,%ebp
xor    %ebx,%ebx
mov    %eax,%edi
mov    $0x4,%esi
xor    %eax,%eax
call   1060 <ioctl@plt>
mov    %ebp,%edi
call   1070 <close@plt>
lea    0xda2(%rip),%rdi
call   1030 <puts@plt>
jmp    1363 <main+0x1d3>
lea    0xd35(%rip),%rsi
mov    %r15,%rdi
call   1080 <strcmp@plt>
cmp    $0x3,%ebp
jne    1370 <main+0x1e0>
test   %eax,%eax
jne    1370 <main+0x1e0>
mov    0x2cc2(%rip),%rax
mov    (%rax),%esi
lea    0xce2(%rip),%rdi
call   1090 <open@plt>
mov    %eax,%ebp
mov    0x10(%r14),%rdx
xor    %ebx,%ebx
mov    %eax,%edi
mov    $0x34324342,%esi
xor    %eax,%eax
call   1060 <ioctl@plt>
mov    %ebp,%edi
call   1070 <close@plt>
mov    0x10(%r14),%rsi
lea    0xcee(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xcef(%rip),%rsi
mov    %r15,%rdi
call   1080 <strcmp@plt>
test   %eax,%eax
je     13dc <main+0x24c>
mov    %r15,%rdi
call   10a0 <atoi@plt>
test   %eax,%eax
jle    141b <main+0x28b>
mov    %eax,%r14d
mov    0x2c4b(%rip),%rax
mov    (%rax),%esi
lea    0xc6b(%rip),%rdi
call   1090 <open@plt>
mov    %eax,%ebp
xor    %ebx,%ebx
mov    %eax,%edi
mov    $0x1,%esi
xor    %eax,%eax
call   1060 <ioctl@plt>
mov    %r14d,%edi
call   10b0 <sleep@plt>
mov    %ebp,%edi
mov    $0x4,%esi
xor    %eax,%eax
call   1060 <ioctl@plt>
mov    %ebp,%edi
call   1070 <close@plt>
jmp    1363 <main+0x1d3>
mov    0x2c05(%rip),%rax
mov    (%rax),%esi
lea    0xc25(%rip),%rdi
call   1090 <open@plt>
mov    %eax,%ebp
xor    %ebx,%ebx
mov    %eax,%edi
mov    $0x1234,%esi
xor    %eax,%eax
call   1060 <ioctl@plt>
mov    %ebp,%edi
call   1070 <close@plt>
lea    0xca3(%rip),%rdi
call   1030 <puts@plt>
jmp    1363 <main+0x1d3>
lea    0xcba(%rip),%rdi
call   1030 <puts@plt>
xor    %ebx,%ebx
jmp    1363 <main+0x1d3>

LLVM IR (-O0):
@.str = [34 x i8] c"This program must be ran as root\0A\00"
@.str.1 = [35 x i8] c"Error, only 1 argument supported.\0A\00"
@.str.2 = [14 x i8] c"hdfw_mgr: %s\0A\00"
@.str.3 = [3 x i8] c"on\00"
@.str.4 = [15 x i8] c"/dev/hdfw_mgmt\00"
@O_RDWR = global i32 0
@.str.5 = [53 x i8] c"Manager enabled, don't forget to turn it off again.\0A\00"
@.str.6 = [4 x i8] c"off\00"
@.str.7 = [19 x i8] c"Manager shut off.\0A\00"
@.str.8 = [7 x i8] c"wl.add\00"
@.str.9 = [24 x i8] c"Added to Whitelist: %s\0A\00"
@.str.10 = [7 x i8] c"wl.del\00"
@.str.11 = [28 x i8] c"Removed from Whitelist: %s\0A\00"
@.str.12 = [8 x i8] c"wl.list\00"
@.str.13 = [41 x i8] c"See the proper logging for the listing.\0A\00"
@.str.14 = [51 x i8] c"Parameter should be either on, off or a time > 0.\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 i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = call i64 (...) @geteuid()
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %143
17: ; preds = %2
%18 = load i32, i32* %4
%19 = icmp eq i32 %18, 1
br i1 %19, label %23, label %20
20: ; preds = %17
%21 = load i32, i32* %4
%22 = icmp sgt i32 %21, 3
br i1 %22, label %23, label %25
23: ; preds = %20, %17
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %143
25: ; preds = %20
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %28)
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
%33 = call i32 @strcmp(i8* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%34 = icmp ne i32 %33, 0
br i1 %34, label %43, label %35
35: ; preds = %25
%36 = load i32, i32* @O_RDWR
%37 = call i32 @open(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %36)
store i32 %37, i32* %6
%38 = load i32, i32* %6
%39 = call i32 (i32, i32, ...) @ioctl(i32 %38, i32 1)
%40 = load i32, i32* %6
%41 = call i32 @close(i32 %40)
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %3
br label %143
43: ; preds = %25
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 1
%46 = load i8*, i8** %45
%47 = call i32 @strcmp(i8* %46, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%48 = icmp ne i32 %47, 0
br i1 %48, label %57, label %49
49: ; preds = %43
%50 = load i32, i32* @O_RDWR
%51 = call i32 @open(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %50)
store i32 %51, i32* %7
%52 = load i32, i32* %7
%53 = call i32 (i32, i32, ...) @ioctl(i32 %52, i32 4)
%54 = load i32, i32* %7
%55 = call i32 @close(i32 %54)
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %3
br label %143
57: ; preds = %43
%58 = load i8**, i8*** %5
%59 = getelementptr inbounds i8*, i8** %58, i64 1
%60 = load i8*, i8** %59
%61 = call i32 @strcmp(i8* %60, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
%62 = icmp ne i32 %61, 0
br i1 %62, label %80, label %63
63: ; preds = %57
%64 = load i32, i32* %4
%65 = icmp eq i32 %64, 3
br i1 %65, label %66, label %80
66: ; preds = %63
%67 = load i32, i32* @O_RDWR
%68 = call i32 @open(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %67)
store i32 %68, i32* %8
%69 = load i32, i32* %8
%70 = load i8**, i8*** %5
%71 = getelementptr inbounds i8*, i8** %70, i64 2
%72 = load i8*, i8** %71
%73 = call i32 (i32, i32, ...) @ioctl(i32 %69, i32 197376, i8* %72)
%74 = load i32, i32* %8
%75 = call i32 @close(i32 %74)
%76 = load i8**, i8*** %5
%77 = getelementptr inbounds i8*, i8** %76, i64 2
%78 = load i8*, i8** %77
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0), i8* %78)
br label %140
80: ; preds = %63, %57
%81 = load i8**, i8*** %5
%82 = getelementptr inbounds i8*, i8** %81, i64 1
%83 = load i8*, i8** %82
%84 = call i32 @strcmp(i8* %83, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0))
%85 = icmp ne i32 %84, 0
br i1 %85, label %103, label %86
86: ; preds = %80
%87 = load i32, i32* %4
%88 = icmp eq i32 %87, 3
br i1 %88, label %89, label %103
89: ; preds = %86
%90 = load i32, i32* @O_RDWR
%91 = call i32 @open(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %90)
store i32 %91, i32* %9
%92 = load i32, i32* %9
%93 = load i8**, i8*** %5
%94 = getelementptr inbounds i8*, i8** %93, i64 2
%95 = load i8*, i8** %94
%96 = call i32 (i32, i32, ...) @ioctl(i32 %92, i32 875709250, i8* %95)
%97 = load i32, i32* %9
%98 = call i32 @close(i32 %97)
%99 = load i8**, i8*** %5
%100 = getelementptr inbounds i8*, i8** %99, i64 2
%101 = load i8*, i8** %100
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0), i8* %101)
br label %139
103: ; preds = %86, %80
%104 = load i8**, i8*** %5
%105 = getelementptr inbounds i8*, i8** %104, i64 1
%106 = load i8*, i8** %105
%107 = call i32 @strcmp(i8* %106, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0))
%108 = icmp ne i32 %107, 0
br i1 %108, label %117, label %109
109: ; preds = %103
%110 = load i32, i32* @O_RDWR
%111 = call i32 @open(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %110)
store i32 %111, i32* %10
%112 = load i32, i32* %10
%113 = call i32 (i32, i32, ...) @ioctl(i32 %112, i32 4660)
%114 = load i32, i32* %10
%115 = call i32 @close(i32 %114)
%116 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.13, i64 0, i64 0))
br label %138
117: ; preds = %103
%118 = load i8**, i8*** %5
%119 = getelementptr inbounds i8*, i8** %118, i64 1
%120 = load i8*, i8** %119
%121 = call i32 @atoi(i8* %120)
store i32 %121, i32* %11
%122 = load i32, i32* %11
%123 = icmp sle i32 %122, 0
br i1 %123, label %124, label %126
124: ; preds = %117
%125 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.14, i64 0, i64 0))
br label %137
126: ; preds = %117
%127 = load i32, i32* @O_RDWR
%128 = call i32 @open(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %127)
store i32 %128, i32* %12
%129 = load i32, i32* %12
%130 = call i32 (i32, i32, ...) @ioctl(i32 %129, i32 1)
%131 = load i32, i32* %11
%132 = call i32 @sleep(i32 %131)
%133 = load i32, i32* %12
%134 = call i32 (i32, i32, ...) @ioctl(i32 %133, i32 4)
%135 = load i32, i32* %12
%136 = call i32 @close(i32 %135)
br label %137
137: ; preds = %126, %124
br label %138
138: ; preds = %137, %109
br label %139
139: ; preds = %138, %89
br label %140
140: ; preds = %139, %66
br label %141
141: ; preds = %140
br label %142
142: ; preds = %141
store i32 0, i32* %3
br label %143
143: ; preds = %142, %49, %35, %23, %15
%144 = load i32, i32* %3
ret i32 %144
}

LLVM IR (-O2):
@.str.2 = [14 x i8] c"hdfw_mgr: %s\0A\00"
@.str.3 = [3 x i8] c"on\00"
@.str.4 = [15 x i8] c"/dev/hdfw_mgmt\00"
@O_RDWR = global i32 0
@.str.6 = [4 x i8] c"off\00"
@.str.8 = [7 x i8] c"wl.add\00"
@.str.9 = [24 x i8] c"Added to Whitelist: %s\0A\00"
@.str.10 = [7 x i8] c"wl.del\00"
@.str.11 = [28 x i8] c"Removed from Whitelist: %s\0A\00"
@.str.12 = [8 x i8] c"wl.list\00"
@str = [52 x i8] c"Manager enabled, don't forget to turn it off again.\00"
@str.15 = [18 x i8] c"Manager shut off.\00"
@str.16 = [40 x i8] c"See the proper logging for the listing.\00"
@str.17 = [50 x i8] c"Parameter should be either on, off or a time > 0.\00"
@str.18 = [34 x i8] c"Error, only 1 argument supported.\00"
@str.19 = [33 x i8] c"This program must be ran as root\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i64 (...) @geteuid()
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.19, i64 0, i64 0))
br label %83
7: ; preds = %2
%8 = icmp eq i32 %0, 1
%9 = icmp sgt i32 %0, 3
%10 = or i1 %8, %9
br i1 %10, label %11, label %13
11: ; preds = %7
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.18, i64 0, i64 0))
br label %83
13: ; preds = %7
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %15)
%17 = load i8*, i8** %14
%18 = tail call i32 @strcmp(i8* dereferenceable(1) %17, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %26
20: ; preds = %13
%21 = load i32, i32* @O_RDWR
%22 = tail call i32 @open(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %21)
%23 = tail call i32 (i32, i32, ...) @ioctl(i32 %22, i32 1)
%24 = tail call i32 @close(i32 %22)
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str, i64 0, i64 0))
br label %83
26: ; preds = %13
%27 = tail call i32 @strcmp(i8* dereferenceable(1) %17, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %35
29: ; preds = %26
%30 = load i32, i32* @O_RDWR
%31 = tail call i32 @open(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %30)
%32 = tail call i32 (i32, i32, ...) @ioctl(i32 %31, i32 4)
%33 = tail call i32 @close(i32 %31)
%34 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.15, i64 0, i64 0))
br label %83
35: ; preds = %26
%36 = tail call i32 @strcmp(i8* dereferenceable(1) %17, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
%37 = icmp eq i32 %36, 0
%38 = icmp eq i32 %0, 3
%39 = and i1 %38, %37
br i1 %39, label %40, label %49
40: ; preds = %35
%41 = load i32, i32* @O_RDWR
%42 = tail call i32 @open(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %41)
%43 = getelementptr inbounds i8*, i8** %1, i64 2
%44 = load i8*, i8** %43
%45 = tail call i32 (i32, i32, ...) @ioctl(i32 %42, i32 197376, i8* %44)
%46 = tail call i32 @close(i32 %42)
%47 = load i8*, i8** %43
%48 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0), i8* %47)
br label %83
49: ; preds = %35
%50 = tail call i32 @strcmp(i8* dereferenceable(1) %17, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0))
%51 = icmp eq i32 %50, 0
%52 = and i1 %38, %51
br i1 %52, label %53, label %62
53: ; preds = %49
%54 = load i32, i32* @O_RDWR
%55 = tail call i32 @open(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %54)
%56 = getelementptr inbounds i8*, i8** %1, i64 2
%57 = load i8*, i8** %56
%58 = tail call i32 (i32, i32, ...) @ioctl(i32 %55, i32 875709250, i8* %57)
%59 = tail call i32 @close(i32 %55)
%60 = load i8*, i8** %56
%61 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0), i8* %60)
br label %83
62: ; preds = %49
%63 = tail call i32 @strcmp(i8* dereferenceable(1) %17, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0))
%64 = icmp eq i32 %63, 0
br i1 %64, label %65, label %71
65: ; preds = %62
%66 = load i32, i32* @O_RDWR
%67 = tail call i32 @open(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %66)
%68 = tail call i32 (i32, i32, ...) @ioctl(i32 %67, i32 4660)
%69 = tail call i32 @close(i32 %67)
%70 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.16, i64 0, i64 0))
br label %83
71: ; preds = %62
%72 = tail call i32 @atoi(i8* %17)
%73 = icmp slt i32 %72, 1
br i1 %73, label %74, label %76
74: ; preds = %71
%75 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.17, i64 0, i64 0))
br label %83
76: ; preds = %71
%77 = load i32, i32* @O_RDWR
%78 = tail call i32 @open(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %77)
%79 = tail call i32 (i32, i32, ...) @ioctl(i32 %78, i32 1)
%80 = tail call i32 @sleep(i32 %72)
%81 = tail call i32 (i32, i32, ...) @ioctl(i32 %78, i32 4)
%82 = tail call i32 @close(i32 %78)
br label %83
83: ; preds = %40, %65, %53, %76, %74, %29, %20, %11, %5
%84 = phi i32 [ -1, %5 ], [ 1, %11 ], [ 0, %29 ], [ 0, %20 ], [ 0, %74 ], [ 0, %76 ], [ 0, %53 ], [ 0, %65 ], [ 0, %40 ]
ret i32 %84
}