#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 */

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ pthread_init();
scalar_t__ test_mutex_debug();
scalar_t__ test_mutex_fast();
scalar_t__ test_mutex_static();
main() {
  pthread_init();
  printf("test_pthread_mutex START\n");
  if (test_mutex_static() || test_mutex_fast() || test_mutex_debug()) {
    printf("test_pthread_mutex FAILED\n");
    exit(1);
  }
  printf("test_pthread_mutex PASSED\n");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <pthread_init@plt>
lea    0xe83(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1080 <test_mutex_static@plt>
cmp    $0x0,%rax
jne    11b5 <main+0x55>
mov    $0x0,%al
call   1050 <test_mutex_fast@plt>
cmp    $0x0,%rax
jne    11b5 <main+0x55>
mov    $0x0,%al
call   1030 <test_mutex_debug@plt>
cmp    $0x0,%rax
je     11cb <main+0x6b>
lea    0xe5e(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
lea    0xe63(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1060 <pthread_init@plt>
lea    0xe91(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1080 <test_mutex_static@plt>
test   %rax,%rax
jne    11ab <main+0x4b>
xor    %eax,%eax
call   1050 <test_mutex_fast@plt>
test   %rax,%rax
jne    11ab <main+0x4b>
xor    %eax,%eax
call   1040 <test_mutex_debug@plt>
test   %rax,%rax
jne    11ab <main+0x4b>
lea    0xe7a(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1070 <exit@plt>
lea    0xe81(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"test_pthread_mutex START\0A\00"
@.str.1 = [27 x i8] c"test_pthread_mutex FAILED\0A\00"
@.str.2 = [27 x i8] c"test_pthread_mutex PASSED\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @pthread_init()
%3 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%4 = call i64 (...) @test_mutex_static()
%5 = icmp ne i64 %4, 0
br i1 %5, label %12, label %6
6: ; preds = %0
%7 = call i64 (...) @test_mutex_fast()
%8 = icmp ne i64 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %6
%10 = call i64 (...) @test_mutex_debug()
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %9, %6, %0
%13 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %9
%16 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [25 x i8] c"test_pthread_mutex START\00"
@str.3 = [26 x i8] c"test_pthread_mutex PASSED\00"
@str.4 = [26 x i8] c"test_pthread_mutex FAILED\00"
define i32 @main() {
%1 = tail call i32 (...) @pthread_init()
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%3 = tail call i64 (...) @test_mutex_static()
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %11
5: ; preds = %0
%6 = tail call i64 (...) @test_mutex_fast()
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = tail call i64 (...) @test_mutex_debug()
%10 = icmp eq i64 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %8, %5, %0
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.4, i64 0, i64 0))
%13 = tail call i32 @exit(i32 1)
unreachable
14: ; preds = %8
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.3, i64 0, i64 0))
%16 = tail call i32 @exit(i32 0)
unreachable
}