#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 */
typedef int /*<<< orphan*/ uid_t;
struct sched_param {
  int sched_priority;
};
typedef int /*<<< orphan*/ gid_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int MCL_CURRENT;
int MCL_FUTURE;
int SCHED_FIFO;
scalar_t__ dropPrivileges(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ execlp(char *, char *, char *);
int /*<<< orphan*/ fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int fork();
int /*<<< orphan*/ memcpy(struct sched_param *, struct sched_param *, int);
scalar_t__ mlockall(int);
int sched_get_priority_max(int);
int sched_get_priority_min(int);
int sched_getparam(int /*<<< orphan*/, struct sched_param *);
int sched_getscheduler(int /*<<< orphan*/);
scalar_t__ sched_setscheduler(int, int, struct sched_param *);
int f(char inputFile[], uid_t uid, gid_t gid, char targetCommand[]) {
  int oldPolicy, policy = SCHED_FIFO;
  struct sched_param oldParam, param;
  int min, max;
  int pid;
  int returnValue;
  FILE *inputF;
  pid = fork();
  if (pid < 0) {
    return 3;
  }
  if (pid == 0) {
    if (dropPrivileges(uid, gid) < 0) {
      return 31;
    }
    execlp(targetCommand, targetCommand, (char *)NULL);
    return 4;
  }
  min = sched_get_priority_min(policy);
  if (min < 0) {
    return 5;
  }
  max = sched_get_priority_max(policy);
  if (max < 0) {
    return 6;
  }
  oldPolicy = sched_getscheduler(0);
  if (oldPolicy < 0) {
    return 9;
  }
  returnValue = sched_getparam(0, &oldParam);
  if (returnValue < 0) {
    return 10;
  }
  param.sched_priority = max;
  if (sched_setscheduler(0, policy, &param) < 0) {
    return 11;
  }
  if (mlockall(MCL_CURRENT | MCL_FUTURE) < 0) {
    return 13;
  }
  if (max < min) {
    return 14;
  }
  if (max == min) {
    param.sched_priority = max;
    if (sched_setscheduler(pid, policy, &param) < 0) {
      return 15;
    }
  } else {
    for (max--; min <= max; max--) {
      param.sched_priority = max;
      if (0 <= sched_setscheduler(pid, policy, &param)) {
        break;
      }
    }
    if (max < min) {
      return 15;
    }
  }
  inputF = fopen(inputFile, "r");
  if (inputF == NULL) {
    return 17;
  }
  for (;;) {
    int tmpPolicy;
    struct sched_param tmpParam;
    fgetc(inputF);
    if (sched_setscheduler(pid, oldPolicy, &oldParam) < 0) {
      return 0;
    }
    tmpPolicy = oldPolicy;
    oldPolicy = policy;
    policy = tmpPolicy;
    memcpy((&tmpParam), (&oldParam), sizeof(*(&oldParam)));
    ;
    memcpy((&oldParam), (&param), sizeof(*(&param)));
    ;
    memcpy((&param), (&tmpParam), sizeof(*(&tmpParam)));
    ;
  }
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    0x2e03(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    $0x0,%al
call   10e0 <fork@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
jge    1202 <f+0x42>
movl   $0x3,-0x4(%rbp)
jmp    1493 <f+0x2d3>
cmpl   $0x0,-0x44(%rbp)
jne    124a <f+0x8a>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1090 <dropPrivileges@plt>
cmp    $0x0,%rax
jge    122d <f+0x6d>
movl   $0x1f,-0x4(%rbp)
jmp    1493 <f+0x2d3>
mov    -0x20(%rbp),%rdi
mov    -0x20(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   10d0 <execlp@plt>
movl   $0x4,-0x4(%rbp)
jmp    1493 <f+0x2d3>
mov    -0x28(%rbp),%edi
call   1080 <sched_get_priority_min@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
jge    126b <f+0xab>
movl   $0x5,-0x4(%rbp)
jmp    1493 <f+0x2d3>
mov    -0x28(%rbp),%edi
call   10c0 <sched_get_priority_max@plt>
mov    %eax,-0x40(%rbp)
cmpl   $0x0,-0x40(%rbp)
jge    128c <f+0xcc>
movl   $0x6,-0x4(%rbp)
jmp    1493 <f+0x2d3>
xor    %edi,%edi
call   1030 <sched_getscheduler@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    12ac <f+0xec>
movl   $0x9,-0x4(%rbp)
jmp    1493 <f+0x2d3>
xor    %edi,%edi
lea    -0x30(%rbp),%rsi
call   1040 <sched_getparam@plt>
mov    %eax,-0x48(%rbp)
cmpl   $0x0,-0x48(%rbp)
jge    12d0 <f+0x110>
movl   $0xa,-0x4(%rbp)
jmp    1493 <f+0x2d3>
mov    -0x40(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x28(%rbp),%esi
xor    %edi,%edi
lea    -0x38(%rbp),%rdx
call   1050 <sched_setscheduler@plt>
cmp    $0x0,%rax
jge    12fa <f+0x13a>
movl   $0xb,-0x4(%rbp)
jmp    1493 <f+0x2d3>
mov    0x2ccf(%rip),%rax
mov    (%rax),%edi
mov    0x2ce6(%rip),%rax
or     (%rax),%edi
call   10a0 <mlockall@plt>
cmp    $0x0,%rax
jge    1327 <f+0x167>
movl   $0xd,-0x4(%rbp)
jmp    1493 <f+0x2d3>
mov    -0x40(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    133f <f+0x17f>
movl   $0xe,-0x4(%rbp)
jmp    1493 <f+0x2d3>
mov    -0x40(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jne    137b <f+0x1bb>
mov    -0x40(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x44(%rbp),%edi
mov    -0x28(%rbp),%esi
lea    -0x38(%rbp),%rdx
call   1050 <sched_setscheduler@plt>
cmp    $0x0,%rax
jge    1376 <f+0x1b6>
movl   $0xf,-0x4(%rbp)
jmp    1493 <f+0x2d3>
jmp    13e8 <f+0x228>
mov    -0x40(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x40(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x40(%rbp),%eax
jg     13cb <f+0x20b>
mov    -0x40(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x44(%rbp),%edi
mov    -0x28(%rbp),%esi
lea    -0x38(%rbp),%rdx
call   1050 <sched_setscheduler@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jg     13b8 <f+0x1f8>
jmp    13cb <f+0x20b>
jmp    13bd <f+0x1fd>
mov    -0x40(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x40(%rbp)
jmp    1384 <f+0x1c4>
mov    -0x40(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    13e3 <f+0x223>
movl   $0xf,-0x4(%rbp)
jmp    1493 <f+0x2d3>
jmp    13e8 <f+0x228>
mov    -0x10(%rbp),%rdi
lea    0xc0d(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x50(%rbp)
jne    1413 <f+0x253>
movl   $0x11,-0x4(%rbp)
jmp    1493 <f+0x2d3>
jmp    1418 <f+0x258>
mov    -0x50(%rbp),%rdi
call   1060 <fgetc@plt>
mov    -0x44(%rbp),%edi
mov    -0x24(%rbp),%esi
lea    -0x30(%rbp),%rdx
call   1050 <sched_setscheduler@plt>
cmp    $0x0,%rax
jge    1446 <f+0x286>
movl   $0x0,-0x4(%rbp)
jmp    1493 <f+0x2d3>
mov    -0x24(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x54(%rbp),%eax
mov    %eax,-0x28(%rbp)
lea    -0x58(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x4,%edx
call   1070 <memcpy@plt>
lea    -0x30(%rbp),%rdi
lea    -0x38(%rbp),%rsi
mov    $0x4,%edx
call   1070 <memcpy@plt>
lea    -0x38(%rbp),%rdi
lea    -0x58(%rbp),%rsi
mov    $0x4,%edx
call   1070 <memcpy@plt>
jmp    1418 <f+0x258>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rcx,%r12
mov    %edx,%ebp
mov    %esi,%ebx
mov    %rdi,%r15
mov    0x2e01(%rip),%rax
mov    (%rax),%r13d
xor    %eax,%eax
call   10e0 <fork@plt>
test   %eax,%eax
js     12b4 <f+0xf4>
je     12be <f+0xfe>
mov    %eax,%r14d
mov    %r13d,%edi
call   1080 <sched_get_priority_min@plt>
test   %eax,%eax
js     12e7 <f+0x127>
mov    %eax,%r12d
mov    %r13d,%edi
call   10c0 <sched_get_priority_max@plt>
test   %eax,%eax
js     13b4 <f+0x1f4>
mov    %eax,%ebx
xor    %edi,%edi
call   1030 <sched_getscheduler@plt>
test   %eax,%eax
js     13c2 <f+0x202>
mov    %eax,%ebp
lea    0x10(%rsp),%rsi
xor    %edi,%edi
call   1040 <sched_getparam@plt>
test   %eax,%eax
js     13c9 <f+0x209>
mov    %ebx,0x8(%rsp)
lea    0x8(%rsp),%rdx
xor    %edi,%edi
mov    %r13d,%esi
call   1050 <sched_setscheduler@plt>
test   %rax,%rax
js     13d0 <f+0x210>
mov    0x2d69(%rip),%rax
mov    0x2d82(%rip),%rcx
mov    (%rcx),%edi
or     (%rax),%edi
call   10a0 <mlockall@plt>
test   %rax,%rax
js     13d7 <f+0x217>
mov    $0xe,%eax
cmp    %r12d,%ebx
jb     13dc <f+0x21c>
jne    12f1 <f+0x131>
mov    %r12d,0x8(%rsp)
lea    0x8(%rsp),%rdx
mov    %r14d,%edi
mov    %r13d,%esi
call   1050 <sched_setscheduler@plt>
test   %rax,%rax
jns    1312 <f+0x152>
mov    $0xf,%eax
jmp    13dc <f+0x21c>
mov    $0x3,%eax
jmp    13dc <f+0x21c>
mov    %ebx,%edi
mov    %ebp,%esi
call   1090 <dropPrivileges@plt>
test   %rax,%rax
js     13bb <f+0x1fb>
mov    %r12,%rdi
mov    %r12,%rsi
xor    %edx,%edx
call   10d0 <execlp@plt>
mov    $0x4,%eax
jmp    13dc <f+0x21c>
mov    $0x5,%eax
jmp    13dc <f+0x21c>
cmp    %ebx,%r12d
jge    12aa <f+0xea>
add    $0xffffffff,%ebx
mov    %ebx,0x8(%rsp)
mov    %r14d,%edi
mov    %r13d,%esi
lea    0x8(%rsp),%rdx
call   1050 <sched_setscheduler@plt>
test   %rax,%rax
js     12f1 <f+0x131>
lea    0xce7(%rip),%rsi
mov    %r15,%rdi
call   10b0 <fopen@plt>
test   %rax,%rax
je     13eb <f+0x22b>
mov    %rax,%rdi
mov    %rax,0x18(%rsp)
call   1060 <fgetc@plt>
lea    0x10(%rsp),%rdx
mov    %r14d,%edi
mov    %ebp,%esi
call   1050 <sched_setscheduler@plt>
test   %rax,%rax
js     13b0 <f+0x1f0>
lea    0x10(%rsp),%rbx
lea    0x8(%rsp),%r15
mov    %ebp,%r12d
lea    0x20(%rsp),%rbp
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    $0x4,%edx
call   1070 <memcpy@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x4,%edx
call   1070 <memcpy@plt>
mov    %r15,%rdi
mov    %rbp,%rsi
mov    $0x4,%edx
call   1070 <memcpy@plt>
mov    0x18(%rsp),%rdi
call   1060 <fgetc@plt>
mov    %r14d,%edi
mov    %r13d,%esi
mov    %rbx,%rdx
call   1050 <sched_setscheduler@plt>
mov    %r13d,%ebp
mov    %r12d,%r13d
test   %rax,%rax
jns    1355 <f+0x195>
xor    %eax,%eax
jmp    13dc <f+0x21c>
mov    $0x6,%eax
jmp    13dc <f+0x21c>
mov    $0x1f,%eax
jmp    13dc <f+0x21c>
mov    $0x9,%eax
jmp    13dc <f+0x21c>
mov    $0xa,%eax
jmp    13dc <f+0x21c>
mov    $0xb,%eax
jmp    13dc <f+0x21c>
mov    $0xd,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x11,%eax
jmp    13dc <f+0x21c>

LLVM IR (-O0):
%struct.sched_param = type { i32 }
@SCHED_FIFO = global i32 0
@MCL_CURRENT = global i32 0
@MCL_FUTURE = global i32 0
@.str = [2 x i8] c"r\00"
define i32 @f(i8* %0, i32 %1, i32 %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca %struct.sched_param
%13 = alloca %struct.sched_param
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32*
%19 = alloca i32
%20 = alloca %struct.sched_param
store i8* %0, i8** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i8* %3, i8** %9
%21 = load i32, i32* @SCHED_FIFO
store i32 %21, i32* %11
%22 = call i32 (...) @fork()
store i32 %22, i32* %16
%23 = load i32, i32* %16
%24 = icmp slt i32 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %4
store i32 3, i32* %5
br label %140
26: ; preds = %4
%27 = load i32, i32* %16
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %39
29: ; preds = %26
%30 = load i32, i32* %7
%31 = load i32, i32* %8
%32 = call i64 @dropPrivileges(i32 %30, i32 %31)
%33 = icmp slt i64 %32, 0
br i1 %33, label %34, label %35
34: ; preds = %29
store i32 31, i32* %5
br label %140
35: ; preds = %29
%36 = load i8*, i8** %9
%37 = load i8*, i8** %9
%38 = call i32 @execlp(i8* %36, i8* %37, i8* null)
store i32 4, i32* %5
br label %140
39: ; preds = %26
%40 = load i32, i32* %11
%41 = call i32 @sched_get_priority_min(i32 %40)
store i32 %41, i32* %14
%42 = load i32, i32* %14
%43 = icmp slt i32 %42, 0
br i1 %43, label %44, label %45
44: ; preds = %39
store i32 5, i32* %5
br label %140
45: ; preds = %39
%46 = load i32, i32* %11
%47 = call i32 @sched_get_priority_max(i32 %46)
store i32 %47, i32* %15
%48 = load i32, i32* %15
%49 = icmp slt i32 %48, 0
br i1 %49, label %50, label %51
50: ; preds = %45
store i32 6, i32* %5
br label %140
51: ; preds = %45
%52 = call i32 @sched_getscheduler(i32 0)
store i32 %52, i32* %10
%53 = load i32, i32* %10
%54 = icmp slt i32 %53, 0
br i1 %54, label %55, label %56
55: ; preds = %51
store i32 9, i32* %5
br label %140
56: ; preds = %51
%57 = call i32 @sched_getparam(i32 0, %struct.sched_param* %12)
store i32 %57, i32* %17
%58 = load i32, i32* %17
%59 = icmp slt i32 %58, 0
br i1 %59, label %60, label %61
60: ; preds = %56
store i32 10, i32* %5
br label %140
61: ; preds = %56
%62 = load i32, i32* %15
%63 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %13, i32 0, i32 0
store i32 %62, i32* %63
%64 = load i32, i32* %11
%65 = call i64 @sched_setscheduler(i32 0, i32 %64, %struct.sched_param* %13)
%66 = icmp slt i64 %65, 0
br i1 %66, label %67, label %68
67: ; preds = %61
store i32 11, i32* %5
br label %140
68: ; preds = %61
%69 = load i32, i32* @MCL_CURRENT
%70 = load i32, i32* @MCL_FUTURE
%71 = or i32 %69, %70
%72 = call i64 @mlockall(i32 %71)
%73 = icmp slt i64 %72, 0
br i1 %73, label %74, label %75
74: ; preds = %68
store i32 13, i32* %5
br label %140
75: ; preds = %68
%76 = load i32, i32* %15
%77 = load i32, i32* %14
%78 = icmp slt i32 %76, %77
br i1 %78, label %79, label %80
79: ; preds = %75
store i32 14, i32* %5
br label %140
80: ; preds = %75
%81 = load i32, i32* %15
%82 = load i32, i32* %14
%83 = icmp eq i32 %81, %82
br i1 %83, label %84, label %93
84: ; preds = %80
%85 = load i32, i32* %15
%86 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %13, i32 0, i32 0
store i32 %85, i32* %86
%87 = load i32, i32* %16
%88 = load i32, i32* %11
%89 = call i64 @sched_setscheduler(i32 %87, i32 %88, %struct.sched_param* %13)
%90 = icmp slt i64 %89, 0
br i1 %90, label %91, label %92
91: ; preds = %84
store i32 15, i32* %5
br label %140
92: ; preds = %84
br label %118
93: ; preds = %80
%94 = load i32, i32* %15
%95 = add nsw i32 %94, -1
store i32 %95, i32* %15
br label %96
96: ; preds = %109, %93
%97 = load i32, i32* %14
%98 = load i32, i32* %15
%99 = icmp sle i32 %97, %98
br i1 %99, label %100, label %112
100: ; preds = %96
%101 = load i32, i32* %15
%102 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %13, i32 0, i32 0
store i32 %101, i32* %102
%103 = load i32, i32* %16
%104 = load i32, i32* %11
%105 = call i64 @sched_setscheduler(i32 %103, i32 %104, %struct.sched_param* %13)
%106 = icmp sle i64 0, %105
br i1 %106, label %107, label %108
107: ; preds = %100
br label %112
108: ; preds = %100
br label %109
109: ; preds = %108
%110 = load i32, i32* %15
%111 = add nsw i32 %110, -1
store i32 %111, i32* %15
br label %96
112: ; preds = %107, %96
%113 = load i32, i32* %15
%114 = load i32, i32* %14
%115 = icmp slt i32 %113, %114
br i1 %115, label %116, label %117
116: ; preds = %112
store i32 15, i32* %5
br label %140
117: ; preds = %112
br label %118
118: ; preds = %117, %92
%119 = load i8*, i8** %6
%120 = call i32* @fopen(i8* %119, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %120, i32** %18
%121 = load i32*, i32** %18
%122 = icmp eq i32* %121, null
br i1 %122, label %123, label %124
123: ; preds = %118
store i32 17, i32* %5
br label %140
124: ; preds = %118
br label %125
125: ; preds = %133, %124
%126 = load i32*, i32** %18
%127 = call i32 @fgetc(i32* %126)
%128 = load i32, i32* %16
%129 = load i32, i32* %10
%130 = call i64 @sched_setscheduler(i32 %128, i32 %129, %struct.sched_param* %12)
%131 = icmp slt i64 %130, 0
br i1 %131, label %132, label %133
132: ; preds = %125
store i32 0, i32* %5
br label %140
133: ; preds = %125
%134 = load i32, i32* %10
store i32 %134, i32* %19
%135 = load i32, i32* %11
store i32 %135, i32* %10
%136 = load i32, i32* %19
store i32 %136, i32* %11
%137 = call i32 @memcpy(%struct.sched_param* %20, %struct.sched_param* %12, i32 4)
%138 = call i32 @memcpy(%struct.sched_param* %12, %struct.sched_param* %13, i32 4)
%139 = call i32 @memcpy(%struct.sched_param* %13, %struct.sched_param* %20, i32 4)
br label %125
140: ; preds = %132, %123, %116, %91, %79, %74, %67, %60, %55, %50, %44, %35, %34, %25
%141 = load i32, i32* %5
ret i32 %141
}

LLVM IR (-O2):
%struct.sched_param = type { i32 }
@SCHED_FIFO = global i32 0
@MCL_CURRENT = global i32 0
@MCL_FUTURE = global i32 0
@.str = [2 x i8] c"r\00"
define i32 @f(i8* nocapture %0, i32 %1, i32 %2, i8* %3) {
%5 = alloca %struct.sched_param
%6 = alloca %struct.sched_param
%7 = alloca %struct.sched_param
%8 = load i32, i32* @SCHED_FIFO
%9 = bitcast %struct.sched_param* %5 to i8*
%10 = bitcast %struct.sched_param* %6 to i8*
%11 = tail call i32 (...) @fork()
%12 = icmp slt i32 %11, 0
br i1 %12, label %74, label %13
13: ; preds = %4
%14 = icmp eq i32 %11, 0
br i1 %14, label %15, label %20
15: ; preds = %13
%16 = tail call i64 @dropPrivileges(i32 %1, i32 %2)
%17 = icmp slt i64 %16, 0
br i1 %17, label %74, label %18
18: ; preds = %15
%19 = tail call i32 @execlp(i8* %3, i8* %3, i8* null)
br label %74
20: ; preds = %13
%21 = tail call i32 @sched_get_priority_min(i32 %8)
%22 = icmp slt i32 %21, 0
br i1 %22, label %74, label %23
23: ; preds = %20
%24 = tail call i32 @sched_get_priority_max(i32 %8)
%25 = icmp slt i32 %24, 0
br i1 %25, label %74, label %26
26: ; preds = %23
%27 = tail call i32 @sched_getscheduler(i32 0)
%28 = icmp slt i32 %27, 0
br i1 %28, label %74, label %29
29: ; preds = %26
%30 = call i32 @sched_getparam(i32 0, %struct.sched_param* %5)
%31 = icmp slt i32 %30, 0
br i1 %31, label %74, label %32
32: ; preds = %29
%33 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %6, i64 0, i32 0
store i32 %24, i32* %33
%34 = call i64 @sched_setscheduler(i32 0, i32 %8, %struct.sched_param* %6)
%35 = icmp slt i64 %34, 0
br i1 %35, label %74, label %36
36: ; preds = %32
%37 = load i32, i32* @MCL_CURRENT
%38 = load i32, i32* @MCL_FUTURE
%39 = or i32 %38, %37
%40 = call i64 @mlockall(i32 %39)
%41 = icmp slt i64 %40, 0
br i1 %41, label %74, label %42
42: ; preds = %36
%43 = icmp ult i32 %24, %21
br i1 %43, label %74, label %44
44: ; preds = %42
%45 = icmp eq i32 %24, %21
br i1 %45, label %46, label %49
46: ; preds = %44
store i32 %21, i32* %33
%47 = call i64 @sched_setscheduler(i32 %11, i32 %8, %struct.sched_param* %6)
%48 = icmp slt i64 %47, 0
br i1 %48, label %74, label %56
49: ; preds = %44, %53
%50 = phi i32 [ %51, %53 ], [ %24, %44 ]
%51 = add nsw i32 %50, -1
%52 = icmp slt i32 %21, %50
br i1 %52, label %53, label %74
53: ; preds = %49
store i32 %51, i32* %33
%54 = call i64 @sched_setscheduler(i32 %11, i32 %8, %struct.sched_param* %6)
%55 = icmp sgt i64 %54, -1
br i1 %55, label %56, label %49
56: ; preds = %53, %46
%57 = call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%58 = icmp eq i32* %57, null
br i1 %58, label %74, label %59
59: ; preds = %56
%60 = bitcast %struct.sched_param* %7 to i8*
%61 = call i32 @fgetc(i32* %57)
%62 = call i64 @sched_setscheduler(i32 %11, i32 %27, %struct.sched_param* %5)
%63 = icmp slt i64 %62, 0
br i1 %63, label %64, label %65
64: ; preds = %65, %59
br label %74
65: ; preds = %59, %65
%66 = phi i32 [ %67, %65 ], [ %27, %59 ]
%67 = phi i32 [ %66, %65 ], [ %8, %59 ]
%68 = call i32 @memcpy(%struct.sched_param* %7, %struct.sched_param* %5, i32 4)
%69 = call i32 @memcpy(%struct.sched_param* %5, %struct.sched_param* %6, i32 4)
%70 = call i32 @memcpy(%struct.sched_param* %6, %struct.sched_param* %7, i32 4)
%71 = call i32 @fgetc(i32* %57)
%72 = call i64 @sched_setscheduler(i32 %11, i32 %67, %struct.sched_param* %5)
%73 = icmp slt i64 %72, 0
br i1 %73, label %64, label %65
74: ; preds = %49, %64, %56, %46, %42, %36, %32, %29, %26, %23, %20, %15, %4, %18
%75 = phi i32 [ 4, %18 ], [ 3, %4 ], [ 31, %15 ], [ 5, %20 ], [ 6, %23 ], [ 9, %26 ], [ 10, %29 ], [ 11, %32 ], [ 13, %36 ], [ 14, %42 ], [ 15, %46 ], [ 17, %56 ], [ 0, %64 ], [ 15, %49 ]
ret i32 %75
}