#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 {
  scalar_t__ sched_priority;
};
typedef int /*<<< orphan*/ sp;

/* Variables and functions */
int /*<<< orphan*/ SCHED_OTHER;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ memset(struct sched_param *, int /*<<< orphan*/, int);
int sched_setscheduler(int /*<<< orphan*/, int /*<<< orphan*/,
                       struct sched_param *);
int /*<<< orphan*/ stderr;
void set_normal(void) {
  struct sched_param sp;
  memset(&sp, 0, sizeof(sp));
  sp.sched_priority = 0;
  if (sched_setscheduler(0, SCHED_OTHER, &sp) == -1) {
    fprintf(stderr, "Weird, could not unset RT scheduling!\n");
  }
}


x86 assembly (clang, -O0):
<set_normal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1040 <memset@plt>
movq   $0x0,-0x8(%rbp)
mov    0x2e81(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
lea    -0x8(%rbp),%rdx
call   1030 <sched_setscheduler@plt>
cmp    $0xffffffff,%eax
jne    1182 <set_normal+0x52>
mov    0x2e6c(%rip),%rax
mov    (%rax),%edi
lea    0xe83(%rip),%rsi
call   1050 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_normal>:
push   %rbx
sub    $0x10,%rsp
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1040 <memset@plt>
movq   $0x0,0x8(%rsp)
mov    0x2e7f(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
mov    %rbx,%rdx
call   1030 <sched_setscheduler@plt>
cmp    $0xffffffff,%eax
jne    117f <set_normal+0x4f>
mov    0x2e6f(%rip),%rax
mov    (%rax),%edi
lea    0xe86(%rip),%rsi
call   1050 <fprintf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.sched_param = type { i64 }
@SCHED_OTHER = global i32 0
@stderr = global i32 0
@.str = [39 x i8] c"Weird, could not unset RT scheduling!\0A\00"
define void @set_normal() {
%1 = alloca %struct.sched_param
%2 = call i32 @memset(%struct.sched_param* %1, i32 0, i32 8)
%3 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %1, i32 0, i32 0
store i64 0, i64* %3
%4 = load i32, i32* @SCHED_OTHER
%5 = call i32 @sched_setscheduler(i32 0, i32 %4, %struct.sched_param* %1)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %7, %0
ret void
}

LLVM IR (-O2):
%struct.sched_param = type { i64 }
@SCHED_OTHER = global i32 0
@stderr = global i32 0
@.str = [39 x i8] c"Weird, could not unset RT scheduling!\0A\00"
define void @set_normal() {
%1 = alloca %struct.sched_param
%2 = bitcast %struct.sched_param* %1 to i8*
%3 = call i32 @memset(%struct.sched_param* %1, i32 0, i32 8)
%4 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %1, i64 0, i32 0
store i64 0, i64* %4
%5 = load i32, i32* @SCHED_OTHER
%6 = call i32 @sched_setscheduler(i32 0, i32 %5, %struct.sched_param* %1)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %11
8: ; preds = %0
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %8, %0
ret void
}