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

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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
mov    $0xffffffff,%esi
mov    $0x4,%edx
call   1060 <memset@plt>
mov    $0x63,%edi
lea    -0x8(%rbp),%rsi
call   1050 <sched_getparam@plt>
cmp    $0xffffffff,%eax
jne    11a3 <main+0x53>
mov    0x2e50(%rip),%rax
mov    (%rax),%rax
mov    0x2e36(%rip),%rcx
cmp    (%rcx),%rax
je     11aa <main+0x5a>
mov    $0x0,%al
call   1030 <abort@plt>
lea    0xe4f(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xffffffff,%esi
mov    $0x4,%edx
call   1060 <memset@plt>
mov    $0x63,%edi
mov    %rbx,%rsi
call   1050 <sched_getparam@plt>
cmp    $0xffffffff,%eax
jne    11a7 <main+0x57>
mov    0x2e5b(%rip),%rax
mov    (%rax),%rax
mov    0x2e41(%rip),%rcx
cmp    (%rcx),%rax
jne    11a7 <main+0x57>
lea    0xe65(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1070 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
%struct.sched_param = type { i32 }
@errno = global i64 0
@ESRCH = global i64 0
@.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 4)
%4 = call i32 @sched_getparam(i32 99, %struct.sched_param* %2)
%5 = icmp ne i32 %4, -1
br i1 %5, label %10, label %6
6: ; preds = %0
%7 = load i64, i64* @errno
%8 = load i64, i64* @ESRCH
%9 = icmp ne i64 %7, %8
br i1 %9, label %10, label %12
10: ; preds = %6, %0
%11 = call i32 (...) @abort()
unreachable
12: ; preds = %6
%13 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.sched_param = type { i32 }
@errno = global i64 0
@ESRCH = global i64 0
@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 4)
%4 = call i32 @sched_getparam(i32 99, %struct.sched_param* %1)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %10
6: ; preds = %0
%7 = load i64, i64* @errno
%8 = load i64, i64* @ESRCH
%9 = icmp eq i64 %7, %8
br i1 %9, label %12, label %10
10: ; preds = %6, %0
%11 = call i32 (...) @abort()
unreachable
12: ; preds = %6
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%14 = call i32 @exit(i32 0)
unreachable
}