#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 */
typedef int /*<<< orphan*/ pthread_condattr_t;

/* Variables and functions */
int EINVAL;
int ENOSYS;
int PTHREAD_PROCESS_PRIVATE;
int PTHREAD_PROCESS_SHARED;
int pthread_condattr_setpshared(pthread_condattr_t *attr, int pshared) {
  (void)attr;
  if ((pshared != PTHREAD_PROCESS_PRIVATE) &&
      (pshared != PTHREAD_PROCESS_SHARED))
    return EINVAL;
  if (pshared != PTHREAD_PROCESS_PRIVATE)
    return ENOSYS;
  return 0;
}


x86 assembly (clang, -O0):
<pthread_condattr_setpshared>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2eb3(%rip),%rcx
cmp    (%rcx),%eax
je     1140 <pthread_condattr_setpshared+0x40>
mov    -0x14(%rbp),%eax
mov    0x2ea9(%rip),%rcx
cmp    (%rcx),%eax
je     1140 <pthread_condattr_setpshared+0x40>
mov    0x2ea2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    116a <pthread_condattr_setpshared+0x6a>
mov    -0x14(%rbp),%eax
mov    0x2e7e(%rip),%rcx
cmp    (%rcx),%eax
je     1163 <pthread_condattr_setpshared+0x63>
mov    0x2e8f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    116a <pthread_condattr_setpshared+0x6a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pthread_condattr_setpshared>:
mov    0x2ec1(%rip),%rax
mov    (%rax),%ecx
xor    %edx,%edx
mov    0x2ebe(%rip),%rax
mov    (%rax),%edi
cmp    %esi,%ecx
je     1121 <pthread_condattr_setpshared+0x21>
mov    0x2ec9(%rip),%rax
mov    (%rax),%edx
mov    %edx,%eax
cmp    %esi,%edi
je     1130 <pthread_condattr_setpshared+0x30>
mov    0x2eaa(%rip),%rax
mov    (%rax),%eax
cmp    %esi,%ecx
cmove  %edx,%eax
ret

LLVM IR (-O0):
@PTHREAD_PROCESS_PRIVATE = global i32 0
@PTHREAD_PROCESS_SHARED = global i32 0
@EINVAL = global i32 0
@ENOSYS = global i32 0
define i32 @pthread_condattr_setpshared(i32* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
%6 = load i32*, i32** %4
%7 = load i32, i32* %5
%8 = load i32, i32* @PTHREAD_PROCESS_PRIVATE
%9 = icmp ne i32 %7, %8
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = load i32, i32* %5
%12 = load i32, i32* @PTHREAD_PROCESS_SHARED
%13 = icmp ne i32 %11, %12
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = load i32, i32* @EINVAL
store i32 %15, i32* %3
br label %23
16: ; preds = %10, %2
%17 = load i32, i32* %5
%18 = load i32, i32* @PTHREAD_PROCESS_PRIVATE
%19 = icmp ne i32 %17, %18
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = load i32, i32* @ENOSYS
store i32 %21, i32* %3
br label %23
22: ; preds = %16
store i32 0, i32* %3
br label %23
23: ; preds = %22, %20, %14
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
@PTHREAD_PROCESS_PRIVATE = global i32 0
@PTHREAD_PROCESS_SHARED = global i32 0
@EINVAL = global i32 0
@ENOSYS = global i32 0
define i32 @pthread_condattr_setpshared(i32* nocapture readnone %0, i32 %1) {
%3 = load i32, i32* @PTHREAD_PROCESS_PRIVATE
%4 = icmp eq i32 %3, %1
%5 = load i32, i32* @PTHREAD_PROCESS_SHARED
%6 = icmp eq i32 %5, %1
%7 = select i1 %4, i1 true, i1 %6
%8 = load i32, i32* @EINVAL
%9 = load i32, i32* @ENOSYS
%10 = select i1 %4, i32 0, i32 %9
%11 = select i1 %7, i32 %10, i32 %8
ret i32 %11
}