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

/* Variables and functions */
scalar_t__ pthread_cond_init(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
scalar_t__ pthread_condattr_init(int /*<<< orphan*/ *);
scalar_t__ test_setclock(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
scalar_t__ test_setpshared(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int main(void) {
  pthread_cond_t condvar;
  pthread_condattr_t attr;
  int result = 1;
  if (pthread_condattr_init(&attr) == 0 &&
      pthread_cond_init(&condvar, NULL) == 0 &&
      test_setclock(&condvar, &attr) == 0 &&
      test_setpshared(&condvar, &attr) == 0)
    result = 0;
  return result;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x10(%rbp)
lea    -0xc(%rbp),%rdi
call   1060 <pthread_condattr_init@plt>
cmp    $0x0,%rax
jne    11b5 <main+0x75>
lea    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <pthread_cond_init@plt>
cmp    $0x0,%rax
jne    11b5 <main+0x75>
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1030 <test_setclock@plt>
cmp    $0x0,%rax
jne    11b5 <main+0x75>
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <test_setpshared@plt>
cmp    $0x0,%rax
jne    11b5 <main+0x75>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0x8(%rsp),%rdi
call   1060 <pthread_condattr_init@plt>
mov    $0x1,%ebx
test   %rax,%rax
jne    1195 <main+0x55>
lea    0xc(%rsp),%rdi
xor    %esi,%esi
call   1050 <pthread_cond_init@plt>
test   %rax,%rax
jne    1195 <main+0x55>
lea    0xc(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1030 <test_setclock@plt>
test   %rax,%rax
jne    1195 <main+0x55>
lea    0xc(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1040 <test_setpshared@plt>
xor    %ebx,%ebx
test   %rax,%rax
setne  %bl
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %4
%5 = call i64 @pthread_condattr_init(i32* %3)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %17
7: ; preds = %0
%8 = call i64 @pthread_cond_init(i32* %2, i32* null)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %17
10: ; preds = %7
%11 = call i64 @test_setclock(i32* %2, i32* %3)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %10
%14 = call i64 @test_setpshared(i32* %2, i32* %3)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %13
store i32 0, i32* %4
br label %17
17: ; preds = %16, %13, %10, %7, %0
%18 = load i32, i32* %4
ret i32 %18
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i64 @pthread_condattr_init(i32* %2)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %17
7: ; preds = %0
%8 = call i64 @pthread_cond_init(i32* %1, i32* null)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %17
10: ; preds = %7
%11 = call i64 @test_setclock(i32* %1, i32* %2)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %10
%14 = call i64 @test_setpshared(i32* %1, i32* %2)
%15 = icmp ne i64 %14, 0
%16 = zext i1 %15 to i32
br label %17
17: ; preds = %13, %10, %7, %0
%18 = phi i32 [ 1, %10 ], [ 1, %7 ], [ 1, %0 ], [ %16, %13 ]
ret i32 %18
}