#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 SCHED_FIFO;
int SCHED_OTHER;
int SCHED_RR;
int /*<<< orphan*/ printf(char *, ...);
int sched_get_priority_max(int);
int sched_get_priority_min(int);
void show_min_max(void) {
  int max, min;
  max = sched_get_priority_max(SCHED_OTHER);
  min = sched_get_priority_min(SCHED_OTHER);
  if (max >= 0 && min >= 0)
    printf("SCHED_OTHER min/max priority\t: %d/%d\n", min, max);
  else
    printf("SCHED_OTHER not supported?\n");
  max = sched_get_priority_max(SCHED_FIFO);
  min = sched_get_priority_min(SCHED_FIFO);
  if (max >= 0 && min >= 0)
    printf("SCHED_FIFO min/max priority\t: %d/%d\n", min, max);
  else
    printf("SCHED_FIFO not supported?\n");
  max = sched_get_priority_max(SCHED_RR);
  min = sched_get_priority_min(SCHED_RR);
  if (max >= 0 && min >= 0)
    printf("SCHED_RR min/max priority\t: %d/%d\n", min, max);
  else
    printf("SCHED_RR not supported?\n");
  max = sched_get_priority_max(3);
  min = sched_get_priority_min(3);
  if (max >= 0 && min >= 0)
    printf("SCHED_BATCH min/max priority\t: %d/%d\n", min, max);
  else
    printf("SCHED_BATCH not supported?\n");
}


x86 assembly (clang, -O0):
<show_min_max>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
call   1050 <sched_get_priority_max@plt>
mov    %eax,-0x4(%rbp)
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
call   1040 <sched_get_priority_min@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     1187 <show_min_max+0x57>
cmpl   $0x0,-0x8(%rbp)
jl     1187 <show_min_max+0x57>
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1195 <show_min_max+0x65>
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
call   1050 <sched_get_priority_max@plt>
mov    %eax,-0x4(%rbp)
mov    0x2e3b(%rip),%rax
mov    (%rax),%edi
call   1040 <sched_get_priority_min@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     11e4 <show_min_max+0xb4>
cmpl   $0x0,-0x8(%rbp)
jl     11e4 <show_min_max+0xb4>
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f2 <show_min_max+0xc2>
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2dcf(%rip),%rax
mov    (%rax),%edi
call   1050 <sched_get_priority_max@plt>
mov    %eax,-0x4(%rbp)
mov    0x2dbe(%rip),%rax
mov    (%rax),%edi
call   1040 <sched_get_priority_min@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     1241 <show_min_max+0x111>
cmpl   $0x0,-0x8(%rbp)
jl     1241 <show_min_max+0x111>
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    124f <show_min_max+0x11f>
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x3,%edi
call   1050 <sched_get_priority_max@plt>
mov    %eax,-0x4(%rbp)
mov    $0x3,%edi
call   1040 <sched_get_priority_min@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     1296 <show_min_max+0x166>
cmpl   $0x0,-0x8(%rbp)
jl     1296 <show_min_max+0x166>
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12a4 <show_min_max+0x174>
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_min_max>:
push   %r14
push   %rbx
push   %rax
mov    0x2e8d(%rip),%r14
mov    (%r14),%edi
call   1060 <sched_get_priority_max@plt>
mov    %eax,%ebx
mov    (%r14),%edi
call   1050 <sched_get_priority_min@plt>
test   %ebx,%ebx
js     1179 <show_min_max+0x39>
test   %eax,%eax
js     1179 <show_min_max+0x39>
lea    0xe94(%rip),%rdi
mov    %eax,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1185 <show_min_max+0x45>
lea    0xf14(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e5c(%rip),%r14
mov    (%r14),%edi
call   1060 <sched_get_priority_max@plt>
mov    %eax,%ebx
mov    (%r14),%edi
call   1050 <sched_get_priority_min@plt>
test   %ebx,%ebx
js     11ba <show_min_max+0x7a>
test   %eax,%eax
js     11ba <show_min_max+0x7a>
lea    0xe79(%rip),%rdi
mov    %eax,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11c6 <show_min_max+0x86>
lea    0xeee(%rip),%rdi
call   1030 <puts@plt>
mov    0x2dfb(%rip),%r14
mov    (%r14),%edi
call   1060 <sched_get_priority_max@plt>
mov    %eax,%ebx
mov    (%r14),%edi
call   1050 <sched_get_priority_min@plt>
test   %ebx,%ebx
js     11fb <show_min_max+0xbb>
test   %eax,%eax
js     11fb <show_min_max+0xbb>
lea    0xe5d(%rip),%rdi
mov    %eax,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1207 <show_min_max+0xc7>
lea    0xec7(%rip),%rdi
call   1030 <puts@plt>
mov    $0x3,%edi
call   1060 <sched_get_priority_max@plt>
mov    %eax,%ebx
mov    $0x3,%edi
call   1050 <sched_get_priority_min@plt>
test   %ebx,%ebx
js     123e <show_min_max+0xfe>
test   %eax,%eax
js     123e <show_min_max+0xfe>
lea    0xe42(%rip),%rdi
mov    %eax,%esi
mov    %ebx,%edx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <printf@plt>
lea    0xe9c(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <puts@plt>

LLVM IR (-O0):
@SCHED_OTHER = global i32 0
@.str = [38 x i8] c"SCHED_OTHER min/max priority\09: %d/%d\0A\00"
@.str.1 = [28 x i8] c"SCHED_OTHER not supported?\0A\00"
@SCHED_FIFO = global i32 0
@.str.2 = [37 x i8] c"SCHED_FIFO min/max priority\09: %d/%d\0A\00"
@.str.3 = [27 x i8] c"SCHED_FIFO not supported?\0A\00"
@SCHED_RR = global i32 0
@.str.4 = [35 x i8] c"SCHED_RR min/max priority\09: %d/%d\0A\00"
@.str.5 = [25 x i8] c"SCHED_RR not supported?\0A\00"
@.str.6 = [38 x i8] c"SCHED_BATCH min/max priority\09: %d/%d\0A\00"
@.str.7 = [28 x i8] c"SCHED_BATCH not supported?\0A\00"
define void @show_min_max() {
%1 = alloca i32
%2 = alloca i32
%3 = load i32, i32* @SCHED_OTHER
%4 = call i32 @sched_get_priority_max(i32 %3)
store i32 %4, i32* %1
%5 = load i32, i32* @SCHED_OTHER
%6 = call i32 @sched_get_priority_min(i32 %5)
store i32 %6, i32* %2
%7 = load i32, i32* %1
%8 = icmp sge i32 %7, 0
br i1 %8, label %9, label %16
9: ; preds = %0
%10 = load i32, i32* %2
%11 = icmp sge i32 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = load i32, i32* %2
%14 = load i32, i32* %1
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %14)
br label %18
16: ; preds = %9, %0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %16, %12
%19 = load i32, i32* @SCHED_FIFO
%20 = call i32 @sched_get_priority_max(i32 %19)
store i32 %20, i32* %1
%21 = load i32, i32* @SCHED_FIFO
%22 = call i32 @sched_get_priority_min(i32 %21)
store i32 %22, i32* %2
%23 = load i32, i32* %1
%24 = icmp sge i32 %23, 0
br i1 %24, label %25, label %32
25: ; preds = %18
%26 = load i32, i32* %2
%27 = icmp sge i32 %26, 0
br i1 %27, label %28, label %32
28: ; preds = %25
%29 = load i32, i32* %2
%30 = load i32, i32* %1
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %29, i32 %30)
br label %34
32: ; preds = %25, %18
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
br label %34
34: ; preds = %32, %28
%35 = load i32, i32* @SCHED_RR
%36 = call i32 @sched_get_priority_max(i32 %35)
store i32 %36, i32* %1
%37 = load i32, i32* @SCHED_RR
%38 = call i32 @sched_get_priority_min(i32 %37)
store i32 %38, i32* %2
%39 = load i32, i32* %1
%40 = icmp sge i32 %39, 0
br i1 %40, label %41, label %48
41: ; preds = %34
%42 = load i32, i32* %2
%43 = icmp sge i32 %42, 0
br i1 %43, label %44, label %48
44: ; preds = %41
%45 = load i32, i32* %2
%46 = load i32, i32* %1
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 %45, i32 %46)
br label %50
48: ; preds = %41, %34
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
br label %50
50: ; preds = %48, %44
%51 = call i32 @sched_get_priority_max(i32 3)
store i32 %51, i32* %1
%52 = call i32 @sched_get_priority_min(i32 3)
store i32 %52, i32* %2
%53 = load i32, i32* %1
%54 = icmp sge i32 %53, 0
br i1 %54, label %55, label %62
55: ; preds = %50
%56 = load i32, i32* %2
%57 = icmp sge i32 %56, 0
br i1 %57, label %58, label %62
58: ; preds = %55
%59 = load i32, i32* %2
%60 = load i32, i32* %1
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0), i32 %59, i32 %60)
br label %64
62: ; preds = %55, %50
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0))
br label %64
64: ; preds = %62, %58
ret void
}

LLVM IR (-O2):
@SCHED_OTHER = global i32 0
@.str = [38 x i8] c"SCHED_OTHER min/max priority\09: %d/%d\0A\00"
@SCHED_FIFO = global i32 0
@.str.2 = [37 x i8] c"SCHED_FIFO min/max priority\09: %d/%d\0A\00"
@SCHED_RR = global i32 0
@.str.4 = [35 x i8] c"SCHED_RR min/max priority\09: %d/%d\0A\00"
@.str.6 = [38 x i8] c"SCHED_BATCH min/max priority\09: %d/%d\0A\00"
@str = [27 x i8] c"SCHED_OTHER not supported?\00"
@str.8 = [26 x i8] c"SCHED_FIFO not supported?\00"
@str.9 = [24 x i8] c"SCHED_RR not supported?\00"
@str.10 = [27 x i8] c"SCHED_BATCH not supported?\00"
define void @show_min_max() {
%1 = load i32, i32* @SCHED_OTHER
%2 = tail call i32 @sched_get_priority_max(i32 %1)
%3 = load i32, i32* @SCHED_OTHER
%4 = tail call i32 @sched_get_priority_min(i32 %3)
%5 = icmp sgt i32 %2, -1
%6 = icmp sgt i32 %4, -1
%7 = select i1 %5, i1 %6, i1 false
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %2)
br label %12
10: ; preds = %0
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
br label %12
12: ; preds = %10, %8
%13 = load i32, i32* @SCHED_FIFO
%14 = tail call i32 @sched_get_priority_max(i32 %13)
%15 = load i32, i32* @SCHED_FIFO
%16 = tail call i32 @sched_get_priority_min(i32 %15)
%17 = icmp sgt i32 %14, -1
%18 = icmp sgt i32 %16, -1
%19 = select i1 %17, i1 %18, i1 false
br i1 %19, label %20, label %22
20: ; preds = %12
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %16, i32 %14)
br label %24
22: ; preds = %12
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.8, i64 0, i64 0))
br label %24
24: ; preds = %22, %20
%25 = load i32, i32* @SCHED_RR
%26 = tail call i32 @sched_get_priority_max(i32 %25)
%27 = load i32, i32* @SCHED_RR
%28 = tail call i32 @sched_get_priority_min(i32 %27)
%29 = icmp sgt i32 %26, -1
%30 = icmp sgt i32 %28, -1
%31 = select i1 %29, i1 %30, i1 false
br i1 %31, label %32, label %34
32: ; preds = %24
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 %28, i32 %26)
br label %36
34: ; preds = %24
%35 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.9, i64 0, i64 0))
br label %36
36: ; preds = %34, %32
%37 = tail call i32 @sched_get_priority_max(i32 3)
%38 = tail call i32 @sched_get_priority_min(i32 3)
%39 = icmp sgt i32 %37, -1
%40 = icmp sgt i32 %38, -1
%41 = select i1 %39, i1 %40, i1 false
br i1 %41, label %42, label %44
42: ; preds = %36
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0), i32 %38, i32 %37)
br label %46
44: ; preds = %36
%45 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.10, i64 0, i64 0))
br label %46
46: ; preds = %44, %42
ret void
}