#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*/ SCHED_FIFO;
int /*<<< orphan*/ SCHED_OTHER;
int /*<<< orphan*/ SCHED_RR;
int /*<<< orphan*/ printf(char *);
int set_policy(char *, int /*<<< orphan*/);
int main(void) {
  int rc;
  rc = set_policy("SCHED_FIFO", SCHED_FIFO);
  if (rc)
    goto done;
  rc = set_policy("SCHED_RR", SCHED_RR);
  if (rc)
    goto done;
  rc = set_policy("SCHED_OTHER", SCHED_OTHER);
  if (rc)
    goto done;
  printf("Test PASSED\n");
done:
  return rc;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eb2(%rip),%rax
mov    (%rax),%esi
lea    0xec1(%rip),%rdi
call   1030 <set_policy@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1156 <main+0x36>
jmp    11b0 <main+0x90>
mov    0x2e6b(%rip),%rax
mov    (%rax),%esi
lea    0xea5(%rip),%rdi
call   1030 <set_policy@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     117d <main+0x5d>
jmp    11b0 <main+0x90>
mov    0x2e54(%rip),%rax
mov    (%rax),%esi
lea    0xe87(%rip),%rdi
call   1030 <set_policy@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     11a4 <main+0x84>
jmp    11b0 <main+0x90>
lea    0xe75(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
lea    0xecf(%rip),%rdi
call   1040 <set_policy@plt>
test   %eax,%eax
je     113c <main+0x1c>
pop    %rcx
ret
mov    0x2e85(%rip),%rax
mov    (%rax),%esi
lea    0xebf(%rip),%rdi
call   1040 <set_policy@plt>
test   %eax,%eax
jne    113a <main+0x1a>
mov    0x2e7c(%rip),%rax
mov    (%rax),%esi
lea    0xeaf(%rip),%rdi
call   1040 <set_policy@plt>
test   %eax,%eax
jne    113a <main+0x1a>
lea    0xeab(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"SCHED_FIFO\00"
@SCHED_FIFO = global i32 0
@.str.1 = [9 x i8] c"SCHED_RR\00"
@SCHED_RR = global i32 0
@.str.2 = [12 x i8] c"SCHED_OTHER\00"
@SCHED_OTHER = global i32 0
@.str.3 = [13 x i8] c"Test PASSED\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = load i32, i32* @SCHED_FIFO
%4 = call i32 @set_policy(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %3)
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %0
br label %22
8: ; preds = %0
%9 = load i32, i32* @SCHED_RR
%10 = call i32 @set_policy(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %9)
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %8
br label %22
14: ; preds = %8
%15 = load i32, i32* @SCHED_OTHER
%16 = call i32 @set_policy(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %15)
store i32 %16, i32* %2
%17 = load i32, i32* %2
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %14
br label %22
20: ; preds = %14
%21 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
br label %22
22: ; preds = %20, %19, %13, %7
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
@.str = [11 x i8] c"SCHED_FIFO\00"
@SCHED_FIFO = global i32 0
@.str.1 = [9 x i8] c"SCHED_RR\00"
@SCHED_RR = global i32 0
@.str.2 = [12 x i8] c"SCHED_OTHER\00"
@SCHED_OTHER = global i32 0
@str = [12 x i8] c"Test PASSED\00"
define i32 @main() {
%1 = load i32, i32* @SCHED_FIFO
%2 = tail call i32 @set_policy(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %14
4: ; preds = %0
%5 = load i32, i32* @SCHED_RR
%6 = tail call i32 @set_policy(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %4
%9 = load i32, i32* @SCHED_OTHER
%10 = tail call i32 @set_policy(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %9)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
br label %14
14: ; preds = %8, %4, %0, %12
%15 = phi i32 [ %2, %0 ], [ %6, %4 ], [ %10, %8 ], [ 0, %12 ]
ret i32 %15
}