#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__ EBUSY;
int /*<<< orphan*/ EDEADLK;
int PTHREAD_MUTEX_NORMAL;
int find_recorded_error(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, char *);
int pthread_mutex_destroy(int /*<<< orphan*/ *);
int pthread_mutex_init(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int pthread_mutex_lock(int /*<<< orphan*/ *);
scalar_t__ pthread_mutex_trylock(int /*<<< orphan*/ *);
int pthread_mutex_unlock(int /*<<< orphan*/ *);
int pthread_mutexattr_destroy(int /*<<< orphan*/ *);
int pthread_mutexattr_init(int /*<<< orphan*/ *);
int pthread_mutexattr_settype(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ stderr;
int test_recursion_on_nonrecursive(void) {
  pthread_mutexattr_t attr;
  pthread_mutex_t mutex;
  int ty = PTHREAD_MUTEX_NORMAL;
  do {
    int __my_ret__ = pthread_mutexattr_init(&attr);
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 360,
              "pthread_mutexattr_init(&attr)");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = pthread_mutexattr_settype(&attr, ty);
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 361,
              "pthread_mutexattr_settype(&attr, ty)");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = pthread_mutex_init(&mutex, &attr);
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 362,
              "pthread_mutex_init(&mutex, &attr)");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = pthread_mutex_lock(&mutex);
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 363,
              "pthread_mutex_lock(&mutex)");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    if ((pthread_mutex_trylock(&mutex)) != (EBUSY)) {
      fprintf(stderr, "failed on line %d: %s\n", 364,
              "pthread_mutex_trylock(&mutex)");
      return 1;
    }
  } while (0);
  ;
  do {
    if ((find_recorded_error(EDEADLK)) != (1)) {
      fprintf(stderr, "failed on line %d: %s\n", 365,
              "find_recorded_error(EDEADLK)");
      return 1;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = pthread_mutex_unlock(&mutex);
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 366,
              "pthread_mutex_unlock(&mutex)");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = pthread_mutexattr_destroy(&attr);
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 367,
              "pthread_mutexattr_destroy(&attr)");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = pthread_mutex_destroy(&mutex);
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 368,
              "pthread_mutex_destroy(&mutex)");
      return __my_ret__;
    }
  } while (0);
  ;
  return 0;
}


x86 assembly (clang, -O0):
<test_recursion_on_nonrecursive>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x2e39(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
lea    -0x8(%rbp),%rdi
call   1090 <pthread_mutexattr_init@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11f6 <test_recursion_on_nonrecursive+0x56>
mov    0x2dff(%rip),%rax
mov    (%rax),%edi
lea    0xe26(%rip),%rsi
mov    $0x168,%edx
lea    0xe31(%rip),%rcx
call   1060 <fprintf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    146f <test_recursion_on_nonrecursive+0x2cf>
jmp    11fb <test_recursion_on_nonrecursive+0x5b>
jmp    1200 <test_recursion_on_nonrecursive+0x60>
mov    -0x10(%rbp),%esi
lea    -0x8(%rbp),%rdi
call   1040 <pthread_mutexattr_settype@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     1245 <test_recursion_on_nonrecursive+0xa5>
mov    0x2db0(%rip),%rax
mov    (%rax),%edi
lea    0xdd7(%rip),%rsi
mov    $0x169,%edx
lea    0xe00(%rip),%rcx
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    146f <test_recursion_on_nonrecursive+0x2cf>
jmp    124a <test_recursion_on_nonrecursive+0xaa>
jmp    124f <test_recursion_on_nonrecursive+0xaf>
lea    -0xc(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   10a0 <pthread_mutex_init@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     1295 <test_recursion_on_nonrecursive+0xf5>
mov    0x2d60(%rip),%rax
mov    (%rax),%edi
lea    0xd87(%rip),%rsi
mov    $0x16a,%edx
lea    0xdd5(%rip),%rcx
call   1060 <fprintf@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    146f <test_recursion_on_nonrecursive+0x2cf>
jmp    129a <test_recursion_on_nonrecursive+0xfa>
jmp    129f <test_recursion_on_nonrecursive+0xff>
lea    -0xc(%rbp),%rdi
call   10c0 <pthread_mutex_lock@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     12e1 <test_recursion_on_nonrecursive+0x141>
mov    0x2d14(%rip),%rax
mov    (%rax),%edi
lea    0xd3b(%rip),%rsi
mov    $0x16b,%edx
lea    0xdab(%rip),%rcx
call   1060 <fprintf@plt>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    146f <test_recursion_on_nonrecursive+0x2cf>
jmp    12e6 <test_recursion_on_nonrecursive+0x146>
jmp    12eb <test_recursion_on_nonrecursive+0x14b>
lea    -0xc(%rbp),%rdi
call   1050 <pthread_mutex_trylock@plt>
mov    0x2ccd(%rip),%rcx
cmp    (%rcx),%rax
je     1331 <test_recursion_on_nonrecursive+0x191>
mov    0x2cc5(%rip),%rax
mov    (%rax),%edi
lea    0xcec(%rip),%rsi
mov    $0x16c,%edx
lea    0xd77(%rip),%rcx
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    146f <test_recursion_on_nonrecursive+0x2cf>
jmp    1336 <test_recursion_on_nonrecursive+0x196>
jmp    133b <test_recursion_on_nonrecursive+0x19b>
mov    0x2c9e(%rip),%rax
mov    (%rax),%edi
call   1080 <find_recorded_error@plt>
cmp    $0x1,%eax
je     137f <test_recursion_on_nonrecursive+0x1df>
mov    0x2c77(%rip),%rax
mov    (%rax),%edi
lea    0xc9e(%rip),%rsi
mov    $0x16d,%edx
lea    0xd47(%rip),%rcx
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    146f <test_recursion_on_nonrecursive+0x2cf>
jmp    1384 <test_recursion_on_nonrecursive+0x1e4>
jmp    1389 <test_recursion_on_nonrecursive+0x1e9>
lea    -0xc(%rbp),%rdi
call   1070 <pthread_mutex_unlock@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     13cb <test_recursion_on_nonrecursive+0x22b>
mov    0x2c2a(%rip),%rax
mov    (%rax),%edi
lea    0xc51(%rip),%rsi
mov    $0x16e,%edx
lea    0xd17(%rip),%rcx
call   1060 <fprintf@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    146f <test_recursion_on_nonrecursive+0x2cf>
jmp    13d0 <test_recursion_on_nonrecursive+0x230>
jmp    13d5 <test_recursion_on_nonrecursive+0x235>
lea    -0x8(%rbp),%rdi
call   10b0 <pthread_mutexattr_destroy@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
je     1417 <test_recursion_on_nonrecursive+0x277>
mov    0x2bde(%rip),%rax
mov    (%rax),%edi
lea    0xc05(%rip),%rsi
mov    $0x16f,%edx
lea    0xce8(%rip),%rcx
call   1060 <fprintf@plt>
mov    -0x28(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    146f <test_recursion_on_nonrecursive+0x2cf>
jmp    141c <test_recursion_on_nonrecursive+0x27c>
jmp    1421 <test_recursion_on_nonrecursive+0x281>
lea    -0xc(%rbp),%rdi
call   1030 <pthread_mutex_destroy@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
je     1463 <test_recursion_on_nonrecursive+0x2c3>
mov    0x2b92(%rip),%rax
mov    (%rax),%edi
lea    0xbb9(%rip),%rsi
mov    $0x170,%edx
lea    0xcbd(%rip),%rcx
call   1060 <fprintf@plt>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    146f <test_recursion_on_nonrecursive+0x2cf>
jmp    1468 <test_recursion_on_nonrecursive+0x2c8>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_recursion_on_nonrecursive>:
push   %rbp
push   %rbx
push   %rax
mov    0x2e3e(%rip),%rax
mov    (%rax),%ebp
lea    0x4(%rsp),%rdi
call   1090 <pthread_mutexattr_init@plt>
test   %eax,%eax
je     11dd <test_recursion_on_nonrecursive+0x3d>
mov    %eax,%ebx
mov    0x2e0d(%rip),%rax
mov    (%rax),%edi
lea    0xe34(%rip),%rsi
lea    0xe44(%rip),%rcx
mov    $0x168,%edx
jmp    1268 <test_recursion_on_nonrecursive+0xc8>
lea    0x4(%rsp),%rdi
mov    %ebp,%esi
call   1040 <pthread_mutexattr_settype@plt>
test   %eax,%eax
je     120d <test_recursion_on_nonrecursive+0x6d>
mov    %eax,%ebx
mov    0x2dda(%rip),%rax
mov    (%rax),%edi
lea    0xe01(%rip),%rsi
lea    0xe2f(%rip),%rcx
mov    $0x169,%edx
jmp    1268 <test_recursion_on_nonrecursive+0xc8>
mov    %rsp,%rdi
lea    0x4(%rsp),%rsi
call   10a0 <pthread_mutex_init@plt>
test   %eax,%eax
je     123e <test_recursion_on_nonrecursive+0x9e>
mov    %eax,%ebx
mov    0x2da9(%rip),%rax
mov    (%rax),%edi
lea    0xdd0(%rip),%rsi
lea    0xe23(%rip),%rcx
mov    $0x16a,%edx
jmp    1268 <test_recursion_on_nonrecursive+0xc8>
mov    %rsp,%rdi
call   10c0 <pthread_mutex_lock@plt>
test   %eax,%eax
je     1276 <test_recursion_on_nonrecursive+0xd6>
mov    %eax,%ebx
mov    0x2d7d(%rip),%rax
mov    (%rax),%edi
lea    0xda4(%rip),%rsi
lea    0xe19(%rip),%rcx
mov    $0x16b,%edx
call   1060 <fprintf@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    %rsp,%rdi
call   1050 <pthread_mutex_trylock@plt>
mov    0x2d43(%rip),%rcx
cmp    (%rcx),%rax
jne    12c9 <test_recursion_on_nonrecursive+0x129>
mov    0x2d4f(%rip),%rax
mov    (%rax),%edi
call   1080 <find_recorded_error@plt>
cmp    $0x1,%eax
jne    12e7 <test_recursion_on_nonrecursive+0x147>
mov    %rsp,%rdi
call   1070 <pthread_mutex_unlock@plt>
test   %eax,%eax
je     1312 <test_recursion_on_nonrecursive+0x172>
mov    %eax,%ebx
mov    0x2d1e(%rip),%rax
mov    (%rax),%edi
lea    0xd45(%rip),%rsi
lea    0xe10(%rip),%rcx
mov    $0x16e,%edx
jmp    1268 <test_recursion_on_nonrecursive+0xc8>
mov    0x2d00(%rip),%rax
mov    (%rax),%edi
lea    0xd27(%rip),%rsi
lea    0xdb7(%rip),%rcx
mov    $0x16c,%edx
jmp    1303 <test_recursion_on_nonrecursive+0x163>
mov    0x2ce2(%rip),%rax
mov    (%rax),%edi
lea    0xd09(%rip),%rsi
lea    0xdb7(%rip),%rcx
mov    $0x16d,%edx
call   1060 <fprintf@plt>
mov    $0x1,%ebx
jmp    126d <test_recursion_on_nonrecursive+0xcd>
lea    0x4(%rsp),%rdi
call   10b0 <pthread_mutexattr_destroy@plt>
test   %eax,%eax
je     1343 <test_recursion_on_nonrecursive+0x1a3>
mov    %eax,%ebx
mov    0x2ca7(%rip),%rax
mov    (%rax),%edi
lea    0xcce(%rip),%rsi
lea    0xdb6(%rip),%rcx
mov    $0x16f,%edx
jmp    1268 <test_recursion_on_nonrecursive+0xc8>
mov    %rsp,%rdi
call   1030 <pthread_mutex_destroy@plt>
test   %eax,%eax
je     1372 <test_recursion_on_nonrecursive+0x1d2>
mov    %eax,%ebx
mov    0x2c78(%rip),%rax
mov    (%rax),%edi
lea    0xc9f(%rip),%rsi
lea    0xda8(%rip),%rcx
mov    $0x170,%edx
jmp    1268 <test_recursion_on_nonrecursive+0xc8>
xor    %ebx,%ebx
jmp    126d <test_recursion_on_nonrecursive+0xcd>

LLVM IR (-O0):
@PTHREAD_MUTEX_NORMAL = global i32 0
@stderr = global i32 0
@.str = [23 x i8] c"failed on line %d: %s\0A\00"
@.str.1 = [30 x i8] c"pthread_mutexattr_init(&attr)\00"
@.str.2 = [37 x i8] c"pthread_mutexattr_settype(&attr, ty)\00"
@.str.3 = [34 x i8] c"pthread_mutex_init(&mutex, &attr)\00"
@.str.4 = [27 x i8] c"pthread_mutex_lock(&mutex)\00"
@EBUSY = global i64 0
@.str.5 = [30 x i8] c"pthread_mutex_trylock(&mutex)\00"
@EDEADLK = global i32 0
@.str.6 = [29 x i8] c"find_recorded_error(EDEADLK)\00"
@.str.7 = [29 x i8] c"pthread_mutex_unlock(&mutex)\00"
@.str.8 = [33 x i8] c"pthread_mutexattr_destroy(&attr)\00"
@.str.9 = [30 x i8] c"pthread_mutex_destroy(&mutex)\00"
define i32 @test_recursion_on_nonrecursive() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = load i32, i32* @PTHREAD_MUTEX_NORMAL
store i32 %12, i32* %4
br label %13
13: ; preds = %0
%14 = call i32 @pthread_mutexattr_init(i32* %2)
store i32 %14, i32* %5
%15 = load i32, i32* %5
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %13
%18 = load i32, i32* @stderr
%19 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 360, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%20 = load i32, i32* %5
store i32 %20, i32* %1
br label %102
21: ; preds = %13
br label %22
22: ; preds = %21
br label %23
23: ; preds = %22
%24 = load i32, i32* %4
%25 = call i32 @pthread_mutexattr_settype(i32* %2, i32 %24)
store i32 %25, i32* %6
%26 = load i32, i32* %6
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %32
28: ; preds = %23
%29 = load i32, i32* @stderr
%30 = call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 361, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
%31 = load i32, i32* %6
store i32 %31, i32* %1
br label %102
32: ; preds = %23
br label %33
33: ; preds = %32
br label %34
34: ; preds = %33
%35 = call i32 @pthread_mutex_init(i32* %3, i32* %2)
store i32 %35, i32* %7
%36 = load i32, i32* %7
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %42
38: ; preds = %34
%39 = load i32, i32* @stderr
%40 = call i32 @fprintf(i32 %39, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 362, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
%41 = load i32, i32* %7
store i32 %41, i32* %1
br label %102
42: ; preds = %34
br label %43
43: ; preds = %42
br label %44
44: ; preds = %43
%45 = call i32 @pthread_mutex_lock(i32* %3)
store i32 %45, i32* %8
%46 = load i32, i32* %8
%47 = icmp ne i32 %46, 0
br i1 %47, label %48, label %52
48: ; preds = %44
%49 = load i32, i32* @stderr
%50 = call i32 @fprintf(i32 %49, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 363, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%51 = load i32, i32* %8
store i32 %51, i32* %1
br label %102
52: ; preds = %44
br label %53
53: ; preds = %52
br label %54
54: ; preds = %53
%55 = call i64 @pthread_mutex_trylock(i32* %3)
%56 = load i64, i64* @EBUSY
%57 = icmp ne i64 %55, %56
br i1 %57, label %58, label %61
58: ; preds = %54
%59 = load i32, i32* @stderr
%60 = call i32 @fprintf(i32 %59, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 364, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %1
br label %102
61: ; preds = %54
br label %62
62: ; preds = %61
br label %63
63: ; preds = %62
%64 = load i32, i32* @EDEADLK
%65 = call i32 @find_recorded_error(i32 %64)
%66 = icmp ne i32 %65, 1
br i1 %66, label %67, label %70
67: ; preds = %63
%68 = load i32, i32* @stderr
%69 = call i32 @fprintf(i32 %68, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 365, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %1
br label %102
70: ; preds = %63
br label %71
71: ; preds = %70
br label %72
72: ; preds = %71
%73 = call i32 @pthread_mutex_unlock(i32* %3)
store i32 %73, i32* %9
%74 = load i32, i32* %9
%75 = icmp ne i32 %74, 0
br i1 %75, label %76, label %80
76: ; preds = %72
%77 = load i32, i32* @stderr
%78 = call i32 @fprintf(i32 %77, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 366, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0))
%79 = load i32, i32* %9
store i32 %79, i32* %1
br label %102
80: ; preds = %72
br label %81
81: ; preds = %80
br label %82
82: ; preds = %81
%83 = call i32 @pthread_mutexattr_destroy(i32* %2)
store i32 %83, i32* %10
%84 = load i32, i32* %10
%85 = icmp ne i32 %84, 0
br i1 %85, label %86, label %90
86: ; preds = %82
%87 = load i32, i32* @stderr
%88 = call i32 @fprintf(i32 %87, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 367, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.8, i64 0, i64 0))
%89 = load i32, i32* %10
store i32 %89, i32* %1
br label %102
90: ; preds = %82
br label %91
91: ; preds = %90
br label %92
92: ; preds = %91
%93 = call i32 @pthread_mutex_destroy(i32* %3)
store i32 %93, i32* %11
%94 = load i32, i32* %11
%95 = icmp ne i32 %94, 0
br i1 %95, label %96, label %100
96: ; preds = %92
%97 = load i32, i32* @stderr
%98 = call i32 @fprintf(i32 %97, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 368, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0))
%99 = load i32, i32* %11
store i32 %99, i32* %1
br label %102
100: ; preds = %92
br label %101
101: ; preds = %100
store i32 0, i32* %1
br label %102
102: ; preds = %101, %96, %86, %76, %67, %58, %48, %38, %28, %17
%103 = load i32, i32* %1
ret i32 %103
}

LLVM IR (-O2):
@PTHREAD_MUTEX_NORMAL = global i32 0
@stderr = global i32 0
@.str = [23 x i8] c"failed on line %d: %s\0A\00"
@.str.1 = [30 x i8] c"pthread_mutexattr_init(&attr)\00"
@.str.2 = [37 x i8] c"pthread_mutexattr_settype(&attr, ty)\00"
@.str.3 = [34 x i8] c"pthread_mutex_init(&mutex, &attr)\00"
@.str.4 = [27 x i8] c"pthread_mutex_lock(&mutex)\00"
@EBUSY = global i64 0
@.str.5 = [30 x i8] c"pthread_mutex_trylock(&mutex)\00"
@EDEADLK = global i32 0
@.str.6 = [29 x i8] c"find_recorded_error(EDEADLK)\00"
@.str.7 = [29 x i8] c"pthread_mutex_unlock(&mutex)\00"
@.str.8 = [33 x i8] c"pthread_mutexattr_destroy(&attr)\00"
@.str.9 = [30 x i8] c"pthread_mutex_destroy(&mutex)\00"
define i32 @test_recursion_on_nonrecursive() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = load i32, i32* @PTHREAD_MUTEX_NORMAL
%6 = call i32 @pthread_mutexattr_init(i32* %1)
%7 = icmp eq i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %0
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 360, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
br label %61
11: ; preds = %0
%12 = call i32 @pthread_mutexattr_settype(i32* %1, i32 %5)
%13 = icmp eq i32 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %11
%15 = load i32, i32* @stderr
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 361, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
br label %61
17: ; preds = %11
%18 = call i32 @pthread_mutex_init(i32* %2, i32* %1)
%19 = icmp eq i32 %18, 0
br i1 %19, label %23, label %20
20: ; preds = %17
%21 = load i32, i32* @stderr
%22 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 362, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
br label %61
23: ; preds = %17
%24 = call i32 @pthread_mutex_lock(i32* %2)
%25 = icmp eq i32 %24, 0
br i1 %25, label %29, label %26
26: ; preds = %23
%27 = load i32, i32* @stderr
%28 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 363, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
br label %61
29: ; preds = %23
%30 = call i64 @pthread_mutex_trylock(i32* %2)
%31 = load i64, i64* @EBUSY
%32 = icmp eq i64 %30, %31
br i1 %32, label %36, label %33
33: ; preds = %29
%34 = load i32, i32* @stderr
%35 = call i32 @fprintf(i32 %34, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 364, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
br label %61
36: ; preds = %29
%37 = load i32, i32* @EDEADLK
%38 = call i32 @find_recorded_error(i32 %37)
%39 = icmp eq i32 %38, 1
br i1 %39, label %43, label %40
40: ; preds = %36
%41 = load i32, i32* @stderr
%42 = call i32 @fprintf(i32 %41, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 365, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0))
br label %61
43: ; preds = %36
%44 = call i32 @pthread_mutex_unlock(i32* %2)
%45 = icmp eq i32 %44, 0
br i1 %45, label %49, label %46
46: ; preds = %43
%47 = load i32, i32* @stderr
%48 = call i32 @fprintf(i32 %47, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 366, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0))
br label %61
49: ; preds = %43
%50 = call i32 @pthread_mutexattr_destroy(i32* %1)
%51 = icmp eq i32 %50, 0
br i1 %51, label %55, label %52
52: ; preds = %49
%53 = load i32, i32* @stderr
%54 = call i32 @fprintf(i32 %53, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 367, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.8, i64 0, i64 0))
br label %61
55: ; preds = %49
%56 = call i32 @pthread_mutex_destroy(i32* %2)
%57 = icmp eq i32 %56, 0
br i1 %57, label %61, label %58
58: ; preds = %55
%59 = load i32, i32* @stderr
%60 = call i32 @fprintf(i32 %59, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 368, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0))
br label %61
61: ; preds = %58, %55, %52, %46, %26, %20, %14, %8, %40, %33
%62 = phi i32 [ 1, %33 ], [ 1, %40 ], [ %50, %52 ], [ %44, %46 ], [ %24, %26 ], [ %18, %20 ], [ %12, %14 ], [ %6, %8 ], [ 0, %55 ], [ %56, %58 ]
ret i32 %62
}