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

/* Variables and functions */
int /*<<< orphan*/ err_quit(char *);
int errno;
int pthread_mutex_destroy(int /*<<< orphan*/ *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ strerror(int);
void Pthread_mutex_destroy(pthread_mutex_t *mutex) {
  int i = 0;
  if ((i = pthread_mutex_destroy(mutex)) != 0) {
    errno = i;
    do {
      strerror(errno);
      puts("\n");
      err_quit("pthread mutex destory error");
    } while (1);
  }
}


x86 assembly (clang, -O0):
<Pthread_mutex_destroy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <pthread_mutex_destroy@plt>
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
je     11ae <Pthread_mutex_destroy+0x6e>
mov    -0xc(%rbp),%ecx
mov    0x2e6e(%rip),%rax
mov    %ecx,(%rax)
mov    0x2e65(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
lea    0xe77(%rip),%rdi
call   1030 <puts@plt>
lea    0xe6d(%rip),%rdi
call   1050 <err_quit@plt>
mov    $0x1,%al
test   $0x1,%al
jne    1174 <Pthread_mutex_destroy+0x34>
jmp    11a9 <Pthread_mutex_destroy+0x69>
jmp    11ae <Pthread_mutex_destroy+0x6e>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Pthread_mutex_destroy>:
push   %r15
push   %r14
push   %rbx
call   1040 <pthread_mutex_destroy@plt>
test   %eax,%eax
je     118a <Pthread_mutex_destroy+0x4a>
mov    %eax,%edi
mov    0x2e89(%rip),%r15
mov    %eax,(%r15)
lea    0xe9f(%rip),%r14
lea    0xe9a(%rip),%rbx
nopl   0x0(%rax,%rax,1)
call   1060 <strerror@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1050 <err_quit@plt>
mov    (%r15),%edi
jmp    1170 <Pthread_mutex_destroy+0x30>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@errno = global i32 0
@.str = [2 x i8] c"\0A\00"
@.str.1 = [28 x i8] c"pthread mutex destory error\00"
define void @Pthread_mutex_destroy(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %3
%4 = load i32*, i32** %2
%5 = call i32 @pthread_mutex_destroy(i32* %4)
store i32 %5, i32* %3
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %16
7: ; preds = %1
%8 = load i32, i32* %3
store i32 %8, i32* @errno
br label %9
9: ; preds = %14, %7
%10 = load i32, i32* @errno
%11 = call i32 @strerror(i32 %10)
%12 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @err_quit(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %9
br i1 true, label %9, label %15
15: ; preds = %14
br label %16
16: ; preds = %15, %1
ret void
}

LLVM IR (-O2):
@errno = global i32 0
@.str = [2 x i8] c"\0A\00"
@.str.1 = [28 x i8] c"pthread mutex destory error\00"
define void @Pthread_mutex_destroy(i32* %0) {
%2 = tail call i32 @pthread_mutex_destroy(i32* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1
store i32 %2, i32* @errno
br label %5
5: ; preds = %5, %4
%6 = phi i32 [ %10, %5 ], [ %2, %4 ]
%7 = tail call i32 @strerror(i32 %6)
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @err_quit(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%10 = load i32, i32* @errno
br label %5
11: ; preds = %1
ret void
}