#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 {
  int __sched_priority;
};
typedef int pid_t;

/* Variables and functions */
int /*<<< orphan*/ PRIO_PROCESS;
#define SCHED_FIFO 130
#define SCHED_OTHER 129
#define SCHED_RR 128
int errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, char *);
int getpriority(int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int sched_get_priority_max(int);
int sched_get_priority_min(int);
int sched_getparam(int, struct sched_param *);
int sched_getscheduler(int);
int /*<<< orphan*/ stderr;
char *strerror(int);
void print_params(pid_t pid, int *cur_policy) {
  int ret, policy, pmin, pmax;
  struct sched_param sched_p;
  errno = 0;
  printf("\nCurrent scheduling parameters for process %d:\n", pid);
  policy = sched_getscheduler(pid);
  if (errno) {
    fprintf(stderr, "sched_getscheduler return errno %d (%s)\n", errno,
            strerror(errno));
  } else {
    if (cur_policy)
      *cur_policy = policy;
    printf("sched_getscheduler returned %d: ", policy);
    switch (policy) {
    case SCHED_OTHER:
      printf("SCHED_OTHER\n");
      break;
    case SCHED_FIFO:
      printf("SCHED_FIFO\n");
      break;
    case SCHED_RR:
      printf("SCHED_RR\n");
      break;
    default:
      printf(" unknown policy (%d)!\n", policy);
      break;
    }
  }
  errno = 0;
  pmin = sched_get_priority_min(policy);
  if (errno) {
    fprintf(stderr, "sched_get_priority_min returned errno %d (%s)\n", errno,
            strerror(errno));
  } else {
    printf("priority min=%d\n", pmin);
  }
  errno = 0;
  pmax = sched_get_priority_max(policy);
  if (errno) {
    fprintf(stderr, "sched_get_priority_max returned errno %d (%s)\n", errno,
            strerror(errno));
  } else {
    printf("priority max=%d\n", pmax);
  }
  if (policy == SCHED_OTHER) {
    int priority;
    errno = 0;
    priority = getpriority(PRIO_PROCESS, pid);
    if (errno) {
      fprintf(stderr, "getpriority returned errno %d (%s)\n", errno,
              strerror(errno));
    } else {
      printf("getpriority: priority=%d\n", priority);
    }
  } else {
    ret = sched_getparam(pid, &sched_p);
    if (!ret) {
      printf("sched_getparam: sched_priority=%d\n", sched_p.__sched_priority);
    } else {
      fprintf(stderr, "sched_getparam returned errno %d (%s)\n", errno,
              strerror(errno));
    }
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_params>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e3a(%rip),%rax
movl   $0x0,(%rax)
mov    -0x4(%rbp),%esi
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x4(%rbp),%edi
call   1030 <sched_getscheduler@plt>
mov    %eax,-0x18(%rbp)
mov    0x2e11(%rip),%rax
cmpl   $0x0,(%rax)
je     1208 <print_params+0x88>
mov    0x2e09(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    0x2df5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    0x2de9(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    -0x34(%rbp),%edi
mov    -0x30(%rbp),%edx
mov    %rax,%rcx
lea    0xe32(%rip),%rsi
call   1070 <fprintf@plt>
jmp    12b8 <print_params+0x138>
cmpq   $0x0,-0x10(%rbp)
je     121c <print_params+0x9c>
mov    -0x18(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%esi
lea    0xe33(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x38(%rbp)
sub    $0x80,%eax
je     128f <print_params+0x10f>
jmp    1243 <print_params+0xc3>
mov    -0x38(%rbp),%eax
sub    $0x81,%eax
je     1269 <print_params+0xe9>
jmp    1256 <print_params+0xd6>
mov    -0x38(%rbp),%eax
sub    $0x82,%eax
je     127c <print_params+0xfc>
jmp    12a2 <print_params+0x122>
lea    0xe0a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    12b3 <print_params+0x133>
lea    0xe04(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    12b3 <print_params+0x133>
lea    0xdfd(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    12b3 <print_params+0x133>
mov    -0x18(%rbp),%esi
lea    0xdf1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    12b8 <print_params+0x138>
mov    0x2d11(%rip),%rax
movl   $0x0,(%rax)
mov    -0x18(%rbp),%edi
call   1080 <sched_get_priority_min@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2cf9(%rip),%rax
cmpl   $0x0,(%rax)
je     1320 <print_params+0x1a0>
mov    0x2cf1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
mov    0x2cdd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    0x2cd1(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    -0x40(%rbp),%edi
mov    -0x3c(%rbp),%edx
mov    %rax,%rcx
lea    0xd9e(%rip),%rsi
call   1070 <fprintf@plt>
jmp    1331 <print_params+0x1b1>
mov    -0x1c(%rbp),%esi
lea    0xdb9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2c98(%rip),%rax
movl   $0x0,(%rax)
mov    -0x18(%rbp),%edi
call   1090 <sched_get_priority_max@plt>
mov    %eax,-0x20(%rbp)
mov    0x2c80(%rip),%rax
cmpl   $0x0,(%rax)
je     1399 <print_params+0x219>
mov    0x2c78(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    0x2c64(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    0x2c58(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    -0x48(%rbp),%edi
mov    -0x44(%rbp),%edx
mov    %rax,%rcx
lea    0xd65(%rip),%rsi
call   1070 <fprintf@plt>
jmp    13aa <print_params+0x22a>
mov    -0x20(%rbp),%esi
lea    0xd80(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x81,-0x18(%rbp)
jne    143e <print_params+0x2be>
mov    0x2c12(%rip),%rax
movl   $0x0,(%rax)
mov    0x2c15(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%esi
call   1040 <getpriority@plt>
mov    %eax,-0x2c(%rbp)
mov    0x2bf1(%rip),%rax
cmpl   $0x0,(%rax)
je     1428 <print_params+0x2a8>
mov    0x2be9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x50(%rbp)
mov    0x2bd5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
mov    0x2bc9(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    -0x50(%rbp),%edi
mov    -0x4c(%rbp),%edx
mov    %rax,%rcx
lea    0xd16(%rip),%rsi
call   1070 <fprintf@plt>
jmp    1439 <print_params+0x2b9>
mov    -0x2c(%rbp),%esi
lea    0xd26(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    14ad <print_params+0x32d>
mov    -0x4(%rbp),%edi
lea    -0x28(%rbp),%rsi
call   1060 <sched_getparam@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    146d <print_params+0x2ed>
mov    -0x28(%rbp),%esi
lea    0xd11(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    14a8 <print_params+0x328>
mov    0x2b64(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x58(%rbp)
mov    0x2b50(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x54(%rbp)
mov    0x2b44(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    -0x58(%rbp),%edi
mov    -0x54(%rbp),%edx
mov    %rax,%rcx
lea    0xcf2(%rip),%rsi
call   1070 <fprintf@plt>
jmp    14ad <print_params+0x32d>
lea    0xbfe(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_params>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %edi,%r14d
mov    0x2e17(%rip),%r12
movl   $0x0,(%r12)
lea    0xe38(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r14d,%edi
call   1040 <sched_getscheduler@plt>
mov    %eax,%r15d
mov    (%r12),%ebp
test   %ebp,%ebp
je     1245 <print_params+0xa5>
mov    0x2dec(%rip),%rax
mov    (%rax),%ebx
mov    %ebp,%edi
call   10c0 <strerror@plt>
lea    0xe34(%rip),%rsi
mov    %ebx,%edi
mov    %ebp,%edx
mov    %rax,%rcx
call   1090 <fprintf@plt>
movl   $0x0,(%r12)
mov    %r15d,%edi
call   10a0 <sched_get_priority_min@plt>
mov    (%r12),%ebx
test   %ebx,%ebx
je     1296 <print_params+0xf6>
mov    0x2db1(%rip),%rax
mov    (%rax),%ebp
mov    %ebx,%edi
call   10c0 <strerror@plt>
lea    0xe5a(%rip),%rsi
mov    %ebp,%edi
mov    %ebx,%edx
mov    %rax,%rcx
call   1090 <fprintf@plt>
jmp    12a6 <print_params+0x106>
test   %rbx,%rbx
je     124d <print_params+0xad>
mov    %r15d,(%rbx)
lea    0xe05(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1070 <printf@plt>
cmp    $0x80,%r15d
je     13af <print_params+0x20f>
cmp    $0x82,%r15d
je     13c0 <print_params+0x220>
cmp    $0x81,%r15d
jne    13d1 <print_params+0x231>
lea    0xf21(%rip),%rdi
call   1060 <puts@plt>
jmp    1208 <print_params+0x68>
lea    0xe23(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
movl   $0x0,(%r12)
mov    %r15d,%edi
call   10b0 <sched_get_priority_max@plt>
mov    (%r12),%ebx
test   %ebx,%ebx
je     1328 <print_params+0x188>
mov    0x2d13(%rip),%rax
mov    (%rax),%ebp
mov    %ebx,%edi
call   10c0 <strerror@plt>
lea    0xdfc(%rip),%rsi
mov    %ebp,%edi
mov    %ebx,%edx
mov    %rax,%rcx
call   1090 <fprintf@plt>
cmp    $0x81,%r15d
jne    1341 <print_params+0x1a1>
movl   $0x0,(%r12)
mov    0x2ce7(%rip),%rax
mov    (%rax),%edi
mov    %r14d,%esi
call   1050 <getpriority@plt>
mov    (%r12),%ebx
test   %ebx,%ebx
je     137b <print_params+0x1db>
mov    0x2cc6(%rip),%rax
mov    (%rax),%ebp
mov    %ebx,%edi
call   10c0 <strerror@plt>
lea    0xdef(%rip),%rsi
mov    %ebp,%edi
mov    %ebx,%edx
jmp    1371 <print_params+0x1d1>
lea    0xdd1(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
cmp    $0x81,%r15d
je     12ea <print_params+0x14a>
lea    0x8(%rsp),%rsi
mov    %r14d,%edi
call   1080 <sched_getparam@plt>
test   %eax,%eax
je     1386 <print_params+0x1e6>
mov    0x2c7f(%rip),%rax
mov    (%rax),%ebx
mov    (%r12),%ebp
mov    %ebp,%edi
call   10c0 <strerror@plt>
lea    0xe05(%rip),%rsi
mov    %ebx,%edi
mov    %ebp,%edx
mov    %rax,%rcx
call   1090 <fprintf@plt>
jmp    1398 <print_params+0x1f8>
lea    0xdb3(%rip),%rdi
mov    %eax,%esi
jmp    1391 <print_params+0x1f1>
mov    0x8(%rsp),%esi
lea    0xdbe(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xde3(%rip),%rdi
call   1060 <puts@plt>
jmp    1208 <print_params+0x68>
lea    0xddb(%rip),%rdi
call   1060 <puts@plt>
jmp    1208 <print_params+0x68>
lea    0xca2(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1070 <printf@plt>
jmp    1208 <print_params+0x68>

LLVM IR (-O0):
%struct.sched_param = type { i32 }
@errno = global i32 0
@.str = [48 x i8] c"\0ACurrent scheduling parameters for process %d:\0A\00"
@stderr = global i32 0
@.str.1 = [41 x i8] c"sched_getscheduler return errno %d (%s)\0A\00"
@.str.2 = [33 x i8] c"sched_getscheduler returned %d: \00"
@.str.3 = [13 x i8] c"SCHED_OTHER\0A\00"
@.str.4 = [12 x i8] c"SCHED_FIFO\0A\00"
@.str.5 = [10 x i8] c"SCHED_RR\0A\00"
@.str.6 = [23 x i8] c" unknown policy (%d)!\0A\00"
@.str.7 = [47 x i8] c"sched_get_priority_min returned errno %d (%s)\0A\00"
@.str.8 = [17 x i8] c"priority min=%d\0A\00"
@.str.9 = [47 x i8] c"sched_get_priority_max returned errno %d (%s)\0A\00"
@.str.10 = [17 x i8] c"priority max=%d\0A\00"
@PRIO_PROCESS = global i32 0
@.str.11 = [36 x i8] c"getpriority returned errno %d (%s)\0A\00"
@.str.12 = [26 x i8] c"getpriority: priority=%d\0A\00"
@.str.13 = [35 x i8] c"sched_getparam: sched_priority=%d\0A\00"
@.str.14 = [39 x i8] c"sched_getparam returned errno %d (%s)\0A\00"
@.str.15 = [2 x i8] c"\0A\00"
define void @print_params(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca %struct.sched_param
%10 = alloca i32
store i32 %0, i32* %3
store i32* %1, i32** %4
store i32 0, i32* @errno
%11 = load i32, i32* %3
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = load i32, i32* %3
%14 = call i32 @sched_getscheduler(i32 %13)
store i32 %14, i32* %6
%15 = load i32, i32* @errno
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %23
17: ; preds = %2
%18 = load i32, i32* @stderr
%19 = load i32, i32* @errno
%20 = load i32, i32* @errno
%21 = call i8* @strerror(i32 %20)
%22 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i32 %19, i8* %21)
br label %43
23: ; preds = %2
%24 = load i32*, i32** %4
%25 = icmp ne i32* %24, null
br i1 %25, label %26, label %29
26: ; preds = %23
%27 = load i32, i32* %6
%28 = load i32*, i32** %4
store i32 %27, i32* %28
br label %29
29: ; preds = %26, %23
%30 = load i32, i32* %6
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 %30)
%32 = load i32, i32* %6
switch i32 %32, label %39 [
i32 129, label %33
i32 130, label %35
i32 128, label %37
]
33: ; preds = %29
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
br label %42
35: ; preds = %29
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
br label %42
37: ; preds = %29
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
br label %42
39: ; preds = %29
%40 = load i32, i32* %6
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 %40)
br label %42
42: ; preds = %39, %37, %35, %33
br label %43
43: ; preds = %42, %17
store i32 0, i32* @errno
%44 = load i32, i32* %6
%45 = call i32 @sched_get_priority_min(i32 %44)
store i32 %45, i32* %7
%46 = load i32, i32* @errno
%47 = icmp ne i32 %46, 0
br i1 %47, label %48, label %54
48: ; preds = %43
%49 = load i32, i32* @stderr
%50 = load i32, i32* @errno
%51 = load i32, i32* @errno
%52 = call i8* @strerror(i32 %51)
%53 = call i32 @fprintf(i32 %49, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.7, i64 0, i64 0), i32 %50, i8* %52)
br label %57
54: ; preds = %43
%55 = load i32, i32* %7
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i32 %55)
br label %57
57: ; preds = %54, %48
store i32 0, i32* @errno
%58 = load i32, i32* %6
%59 = call i32 @sched_get_priority_max(i32 %58)
store i32 %59, i32* %8
%60 = load i32, i32* @errno
%61 = icmp ne i32 %60, 0
br i1 %61, label %62, label %68
62: ; preds = %57
%63 = load i32, i32* @stderr
%64 = load i32, i32* @errno
%65 = load i32, i32* @errno
%66 = call i8* @strerror(i32 %65)
%67 = call i32 @fprintf(i32 %63, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.9, i64 0, i64 0), i32 %64, i8* %66)
br label %71
68: ; preds = %57
%69 = load i32, i32* %8
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0), i32 %69)
br label %71
71: ; preds = %68, %62
%72 = load i32, i32* %6
%73 = icmp eq i32 %72, 129
br i1 %73, label %74, label %90
74: ; preds = %71
store i32 0, i32* @errno
%75 = load i32, i32* @PRIO_PROCESS
%76 = load i32, i32* %3
%77 = call i32 @getpriority(i32 %75, i32 %76)
store i32 %77, i32* %10
%78 = load i32, i32* @errno
%79 = icmp ne i32 %78, 0
br i1 %79, label %80, label %86
80: ; preds = %74
%81 = load i32, i32* @stderr
%82 = load i32, i32* @errno
%83 = load i32, i32* @errno
%84 = call i8* @strerror(i32 %83)
%85 = call i32 @fprintf(i32 %81, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.11, i64 0, i64 0), i32 %82, i8* %84)
br label %89
86: ; preds = %74
%87 = load i32, i32* %10
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.12, i64 0, i64 0), i32 %87)
br label %89
89: ; preds = %86, %80
br label %106
90: ; preds = %71
%91 = load i32, i32* %3
%92 = call i32 @sched_getparam(i32 %91, %struct.sched_param* %9)
store i32 %92, i32* %5
%93 = load i32, i32* %5
%94 = icmp ne i32 %93, 0
br i1 %94, label %99, label %95
95: ; preds = %90
%96 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %9, i32 0, i32 0
%97 = load i32, i32* %96
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.13, i64 0, i64 0), i32 %97)
br label %105
99: ; preds = %90
%100 = load i32, i32* @stderr
%101 = load i32, i32* @errno
%102 = load i32, i32* @errno
%103 = call i8* @strerror(i32 %102)
%104 = call i32 @fprintf(i32 %100, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.14, i64 0, i64 0), i32 %101, i8* %103)
br label %105
105: ; preds = %99, %95
br label %106
106: ; preds = %105, %89
%107 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.sched_param = type { i32 }
@errno = global i32 0
@.str = [48 x i8] c"\0ACurrent scheduling parameters for process %d:\0A\00"
@stderr = global i32 0
@.str.1 = [41 x i8] c"sched_getscheduler return errno %d (%s)\0A\00"
@.str.2 = [33 x i8] c"sched_getscheduler returned %d: \00"
@.str.6 = [23 x i8] c" unknown policy (%d)!\0A\00"
@.str.7 = [47 x i8] c"sched_get_priority_min returned errno %d (%s)\0A\00"
@.str.8 = [17 x i8] c"priority min=%d\0A\00"
@.str.9 = [47 x i8] c"sched_get_priority_max returned errno %d (%s)\0A\00"
@.str.10 = [17 x i8] c"priority max=%d\0A\00"
@PRIO_PROCESS = global i32 0
@.str.11 = [36 x i8] c"getpriority returned errno %d (%s)\0A\00"
@.str.12 = [26 x i8] c"getpriority: priority=%d\0A\00"
@.str.13 = [35 x i8] c"sched_getparam: sched_priority=%d\0A\00"
@.str.14 = [39 x i8] c"sched_getparam returned errno %d (%s)\0A\00"
@str = [9 x i8] c"SCHED_RR\00"
@str.16 = [11 x i8] c"SCHED_FIFO\00"
@str.17 = [12 x i8] c"SCHED_OTHER\00"
define void @print_params(i32 %0, i32* writeonly %1) {
%3 = alloca %struct.sched_param
%4 = bitcast %struct.sched_param* %3 to i8*
store i32 0, i32* @errno
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 %0)
%6 = tail call i32 @sched_getscheduler(i32 %0)
%7 = load i32, i32* @errno
%8 = icmp eq i32 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = tail call i8* @strerror(i32 %7)
%12 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i32 %7, i8* %11)
br label %26
13: ; preds = %2
%14 = icmp eq i32* %1, null
br i1 %14, label %16, label %15
15: ; preds = %13
store i32 %6, i32* %1
br label %16
16: ; preds = %15, %13
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 %6)
switch i32 %6, label %24 [
i32 129, label %18
i32 130, label %20
i32 128, label %22
]
18: ; preds = %16
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.17, i64 0, i64 0))
br label %26
20: ; preds = %16
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.16, i64 0, i64 0))
br label %26
22: ; preds = %16
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
br label %26
24: ; preds = %16
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 %6)
br label %26
26: ; preds = %18, %20, %22, %24, %9
store i32 0, i32* @errno
%27 = tail call i32 @sched_get_priority_min(i32 %6)
%28 = load i32, i32* @errno
%29 = icmp eq i32 %28, 0
br i1 %29, label %34, label %30
30: ; preds = %26
%31 = load i32, i32* @stderr
%32 = tail call i8* @strerror(i32 %28)
%33 = tail call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.7, i64 0, i64 0), i32 %28, i8* %32)
br label %36
34: ; preds = %26
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i32 %27)
br label %36
36: ; preds = %34, %30
store i32 0, i32* @errno
%37 = tail call i32 @sched_get_priority_max(i32 %6)
%38 = load i32, i32* @errno
%39 = icmp eq i32 %38, 0
br i1 %39, label %44, label %40
40: ; preds = %36
%41 = load i32, i32* @stderr
%42 = tail call i8* @strerror(i32 %38)
%43 = tail call i32 @fprintf(i32 %41, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.9, i64 0, i64 0), i32 %38, i8* %42)
br label %46
44: ; preds = %36
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0), i32 %37)
br label %46
46: ; preds = %44, %40
%47 = icmp eq i32 %6, 129
br i1 %47, label %48, label %59
48: ; preds = %46
store i32 0, i32* @errno
%49 = load i32, i32* @PRIO_PROCESS
%50 = tail call i32 @getpriority(i32 %49, i32 %0)
%51 = load i32, i32* @errno
%52 = icmp eq i32 %51, 0
br i1 %52, label %57, label %53
53: ; preds = %48
%54 = load i32, i32* @stderr
%55 = tail call i8* @strerror(i32 %51)
%56 = tail call i32 @fprintf(i32 %54, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.11, i64 0, i64 0), i32 %51, i8* %55)
br label %71
57: ; preds = %48
%58 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.12, i64 0, i64 0), i32 %50)
br label %71
59: ; preds = %46
%60 = call i32 @sched_getparam(i32 %0, %struct.sched_param* %3)
%61 = icmp eq i32 %60, 0
br i1 %61, label %62, label %66
62: ; preds = %59
%63 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %3, i64 0, i32 0
%64 = load i32, i32* %63
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.13, i64 0, i64 0), i32 %64)
br label %71
66: ; preds = %59
%67 = load i32, i32* @stderr
%68 = load i32, i32* @errno
%69 = call i8* @strerror(i32 %68)
%70 = call i32 @fprintf(i32 %67, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.14, i64 0, i64 0), i32 %68, i8* %69)
br label %71
71: ; preds = %53, %57, %62, %66
%72 = call i32 @putchar(i32 10)
ret void
}