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

/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ getpid();
int /*<<< orphan*/ memset(struct sched_param *, int, int);
int /*<<< orphan*/ printf(char *);
scalar_t__ sched_getparam(int /*<<< orphan*/, struct sched_param *);
int main(void) {
  struct sched_param sb;
  memset(&sb, -1, sizeof sb);
  if (sched_getparam(getpid(), &sb) != 0 || sb.sched_priority != 0)
    abort();
  printf("pass\n");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x10(%rbp),%rdi
mov    $0xffffffff,%esi
mov    $0x8,%edx
call   1070 <memset@plt>
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %eax,%edi
lea    -0x10(%rbp),%rsi
call   1060 <sched_getparam@plt>
cmp    $0x0,%rax
jne    11a9 <main+0x49>
cmpq   $0x0,-0x10(%rbp)
je     11b0 <main+0x50>
mov    $0x0,%al
call   1030 <abort@plt>
lea    0xe49(%rip),%rdi
call   1050 <printf@plt>
xor    %edi,%edi
call   1080 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xffffffff,%esi
mov    $0x8,%edx
call   1070 <memset@plt>
xor    %eax,%eax
call   1050 <getpid@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <sched_getparam@plt>
or     0x8(%rsp),%rax
je     119b <main+0x3b>
xor    %eax,%eax
call   1030 <abort@plt>
lea    0xe5e(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
%struct.sched_param = type { i64 }
@.str = [6 x i8] c"pass\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.sched_param
store i32 0, i32* %1
%3 = call i32 @memset(%struct.sched_param* %2, i32 -1, i32 8)
%4 = call i32 (...) @getpid()
%5 = call i64 @sched_getparam(i32 %4, %struct.sched_param* %2)
%6 = icmp ne i64 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %0
%8 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %2, i32 0, i32 0
%9 = load i64, i64* %8
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %7, %0
%12 = call i32 (...) @abort()
unreachable
13: ; preds = %7
%14 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.sched_param = type { i64 }
@str = [5 x i8] c"pass\00"
define i32 @main() {
%1 = alloca %struct.sched_param
%2 = bitcast %struct.sched_param* %1 to i8*
%3 = call i32 @memset(%struct.sched_param* %1, i32 -1, i32 8)
%4 = call i32 (...) @getpid()
%5 = call i64 @sched_getparam(i32 %4, %struct.sched_param* %1)
%6 = icmp ne i64 %5, 0
%7 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %1, i64 0, i32 0
%8 = load i64, i64* %7
%9 = icmp ne i64 %8, 0
%10 = select i1 %6, i1 true, i1 %9
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = call i32 (...) @abort()
unreachable
13: ; preds = %0
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%15 = call i32 @exit(i32 0)
unreachable
}