#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 */
int /*<<< orphan*/ PTHREAD_MUTEX_NORMAL;
int /*<<< orphan*/ PTHREAD_MUTEX_RECURSIVE;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ pthread_mutex_destroy(int /*<<< orphan*/ *);
int /*<<< orphan*/ pthread_mutex_init(int /*<<< orphan*/ *,
                                      int /*<<< orphan*/ *);
int /*<<< orphan*/ pthread_mutex_lock(int /*<<< orphan*/ *);
int /*<<< orphan*/ pthread_mutex_unlock(int /*<<< orphan*/ *);
int /*<<< orphan*/ pthread_mutexattr_destroy(int /*<<< orphan*/ *);
int /*<<< orphan*/ pthread_mutexattr_init(int /*<<< orphan*/ *);
int /*<<< orphan*/ pthread_mutexattr_settype(int /*<<< orphan*/ *,
                                             int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  pthread_mutex_t m;
  pthread_mutexattr_t attr;
  pthread_mutexattr_init(&attr);
  pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL);
  pthread_mutex_init(&m, &attr);
  pthread_mutexattr_destroy(&attr);
  pthread_mutex_lock(&m);
  pthread_mutex_unlock(&m);
  pthread_mutexattr_init(&attr);
  pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
  pthread_mutex_init(&m, &attr);
  pthread_mutexattr_destroy(&attr);
  pthread_mutex_lock(&m);
  pthread_mutex_unlock(&m);
  pthread_mutex_destroy(&m);
  fprintf(stderr, "Done.\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
call   1070 <pthread_mutexattr_init@plt>
mov    0x2e3a(%rip),%rax
mov    (%rax),%esi
lea    -0x18(%rbp),%rdi
call   1040 <pthread_mutexattr_settype@plt>
lea    -0x14(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1080 <pthread_mutex_init@plt>
lea    -0x18(%rbp),%rdi
call   1090 <pthread_mutexattr_destroy@plt>
lea    -0x14(%rbp),%rdi
call   10a0 <pthread_mutex_lock@plt>
lea    -0x14(%rbp),%rdi
call   1060 <pthread_mutex_unlock@plt>
lea    -0x18(%rbp),%rdi
call   1070 <pthread_mutexattr_init@plt>
mov    0x2e0f(%rip),%rax
mov    (%rax),%esi
lea    -0x18(%rbp),%rdi
call   1040 <pthread_mutexattr_settype@plt>
lea    -0x14(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1080 <pthread_mutex_init@plt>
lea    -0x18(%rbp),%rdi
call   1090 <pthread_mutexattr_destroy@plt>
lea    -0x14(%rbp),%rdi
call   10a0 <pthread_mutex_lock@plt>
lea    -0x14(%rbp),%rdi
call   1060 <pthread_mutex_unlock@plt>
lea    -0x14(%rbp),%rdi
call   1030 <pthread_mutex_destroy@plt>
mov    0x2da4(%rip),%rax
mov    (%rax),%edi
lea    0xdcb(%rip),%rsi
call   1050 <fprintf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1070 <pthread_mutexattr_init@plt>
mov    0x2e4a(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1040 <pthread_mutexattr_settype@plt>
lea    0x4(%rsp),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1080 <pthread_mutex_init@plt>
mov    %rbx,%rdi
call   1090 <pthread_mutexattr_destroy@plt>
mov    %r14,%rdi
call   10a0 <pthread_mutex_lock@plt>
mov    %r14,%rdi
call   1060 <pthread_mutex_unlock@plt>
mov    %rbx,%rdi
call   1070 <pthread_mutexattr_init@plt>
mov    0x2e21(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1040 <pthread_mutexattr_settype@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1080 <pthread_mutex_init@plt>
mov    %rbx,%rdi
call   1090 <pthread_mutexattr_destroy@plt>
mov    %r14,%rdi
call   10a0 <pthread_mutex_lock@plt>
mov    %r14,%rdi
call   1060 <pthread_mutex_unlock@plt>
mov    %r14,%rdi
call   1030 <pthread_mutex_destroy@plt>
mov    0x2dbd(%rip),%rax
mov    (%rax),%edi
lea    0xde4(%rip),%rsi
call   1050 <fprintf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@PTHREAD_MUTEX_NORMAL = global i32 0
@PTHREAD_MUTEX_RECURSIVE = global i32 0
@stderr = global i32 0
@.str = [7 x i8] c"Done.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 @pthread_mutexattr_init(i32* %7)
%9 = load i32, i32* @PTHREAD_MUTEX_NORMAL
%10 = call i32 @pthread_mutexattr_settype(i32* %7, i32 %9)
%11 = call i32 @pthread_mutex_init(i32* %6, i32* %7)
%12 = call i32 @pthread_mutexattr_destroy(i32* %7)
%13 = call i32 @pthread_mutex_lock(i32* %6)
%14 = call i32 @pthread_mutex_unlock(i32* %6)
%15 = call i32 @pthread_mutexattr_init(i32* %7)
%16 = load i32, i32* @PTHREAD_MUTEX_RECURSIVE
%17 = call i32 @pthread_mutexattr_settype(i32* %7, i32 %16)
%18 = call i32 @pthread_mutex_init(i32* %6, i32* %7)
%19 = call i32 @pthread_mutexattr_destroy(i32* %7)
%20 = call i32 @pthread_mutex_lock(i32* %6)
%21 = call i32 @pthread_mutex_unlock(i32* %6)
%22 = call i32 @pthread_mutex_destroy(i32* %6)
%23 = load i32, i32* @stderr
%24 = call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@PTHREAD_MUTEX_NORMAL = global i32 0
@PTHREAD_MUTEX_RECURSIVE = global i32 0
@stderr = global i32 0
@.str = [7 x i8] c"Done.\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = call i32 @pthread_mutexattr_init(i32* %4)
%8 = load i32, i32* @PTHREAD_MUTEX_NORMAL
%9 = call i32 @pthread_mutexattr_settype(i32* %4, i32 %8)
%10 = call i32 @pthread_mutex_init(i32* %3, i32* %4)
%11 = call i32 @pthread_mutexattr_destroy(i32* %4)
%12 = call i32 @pthread_mutex_lock(i32* %3)
%13 = call i32 @pthread_mutex_unlock(i32* %3)
%14 = call i32 @pthread_mutexattr_init(i32* %4)
%15 = load i32, i32* @PTHREAD_MUTEX_RECURSIVE
%16 = call i32 @pthread_mutexattr_settype(i32* %4, i32 %15)
%17 = call i32 @pthread_mutex_init(i32* %3, i32* %4)
%18 = call i32 @pthread_mutexattr_destroy(i32* %4)
%19 = call i32 @pthread_mutex_lock(i32* %3)
%20 = call i32 @pthread_mutex_unlock(i32* %3)
%21 = call i32 @pthread_mutex_destroy(i32* %3)
%22 = load i32, i32* @stderr
%23 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret i32 0
}