#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;
};

/* Variables and functions */
int /*<<< orphan*/ SCHED_RR;
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ sched_getparam(int /*<<< orphan*/, struct sched_param *);
int /*<<< orphan*/ sched_setparam(int /*<<< orphan*/, struct sched_param *);
int /*<<< orphan*/ sched_setscheduler(int /*<<< orphan*/, int /*<<< orphan*/,
                                      struct sched_param *);
int main() {
  struct sched_param param;
  sched_getparam(0, &param);
  printf("\n Default Priority : %d", param.sched_priority);
  param.sched_priority = 70;
  sched_setscheduler(0, SCHED_RR, &param);
  sched_getparam(0, &param);
  printf("\n New Priority : %d", param.sched_priority);
  param.sched_priority = 60;
  sched_setparam(0, &param);
  sched_getparam(0, &param);
  printf("\n New Priority : %d", param.sched_priority);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
lea    -0x8(%rbp),%rsi
call   1040 <sched_getparam@plt>
mov    -0x8(%rbp),%esi
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
movl   $0x46,-0x8(%rbp)
mov    0x2e68(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
lea    -0x8(%rbp),%rdx
call   1050 <sched_setscheduler@plt>
xor    %edi,%edi
lea    -0x8(%rbp),%rsi
call   1040 <sched_getparam@plt>
mov    -0x8(%rbp),%esi
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
movl   $0x3c,-0x8(%rbp)
xor    %edi,%edi
lea    -0x8(%rbp),%rsi
call   1060 <sched_setparam@plt>
xor    %edi,%edi
lea    -0x8(%rbp),%rsi
call   1040 <sched_getparam@plt>
mov    -0x8(%rbp),%esi
lea    0xe5a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsp,%rbx
xor    %edi,%edi
mov    %rbx,%rsi
call   1040 <sched_getparam@plt>
mov    (%rsp),%esi
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
movl   $0x46,(%rsp)
mov    0x2e6a(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
mov    %rbx,%rdx
call   1050 <sched_setscheduler@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1040 <sched_getparam@plt>
mov    (%rsp),%esi
lea    0xe8a(%rip),%r14
mov    %r14,%rdi
call   1030 <printf@plt>
movl   $0x3c,(%rsp)
xor    %edi,%edi
mov    %rbx,%rsi
call   1060 <sched_setparam@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1040 <sched_getparam@plt>
mov    (%rsp),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.sched_param = type { i32 }
@.str = [24 x i8] c"\0A Default Priority : %d\00"
@SCHED_RR = global i32 0
@.str.1 = [20 x i8] c"\0A New Priority : %d\00"
define i32 @main() {
%1 = alloca %struct.sched_param
%2 = call i32 @sched_getparam(i32 0, %struct.sched_param* %1)
%3 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %1, i32 0, i32 0
%4 = load i32, i32* %3
%5 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %1, i32 0, i32 0
store i32 70, i32* %6
%7 = load i32, i32* @SCHED_RR
%8 = call i32 @sched_setscheduler(i32 0, i32 %7, %struct.sched_param* %1)
%9 = call i32 @sched_getparam(i32 0, %struct.sched_param* %1)
%10 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %1, i32 0, i32 0
%11 = load i32, i32* %10
%12 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %1, i32 0, i32 0
store i32 60, i32* %13
%14 = call i32 @sched_setparam(i32 0, %struct.sched_param* %1)
%15 = call i32 @sched_getparam(i32 0, %struct.sched_param* %1)
%16 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %1, i32 0, i32 0
%17 = load i32, i32* %16
%18 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %17)
ret i32 0
}

LLVM IR (-O2):
%struct.sched_param = type { i32 }
@.str = [24 x i8] c"\0A Default Priority : %d\00"
@SCHED_RR = global i32 0
@.str.1 = [20 x i8] c"\0A New Priority : %d\00"
define i32 @main() {
%1 = alloca %struct.sched_param
%2 = bitcast %struct.sched_param* %1 to i8*
%3 = call i32 @sched_getparam(i32 0, %struct.sched_param* %1)
%4 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %5)
store i32 70, i32* %4
%7 = load i32, i32* @SCHED_RR
%8 = call i32 @sched_setscheduler(i32 0, i32 %7, %struct.sched_param* %1)
%9 = call i32 @sched_getparam(i32 0, %struct.sched_param* %1)
%10 = load i32, i32* %4
%11 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %10)
store i32 60, i32* %4
%12 = call i32 @sched_setparam(i32 0, %struct.sched_param* %1)
%13 = call i32 @sched_getparam(i32 0, %struct.sched_param* %1)
%14 = load i32, i32* %4
%15 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %14)
ret i32 0
}