#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 */
int /*<<< orphan*/ CLOCK_MONOTONIC;
int /*<<< orphan*/ assert(int);
int pthread_cond_init(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int pthread_condattr_destroy(int /*<<< orphan*/ *);
int pthread_condattr_init(int /*<<< orphan*/ *);
int pthread_condattr_setclock(int /*<<< orphan*/ *, int /*<<< orphan*/);
void pthread_cond_init_mono(pthread_cond_t *cond) {
  pthread_condattr_t attr;
  int res;
  res = pthread_condattr_init(&attr);
  assert(res == 0);
  res = pthread_condattr_setclock(&attr, CLOCK_MONOTONIC);
  assert(res == 0);
  res = pthread_cond_init(cond, &attr);
  assert(res == 0);
  res = pthread_condattr_destroy(&attr);
  assert(res == 0);
}


x86 assembly (clang, -O0):
<pthread_cond_init_mono>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0xc(%rbp),%rdi
call   1070 <pthread_condattr_init@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    0x2e68(%rip),%rax
mov    (%rax),%esi
lea    -0xc(%rbp),%rdi
call   1040 <pthread_condattr_setclock@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1060 <pthread_cond_init@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0xc(%rbp),%rdi
call   1030 <pthread_condattr_destroy@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pthread_cond_init_mono>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0x4(%rsp),%rbx
mov    %rbx,%rdi
call   1070 <pthread_condattr_init@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    0x2e70(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1040 <pthread_condattr_setclock@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <pthread_cond_init@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
call   1030 <pthread_condattr_destroy@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@CLOCK_MONOTONIC = global i32 0
define void @pthread_cond_init_mono(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
%5 = call i32 @pthread_condattr_init(i32* %3)
store i32 %5, i32* %4
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 0
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = load i32, i32* @CLOCK_MONOTONIC
%11 = call i32 @pthread_condattr_setclock(i32* %3, i32 %10)
store i32 %11, i32* %4
%12 = load i32, i32* %4
%13 = icmp eq i32 %12, 0
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = load i32*, i32** %2
%17 = call i32 @pthread_cond_init(i32* %16, i32* %3)
store i32 %17, i32* %4
%18 = load i32, i32* %4
%19 = icmp eq i32 %18, 0
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = call i32 @pthread_condattr_destroy(i32* %3)
store i32 %22, i32* %4
%23 = load i32, i32* %4
%24 = icmp eq i32 %23, 0
%25 = zext i1 %24 to i32
%26 = call i32 @assert(i32 %25)
ret void
}

LLVM IR (-O2):
@CLOCK_MONOTONIC = global i32 0
define void @pthread_cond_init_mono(i32* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @pthread_condattr_init(i32* %2)
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
%8 = load i32, i32* @CLOCK_MONOTONIC
%9 = call i32 @pthread_condattr_setclock(i32* %2, i32 %8)
%10 = icmp eq i32 %9, 0
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = call i32 @pthread_cond_init(i32* %0, i32* %2)
%14 = icmp eq i32 %13, 0
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = call i32 @pthread_condattr_destroy(i32* %2)
%18 = icmp eq i32 %17, 0
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
ret void
}