#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_RR;
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, int, int);
int sched_get_priority_max(int /*<<< orphan*/);
int sched_get_priority_min(int /*<<< orphan*/);
int main(void) {
  int min, max;
  min = sched_get_priority_min(SCHED_RR);
  if (min == -1) {
    perror("ched_get_priority_min");
    return 1;
  }
  max = sched_get_priority_max(SCHED_RR);
  if (max == -1) {
    perror("sched_get_priority_max");
    return 1;
  }
  printf("SCHED_RR priority range is %d - %d\n", min, max);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e82(%rip),%rax
mov    (%rax),%edi
call   1040 <sched_get_priority_min@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    1182 <main+0x42>
lea    0xe8f(%rip),%rdi
call   1050 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    11ce <main+0x8e>
mov    0x2e4f(%rip),%rax
mov    (%rax),%edi
call   1060 <sched_get_priority_max@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    11b5 <main+0x75>
lea    0xe72(%rip),%rdi
call   1050 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    11ce <main+0x8e>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe6b(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x2e8d(%rip),%r14
mov    (%r14),%edi
call   1040 <sched_get_priority_min@plt>
cmp    $0xffffffff,%eax
je     1181 <main+0x41>
mov    %eax,%ebx
mov    (%r14),%edi
call   1060 <sched_get_priority_max@plt>
cmp    $0xffffffff,%eax
je     118a <main+0x4a>
lea    0xebf(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe78(%rip),%rdi
jmp    1191 <main+0x51>
lea    0xe85(%rip),%rdi
call   1050 <perror@plt>
mov    $0x1,%eax
jmp    1179 <main+0x39>

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

LLVM IR (-O2):
@SCHED_RR = global i32 0
@.str = [22 x i8] c"ched_get_priority_min\00"
@.str.1 = [23 x i8] c"sched_get_priority_max\00"
@.str.2 = [36 x i8] c"SCHED_RR priority range is %d - %d\0A\00"
define i32 @main() {
%1 = load i32, i32* @SCHED_RR
%2 = tail call i32 @sched_get_priority_min(i32 %1)
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = tail call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %14
6: ; preds = %0
%7 = load i32, i32* @SCHED_RR
%8 = tail call i32 @sched_get_priority_max(i32 %7)
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = tail call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
br label %14
12: ; preds = %6
%13 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i32 %2, i32 %8)
br label %14
14: ; preds = %12, %10, %4
%15 = phi i32 [ 1, %4 ], [ 1, %10 ], [ 0, %12 ]
ret i32 %15
}