#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_spinlock_t;
typedef int /*<<< orphan*/ pthread_mutex_t;

/* Variables and functions */
int /*<<< orphan*/ EWOULDBLOCK;
int /*<<< orphan*/ clear_recorded_errors();
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*/ *);
int pthread_mutex_unlock(int /*<<< orphan*/ *);
int pthread_spin_destroy(int /*<<< orphan*/ *);
int pthread_spin_init(int /*<<< orphan*/ *, int /*<<< orphan*/);
int pthread_spin_lock(int /*<<< orphan*/ *);
int pthread_spin_unlock(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int test_take_sleeping_lock_while_holding_spin(void) {
  pthread_mutex_t mutex;
  pthread_spinlock_t spin;
  do {
    int __my_ret__ = pthread_mutex_init(&mutex, NULL);
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 268,
              "pthread_mutex_init(&mutex, NULL)");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = pthread_spin_init(&spin, 0);
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 269,
              "pthread_spin_init(&spin, 0)");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = pthread_mutex_lock(&mutex);
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 272,
              "pthread_mutex_lock(&mutex)");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = pthread_spin_lock(&spin);
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 273,
              "pthread_spin_lock(&spin)");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = pthread_spin_unlock(&spin);
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 274,
              "pthread_spin_unlock(&spin)");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = pthread_mutex_unlock(&mutex);
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 275,
              "pthread_mutex_unlock(&mutex)");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    if ((find_recorded_error(EWOULDBLOCK)) != (0)) {
      fprintf(stderr, "failed on line %d: %s\n", 276,
              "find_recorded_error(EWOULDBLOCK)");
      return 1;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = pthread_spin_lock(&spin);
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 279,
              "pthread_spin_lock(&spin)");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = pthread_mutex_lock(&mutex);
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 280,
              "pthread_mutex_lock(&mutex)");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = pthread_mutex_unlock(&mutex);
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 281,
              "pthread_mutex_unlock(&mutex)");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = pthread_spin_unlock(&spin);
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 282,
              "pthread_spin_unlock(&spin)");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    if ((find_recorded_error(EWOULDBLOCK)) != (1)) {
      fprintf(stderr, "failed on line %d: %s\n", 283,
              "find_recorded_error(EWOULDBLOCK)");
      return 1;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = pthread_spin_lock(&spin);
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 287,
              "pthread_spin_lock(&spin)");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = pthread_mutex_lock(&mutex);
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 288,
              "pthread_mutex_lock(&mutex)");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = pthread_mutex_unlock(&mutex);
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 289,
              "pthread_mutex_unlock(&mutex)");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = pthread_spin_unlock(&spin);
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 290,
              "pthread_spin_unlock(&spin)");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    if ((find_recorded_error(EWOULDBLOCK)) != (0)) {
      fprintf(stderr, "failed on line %d: %s\n", 291,
              "find_recorded_error(EWOULDBLOCK)");
      return 1;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = pthread_spin_destroy(&spin);
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 293,
              "pthread_spin_destroy(&spin)");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = pthread_mutex_destroy(&mutex);
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 294,
              "pthread_mutex_destroy(&mutex)");
      return __my_ret__;
    }
  } while (0);
  ;
  clear_recorded_errors();
  return 0;
}


x86 assembly (clang, -O0):
<test_take_sleeping_lock_while_holding_spin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   10c0 <pthread_mutex_init@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     11fe <test_take_sleeping_lock_while_holding_spin+0x4e>
mov    0x2e07(%rip),%rax
mov    (%rax),%edi
lea    0xe1e(%rip),%rsi
mov    $0x10c,%edx
lea    0xe29(%rip),%rcx
call   1060 <fprintf@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1771 <test_take_sleeping_lock_while_holding_spin+0x5c1>
jmp    1203 <test_take_sleeping_lock_while_holding_spin+0x53>
jmp    1208 <test_take_sleeping_lock_while_holding_spin+0x58>
lea    -0xc(%rbp),%rdi
xor    %esi,%esi
call   1050 <pthread_spin_init@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     124c <test_take_sleeping_lock_while_holding_spin+0x9c>
mov    0x2db9(%rip),%rax
mov    (%rax),%edi
lea    0xdd0(%rip),%rsi
mov    $0x10d,%edx
lea    0xdfc(%rip),%rcx
call   1060 <fprintf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1771 <test_take_sleeping_lock_while_holding_spin+0x5c1>
jmp    1251 <test_take_sleeping_lock_while_holding_spin+0xa1>
jmp    1256 <test_take_sleeping_lock_while_holding_spin+0xa6>
lea    -0x8(%rbp),%rdi
call   10d0 <pthread_mutex_lock@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     1298 <test_take_sleeping_lock_while_holding_spin+0xe8>
mov    0x2d6d(%rip),%rax
mov    (%rax),%edi
lea    0xd84(%rip),%rsi
mov    $0x110,%edx
lea    0xdcc(%rip),%rcx
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1771 <test_take_sleeping_lock_while_holding_spin+0x5c1>
jmp    129d <test_take_sleeping_lock_while_holding_spin+0xed>
jmp    12a2 <test_take_sleeping_lock_while_holding_spin+0xf2>
lea    -0xc(%rbp),%rdi
call   1030 <pthread_spin_lock@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     12e4 <test_take_sleeping_lock_while_holding_spin+0x134>
mov    0x2d21(%rip),%rax
mov    (%rax),%edi
lea    0xd38(%rip),%rsi
mov    $0x111,%edx
lea    0xd9b(%rip),%rcx
call   1060 <fprintf@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1771 <test_take_sleeping_lock_while_holding_spin+0x5c1>
jmp    12e9 <test_take_sleeping_lock_while_holding_spin+0x139>
jmp    12ee <test_take_sleeping_lock_while_holding_spin+0x13e>
lea    -0xc(%rbp),%rdi
call   1070 <pthread_spin_unlock@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     1330 <test_take_sleeping_lock_while_holding_spin+0x180>
mov    0x2cd5(%rip),%rax
mov    (%rax),%edi
lea    0xcec(%rip),%rsi
mov    $0x112,%edx
lea    0xd68(%rip),%rcx
call   1060 <fprintf@plt>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1771 <test_take_sleeping_lock_while_holding_spin+0x5c1>
jmp    1335 <test_take_sleeping_lock_while_holding_spin+0x185>
jmp    133a <test_take_sleeping_lock_while_holding_spin+0x18a>
lea    -0x8(%rbp),%rdi
call   1080 <pthread_mutex_unlock@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     137c <test_take_sleeping_lock_while_holding_spin+0x1cc>
mov    0x2c89(%rip),%rax
mov    (%rax),%edi
lea    0xca0(%rip),%rsi
mov    $0x113,%edx
lea    0xd37(%rip),%rcx
call   1060 <fprintf@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1771 <test_take_sleeping_lock_while_holding_spin+0x5c1>
jmp    1381 <test_take_sleeping_lock_while_holding_spin+0x1d1>
jmp    1386 <test_take_sleeping_lock_while_holding_spin+0x1d6>
mov    0x2c4b(%rip),%rax
mov    (%rax),%edi
call   10b0 <find_recorded_error@plt>
cmp    $0x0,%eax
je     13ca <test_take_sleeping_lock_while_holding_spin+0x21a>
mov    0x2c3c(%rip),%rax
mov    (%rax),%edi
lea    0xc53(%rip),%rsi
mov    $0x114,%edx
lea    0xd07(%rip),%rcx
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1771 <test_take_sleeping_lock_while_holding_spin+0x5c1>
jmp    13cf <test_take_sleeping_lock_while_holding_spin+0x21f>
jmp    13d4 <test_take_sleeping_lock_while_holding_spin+0x224>
lea    -0xc(%rbp),%rdi
call   1030 <pthread_spin_lock@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
je     1416 <test_take_sleeping_lock_while_holding_spin+0x266>
mov    0x2bef(%rip),%rax
mov    (%rax),%edi
lea    0xc06(%rip),%rsi
mov    $0x117,%edx
lea    0xc69(%rip),%rcx
call   1060 <fprintf@plt>
mov    -0x28(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1771 <test_take_sleeping_lock_while_holding_spin+0x5c1>
jmp    141b <test_take_sleeping_lock_while_holding_spin+0x26b>
jmp    1420 <test_take_sleeping_lock_while_holding_spin+0x270>
lea    -0x8(%rbp),%rdi
call   10d0 <pthread_mutex_lock@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
je     1462 <test_take_sleeping_lock_while_holding_spin+0x2b2>
mov    0x2ba3(%rip),%rax
mov    (%rax),%edi
lea    0xbba(%rip),%rsi
mov    $0x118,%edx
lea    0xc02(%rip),%rcx
call   1060 <fprintf@plt>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1771 <test_take_sleeping_lock_while_holding_spin+0x5c1>
jmp    1467 <test_take_sleeping_lock_while_holding_spin+0x2b7>
jmp    146c <test_take_sleeping_lock_while_holding_spin+0x2bc>
lea    -0x8(%rbp),%rdi
call   1080 <pthread_mutex_unlock@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
je     14ae <test_take_sleeping_lock_while_holding_spin+0x2fe>
mov    0x2b57(%rip),%rax
mov    (%rax),%edi
lea    0xb6e(%rip),%rsi
mov    $0x119,%edx
lea    0xc05(%rip),%rcx
call   1060 <fprintf@plt>
mov    -0x30(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1771 <test_take_sleeping_lock_while_holding_spin+0x5c1>
jmp    14b3 <test_take_sleeping_lock_while_holding_spin+0x303>
jmp    14b8 <test_take_sleeping_lock_while_holding_spin+0x308>
lea    -0xc(%rbp),%rdi
call   1070 <pthread_spin_unlock@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
je     14fa <test_take_sleeping_lock_while_holding_spin+0x34a>
mov    0x2b0b(%rip),%rax
mov    (%rax),%edi
lea    0xb22(%rip),%rsi
mov    $0x11a,%edx
lea    0xb9e(%rip),%rcx
call   1060 <fprintf@plt>
mov    -0x34(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1771 <test_take_sleeping_lock_while_holding_spin+0x5c1>
jmp    14ff <test_take_sleeping_lock_while_holding_spin+0x34f>
jmp    1504 <test_take_sleeping_lock_while_holding_spin+0x354>
mov    0x2acd(%rip),%rax
mov    (%rax),%edi
call   10b0 <find_recorded_error@plt>
cmp    $0x1,%eax
je     1548 <test_take_sleeping_lock_while_holding_spin+0x398>
mov    0x2abe(%rip),%rax
mov    (%rax),%edi
lea    0xad5(%rip),%rsi
mov    $0x11b,%edx
lea    0xb89(%rip),%rcx
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1771 <test_take_sleeping_lock_while_holding_spin+0x5c1>
jmp    154d <test_take_sleeping_lock_while_holding_spin+0x39d>
jmp    1552 <test_take_sleeping_lock_while_holding_spin+0x3a2>
lea    -0xc(%rbp),%rdi
call   1030 <pthread_spin_lock@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0x0,-0x38(%rbp)
je     1594 <test_take_sleeping_lock_while_holding_spin+0x3e4>
mov    0x2a71(%rip),%rax
mov    (%rax),%edi
lea    0xa88(%rip),%rsi
mov    $0x11f,%edx
lea    0xaeb(%rip),%rcx
call   1060 <fprintf@plt>
mov    -0x38(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1771 <test_take_sleeping_lock_while_holding_spin+0x5c1>
jmp    1599 <test_take_sleeping_lock_while_holding_spin+0x3e9>
jmp    159e <test_take_sleeping_lock_while_holding_spin+0x3ee>
lea    -0x8(%rbp),%rdi
call   10d0 <pthread_mutex_lock@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
je     15e0 <test_take_sleeping_lock_while_holding_spin+0x430>
mov    0x2a25(%rip),%rax
mov    (%rax),%edi
lea    0xa3c(%rip),%rsi
mov    $0x120,%edx
lea    0xa84(%rip),%rcx
call   1060 <fprintf@plt>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1771 <test_take_sleeping_lock_while_holding_spin+0x5c1>
jmp    15e5 <test_take_sleeping_lock_while_holding_spin+0x435>
jmp    15ea <test_take_sleeping_lock_while_holding_spin+0x43a>
lea    -0x8(%rbp),%rdi
call   1080 <pthread_mutex_unlock@plt>
mov    %eax,-0x40(%rbp)
cmpl   $0x0,-0x40(%rbp)
je     162c <test_take_sleeping_lock_while_holding_spin+0x47c>
mov    0x29d9(%rip),%rax
mov    (%rax),%edi
lea    0x9f0(%rip),%rsi
mov    $0x121,%edx
lea    0xa87(%rip),%rcx
call   1060 <fprintf@plt>
mov    -0x40(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1771 <test_take_sleeping_lock_while_holding_spin+0x5c1>
jmp    1631 <test_take_sleeping_lock_while_holding_spin+0x481>
jmp    1636 <test_take_sleeping_lock_while_holding_spin+0x486>
lea    -0xc(%rbp),%rdi
call   1070 <pthread_spin_unlock@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
je     1678 <test_take_sleeping_lock_while_holding_spin+0x4c8>
mov    0x298d(%rip),%rax
mov    (%rax),%edi
lea    0x9a4(%rip),%rsi
mov    $0x122,%edx
lea    0xa20(%rip),%rcx
call   1060 <fprintf@plt>
mov    -0x44(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1771 <test_take_sleeping_lock_while_holding_spin+0x5c1>
jmp    167d <test_take_sleeping_lock_while_holding_spin+0x4cd>
jmp    1682 <test_take_sleeping_lock_while_holding_spin+0x4d2>
mov    0x294f(%rip),%rax
mov    (%rax),%edi
call   10b0 <find_recorded_error@plt>
cmp    $0x0,%eax
je     16c6 <test_take_sleeping_lock_while_holding_spin+0x516>
mov    0x2940(%rip),%rax
mov    (%rax),%edi
lea    0x957(%rip),%rsi
mov    $0x123,%edx
lea    0xa0b(%rip),%rcx
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1771 <test_take_sleeping_lock_while_holding_spin+0x5c1>
jmp    16cb <test_take_sleeping_lock_while_holding_spin+0x51b>
jmp    16d0 <test_take_sleeping_lock_while_holding_spin+0x520>
lea    -0xc(%rbp),%rdi
call   1090 <pthread_spin_destroy@plt>
mov    %eax,-0x48(%rbp)
cmpl   $0x0,-0x48(%rbp)
je     1712 <test_take_sleeping_lock_while_holding_spin+0x562>
mov    0x28f3(%rip),%rax
mov    (%rax),%edi
lea    0x90a(%rip),%rsi
mov    $0x125,%edx
lea    0x9df(%rip),%rcx
call   1060 <fprintf@plt>
mov    -0x48(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1771 <test_take_sleeping_lock_while_holding_spin+0x5c1>
jmp    1717 <test_take_sleeping_lock_while_holding_spin+0x567>
jmp    171c <test_take_sleeping_lock_while_holding_spin+0x56c>
lea    -0x8(%rbp),%rdi
call   1040 <pthread_mutex_destroy@plt>
mov    %eax,-0x4c(%rbp)
cmpl   $0x0,-0x4c(%rbp)
je     175e <test_take_sleeping_lock_while_holding_spin+0x5ae>
mov    0x28a7(%rip),%rax
mov    (%rax),%edi
lea    0x8be(%rip),%rsi
mov    $0x126,%edx
lea    0x9af(%rip),%rcx
call   1060 <fprintf@plt>
mov    -0x4c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1771 <test_take_sleeping_lock_while_holding_spin+0x5c1>
jmp    1763 <test_take_sleeping_lock_while_holding_spin+0x5b3>
mov    $0x0,%al
call   10a0 <clear_recorded_errors@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_take_sleeping_lock_while_holding_spin>:
push   %r14
push   %rbx
push   %rax
lea    0x4(%rsp),%rdi
xor    %esi,%esi
call   10c0 <pthread_mutex_init@plt>
test   %eax,%eax
je     11e7 <test_take_sleeping_lock_while_holding_spin+0x37>
mov    %eax,%ebx
mov    0x2e13(%rip),%rax
mov    (%rax),%edi
lea    0xe2a(%rip),%rsi
lea    0xe3a(%rip),%rcx
mov    $0x10c,%edx
jmp    12cd <test_take_sleeping_lock_while_holding_spin+0x11d>
mov    %rsp,%rdi
xor    %esi,%esi
call   1050 <pthread_spin_init@plt>
test   %eax,%eax
je     1218 <test_take_sleeping_lock_while_holding_spin+0x68>
mov    %eax,%ebx
mov    0x2de2(%rip),%rax
mov    (%rax),%edi
lea    0xdf9(%rip),%rsi
lea    0xe2a(%rip),%rcx
mov    $0x10d,%edx
jmp    12cd <test_take_sleeping_lock_while_holding_spin+0x11d>
lea    0x4(%rsp),%rdi
call   10d0 <pthread_mutex_lock@plt>
test   %eax,%eax
je     1249 <test_take_sleeping_lock_while_holding_spin+0x99>
mov    %eax,%ebx
mov    0x2db1(%rip),%rax
mov    (%rax),%edi
lea    0xdc8(%rip),%rsi
lea    0xe15(%rip),%rcx
mov    $0x110,%edx
jmp    12cd <test_take_sleeping_lock_while_holding_spin+0x11d>
mov    %rsp,%rdi
call   1030 <pthread_spin_lock@plt>
test   %eax,%eax
je     1275 <test_take_sleeping_lock_while_holding_spin+0xc5>
mov    %eax,%ebx
mov    0x2d82(%rip),%rax
mov    (%rax),%edi
lea    0xd99(%rip),%rsi
lea    0xe01(%rip),%rcx
mov    $0x111,%edx
jmp    12cd <test_take_sleeping_lock_while_holding_spin+0x11d>
mov    %rsp,%rdi
call   1070 <pthread_spin_unlock@plt>
test   %eax,%eax
je     12a1 <test_take_sleeping_lock_while_holding_spin+0xf1>
mov    %eax,%ebx
mov    0x2d56(%rip),%rax
mov    (%rax),%edi
lea    0xd6d(%rip),%rsi
lea    0xdee(%rip),%rcx
mov    $0x112,%edx
jmp    12cd <test_take_sleeping_lock_while_holding_spin+0x11d>
lea    0x4(%rsp),%rdi
call   1080 <pthread_mutex_unlock@plt>
test   %eax,%eax
je     12dc <test_take_sleeping_lock_while_holding_spin+0x12c>
mov    %eax,%ebx
mov    0x2d28(%rip),%rax
mov    (%rax),%edi
lea    0xd3f(%rip),%rsi
lea    0xddb(%rip),%rcx
mov    $0x113,%edx
call   1060 <fprintf@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2cf5(%rip),%r14
mov    (%r14),%edi
call   10b0 <find_recorded_error@plt>
test   %eax,%eax
je     1317 <test_take_sleeping_lock_while_holding_spin+0x167>
mov    0x2cea(%rip),%rax
mov    (%rax),%edi
lea    0xd01(%rip),%rsi
lea    0xdba(%rip),%rcx
mov    $0x114,%edx
call   1060 <fprintf@plt>
mov    $0x1,%ebx
jmp    12d2 <test_take_sleeping_lock_while_holding_spin+0x122>
mov    %rsp,%rdi
call   1030 <pthread_spin_lock@plt>
test   %eax,%eax
je     1343 <test_take_sleeping_lock_while_holding_spin+0x193>
mov    %eax,%ebx
mov    0x2cb4(%rip),%rax
mov    (%rax),%edi
lea    0xccb(%rip),%rsi
lea    0xd33(%rip),%rcx
mov    $0x117,%edx
jmp    12cd <test_take_sleeping_lock_while_holding_spin+0x11d>
lea    0x4(%rsp),%rdi
call   10d0 <pthread_mutex_lock@plt>
test   %eax,%eax
je     1374 <test_take_sleeping_lock_while_holding_spin+0x1c4>
mov    %eax,%ebx
mov    0x2c86(%rip),%rax
mov    (%rax),%edi
lea    0xc9d(%rip),%rsi
lea    0xcea(%rip),%rcx
mov    $0x118,%edx
jmp    12cd <test_take_sleeping_lock_while_holding_spin+0x11d>
lea    0x4(%rsp),%rdi
call   1080 <pthread_mutex_unlock@plt>
test   %eax,%eax
je     13a5 <test_take_sleeping_lock_while_holding_spin+0x1f5>
mov    %eax,%ebx
mov    0x2c55(%rip),%rax
mov    (%rax),%edi
lea    0xc6c(%rip),%rsi
lea    0xd08(%rip),%rcx
mov    $0x119,%edx
jmp    12cd <test_take_sleeping_lock_while_holding_spin+0x11d>
mov    %rsp,%rdi
call   1070 <pthread_spin_unlock@plt>
test   %eax,%eax
je     13d4 <test_take_sleeping_lock_while_holding_spin+0x224>
mov    %eax,%ebx
mov    0x2c26(%rip),%rax
mov    (%rax),%edi
lea    0xc3d(%rip),%rsi
lea    0xcbe(%rip),%rcx
mov    $0x11a,%edx
jmp    12cd <test_take_sleeping_lock_while_holding_spin+0x11d>
mov    (%r14),%edi
call   10b0 <find_recorded_error@plt>
cmp    $0x1,%eax
jne    1410 <test_take_sleeping_lock_while_holding_spin+0x260>
mov    %rsp,%rdi
call   1030 <pthread_spin_lock@plt>
test   %eax,%eax
je     1431 <test_take_sleeping_lock_while_holding_spin+0x281>
mov    %eax,%ebx
mov    0x2bea(%rip),%rax
mov    (%rax),%edi
lea    0xc01(%rip),%rsi
lea    0xc69(%rip),%rcx
mov    $0x11f,%edx
jmp    12cd <test_take_sleeping_lock_while_holding_spin+0x11d>
mov    0x2bc9(%rip),%rax
mov    (%rax),%edi
lea    0xbe0(%rip),%rsi
lea    0xc99(%rip),%rcx
mov    $0x11b,%edx
jmp    130b <test_take_sleeping_lock_while_holding_spin+0x15b>
lea    0x4(%rsp),%rdi
call   10d0 <pthread_mutex_lock@plt>
test   %eax,%eax
je     1462 <test_take_sleeping_lock_while_holding_spin+0x2b2>
mov    %eax,%ebx
mov    0x2b98(%rip),%rax
mov    (%rax),%edi
lea    0xbaf(%rip),%rsi
lea    0xbfc(%rip),%rcx
mov    $0x120,%edx
jmp    12cd <test_take_sleeping_lock_while_holding_spin+0x11d>
lea    0x4(%rsp),%rdi
call   1080 <pthread_mutex_unlock@plt>
test   %eax,%eax
je     1493 <test_take_sleeping_lock_while_holding_spin+0x2e3>
mov    %eax,%ebx
mov    0x2b67(%rip),%rax
mov    (%rax),%edi
lea    0xb7e(%rip),%rsi
lea    0xc1a(%rip),%rcx
mov    $0x121,%edx
jmp    12cd <test_take_sleeping_lock_while_holding_spin+0x11d>
mov    %rsp,%rdi
call   1070 <pthread_spin_unlock@plt>
test   %eax,%eax
je     14c2 <test_take_sleeping_lock_while_holding_spin+0x312>
mov    %eax,%ebx
mov    0x2b38(%rip),%rax
mov    (%rax),%edi
lea    0xb4f(%rip),%rsi
lea    0xbd0(%rip),%rcx
mov    $0x122,%edx
jmp    12cd <test_take_sleeping_lock_while_holding_spin+0x11d>
mov    (%r14),%edi
call   10b0 <find_recorded_error@plt>
test   %eax,%eax
je     14ef <test_take_sleeping_lock_while_holding_spin+0x33f>
mov    0x2b0b(%rip),%rax
mov    (%rax),%edi
lea    0xb22(%rip),%rsi
lea    0xbdb(%rip),%rcx
mov    $0x123,%edx
jmp    130b <test_take_sleeping_lock_while_holding_spin+0x15b>
mov    %rsp,%rdi
call   1090 <pthread_spin_destroy@plt>
test   %eax,%eax
je     151e <test_take_sleeping_lock_while_holding_spin+0x36e>
mov    %eax,%ebx
mov    0x2adc(%rip),%rax
mov    (%rax),%edi
lea    0xaf3(%rip),%rsi
lea    0xbcd(%rip),%rcx
mov    $0x125,%edx
jmp    12cd <test_take_sleeping_lock_while_holding_spin+0x11d>
lea    0x4(%rsp),%rdi
call   1040 <pthread_mutex_destroy@plt>
test   %eax,%eax
je     154f <test_take_sleeping_lock_while_holding_spin+0x39f>
mov    %eax,%ebx
mov    0x2aab(%rip),%rax
mov    (%rax),%edi
lea    0xac2(%rip),%rsi
lea    0xbb8(%rip),%rcx
mov    $0x126,%edx
jmp    12cd <test_take_sleeping_lock_while_holding_spin+0x11d>
xor    %ebx,%ebx
xor    %eax,%eax
call   10a0 <clear_recorded_errors@plt>
jmp    12d2 <test_take_sleeping_lock_while_holding_spin+0x122>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [23 x i8] c"failed on line %d: %s\0A\00"
@.str.1 = [33 x i8] c"pthread_mutex_init(&mutex, NULL)\00"
@.str.2 = [28 x i8] c"pthread_spin_init(&spin, 0)\00"
@.str.3 = [27 x i8] c"pthread_mutex_lock(&mutex)\00"
@.str.4 = [25 x i8] c"pthread_spin_lock(&spin)\00"
@.str.5 = [27 x i8] c"pthread_spin_unlock(&spin)\00"
@.str.6 = [29 x i8] c"pthread_mutex_unlock(&mutex)\00"
@EWOULDBLOCK = global i32 0
@.str.7 = [33 x i8] c"find_recorded_error(EWOULDBLOCK)\00"
@.str.8 = [28 x i8] c"pthread_spin_destroy(&spin)\00"
@.str.9 = [30 x i8] c"pthread_mutex_destroy(&mutex)\00"
define i32 @test_take_sleeping_lock_while_holding_spin() {
%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 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
br label %20
20: ; preds = %0
%21 = call i32 @pthread_mutex_init(i32* %2, i32* null)
store i32 %21, i32* %4
%22 = load i32, i32* %4
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %28
24: ; preds = %20
%25 = load i32, i32* @stderr
%26 = call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 268, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%27 = load i32, i32* %4
store i32 %27, i32* %1
br label %208
28: ; preds = %20
br label %29
29: ; preds = %28
br label %30
30: ; preds = %29
%31 = call i32 @pthread_spin_init(i32* %3, i32 0)
store i32 %31, i32* %5
%32 = load i32, i32* %5
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %38
34: ; preds = %30
%35 = load i32, i32* @stderr
%36 = call i32 @fprintf(i32 %35, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 269, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%37 = load i32, i32* %5
store i32 %37, i32* %1
br label %208
38: ; preds = %30
br label %39
39: ; preds = %38
br label %40
40: ; preds = %39
%41 = call i32 @pthread_mutex_lock(i32* %2)
store i32 %41, i32* %6
%42 = load i32, i32* %6
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %48
44: ; preds = %40
%45 = load i32, i32* @stderr
%46 = call i32 @fprintf(i32 %45, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 272, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%47 = load i32, i32* %6
store i32 %47, i32* %1
br label %208
48: ; preds = %40
br label %49
49: ; preds = %48
br label %50
50: ; preds = %49
%51 = call i32 @pthread_spin_lock(i32* %3)
store i32 %51, i32* %7
%52 = load i32, i32* %7
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %58
54: ; preds = %50
%55 = load i32, i32* @stderr
%56 = call i32 @fprintf(i32 %55, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 273, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
%57 = load i32, i32* %7
store i32 %57, i32* %1
br label %208
58: ; preds = %50
br label %59
59: ; preds = %58
br label %60
60: ; preds = %59
%61 = call i32 @pthread_spin_unlock(i32* %3)
store i32 %61, i32* %8
%62 = load i32, i32* %8
%63 = icmp ne i32 %62, 0
br i1 %63, label %64, label %68
64: ; preds = %60
%65 = load i32, i32* @stderr
%66 = call i32 @fprintf(i32 %65, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 274, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
%67 = load i32, i32* %8
store i32 %67, i32* %1
br label %208
68: ; preds = %60
br label %69
69: ; preds = %68
br label %70
70: ; preds = %69
%71 = call i32 @pthread_mutex_unlock(i32* %2)
store i32 %71, i32* %9
%72 = load i32, i32* %9
%73 = icmp ne i32 %72, 0
br i1 %73, label %74, label %78
74: ; preds = %70
%75 = load i32, i32* @stderr
%76 = call i32 @fprintf(i32 %75, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 275, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0))
%77 = load i32, i32* %9
store i32 %77, i32* %1
br label %208
78: ; preds = %70
br label %79
79: ; preds = %78
br label %80
80: ; preds = %79
%81 = load i32, i32* @EWOULDBLOCK
%82 = call i32 @find_recorded_error(i32 %81)
%83 = icmp ne i32 %82, 0
br i1 %83, label %84, label %87
84: ; preds = %80
%85 = load i32, i32* @stderr
%86 = call i32 @fprintf(i32 %85, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 276, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0))
store i32 1, i32* %1
br label %208
87: ; preds = %80
br label %88
88: ; preds = %87
br label %89
89: ; preds = %88
%90 = call i32 @pthread_spin_lock(i32* %3)
store i32 %90, i32* %10
%91 = load i32, i32* %10
%92 = icmp ne i32 %91, 0
br i1 %92, label %93, label %97
93: ; preds = %89
%94 = load i32, i32* @stderr
%95 = call i32 @fprintf(i32 %94, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 279, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
%96 = load i32, i32* %10
store i32 %96, i32* %1
br label %208
97: ; preds = %89
br label %98
98: ; preds = %97
br label %99
99: ; preds = %98
%100 = call i32 @pthread_mutex_lock(i32* %2)
store i32 %100, i32* %11
%101 = load i32, i32* %11
%102 = icmp ne i32 %101, 0
br i1 %102, label %103, label %107
103: ; preds = %99
%104 = load i32, i32* @stderr
%105 = call i32 @fprintf(i32 %104, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 280, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%106 = load i32, i32* %11
store i32 %106, i32* %1
br label %208
107: ; preds = %99
br label %108
108: ; preds = %107
br label %109
109: ; preds = %108
%110 = call i32 @pthread_mutex_unlock(i32* %2)
store i32 %110, i32* %12
%111 = load i32, i32* %12
%112 = icmp ne i32 %111, 0
br i1 %112, label %113, label %117
113: ; preds = %109
%114 = load i32, i32* @stderr
%115 = call i32 @fprintf(i32 %114, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 281, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0))
%116 = load i32, i32* %12
store i32 %116, i32* %1
br label %208
117: ; preds = %109
br label %118
118: ; preds = %117
br label %119
119: ; preds = %118
%120 = call i32 @pthread_spin_unlock(i32* %3)
store i32 %120, i32* %13
%121 = load i32, i32* %13
%122 = icmp ne i32 %121, 0
br i1 %122, label %123, label %127
123: ; preds = %119
%124 = load i32, i32* @stderr
%125 = call i32 @fprintf(i32 %124, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 282, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
%126 = load i32, i32* %13
store i32 %126, i32* %1
br label %208
127: ; preds = %119
br label %128
128: ; preds = %127
br label %129
129: ; preds = %128
%130 = load i32, i32* @EWOULDBLOCK
%131 = call i32 @find_recorded_error(i32 %130)
%132 = icmp ne i32 %131, 1
br i1 %132, label %133, label %136
133: ; preds = %129
%134 = load i32, i32* @stderr
%135 = call i32 @fprintf(i32 %134, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 283, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0))
store i32 1, i32* %1
br label %208
136: ; preds = %129
br label %137
137: ; preds = %136
br label %138
138: ; preds = %137
%139 = call i32 @pthread_spin_lock(i32* %3)
store i32 %139, i32* %14
%140 = load i32, i32* %14
%141 = icmp ne i32 %140, 0
br i1 %141, label %142, label %146
142: ; preds = %138
%143 = load i32, i32* @stderr
%144 = call i32 @fprintf(i32 %143, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 287, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
%145 = load i32, i32* %14
store i32 %145, i32* %1
br label %208
146: ; preds = %138
br label %147
147: ; preds = %146
br label %148
148: ; preds = %147
%149 = call i32 @pthread_mutex_lock(i32* %2)
store i32 %149, i32* %15
%150 = load i32, i32* %15
%151 = icmp ne i32 %150, 0
br i1 %151, label %152, label %156
152: ; preds = %148
%153 = load i32, i32* @stderr
%154 = call i32 @fprintf(i32 %153, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 288, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%155 = load i32, i32* %15
store i32 %155, i32* %1
br label %208
156: ; preds = %148
br label %157
157: ; preds = %156
br label %158
158: ; preds = %157
%159 = call i32 @pthread_mutex_unlock(i32* %2)
store i32 %159, i32* %16
%160 = load i32, i32* %16
%161 = icmp ne i32 %160, 0
br i1 %161, label %162, label %166
162: ; preds = %158
%163 = load i32, i32* @stderr
%164 = call i32 @fprintf(i32 %163, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 289, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0))
%165 = load i32, i32* %16
store i32 %165, i32* %1
br label %208
166: ; preds = %158
br label %167
167: ; preds = %166
br label %168
168: ; preds = %167
%169 = call i32 @pthread_spin_unlock(i32* %3)
store i32 %169, i32* %17
%170 = load i32, i32* %17
%171 = icmp ne i32 %170, 0
br i1 %171, label %172, label %176
172: ; preds = %168
%173 = load i32, i32* @stderr
%174 = call i32 @fprintf(i32 %173, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 290, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
%175 = load i32, i32* %17
store i32 %175, i32* %1
br label %208
176: ; preds = %168
br label %177
177: ; preds = %176
br label %178
178: ; preds = %177
%179 = load i32, i32* @EWOULDBLOCK
%180 = call i32 @find_recorded_error(i32 %179)
%181 = icmp ne i32 %180, 0
br i1 %181, label %182, label %185
182: ; preds = %178
%183 = load i32, i32* @stderr
%184 = call i32 @fprintf(i32 %183, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 291, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0))
store i32 1, i32* %1
br label %208
185: ; preds = %178
br label %186
186: ; preds = %185
br label %187
187: ; preds = %186
%188 = call i32 @pthread_spin_destroy(i32* %3)
store i32 %188, i32* %18
%189 = load i32, i32* %18
%190 = icmp ne i32 %189, 0
br i1 %190, label %191, label %195
191: ; preds = %187
%192 = load i32, i32* @stderr
%193 = call i32 @fprintf(i32 %192, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 293, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0))
%194 = load i32, i32* %18
store i32 %194, i32* %1
br label %208
195: ; preds = %187
br label %196
196: ; preds = %195
br label %197
197: ; preds = %196
%198 = call i32 @pthread_mutex_destroy(i32* %2)
store i32 %198, i32* %19
%199 = load i32, i32* %19
%200 = icmp ne i32 %199, 0
br i1 %200, label %201, label %205
201: ; preds = %197
%202 = load i32, i32* @stderr
%203 = call i32 @fprintf(i32 %202, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 294, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0))
%204 = load i32, i32* %19
store i32 %204, i32* %1
br label %208
205: ; preds = %197
br label %206
206: ; preds = %205
%207 = call i32 (...) @clear_recorded_errors()
store i32 0, i32* %1
br label %208
208: ; preds = %206, %201, %191, %182, %172, %162, %152, %142, %133, %123, %113, %103, %93, %84, %74, %64, %54, %44, %34, %24
%209 = load i32, i32* %1
ret i32 %209
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [23 x i8] c"failed on line %d: %s\0A\00"
@.str.1 = [33 x i8] c"pthread_mutex_init(&mutex, NULL)\00"
@.str.2 = [28 x i8] c"pthread_spin_init(&spin, 0)\00"
@.str.3 = [27 x i8] c"pthread_mutex_lock(&mutex)\00"
@.str.4 = [25 x i8] c"pthread_spin_lock(&spin)\00"
@.str.5 = [27 x i8] c"pthread_spin_unlock(&spin)\00"
@.str.6 = [29 x i8] c"pthread_mutex_unlock(&mutex)\00"
@EWOULDBLOCK = global i32 0
@.str.7 = [33 x i8] c"find_recorded_error(EWOULDBLOCK)\00"
@.str.8 = [28 x i8] c"pthread_spin_destroy(&spin)\00"
@.str.9 = [30 x i8] c"pthread_mutex_destroy(&mutex)\00"
define i32 @test_take_sleeping_lock_while_holding_spin() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @pthread_mutex_init(i32* %1, i32* null)
%6 = icmp eq i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %0
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 268, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
br label %123
10: ; preds = %0
%11 = call i32 @pthread_spin_init(i32* %2, i32 0)
%12 = icmp eq i32 %11, 0
br i1 %12, label %16, label %13
13: ; preds = %10
%14 = load i32, i32* @stderr
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 269, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
br label %123
16: ; preds = %10
%17 = call i32 @pthread_mutex_lock(i32* %1)
%18 = icmp eq i32 %17, 0
br i1 %18, label %22, label %19
19: ; preds = %16
%20 = load i32, i32* @stderr
%21 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 272, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
br label %123
22: ; preds = %16
%23 = call i32 @pthread_spin_lock(i32* %2)
%24 = icmp eq i32 %23, 0
br i1 %24, label %28, label %25
25: ; preds = %22
%26 = load i32, i32* @stderr
%27 = call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 273, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
br label %123
28: ; preds = %22
%29 = call i32 @pthread_spin_unlock(i32* %2)
%30 = icmp eq i32 %29, 0
br i1 %30, label %34, label %31
31: ; preds = %28
%32 = load i32, i32* @stderr
%33 = call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 274, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
br label %123
34: ; preds = %28
%35 = call i32 @pthread_mutex_unlock(i32* %1)
%36 = icmp eq i32 %35, 0
br i1 %36, label %40, label %37
37: ; preds = %34
%38 = load i32, i32* @stderr
%39 = call i32 @fprintf(i32 %38, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 275, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0))
br label %123
40: ; preds = %34
%41 = load i32, i32* @EWOULDBLOCK
%42 = call i32 @find_recorded_error(i32 %41)
%43 = icmp eq i32 %42, 0
br i1 %43, label %47, label %44
44: ; preds = %40
%45 = load i32, i32* @stderr
%46 = call i32 @fprintf(i32 %45, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 276, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0))
br label %123
47: ; preds = %40
%48 = call i32 @pthread_spin_lock(i32* %2)
%49 = icmp eq i32 %48, 0
br i1 %49, label %53, label %50
50: ; preds = %47
%51 = load i32, i32* @stderr
%52 = call i32 @fprintf(i32 %51, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 279, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
br label %123
53: ; preds = %47
%54 = call i32 @pthread_mutex_lock(i32* %1)
%55 = icmp eq i32 %54, 0
br i1 %55, label %59, label %56
56: ; preds = %53
%57 = load i32, i32* @stderr
%58 = call i32 @fprintf(i32 %57, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 280, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
br label %123
59: ; preds = %53
%60 = call i32 @pthread_mutex_unlock(i32* %1)
%61 = icmp eq i32 %60, 0
br i1 %61, label %65, label %62
62: ; preds = %59
%63 = load i32, i32* @stderr
%64 = call i32 @fprintf(i32 %63, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 281, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0))
br label %123
65: ; preds = %59
%66 = call i32 @pthread_spin_unlock(i32* %2)
%67 = icmp eq i32 %66, 0
br i1 %67, label %71, label %68
68: ; preds = %65
%69 = load i32, i32* @stderr
%70 = call i32 @fprintf(i32 %69, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 282, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
br label %123
71: ; preds = %65
%72 = load i32, i32* @EWOULDBLOCK
%73 = call i32 @find_recorded_error(i32 %72)
%74 = icmp eq i32 %73, 1
br i1 %74, label %78, label %75
75: ; preds = %71
%76 = load i32, i32* @stderr
%77 = call i32 @fprintf(i32 %76, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 283, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0))
br label %123
78: ; preds = %71
%79 = call i32 @pthread_spin_lock(i32* %2)
%80 = icmp eq i32 %79, 0
br i1 %80, label %84, label %81
81: ; preds = %78
%82 = load i32, i32* @stderr
%83 = call i32 @fprintf(i32 %82, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 287, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
br label %123
84: ; preds = %78
%85 = call i32 @pthread_mutex_lock(i32* %1)
%86 = icmp eq i32 %85, 0
br i1 %86, label %90, label %87
87: ; preds = %84
%88 = load i32, i32* @stderr
%89 = call i32 @fprintf(i32 %88, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 288, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
br label %123
90: ; preds = %84
%91 = call i32 @pthread_mutex_unlock(i32* %1)
%92 = icmp eq i32 %91, 0
br i1 %92, label %96, label %93
93: ; preds = %90
%94 = load i32, i32* @stderr
%95 = call i32 @fprintf(i32 %94, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 289, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0))
br label %123
96: ; preds = %90
%97 = call i32 @pthread_spin_unlock(i32* %2)
%98 = icmp eq i32 %97, 0
br i1 %98, label %102, label %99
99: ; preds = %96
%100 = load i32, i32* @stderr
%101 = call i32 @fprintf(i32 %100, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 290, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
br label %123
102: ; preds = %96
%103 = load i32, i32* @EWOULDBLOCK
%104 = call i32 @find_recorded_error(i32 %103)
%105 = icmp eq i32 %104, 0
br i1 %105, label %109, label %106
106: ; preds = %102
%107 = load i32, i32* @stderr
%108 = call i32 @fprintf(i32 %107, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 291, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0))
br label %123
109: ; preds = %102
%110 = call i32 @pthread_spin_destroy(i32* %2)
%111 = icmp eq i32 %110, 0
br i1 %111, label %115, label %112
112: ; preds = %109
%113 = load i32, i32* @stderr
%114 = call i32 @fprintf(i32 %113, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 293, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0))
br label %123
115: ; preds = %109
%116 = call i32 @pthread_mutex_destroy(i32* %1)
%117 = icmp eq i32 %116, 0
br i1 %117, label %121, label %118
118: ; preds = %115
%119 = load i32, i32* @stderr
%120 = call i32 @fprintf(i32 %119, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 294, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0))
br label %123
121: ; preds = %115
%122 = call i32 (...) @clear_recorded_errors()
br label %123
123: ; preds = %118, %112, %99, %93, %87, %81, %68, %62, %56, %50, %37, %31, %25, %19, %13, %7, %121, %106, %75, %44
%124 = phi i32 [ 1, %44 ], [ 1, %75 ], [ 1, %106 ], [ 0, %121 ], [ %116, %118 ], [ %110, %112 ], [ %97, %99 ], [ %91, %93 ], [ %85, %87 ], [ %79, %81 ], [ %66, %68 ], [ %60, %62 ], [ %54, %56 ], [ %48, %50 ], [ %35, %37 ], [ %29, %31 ], [ %23, %25 ], [ %17, %19 ], [ %11, %13 ], [ %5, %7 ]
ret i32 %124
}