#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 /*<<< orphan*/ pthread_attr_t;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
int pthread_attr_getschedparam(int /*<<< orphan*/ *, struct sched_param *);
int verify_param(pthread_attr_t *attr, int priority) {
  int rc;
  struct sched_param param;
  rc = pthread_attr_getschedparam(attr, &param);
  if (rc != 0) {
    printf("unexpected error: "
           "pthread_attr_getschedparam"
           " "
           "1-1"
           ": "
           "pthread_attr_getschedparam\n");
    exit(2);
  }
  if (priority != param.sched_priority) {
    printf("unexpected error: "
           "pthread_attr_getschedparam"
           " "
           "1-1"
           ": "
           "got wrong sched param\n");
    exit(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<verify_param>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <pthread_attr_getschedparam@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     116f <verify_param+0x3f>
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
mov    $0x2,%edi
call   1050 <exit@plt>
mov    -0xc(%rbp),%eax
cmp    -0x18(%rbp),%eax
je     1191 <verify_param+0x61>
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<verify_param>:
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ebx
lea    0x8(%rsp),%rsi
call   1040 <pthread_attr_getschedparam@plt>
test   %eax,%eax
jne    1153 <verify_param+0x23>
cmp    %ebx,0x8(%rsp)
jne    1169 <verify_param+0x39>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
lea    0xeee(%rip),%rdi
call   1030 <puts@plt>
mov    $0x2,%edi
call   1050 <exit@plt>
lea    0xe90(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
%struct.sched_param = type { i32 }
@.str = [78 x i8] c"unexpected error: pthread_attr_getschedparam 1-1: pthread_attr_getschedparam\0A\00"
@.str.1 = [73 x i8] c"unexpected error: pthread_attr_getschedparam 1-1: got wrong sched param\0A\00"
define i32 @verify_param(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.sched_param
store i32* %0, i32** %3
store i32 %1, i32* %4
%7 = load i32*, i32** %3
%8 = call i32 @pthread_attr_getschedparam(i32* %7, %struct.sched_param* %6)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = call i32 @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @exit(i32 2)
unreachable
14: ; preds = %2
%15 = load i32, i32* %4
%16 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %6, i32 0, i32 0
%17 = load i32, i32* %16
%18 = icmp ne i32 %15, %17
br i1 %18, label %19, label %22
19: ; preds = %14
%20 = call i32 @printf(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.1, i64 0, i64 0))
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %14
ret i32 0
}

LLVM IR (-O2):
%struct.sched_param = type { i32 }
@str = [72 x i8] c"unexpected error: pthread_attr_getschedparam 1-1: got wrong sched param\00"
@str.2 = [77 x i8] c"unexpected error: pthread_attr_getschedparam 1-1: pthread_attr_getschedparam\00"
define i32 @verify_param(i32* %0, i32 %1) {
%3 = alloca %struct.sched_param
%4 = bitcast %struct.sched_param* %3 to i8*
%5 = call i32 @pthread_attr_getschedparam(i32* %0, %struct.sched_param* %3)
%6 = icmp eq i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([77 x i8], [77 x i8]* @str.2, i64 0, i64 0))
%9 = call i32 @exit(i32 2)
unreachable
10: ; preds = %2
%11 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %3, i64 0, i32 0
%12 = load i32, i32* %11
%13 = icmp eq i32 %12, %1
br i1 %13, label %17, label %14
14: ; preds = %10
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @str, i64 0, i64 0))
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %10
ret i32 0
}