#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 /*<<< orphan*/ CLOCK_REALTIME;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ printf(char *);
int pthread_condattr_init(int /*<<< orphan*/ *);
int pthread_condattr_setclock(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int main(void) {
  pthread_condattr_t condattr;
  int rc;
  if ((rc = pthread_condattr_init(&condattr)) != 0) {
    fprintf(stderr, "Error at pthread_condattr_init(), rc=%d\n", rc);
    printf("Test FAILED\n");
    return 1;
  }
  rc = pthread_condattr_setclock(&condattr, CLOCK_REALTIME);
  if (rc != 0) {
    printf("Test FAILED: Could not set clock to CLOCK_REALTIME\n");
    return 1;
  }
  printf("Test PASSED\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1060 <pthread_condattr_init@plt>
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
je     1194 <main+0x54>
mov    0x2e75(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%edx
lea    0xe89(%rip),%rsi
call   1050 <fprintf@plt>
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11de <main+0x9e>
mov    0x2e3d(%rip),%rax
mov    (%rax),%esi
lea    -0x8(%rbp),%rdi
call   1040 <pthread_condattr_setclock@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     11cb <main+0x8b>
lea    0xe7c(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11de <main+0x9e>
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rdi
call   1060 <pthread_condattr_init@plt>
test   %eax,%eax
je     1178 <main+0x38>
mov    0x2e86(%rip),%rcx
mov    (%rcx),%edi
lea    0xe9d(%rip),%rsi
mov    %eax,%edx
call   1050 <fprintf@plt>
mov    $0x1,%ebx
lea    0xef2(%rip),%rdi
jmp    11a4 <main+0x64>
mov    0x2e59(%rip),%rax
mov    (%rax),%esi
lea    0xc(%rsp),%rdi
call   1040 <pthread_condattr_setclock@plt>
xor    %ebx,%ebx
test   %eax,%eax
setne  %bl
lea    0xe90(%rip),%rax
lea    0xe95(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [41 x i8] c"Error at pthread_condattr_init(), rc=%d\0A\00"
@.str.1 = [13 x i8] c"Test FAILED\0A\00"
@CLOCK_REALTIME = global i32 0
@.str.2 = [52 x i8] c"Test FAILED: Could not set clock to CLOCK_REALTIME\0A\00"
@.str.3 = [13 x i8] c"Test PASSED\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @pthread_condattr_init(i32* %2)
store i32 %4, i32* %3
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %0
%7 = load i32, i32* @stderr
%8 = load i32, i32* %3
%9 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %1
br label %20
11: ; preds = %0
%12 = load i32, i32* @CLOCK_REALTIME
%13 = call i32 @pthread_condattr_setclock(i32* %2, i32 %12)
store i32 %13, i32* %3
%14 = load i32, i32* %3
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %20
18: ; preds = %11
%19 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %1
br label %20
20: ; preds = %18, %16, %6
%21 = load i32, i32* %1
ret i32 %21
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [41 x i8] c"Error at pthread_condattr_init(), rc=%d\0A\00"
@CLOCK_REALTIME = global i32 0
@str = [12 x i8] c"Test PASSED\00"
@str.4 = [51 x i8] c"Test FAILED: Could not set clock to CLOCK_REALTIME\00"
@str.5 = [12 x i8] c"Test FAILED\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @pthread_condattr_init(i32* %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %0
%6 = load i32, i32* @stderr
%7 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %3)
br label %15
8: ; preds = %0
%9 = load i32, i32* @CLOCK_REALTIME
%10 = call i32 @pthread_condattr_setclock(i32* %1, i32 %9)
%11 = icmp eq i32 %10, 0
%12 = select i1 %11, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([51 x i8], [51 x i8]* @str.4, i64 0, i64 0)
%13 = xor i1 %11, true
%14 = zext i1 %13 to i32
br label %15
15: ; preds = %8, %5
%16 = phi i8* [ getelementptr inbounds ([12 x i8], [12 x i8]* @str.5, i64 0, i64 0), %5 ], [ %12, %8 ]
%17 = phi i32 [ 1, %5 ], [ %14, %8 ]
%18 = call i32 @puts(i8* dereferenceable(1) %16)
ret i32 %17
}