#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*/ assert(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
int /*<<< orphan*/ *malloc(int);
int pthread_mutex_destroy(int /*<<< orphan*/ *);
int pthread_mutex_init(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int pthread_mutex_lock(int /*<<< orphan*/ *);
int pthread_mutex_unlock(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int main(void) {
  int r;
  pthread_mutex_t *mx1, *mx2;
  mx1 = malloc(sizeof(pthread_mutex_t));
  mx2 = malloc(sizeof(pthread_mutex_t));
  assert(mx1);
  assert(mx2);
  r = pthread_mutex_init(mx1, NULL);
  assert(r == 0);
  r = pthread_mutex_init(mx2, NULL);
  assert(r == 0);
  fprintf(stderr, "Establish order 1 -> 2\n");
  r = pthread_mutex_lock(mx1);
  assert(r == 0);
  r = pthread_mutex_lock(mx2);
  assert(r == 0);
  r = pthread_mutex_unlock(mx1);
  assert(r == 0);
  r = pthread_mutex_unlock(mx2);
  assert(r == 0);
  fprintf(stderr, "Try order 2 -> 1.  This gives an error.\n");
  r = pthread_mutex_lock(mx2);
  assert(r == 0);
  r = pthread_mutex_lock(mx1);
  assert(r == 0);
  r = pthread_mutex_unlock(mx1);
  assert(r == 0);
  r = pthread_mutex_unlock(mx2);
  assert(r == 0);
  fprintf(stderr,
          "Free 2 and re-allocate it.  This gives it a new identity,\n");
  fprintf(stderr, "so a second locking sequence 2 -> 1 should now be OK.\n");
  pthread_mutex_destroy(mx2);
  free(mx2);
  mx2 = malloc(sizeof(pthread_mutex_t));
  assert(mx2);
  r = pthread_mutex_init(mx2, NULL);
  assert(r == 0);
  r = pthread_mutex_lock(mx2);
  assert(r == 0);
  r = pthread_mutex_lock(mx1);
  assert(r == 0);
  r = pthread_mutex_unlock(mx1);
  assert(r == 0);
  r = pthread_mutex_unlock(mx2);
  assert(r == 0);
  fprintf(stderr, "done\n");
  r = pthread_mutex_destroy(mx1);
  r = pthread_mutex_destroy(mx2);
  free(mx1);
  free(mx2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
call   1080 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x4,%edi
call   1080 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,%edi
call   1050 <assert@plt>
mov    -0x18(%rbp),%rax
mov    %eax,%edi
call   1050 <assert@plt>
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1090 <pthread_mutex_init@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1090 <pthread_mutex_init@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    0x2dd6(%rip),%rax
mov    (%rax),%edi
lea    0xded(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   10a0 <pthread_mutex_lock@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x18(%rbp),%rdi
call   10a0 <pthread_mutex_lock@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1070 <pthread_mutex_unlock@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x18(%rbp),%rdi
call   1070 <pthread_mutex_unlock@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    0x2d4d(%rip),%rax
mov    (%rax),%edi
lea    0xd7c(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   10a0 <pthread_mutex_lock@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x10(%rbp),%rdi
call   10a0 <pthread_mutex_lock@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1070 <pthread_mutex_unlock@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x18(%rbp),%rdi
call   1070 <pthread_mutex_unlock@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    0x2cc4(%rip),%rax
mov    (%rax),%edi
lea    0xd1c(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2caf(%rip),%rax
mov    (%rax),%edi
lea    0xd42(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <pthread_mutex_destroy@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    $0x4,%edi
call   1080 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %eax,%edi
call   1050 <assert@plt>
mov    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1090 <pthread_mutex_init@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x18(%rbp),%rdi
call   10a0 <pthread_mutex_lock@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x10(%rbp),%rdi
call   10a0 <pthread_mutex_lock@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1070 <pthread_mutex_unlock@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x18(%rbp),%rdi
call   1070 <pthread_mutex_unlock@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    0x2bda(%rip),%rax
mov    (%rax),%edi
lea    0xca4(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <pthread_mutex_destroy@plt>
mov    %eax,-0x8(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <pthread_mutex_destroy@plt>
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0x4,%edi
call   1080 <malloc@plt>
mov    %rax,%r14
mov    $0x4,%edi
call   1080 <malloc@plt>
mov    %rax,%rbx
mov    %r14d,%edi
call   1050 <assert@plt>
mov    %ebx,%edi
call   1050 <assert@plt>
mov    %r14,%rdi
xor    %esi,%esi
call   1090 <pthread_mutex_init@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1090 <pthread_mutex_init@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    0x2dfd(%rip),%r15
mov    (%r15),%edi
lea    0xe13(%rip),%rsi
call   1060 <fprintf@plt>
mov    %r14,%rdi
call   10a0 <pthread_mutex_lock@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
call   10a0 <pthread_mutex_lock@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    %r14,%rdi
call   1070 <pthread_mutex_unlock@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
call   1070 <pthread_mutex_unlock@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    (%r15),%edi
lea    0xdc8(%rip),%rsi
call   1060 <fprintf@plt>
mov    %rbx,%rdi
call   10a0 <pthread_mutex_lock@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    %r14,%rdi
call   10a0 <pthread_mutex_lock@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    %r14,%rdi
call   1070 <pthread_mutex_unlock@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
call   1070 <pthread_mutex_unlock@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    (%r15),%edi
lea    0xd8e(%rip),%rsi
call   1060 <fprintf@plt>
mov    (%r15),%edi
lea    0xdba(%rip),%rsi
call   1060 <fprintf@plt>
mov    %rbx,%rdi
call   1040 <pthread_mutex_destroy@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    $0x4,%edi
call   1080 <malloc@plt>
mov    %rax,%rbx
mov    %ebx,%edi
call   1050 <assert@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1090 <pthread_mutex_init@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
call   10a0 <pthread_mutex_lock@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    %r14,%rdi
call   10a0 <pthread_mutex_lock@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    %r14,%rdi
call   1070 <pthread_mutex_unlock@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
call   1070 <pthread_mutex_unlock@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    (%r15),%edi
lea    0xd53(%rip),%rsi
call   1060 <fprintf@plt>
mov    %r14,%rdi
call   1040 <pthread_mutex_destroy@plt>
mov    %rbx,%rdi
call   1040 <pthread_mutex_destroy@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"Establish order 1 -> 2\0A\00"
@.str.1 = [41 x i8] c"Try order 2 -> 1. This gives an error.\0A\00"
@.str.2 = [59 x i8] c"Free 2 and re-allocate it. This gives it a new identity,\0A\00"
@.str.3 = [55 x i8] c"so a second locking sequence 2 -> 1 should now be OK.\0A\00"
@.str.4 = [6 x i8] c"done\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32*
store i32 0, i32* %1
%5 = call i32* @malloc(i32 4)
store i32* %5, i32** %3
%6 = call i32* @malloc(i32 4)
store i32* %6, i32** %4
%7 = load i32*, i32** %3
%8 = ptrtoint i32* %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = load i32*, i32** %4
%11 = ptrtoint i32* %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = load i32*, i32** %3
%14 = call i32 @pthread_mutex_init(i32* %13, i32* null)
store i32 %14, i32* %2
%15 = load i32, i32* %2
%16 = icmp eq i32 %15, 0
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = load i32*, i32** %4
%20 = call i32 @pthread_mutex_init(i32* %19, i32* null)
store i32 %20, i32* %2
%21 = load i32, i32* %2
%22 = icmp eq i32 %21, 0
%23 = zext i1 %22 to i32
%24 = call i32 @assert(i32 %23)
%25 = load i32, i32* @stderr
%26 = call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%27 = load i32*, i32** %3
%28 = call i32 @pthread_mutex_lock(i32* %27)
store i32 %28, i32* %2
%29 = load i32, i32* %2
%30 = icmp eq i32 %29, 0
%31 = zext i1 %30 to i32
%32 = call i32 @assert(i32 %31)
%33 = load i32*, i32** %4
%34 = call i32 @pthread_mutex_lock(i32* %33)
store i32 %34, i32* %2
%35 = load i32, i32* %2
%36 = icmp eq i32 %35, 0
%37 = zext i1 %36 to i32
%38 = call i32 @assert(i32 %37)
%39 = load i32*, i32** %3
%40 = call i32 @pthread_mutex_unlock(i32* %39)
store i32 %40, i32* %2
%41 = load i32, i32* %2
%42 = icmp eq i32 %41, 0
%43 = zext i1 %42 to i32
%44 = call i32 @assert(i32 %43)
%45 = load i32*, i32** %4
%46 = call i32 @pthread_mutex_unlock(i32* %45)
store i32 %46, i32* %2
%47 = load i32, i32* %2
%48 = icmp eq i32 %47, 0
%49 = zext i1 %48 to i32
%50 = call i32 @assert(i32 %49)
%51 = load i32, i32* @stderr
%52 = call i32 @fprintf(i32 %51, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%53 = load i32*, i32** %4
%54 = call i32 @pthread_mutex_lock(i32* %53)
store i32 %54, i32* %2
%55 = load i32, i32* %2
%56 = icmp eq i32 %55, 0
%57 = zext i1 %56 to i32
%58 = call i32 @assert(i32 %57)
%59 = load i32*, i32** %3
%60 = call i32 @pthread_mutex_lock(i32* %59)
store i32 %60, i32* %2
%61 = load i32, i32* %2
%62 = icmp eq i32 %61, 0
%63 = zext i1 %62 to i32
%64 = call i32 @assert(i32 %63)
%65 = load i32*, i32** %3
%66 = call i32 @pthread_mutex_unlock(i32* %65)
store i32 %66, i32* %2
%67 = load i32, i32* %2
%68 = icmp eq i32 %67, 0
%69 = zext i1 %68 to i32
%70 = call i32 @assert(i32 %69)
%71 = load i32*, i32** %4
%72 = call i32 @pthread_mutex_unlock(i32* %71)
store i32 %72, i32* %2
%73 = load i32, i32* %2
%74 = icmp eq i32 %73, 0
%75 = zext i1 %74 to i32
%76 = call i32 @assert(i32 %75)
%77 = load i32, i32* @stderr
%78 = call i32 @fprintf(i32 %77, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0))
%79 = load i32, i32* @stderr
%80 = call i32 @fprintf(i32 %79, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.3, i64 0, i64 0))
%81 = load i32*, i32** %4
%82 = call i32 @pthread_mutex_destroy(i32* %81)
%83 = load i32*, i32** %4
%84 = call i32 @free(i32* %83)
%85 = call i32* @malloc(i32 4)
store i32* %85, i32** %4
%86 = load i32*, i32** %4
%87 = ptrtoint i32* %86 to i32
%88 = call i32 @assert(i32 %87)
%89 = load i32*, i32** %4
%90 = call i32 @pthread_mutex_init(i32* %89, i32* null)
store i32 %90, i32* %2
%91 = load i32, i32* %2
%92 = icmp eq i32 %91, 0
%93 = zext i1 %92 to i32
%94 = call i32 @assert(i32 %93)
%95 = load i32*, i32** %4
%96 = call i32 @pthread_mutex_lock(i32* %95)
store i32 %96, i32* %2
%97 = load i32, i32* %2
%98 = icmp eq i32 %97, 0
%99 = zext i1 %98 to i32
%100 = call i32 @assert(i32 %99)
%101 = load i32*, i32** %3
%102 = call i32 @pthread_mutex_lock(i32* %101)
store i32 %102, i32* %2
%103 = load i32, i32* %2
%104 = icmp eq i32 %103, 0
%105 = zext i1 %104 to i32
%106 = call i32 @assert(i32 %105)
%107 = load i32*, i32** %3
%108 = call i32 @pthread_mutex_unlock(i32* %107)
store i32 %108, i32* %2
%109 = load i32, i32* %2
%110 = icmp eq i32 %109, 0
%111 = zext i1 %110 to i32
%112 = call i32 @assert(i32 %111)
%113 = load i32*, i32** %4
%114 = call i32 @pthread_mutex_unlock(i32* %113)
store i32 %114, i32* %2
%115 = load i32, i32* %2
%116 = icmp eq i32 %115, 0
%117 = zext i1 %116 to i32
%118 = call i32 @assert(i32 %117)
%119 = load i32, i32* @stderr
%120 = call i32 @fprintf(i32 %119, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%121 = load i32*, i32** %3
%122 = call i32 @pthread_mutex_destroy(i32* %121)
store i32 %122, i32* %2
%123 = load i32*, i32** %4
%124 = call i32 @pthread_mutex_destroy(i32* %123)
store i32 %124, i32* %2
%125 = load i32*, i32** %3
%126 = call i32 @free(i32* %125)
%127 = load i32*, i32** %4
%128 = call i32 @free(i32* %127)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"Establish order 1 -> 2\0A\00"
@.str.1 = [41 x i8] c"Try order 2 -> 1. This gives an error.\0A\00"
@.str.2 = [59 x i8] c"Free 2 and re-allocate it. This gives it a new identity,\0A\00"
@.str.3 = [55 x i8] c"so a second locking sequence 2 -> 1 should now be OK.\0A\00"
@.str.4 = [6 x i8] c"done\0A\00"
define i32 @main() {
%1 = tail call i32* @malloc(i32 4)
%2 = tail call i32* @malloc(i32 4)
%3 = ptrtoint i32* %1 to i64
%4 = trunc i64 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = ptrtoint i32* %2 to i64
%7 = trunc i64 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = tail call i32 @pthread_mutex_init(i32* %1, i32* null)
%10 = icmp eq i32 %9, 0
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = tail call i32 @pthread_mutex_init(i32* %2, i32* null)
%14 = icmp eq i32 %13, 0
%15 = zext i1 %14 to i32
%16 = tail call i32 @assert(i32 %15)
%17 = load i32, i32* @stderr
%18 = tail call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%19 = tail call i32 @pthread_mutex_lock(i32* %1)
%20 = icmp eq i32 %19, 0
%21 = zext i1 %20 to i32
%22 = tail call i32 @assert(i32 %21)
%23 = tail call i32 @pthread_mutex_lock(i32* %2)
%24 = icmp eq i32 %23, 0
%25 = zext i1 %24 to i32
%26 = tail call i32 @assert(i32 %25)
%27 = tail call i32 @pthread_mutex_unlock(i32* %1)
%28 = icmp eq i32 %27, 0
%29 = zext i1 %28 to i32
%30 = tail call i32 @assert(i32 %29)
%31 = tail call i32 @pthread_mutex_unlock(i32* %2)
%32 = icmp eq i32 %31, 0
%33 = zext i1 %32 to i32
%34 = tail call i32 @assert(i32 %33)
%35 = load i32, i32* @stderr
%36 = tail call i32 @fprintf(i32 %35, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%37 = tail call i32 @pthread_mutex_lock(i32* %2)
%38 = icmp eq i32 %37, 0
%39 = zext i1 %38 to i32
%40 = tail call i32 @assert(i32 %39)
%41 = tail call i32 @pthread_mutex_lock(i32* %1)
%42 = icmp eq i32 %41, 0
%43 = zext i1 %42 to i32
%44 = tail call i32 @assert(i32 %43)
%45 = tail call i32 @pthread_mutex_unlock(i32* %1)
%46 = icmp eq i32 %45, 0
%47 = zext i1 %46 to i32
%48 = tail call i32 @assert(i32 %47)
%49 = tail call i32 @pthread_mutex_unlock(i32* %2)
%50 = icmp eq i32 %49, 0
%51 = zext i1 %50 to i32
%52 = tail call i32 @assert(i32 %51)
%53 = load i32, i32* @stderr
%54 = tail call i32 @fprintf(i32 %53, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0))
%55 = load i32, i32* @stderr
%56 = tail call i32 @fprintf(i32 %55, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.3, i64 0, i64 0))
%57 = tail call i32 @pthread_mutex_destroy(i32* %2)
%58 = tail call i32 @free(i32* %2)
%59 = tail call i32* @malloc(i32 4)
%60 = ptrtoint i32* %59 to i64
%61 = trunc i64 %60 to i32
%62 = tail call i32 @assert(i32 %61)
%63 = tail call i32 @pthread_mutex_init(i32* %59, i32* null)
%64 = icmp eq i32 %63, 0
%65 = zext i1 %64 to i32
%66 = tail call i32 @assert(i32 %65)
%67 = tail call i32 @pthread_mutex_lock(i32* %59)
%68 = icmp eq i32 %67, 0
%69 = zext i1 %68 to i32
%70 = tail call i32 @assert(i32 %69)
%71 = tail call i32 @pthread_mutex_lock(i32* %1)
%72 = icmp eq i32 %71, 0
%73 = zext i1 %72 to i32
%74 = tail call i32 @assert(i32 %73)
%75 = tail call i32 @pthread_mutex_unlock(i32* %1)
%76 = icmp eq i32 %75, 0
%77 = zext i1 %76 to i32
%78 = tail call i32 @assert(i32 %77)
%79 = tail call i32 @pthread_mutex_unlock(i32* %59)
%80 = icmp eq i32 %79, 0
%81 = zext i1 %80 to i32
%82 = tail call i32 @assert(i32 %81)
%83 = load i32, i32* @stderr
%84 = tail call i32 @fprintf(i32 %83, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%85 = tail call i32 @pthread_mutex_destroy(i32* %1)
%86 = tail call i32 @pthread_mutex_destroy(i32* %59)
%87 = tail call i32 @free(i32* %1)
%88 = tail call i32 @free(i32* %59)
ret i32 0
}