#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_rwlockattr_t;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *, int);
int pthread_rwlockattr_init(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int main(void) {
  pthread_rwlockattr_t rwa;
  int rc;
  rc = pthread_rwlockattr_init(&rwa);
  if (rc != 0) {
    printf("Test FAILED, pthread_rwlockattr_init() returns %d\n", rc);
    return 1;
  }
  fprintf(stderr, "process-shared attribute is not available for testing\n");
  return 4;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1040 <pthread_rwlockattr_init@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1170 <main+0x40>
mov    -0xc(%rbp),%esi
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    118c <main+0x5c>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x4,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0x4(%rsp),%rdi
call   1040 <pthread_rwlockattr_init@plt>
test   %eax,%eax
je     1154 <main+0x24>
lea    0xeba(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x1,%eax
pop    %rcx
ret
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x4,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [51 x i8] c"Test FAILED, pthread_rwlockattr_init() returns %d\0A\00"
@stderr = global i32 0
@.str.1 = [55 x i8] c"process-shared attribute is not available for testing\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @pthread_rwlockattr_init(i32* %2)
store i32 %4, i32* %3
%5 = load i32, i32* %3
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = load i32, i32* %3
%9 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 %8)
store i32 1, i32* %1
br label %13
10: ; preds = %0
%11 = load i32, i32* @stderr
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0))
store i32 4, i32* %1
br label %13
13: ; preds = %10, %7
%14 = load i32, i32* %1
ret i32 %14
}

LLVM IR (-O2):
@.str = [51 x i8] c"Test FAILED, pthread_rwlockattr_init() returns %d\0A\00"
@stderr = global i32 0
@.str.1 = [55 x i8] c"process-shared attribute is not available for testing\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @pthread_rwlockattr_init(i32* %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 %3)
br label %10
7: ; preds = %0
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %7, %5
%11 = phi i32 [ 1, %5 ], [ 4, %7 ]
ret i32 %11
}