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

/* Variables and functions */
scalar_t__ pthread_mutexattr_init(int /*<<< orphan*/ *);
scalar_t__ test_recursive_locks(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
scalar_t__ test_status_destroyed(int /*<<< orphan*/ *);
scalar_t__ test_status_no_robust(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
scalar_t__ test_status_robust(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int main(void) {
  pthread_mutex_t mutex;
  pthread_mutexattr_t attr;
  int result = 1;
  if (pthread_mutexattr_init(&attr) == 0 &&
      test_status_destroyed(&mutex) == 0 &&
      test_status_no_robust(&mutex, &attr) == 0 &&
      test_status_robust(&mutex, &attr) == 0 &&
      test_recursive_locks(&mutex, &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   1070 <pthread_mutexattr_init@plt>
cmp    $0x0,%rax
jne    11d8 <main+0x88>
lea    -0x8(%rbp),%rdi
call   1040 <test_status_destroyed@plt>
cmp    $0x0,%rax
jne    11d8 <main+0x88>
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1030 <test_status_no_robust@plt>
cmp    $0x0,%rax
jne    11d8 <main+0x88>
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1060 <test_status_robust@plt>
cmp    $0x0,%rax
jne    11d8 <main+0x88>
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <test_recursive_locks@plt>
cmp    $0x0,%rax
jne    11d8 <main+0x88>
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   1070 <pthread_mutexattr_init@plt>
mov    $0x1,%ebx
test   %rax,%rax
jne    11b7 <main+0x67>
lea    0xc(%rsp),%rdi
call   1040 <test_status_destroyed@plt>
test   %rax,%rax
jne    11b7 <main+0x67>
lea    0xc(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1030 <test_status_no_robust@plt>
test   %rax,%rax
jne    11b7 <main+0x67>
lea    0xc(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1060 <test_status_robust@plt>
test   %rax,%rax
jne    11b7 <main+0x67>
lea    0xc(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1050 <test_recursive_locks@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_mutexattr_init(i32* %3)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %20
7: ; preds = %0
%8 = call i64 @test_status_destroyed(i32* %2)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %20
10: ; preds = %7
%11 = call i64 @test_status_no_robust(i32* %2, i32* %3)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %20
13: ; preds = %10
%14 = call i64 @test_status_robust(i32* %2, i32* %3)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = call i64 @test_recursive_locks(i32* %2, i32* %3)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %16
store i32 0, i32* %4
br label %20
20: ; preds = %19, %16, %13, %10, %7, %0
%21 = load i32, i32* %4
ret i32 %21
}

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_mutexattr_init(i32* %2)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %20
7: ; preds = %0
%8 = call i64 @test_status_destroyed(i32* %1)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %20
10: ; preds = %7
%11 = call i64 @test_status_no_robust(i32* %1, i32* %2)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %20
13: ; preds = %10
%14 = call i64 @test_status_robust(i32* %1, i32* %2)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = call i64 @test_recursive_locks(i32* %1, i32* %2)
%18 = icmp ne i64 %17, 0
%19 = zext i1 %18 to i32
br label %20
20: ; preds = %16, %13, %10, %7, %0
%21 = phi i32 [ 1, %13 ], [ 1, %10 ], [ 1, %7 ], [ 1, %0 ], [ %19, %16 ]
ret i32 %21
}