#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_rwlockattr_t;
typedef int /*<<< orphan*/ pthread_mutexattr_t;
typedef int /*<<< orphan*/ pthread_attr_t;

/* Variables and functions */
int EINVAL;
long PTHREAD_CANCEL_ASYNCHRONOUS;
long PTHREAD_CANCEL_DEFERRED;
long PTHREAD_CANCEL_DISABLE;
long PTHREAD_CANCEL_ENABLE;
long PTHREAD_CREATE_DETACHED;
long PTHREAD_CREATE_JOINABLE;
long PTHREAD_EXPLICIT_SCHED;
long PTHREAD_INHERIT_SCHED;
long PTHREAD_PROCESS_PRIVATE;
long PTHREAD_PROCESS_SHARED;
long PTHREAD_SCOPE_PROCESS;
long PTHREAD_SCOPE_SYSTEM;
long SCHED_FIFO;
long SCHED_OTHER;
long SCHED_RR;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, long);
scalar_t__ pthread_attr_getdetachstate(int /*<<< orphan*/ *, int *);
scalar_t__ pthread_attr_getinheritsched(int /*<<< orphan*/ *, int *);
scalar_t__ pthread_attr_getschedpolicy(int /*<<< orphan*/ *, int *);
scalar_t__ pthread_attr_getscope(int /*<<< orphan*/ *, int *);
scalar_t__ pthread_attr_init(int /*<<< orphan*/ *);
int pthread_attr_setdetachstate(int /*<<< orphan*/ *, long);
int pthread_attr_setinheritsched(int /*<<< orphan*/ *, long);
int pthread_attr_setschedpolicy(int /*<<< orphan*/ *, long);
int pthread_attr_setscope(int /*<<< orphan*/ *, long);
scalar_t__ pthread_mutexattr_getpshared(int /*<<< orphan*/ *, int *);
scalar_t__ pthread_mutexattr_init(int /*<<< orphan*/ *);
int pthread_mutexattr_setpshared(int /*<<< orphan*/ *, long);
scalar_t__ pthread_rwlockattr_getpshared(int /*<<< orphan*/ *, int *);
scalar_t__ pthread_rwlockattr_init(int /*<<< orphan*/ *);
int pthread_rwlockattr_setpshared(int /*<<< orphan*/ *, long);
scalar_t__ pthread_setcancelstate(long, int *);
scalar_t__ pthread_setcanceltype(long, int *);
int /*<<< orphan*/ puts(char *);
long random();
int do_test(void) {
  int i;
  pthread_attr_t a;
  if (pthread_attr_init(&a) != 0) {
    puts("attr_init failed");
    exit(1);
  }
  pthread_mutexattr_t ma;
  if (pthread_mutexattr_init(&ma) != 0) {
    puts("mutexattr_init failed");
    exit(1);
  }
  pthread_rwlockattr_t rwa;
  if (pthread_rwlockattr_init(&rwa) != 0) {
    puts("rwlockattr_init failed");
    exit(1);
  }
  pthread_attr_setinheritsched(&a, PTHREAD_INHERIT_SCHED);
  pthread_attr_setschedpolicy(&a, SCHED_OTHER);
  pthread_attr_setscope(&a, PTHREAD_SCOPE_SYSTEM);
  for (i = 0; i < 10000; ++i) {
    long int r = random();
    if (r != PTHREAD_CREATE_DETACHED && r != PTHREAD_CREATE_JOINABLE) {
      int e = pthread_attr_setdetachstate(&a, r);
      if (e == 0) {
        printf("attr_setdetachstate with value %ld succeeded\n", r);
        exit(1);
      }
      if (e != EINVAL) {
        puts("attr_setdetachstate didn't return EINVAL");
        exit(1);
      }
      int s;
      if (pthread_attr_getdetachstate(&a, &s) != 0) {
        puts("attr_getdetachstate failed");
        exit(1);
      }
      if (s != PTHREAD_CREATE_JOINABLE) {
        printf("detach state changed to %d by invalid setdetachstate call\n",
               s);
        exit(1);
      }
    }
    if (r != PTHREAD_INHERIT_SCHED && r != PTHREAD_EXPLICIT_SCHED) {
      int e = pthread_attr_setinheritsched(&a, r);
      if (e == 0) {
        printf("attr_setinheritsched with value %ld succeeded\n", r);
        exit(1);
      }
      if (e != EINVAL) {
        puts("attr_setinheritsched didn't return EINVAL");
        exit(1);
      }
      int s;
      if (pthread_attr_getinheritsched(&a, &s) != 0) {
        puts("attr_getinheritsched failed");
        exit(1);
      }
      if (s != PTHREAD_INHERIT_SCHED) {
        printf("inheritsched changed to %d by invalid setinheritsched call\n",
               s);
        exit(1);
      }
    }
    if (r != SCHED_OTHER && r != SCHED_RR && r != SCHED_FIFO) {
      int e = pthread_attr_setschedpolicy(&a, r);
      if (e == 0) {
        printf("attr_setschedpolicy with value %ld succeeded\n", r);
        exit(1);
      }
      if (e != EINVAL) {
        puts("attr_setschedpolicy didn't return EINVAL");
        exit(1);
      }
      int s;
      if (pthread_attr_getschedpolicy(&a, &s) != 0) {
        puts("attr_getschedpolicy failed");
        exit(1);
      }
      if (s != SCHED_OTHER) {
        printf("schedpolicy changed to %d by invalid setschedpolicy call\n", s);
        exit(1);
      }
    }
    if (r != PTHREAD_SCOPE_SYSTEM && r != PTHREAD_SCOPE_PROCESS) {
      int e = pthread_attr_setscope(&a, r);
      if (e == 0) {
        printf("attr_setscope with value %ld succeeded\n", r);
        exit(1);
      }
      if (e != EINVAL) {
        puts("attr_setscope didn't return EINVAL");
        exit(1);
      }
      int s;
      if (pthread_attr_getscope(&a, &s) != 0) {
        puts("attr_getscope failed");
        exit(1);
      }
      if (s != PTHREAD_SCOPE_SYSTEM) {
        printf("contentionscope changed to %d by invalid setscope call\n", s);
        exit(1);
      }
    }
    if (r != PTHREAD_PROCESS_PRIVATE && r != PTHREAD_PROCESS_SHARED) {
      int e = pthread_mutexattr_setpshared(&ma, r);
      if (e == 0) {
        printf("mutexattr_setpshared with value %ld succeeded\n", r);
        exit(1);
      }
      if (e != EINVAL) {
        puts("mutexattr_setpshared didn't return EINVAL");
        exit(1);
      }
      int s;
      if (pthread_mutexattr_getpshared(&ma, &s) != 0) {
        puts("mutexattr_getpshared failed");
        exit(1);
      }
      if (s != PTHREAD_PROCESS_PRIVATE) {
        printf("pshared changed to %d by invalid mutexattr_setpshared call\n",
               s);
        exit(1);
      }
      e = pthread_rwlockattr_setpshared(&rwa, r);
      if (e == 0) {
        printf("rwlockattr_setpshared with value %ld succeeded\n", r);
        exit(1);
      }
      if (e != EINVAL) {
        puts("rwlockattr_setpshared didn't return EINVAL");
        exit(1);
      }
      if (pthread_rwlockattr_getpshared(&rwa, &s) != 0) {
        puts("rwlockattr_getpshared failed");
        exit(1);
      }
      if (s != PTHREAD_PROCESS_PRIVATE) {
        printf("pshared changed to %d by invalid rwlockattr_setpshared call\n",
               s);
        exit(1);
      }
    }
    if (r != PTHREAD_CANCEL_ENABLE && r != PTHREAD_CANCEL_DISABLE) {
      int e = pthread_setcancelstate(r, NULL);
      if (e == 0) {
        printf("setcancelstate with value %ld succeeded\n", r);
        exit(1);
      }
      if (e != EINVAL) {
        puts("setcancelstate didn't return EINVAL");
        exit(1);
      }
      int s;
      if (pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &s) != 0) {
        puts("setcancelstate failed for PTHREAD_CANCEL_ENABLE");
        exit(1);
      }
      if (s != PTHREAD_CANCEL_ENABLE) {
        puts("invalid setcancelstate changed state");
        exit(1);
      }
    }
    if (r != PTHREAD_CANCEL_DEFERRED && r != PTHREAD_CANCEL_ASYNCHRONOUS) {
      int e = pthread_setcanceltype(r, NULL);
      if (e == 0) {
        printf("setcanceltype with value %ld succeeded\n", r);
        exit(1);
      }
      if (e != EINVAL) {
        puts("setcanceltype didn't return EINVAL");
        exit(1);
      }
      int s;
      if (pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &s) != 0) {
        puts("setcanceltype failed for PTHREAD_CANCEL_DEFERRED");
        exit(1);
      }
      if (s != PTHREAD_CANCEL_DEFERRED) {
        puts("invalid setcanceltype changed state");
        exit(1);
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<do_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    -0x8(%rbp),%rdi
call   10c0 <pthread_attr_init@plt>
cmp    $0x0,%rax
je     1281 <do_test+0x31>
lea    0xdaa(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
lea    -0xc(%rbp),%rdi
call   1160 <pthread_mutexattr_init@plt>
cmp    $0x0,%rax
je     12aa <do_test+0x5a>
lea    0xd65(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
lea    -0x10(%rbp),%rdi
call   10b0 <pthread_rwlockattr_init@plt>
cmp    $0x0,%rax
je     12d3 <do_test+0x83>
lea    0xd52(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
mov    0x2cbe(%rip),%rax
mov    (%rax),%rsi
lea    -0x8(%rbp),%rdi
call   1040 <pthread_attr_setinheritsched@plt>
mov    0x2cbb(%rip),%rax
mov    (%rax),%rsi
lea    -0x8(%rbp),%rdi
call   10a0 <pthread_attr_setschedpolicy@plt>
mov    0x2cd0(%rip),%rax
mov    (%rax),%rsi
lea    -0x8(%rbp),%rdi
call   10e0 <pthread_attr_setscope@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x2710,-0x4(%rbp)
jge    1a49 <do_test+0x7f9>
mov    $0x0,%al
call   1100 <random@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    0x2c82(%rip),%rcx
cmp    (%rcx),%rax
je     140f <do_test+0x1bf>
mov    -0x18(%rbp),%rax
mov    0x2c9e(%rip),%rcx
cmp    (%rcx),%rax
je     140f <do_test+0x1bf>
mov    -0x18(%rbp),%rsi
lea    -0x8(%rbp),%rdi
call   10f0 <pthread_attr_setdetachstate@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    1387 <do_test+0x137>
mov    -0x18(%rbp),%rsi
lea    0xcb5(%rip),%rdi
call   1070 <printf@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
mov    -0x1c(%rbp),%eax
mov    0x2bff(%rip),%rcx
cmp    (%rcx),%eax
je     13af <do_test+0x15f>
lea    0xcbb(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
lea    -0x8(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1170 <pthread_attr_getdetachstate@plt>
cmp    $0x0,%rax
je     13dc <do_test+0x18c>
lea    0xcb7(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
movslq -0x20(%rbp),%rax
mov    0x2c01(%rip),%rcx
cmp    (%rcx),%rax
je     140a <do_test+0x1ba>
movslq -0x20(%rbp),%rsi
lea    0xca4(%rip),%rdi
call   1070 <printf@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
jmp    140f <do_test+0x1bf>
mov    -0x18(%rbp),%rax
mov    0x2b7e(%rip),%rcx
cmp    (%rcx),%rax
je     14f3 <do_test+0x2a3>
mov    -0x18(%rbp),%rax
mov    0x2baa(%rip),%rcx
cmp    (%rcx),%rax
je     14f3 <do_test+0x2a3>
mov    -0x18(%rbp),%rsi
lea    -0x8(%rbp),%rdi
call   1040 <pthread_attr_setinheritsched@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    146b <do_test+0x21b>
mov    -0x18(%rbp),%rsi
lea    0xc7e(%rip),%rdi
call   1070 <printf@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
mov    -0x24(%rbp),%eax
mov    0x2b1b(%rip),%rcx
cmp    (%rcx),%eax
je     1493 <do_test+0x243>
lea    0xc85(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
lea    -0x8(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1110 <pthread_attr_getinheritsched@plt>
cmp    $0x0,%rax
je     14c0 <do_test+0x270>
lea    0xc82(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
movslq -0x28(%rbp),%rax
mov    0x2acd(%rip),%rcx
cmp    (%rcx),%rax
je     14ee <do_test+0x29e>
movslq -0x28(%rbp),%rsi
lea    0xc70(%rip),%rdi
call   1070 <printf@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
jmp    14f3 <do_test+0x2a3>
mov    -0x18(%rbp),%rax
mov    0x2aaa(%rip),%rcx
cmp    (%rcx),%rax
je     15eb <do_test+0x39b>
mov    -0x18(%rbp),%rax
mov    0x2a56(%rip),%rcx
cmp    (%rcx),%rax
je     15eb <do_test+0x39b>
mov    -0x18(%rbp),%rax
mov    0x2aa2(%rip),%rcx
cmp    (%rcx),%rax
je     15eb <do_test+0x39b>
mov    -0x18(%rbp),%rsi
lea    -0x8(%rbp),%rdi
call   10a0 <pthread_attr_setschedpolicy@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jne    1563 <do_test+0x313>
mov    -0x18(%rbp),%rsi
lea    0xc37(%rip),%rdi
call   1070 <printf@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
mov    -0x2c(%rbp),%eax
mov    0x2a23(%rip),%rcx
cmp    (%rcx),%eax
je     158b <do_test+0x33b>
lea    0xc3d(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
lea    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1120 <pthread_attr_getschedpolicy@plt>
cmp    $0x0,%rax
je     15b8 <do_test+0x368>
lea    0xc39(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
movslq -0x30(%rbp),%rax
mov    0x29e5(%rip),%rcx
cmp    (%rcx),%rax
je     15e6 <do_test+0x396>
movslq -0x30(%rbp),%rsi
lea    0xc26(%rip),%rdi
call   1070 <printf@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
jmp    15eb <do_test+0x39b>
mov    -0x18(%rbp),%rax
mov    0x29da(%rip),%rcx
cmp    (%rcx),%rax
je     16cf <do_test+0x47f>
mov    -0x18(%rbp),%rax
mov    0x2996(%rip),%rcx
cmp    (%rcx),%rax
je     16cf <do_test+0x47f>
mov    -0x18(%rbp),%rsi
lea    -0x8(%rbp),%rdi
call   10e0 <pthread_attr_setscope@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jne    1647 <do_test+0x3f7>
mov    -0x18(%rbp),%rsi
lea    0xbff(%rip),%rdi
call   1070 <printf@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
mov    -0x34(%rbp),%eax
mov    0x293f(%rip),%rcx
cmp    (%rcx),%eax
je     166f <do_test+0x41f>
lea    0xbff(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
lea    -0x8(%rbp),%rdi
lea    -0x38(%rbp),%rsi
call   1030 <pthread_attr_getscope@plt>
cmp    $0x0,%rax
je     169c <do_test+0x44c>
lea    0xbf5(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
movslq -0x38(%rbp),%rax
mov    0x2929(%rip),%rcx
cmp    (%rcx),%rax
je     16ca <do_test+0x47a>
movslq -0x38(%rbp),%rsi
lea    0xbdc(%rip),%rdi
call   1070 <printf@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
jmp    16cf <do_test+0x47f>
mov    -0x18(%rbp),%rax
mov    0x28a6(%rip),%rcx
cmp    (%rcx),%rax
je     186a <do_test+0x61a>
mov    -0x18(%rbp),%rax
mov    0x289a(%rip),%rcx
cmp    (%rcx),%rax
je     186a <do_test+0x61a>
mov    -0x18(%rbp),%rsi
lea    -0xc(%rbp),%rdi
call   10d0 <pthread_mutexattr_setpshared@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
jne    172b <do_test+0x4db>
mov    -0x18(%rbp),%rsi
lea    0xbb3(%rip),%rdi
call   1070 <printf@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
mov    -0x3c(%rbp),%eax
mov    0x285b(%rip),%rcx
cmp    (%rcx),%eax
je     1753 <do_test+0x503>
lea    0xbba(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
lea    -0xc(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1080 <pthread_mutexattr_getpshared@plt>
cmp    $0x0,%rax
je     1780 <do_test+0x530>
lea    0xbb7(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
movslq -0x40(%rbp),%rax
mov    0x27f5(%rip),%rcx
cmp    (%rcx),%rax
je     17ae <do_test+0x55e>
movslq -0x40(%rbp),%rsi
lea    0xba5(%rip),%rdi
call   1070 <printf@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
mov    -0x18(%rbp),%rsi
lea    -0x10(%rbp),%rdi
call   1090 <pthread_rwlockattr_setpshared@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
jne    17e2 <do_test+0x592>
mov    -0x18(%rbp),%rsi
lea    0xbad(%rip),%rdi
call   1070 <printf@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
mov    -0x3c(%rbp),%eax
mov    0x27a4(%rip),%rcx
cmp    (%rcx),%eax
je     180a <do_test+0x5ba>
lea    0xbb5(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
lea    -0x10(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1130 <pthread_rwlockattr_getpshared@plt>
cmp    $0x0,%rax
je     1837 <do_test+0x5e7>
lea    0xbb3(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
movslq -0x40(%rbp),%rax
mov    0x273e(%rip),%rcx
cmp    (%rcx),%rax
je     1865 <do_test+0x615>
movslq -0x40(%rbp),%rsi
lea    0xba2(%rip),%rdi
call   1070 <printf@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
jmp    186a <do_test+0x61a>
mov    -0x18(%rbp),%rax
mov    0x273b(%rip),%rcx
cmp    (%rcx),%rax
je     1950 <do_test+0x700>
mov    -0x18(%rbp),%rax
mov    0x26d7(%rip),%rcx
cmp    (%rcx),%rax
je     1950 <do_test+0x700>
mov    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1060 <pthread_setcancelstate@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
jne    18c6 <do_test+0x676>
mov    -0x18(%rbp),%rsi
lea    0xb7e(%rip),%rdi
call   1070 <printf@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
mov    -0x44(%rbp),%eax
mov    0x26c0(%rip),%rcx
cmp    (%rcx),%eax
je     18ee <do_test+0x69e>
lea    0xb7f(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
mov    0x26bb(%rip),%rax
mov    (%rax),%rdi
lea    -0x48(%rbp),%rsi
call   1060 <pthread_setcancelstate@plt>
cmp    $0x0,%rax
je     1921 <do_test+0x6d1>
lea    0xb70(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
movslq -0x48(%rbp),%rax
mov    0x2684(%rip),%rcx
cmp    (%rcx),%rax
je     194b <do_test+0x6fb>
lea    0xb76(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
jmp    1950 <do_test+0x700>
mov    -0x18(%rbp),%rax
mov    0x261d(%rip),%rcx
cmp    (%rcx),%rax
je     1a36 <do_test+0x7e6>
mov    -0x18(%rbp),%rax
mov    0x2671(%rip),%rcx
cmp    (%rcx),%rax
je     1a36 <do_test+0x7e6>
mov    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1140 <pthread_setcanceltype@plt>
mov    %eax,-0x4c(%rbp)
cmpl   $0x0,-0x4c(%rbp)
jne    19ac <do_test+0x75c>
mov    -0x18(%rbp),%rsi
lea    0xb3a(%rip),%rdi
call   1070 <printf@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
mov    -0x4c(%rbp),%eax
mov    0x25da(%rip),%rcx
cmp    (%rcx),%eax
je     19d4 <do_test+0x784>
lea    0xb3a(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
mov    0x259d(%rip),%rax
mov    (%rax),%rdi
lea    -0x50(%rbp),%rsi
call   1140 <pthread_setcanceltype@plt>
cmp    $0x0,%rax
je     1a07 <do_test+0x7b7>
lea    0xb2a(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
movslq -0x50(%rbp),%rax
mov    0x2566(%rip),%rcx
cmp    (%rcx),%rax
je     1a31 <do_test+0x7e1>
lea    0xb31(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
jmp    1a36 <do_test+0x7e6>
jmp    1a3b <do_test+0x7eb>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1313 <do_test+0xc3>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_test>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0x14(%rsp),%rdi
call   10c0 <pthread_attr_init@plt>
test   %rax,%rax
jne    177a <do_test+0x52a>
lea    0xc(%rsp),%rdi
call   1160 <pthread_mutexattr_init@plt>
test   %rax,%rax
jne    1783 <do_test+0x533>
lea    0x8(%rsp),%rdi
call   10b0 <pthread_rwlockattr_init@plt>
test   %rax,%rax
jne    178c <do_test+0x53c>
mov    0x2cfa(%rip),%rax
mov    (%rax),%rsi
lea    0x14(%rsp),%r12
mov    %r12,%rdi
call   1040 <pthread_attr_setinheritsched@plt>
mov    0x2cf3(%rip),%rax
mov    (%rax),%rsi
mov    %r12,%rdi
call   10a0 <pthread_attr_setschedpolicy@plt>
mov    0x2d09(%rip),%rax
mov    (%rax),%rsi
mov    %r12,%rdi
call   10e0 <pthread_attr_setscope@plt>
mov    $0x2710,%ebp
mov    0x2c9a(%rip),%r14
mov    0x2cab(%rip),%r13
lea    0x4(%rsp),%r15
jmp    12f9 <do_test+0xa9>
nopl   0x0(%rax)
add    $0xffffffff,%ebp
je     1605 <do_test+0x3b5>
xor    %eax,%eax
call   1100 <random@plt>
mov    %rax,%rbx
mov    0x2cae(%rip),%rax
cmp    (%rax),%rbx
je     1361 <do_test+0x111>
mov    0x2cd2(%rip),%rax
cmp    (%rax),%rbx
je     1361 <do_test+0x111>
mov    %r12,%rdi
mov    %rbx,%rsi
call   10f0 <pthread_attr_setdetachstate@plt>
test   %eax,%eax
je     1616 <do_test+0x3c6>
cmp    0x0(%r13),%eax
jne    1622 <do_test+0x3d2>
mov    %r12,%rdi
mov    %r15,%rsi
call   1170 <pthread_attr_getdetachstate@plt>
test   %rax,%rax
jne    162e <do_test+0x3de>
movslq 0x4(%rsp),%rsi
mov    0x2c90(%rip),%rax
cmp    %rsi,(%rax)
jne    163a <do_test+0x3ea>
mov    0x2c30(%rip),%rax
cmp    (%rax),%rbx
je     13bf <do_test+0x16f>
mov    0x2c64(%rip),%rax
cmp    (%rax),%rbx
je     13bf <do_test+0x16f>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <pthread_attr_setinheritsched@plt>
test   %eax,%eax
je     1646 <do_test+0x3f6>
cmp    0x0(%r13),%eax
jne    1652 <do_test+0x402>
mov    %r12,%rdi
mov    %r15,%rsi
call   1110 <pthread_attr_getinheritsched@plt>
test   %rax,%rax
jne    165e <do_test+0x40e>
movslq 0x4(%rsp),%rsi
mov    0x2be2(%rip),%rax
cmp    %rsi,(%rax)
jne    166a <do_test+0x41a>
mov    0x2be2(%rip),%rax
cmp    (%rax),%rbx
je     1429 <do_test+0x1d9>
mov    0x2b96(%rip),%rax
cmp    (%rax),%rbx
je     1429 <do_test+0x1d9>
mov    0x2bea(%rip),%rax
cmp    (%rax),%rbx
je     1429 <do_test+0x1d9>
mov    %r12,%rdi
mov    %rbx,%rsi
call   10a0 <pthread_attr_setschedpolicy@plt>
test   %eax,%eax
je     1676 <do_test+0x426>
cmp    0x0(%r13),%eax
jne    1682 <do_test+0x432>
mov    %r12,%rdi
mov    %r15,%rsi
call   1120 <pthread_attr_getschedpolicy@plt>
test   %rax,%rax
jne    168e <do_test+0x43e>
movslq 0x4(%rsp),%rsi
mov    0x2b88(%rip),%rax
cmp    %rsi,(%rax)
jne    169a <do_test+0x44a>
mov    0x2ba0(%rip),%rax
cmp    (%rax),%rbx
je     1487 <do_test+0x237>
mov    0x2b64(%rip),%rax
cmp    (%rax),%rbx
je     1487 <do_test+0x237>
mov    %r12,%rdi
mov    %rbx,%rsi
call   10e0 <pthread_attr_setscope@plt>
test   %eax,%eax
je     16a6 <do_test+0x456>
cmp    0x0(%r13),%eax
jne    16b2 <do_test+0x462>
mov    %r12,%rdi
mov    %r15,%rsi
call   1030 <pthread_attr_getscope@plt>
test   %rax,%rax
jne    16be <do_test+0x46e>
movslq 0x4(%rsp),%rsi
mov    0x2b52(%rip),%rax
cmp    %rsi,(%rax)
jne    16ca <do_test+0x47a>
mov    0x2af2(%rip),%rax
cmp    (%rax),%rbx
je     153b <do_test+0x2eb>
mov    0x2aea(%rip),%rax
cmp    (%rax),%rbx
je     153b <do_test+0x2eb>
lea    0xc(%rsp),%rdi
mov    %rbx,%rsi
call   10d0 <pthread_mutexattr_setpshared@plt>
test   %eax,%eax
je     16d3 <do_test+0x483>
cmp    0x0(%r13),%eax
jne    16dc <do_test+0x48c>
lea    0xc(%rsp),%rdi
mov    %r15,%rsi
call   1080 <pthread_mutexattr_getpshared@plt>
test   %rax,%rax
jne    16e8 <do_test+0x498>
movslq 0x4(%rsp),%rsi
mov    0x2a98(%rip),%rax
cmp    %rsi,(%rax)
jne    16f1 <do_test+0x4a1>
lea    0x8(%rsp),%rdi
mov    %rbx,%rsi
call   1090 <pthread_rwlockattr_setpshared@plt>
test   %eax,%eax
je     16fa <do_test+0x4aa>
cmp    0x0(%r13),%eax
jne    1703 <do_test+0x4b3>
lea    0x8(%rsp),%rdi
mov    %r15,%rsi
call   1130 <pthread_rwlockattr_getpshared@plt>
test   %rax,%rax
jne    170c <do_test+0x4bc>
movslq 0x4(%rsp),%rsi
mov    0x2a4e(%rip),%rax
cmp    %rsi,(%rax)
jne    1715 <do_test+0x4c5>
mov    0x2a6e(%rip),%rax
cmp    (%rax),%rbx
je     15a2 <do_test+0x352>
mov    0x2a12(%rip),%rcx
cmp    (%rcx),%rbx
je     15a2 <do_test+0x352>
mov    %ebp,0x10(%rsp)
mov    %rbx,%rdi
xor    %esi,%esi
call   1060 <pthread_setcancelstate@plt>
test   %eax,%eax
je     171e <do_test+0x4ce>
cmp    %eax,0x0(%r13)
jne    1727 <do_test+0x4d7>
mov    0x2a36(%rip),%rbp
mov    0x0(%rbp),%rdi
mov    %r15,%rsi
call   1060 <pthread_setcancelstate@plt>
test   %rax,%rax
jne    1730 <do_test+0x4e0>
movslq 0x4(%rsp),%rax
cmp    %rax,0x0(%rbp)
jne    1739 <do_test+0x4e9>
mov    0x10(%rsp),%ebp
cmp    (%r14),%rbx
je     12f0 <do_test+0xa0>
mov    0x2a2e(%rip),%rcx
cmp    (%rcx),%rbx
je     12f0 <do_test+0xa0>
mov    %rbx,%rdi
xor    %esi,%esi
call   1140 <pthread_setcanceltype@plt>
test   %eax,%eax
je     1742 <do_test+0x4f2>
cmp    %eax,0x0(%r13)
jne    175b <do_test+0x50b>
mov    (%r14),%rdi
mov    %r15,%rsi
call   1140 <pthread_setcanceltype@plt>
test   %rax,%rax
jne    1764 <do_test+0x514>
movslq 0x4(%rsp),%rax
cmp    %rax,(%r14)
je     12f0 <do_test+0xa0>
lea    0xf53(%rip),%rdi
jmp    176b <do_test+0x51b>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xa10(%rip),%rdi
jmp    1749 <do_test+0x4f9>
lea    0xa32(%rip),%rdi
jmp    176b <do_test+0x51b>
lea    0xa4f(%rip),%rdi
jmp    176b <do_test+0x51b>
lea    0xa5e(%rip),%rdi
jmp    174c <do_test+0x4fc>
lea    0xa8d(%rip),%rdi
jmp    1749 <do_test+0x4f9>
lea    0xab0(%rip),%rdi
jmp    176b <do_test+0x51b>
lea    0xace(%rip),%rdi
jmp    176b <do_test+0x51b>
lea    0xade(%rip),%rdi
jmp    174c <do_test+0x4fc>
lea    0xb0e(%rip),%rdi
jmp    1749 <do_test+0x4f9>
lea    0xb30(%rip),%rdi
jmp    176b <do_test+0x51b>
lea    0xb4d(%rip),%rdi
jmp    176b <do_test+0x51b>
lea    0xb5c(%rip),%rdi
jmp    174c <do_test+0x4fc>
lea    0xb8a(%rip),%rdi
jmp    1749 <do_test+0x4f9>
lea    0xba6(%rip),%rdi
jmp    176b <do_test+0x51b>
lea    0xbbd(%rip),%rdi
jmp    176b <do_test+0x51b>
lea    0xbc6(%rip),%rdi
jmp    174c <do_test+0x4fc>
lea    0xbf5(%rip),%rdi
jmp    1749 <do_test+0x4f9>
lea    0xc1b(%rip),%rdi
jmp    176b <do_test+0x51b>
lea    0xc39(%rip),%rdi
jmp    176b <do_test+0x51b>
lea    0xc4c(%rip),%rdi
jmp    174c <do_test+0x4fc>
lea    0xc7f(%rip),%rdi
jmp    1749 <do_test+0x4f9>
lea    0xca6(%rip),%rdi
jmp    176b <do_test+0x51b>
lea    0xcc8(%rip),%rdi
jmp    176b <do_test+0x51b>
lea    0xcdc(%rip),%rdi
jmp    174c <do_test+0x4fc>
lea    0xd10(%rip),%rdi
jmp    1749 <do_test+0x4f9>
lea    0xd30(%rip),%rdi
jmp    176b <do_test+0x51b>
lea    0xd4b(%rip),%rdi
jmp    176b <do_test+0x51b>
lea    0xd72(%rip),%rdi
jmp    176b <do_test+0x51b>
lea    0xd8e(%rip),%rdi
mov    %rbx,%rsi
call   1070 <printf@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
lea    0xd9d(%rip),%rdi
jmp    176b <do_test+0x51b>
lea    0xdb7(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
lea    0x89b(%rip),%rdi
jmp    176b <do_test+0x51b>
lea    0x876(%rip),%rdi
jmp    176b <do_test+0x51b>
lea    0x883(%rip),%rdi
jmp    176b <do_test+0x51b>

LLVM IR (-O0):
@.str = [17 x i8] c"attr_init failed\00"
@.str.1 = [22 x i8] c"mutexattr_init failed\00"
@.str.2 = [23 x i8] c"rwlockattr_init failed\00"
@PTHREAD_INHERIT_SCHED = global i64 0
@SCHED_OTHER = global i64 0
@PTHREAD_SCOPE_SYSTEM = global i64 0
@PTHREAD_CREATE_DETACHED = global i64 0
@PTHREAD_CREATE_JOINABLE = global i64 0
@.str.3 = [46 x i8] c"attr_setdetachstate with value %ld succeeded\0A\00"
@EINVAL = global i32 0
@.str.4 = [41 x i8] c"attr_setdetachstate didn't return EINVAL\00"
@.str.5 = [27 x i8] c"attr_getdetachstate failed\00"
@.str.6 = [59 x i8] c"detach state changed to %d by invalid setdetachstate call\0A\00"
@PTHREAD_EXPLICIT_SCHED = global i64 0
@.str.7 = [47 x i8] c"attr_setinheritsched with value %ld succeeded\0A\00"
@.str.8 = [42 x i8] c"attr_setinheritsched didn't return EINVAL\00"
@.str.9 = [28 x i8] c"attr_getinheritsched failed\00"
@.str.10 = [60 x i8] c"inheritsched changed to %d by invalid setinheritsched call\0A\00"
@SCHED_RR = global i64 0
@SCHED_FIFO = global i64 0
@.str.11 = [46 x i8] c"attr_setschedpolicy with value %ld succeeded\0A\00"
@.str.12 = [41 x i8] c"attr_setschedpolicy didn't return EINVAL\00"
@.str.13 = [27 x i8] c"attr_getschedpolicy failed\00"
@.str.14 = [58 x i8] c"schedpolicy changed to %d by invalid setschedpolicy call\0A\00"
@PTHREAD_SCOPE_PROCESS = global i64 0
@.str.15 = [40 x i8] c"attr_setscope with value %ld succeeded\0A\00"
@.str.16 = [35 x i8] c"attr_setscope didn't return EINVAL\00"
@.str.17 = [21 x i8] c"attr_getscope failed\00"
@.str.18 = [56 x i8] c"contentionscope changed to %d by invalid setscope call\0A\00"
@PTHREAD_PROCESS_PRIVATE = global i64 0
@PTHREAD_PROCESS_SHARED = global i64 0
@.str.19 = [47 x i8] c"mutexattr_setpshared with value %ld succeeded\0A\00"
@.str.20 = [42 x i8] c"mutexattr_setpshared didn't return EINVAL\00"
@.str.21 = [28 x i8] c"mutexattr_getpshared failed\00"
@.str.22 = [60 x i8] c"pshared changed to %d by invalid mutexattr_setpshared call\0A\00"
@.str.23 = [48 x i8] c"rwlockattr_setpshared with value %ld succeeded\0A\00"
@.str.24 = [43 x i8] c"rwlockattr_setpshared didn't return EINVAL\00"
@.str.25 = [29 x i8] c"rwlockattr_getpshared failed\00"
@.str.26 = [61 x i8] c"pshared changed to %d by invalid rwlockattr_setpshared call\0A\00"
@PTHREAD_CANCEL_ENABLE = global i64 0
@PTHREAD_CANCEL_DISABLE = global i64 0
@.str.27 = [41 x i8] c"setcancelstate with value %ld succeeded\0A\00"
@.str.28 = [36 x i8] c"setcancelstate didn't return EINVAL\00"
@.str.29 = [48 x i8] c"setcancelstate failed for PTHREAD_CANCEL_ENABLE\00"
@.str.30 = [37 x i8] c"invalid setcancelstate changed state\00"
@PTHREAD_CANCEL_DEFERRED = global i64 0
@PTHREAD_CANCEL_ASYNCHRONOUS = global i64 0
@.str.31 = [40 x i8] c"setcanceltype with value %ld succeeded\0A\00"
@.str.32 = [35 x i8] c"setcanceltype didn't return EINVAL\00"
@.str.33 = [49 x i8] c"setcanceltype failed for PTHREAD_CANCEL_DEFERRED\00"
@.str.34 = [36 x i8] c"invalid setcanceltype changed state\00"
define i32 @do_test() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
%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
%20 = call i64 @pthread_attr_init(i32* %2)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %0
%23 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%24 = call i32 @exit(i32 1)
unreachable
25: ; preds = %0
%26 = call i64 @pthread_mutexattr_init(i32* %3)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %25
%29 = call i32 @puts(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%30 = call i32 @exit(i32 1)
unreachable
31: ; preds = %25
%32 = call i64 @pthread_rwlockattr_init(i32* %4)
%33 = icmp ne i64 %32, 0
br i1 %33, label %34, label %37
34: ; preds = %31
%35 = call i32 @puts(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%36 = call i32 @exit(i32 1)
unreachable
37: ; preds = %31
%38 = load i64, i64* @PTHREAD_INHERIT_SCHED
%39 = call i32 @pthread_attr_setinheritsched(i32* %2, i64 %38)
%40 = load i64, i64* @SCHED_OTHER
%41 = call i32 @pthread_attr_setschedpolicy(i32* %2, i64 %40)
%42 = load i64, i64* @PTHREAD_SCOPE_SYSTEM
%43 = call i32 @pthread_attr_setscope(i32* %2, i64 %42)
store i32 0, i32* %1
br label %44
44: ; preds = %372, %37
%45 = load i32, i32* %1
%46 = icmp slt i32 %45, 10000
br i1 %46, label %47, label %375
47: ; preds = %44
%48 = call i64 (...) @random()
store i64 %48, i64* %5
%49 = load i64, i64* %5
%50 = load i64, i64* @PTHREAD_CREATE_DETACHED
%51 = icmp ne i64 %49, %50
br i1 %51, label %52, label %89
52: ; preds = %47
%53 = load i64, i64* %5
%54 = load i64, i64* @PTHREAD_CREATE_JOINABLE
%55 = icmp ne i64 %53, %54
br i1 %55, label %56, label %89
56: ; preds = %52
%57 = load i64, i64* %5
%58 = call i32 @pthread_attr_setdetachstate(i32* %2, i64 %57)
store i32 %58, i32* %6
%59 = load i32, i32* %6
%60 = icmp eq i32 %59, 0
br i1 %60, label %61, label %65
61: ; preds = %56
%62 = load i64, i64* %5
%63 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0), i64 %62)
%64 = call i32 @exit(i32 1)
unreachable
65: ; preds = %56
%66 = load i32, i32* %6
%67 = load i32, i32* @EINVAL
%68 = icmp ne i32 %66, %67
br i1 %68, label %69, label %72
69: ; preds = %65
%70 = call i32 @puts(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0))
%71 = call i32 @exit(i32 1)
unreachable
72: ; preds = %65
%73 = call i64 @pthread_attr_getdetachstate(i32* %2, i32* %7)
%74 = icmp ne i64 %73, 0
br i1 %74, label %75, label %78
75: ; preds = %72
%76 = call i32 @puts(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
%77 = call i32 @exit(i32 1)
unreachable
78: ; preds = %72
%79 = load i32, i32* %7
%80 = sext i32 %79 to i64
%81 = load i64, i64* @PTHREAD_CREATE_JOINABLE
%82 = icmp ne i64 %80, %81
br i1 %82, label %83, label %88
83: ; preds = %78
%84 = load i32, i32* %7
%85 = sext i32 %84 to i64
%86 = call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.6, i64 0, i64 0), i64 %85)
%87 = call i32 @exit(i32 1)
unreachable
88: ; preds = %78
br label %89
89: ; preds = %88, %52, %47
%90 = load i64, i64* %5
%91 = load i64, i64* @PTHREAD_INHERIT_SCHED
%92 = icmp ne i64 %90, %91
br i1 %92, label %93, label %130
93: ; preds = %89
%94 = load i64, i64* %5
%95 = load i64, i64* @PTHREAD_EXPLICIT_SCHED
%96 = icmp ne i64 %94, %95
br i1 %96, label %97, label %130
97: ; preds = %93
%98 = load i64, i64* %5
%99 = call i32 @pthread_attr_setinheritsched(i32* %2, i64 %98)
store i32 %99, i32* %8
%100 = load i32, i32* %8
%101 = icmp eq i32 %100, 0
br i1 %101, label %102, label %106
102: ; preds = %97
%103 = load i64, i64* %5
%104 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.7, i64 0, i64 0), i64 %103)
%105 = call i32 @exit(i32 1)
unreachable
106: ; preds = %97
%107 = load i32, i32* %8
%108 = load i32, i32* @EINVAL
%109 = icmp ne i32 %107, %108
br i1 %109, label %110, label %113
110: ; preds = %106
%111 = call i32 @puts(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.8, i64 0, i64 0))
%112 = call i32 @exit(i32 1)
unreachable
113: ; preds = %106
%114 = call i64 @pthread_attr_getinheritsched(i32* %2, i32* %9)
%115 = icmp ne i64 %114, 0
br i1 %115, label %116, label %119
116: ; preds = %113
%117 = call i32 @puts(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
%118 = call i32 @exit(i32 1)
unreachable
119: ; preds = %113
%120 = load i32, i32* %9
%121 = sext i32 %120 to i64
%122 = load i64, i64* @PTHREAD_INHERIT_SCHED
%123 = icmp ne i64 %121, %122
br i1 %123, label %124, label %129
124: ; preds = %119
%125 = load i32, i32* %9
%126 = sext i32 %125 to i64
%127 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.10, i64 0, i64 0), i64 %126)
%128 = call i32 @exit(i32 1)
unreachable
129: ; preds = %119
br label %130
130: ; preds = %129, %93, %89
%131 = load i64, i64* %5
%132 = load i64, i64* @SCHED_OTHER
%133 = icmp ne i64 %131, %132
br i1 %133, label %134, label %175
134: ; preds = %130
%135 = load i64, i64* %5
%136 = load i64, i64* @SCHED_RR
%137 = icmp ne i64 %135, %136
br i1 %137, label %138, label %175
138: ; preds = %134
%139 = load i64, i64* %5
%140 = load i64, i64* @SCHED_FIFO
%141 = icmp ne i64 %139, %140
br i1 %141, label %142, label %175
142: ; preds = %138
%143 = load i64, i64* %5
%144 = call i32 @pthread_attr_setschedpolicy(i32* %2, i64 %143)
store i32 %144, i32* %10
%145 = load i32, i32* %10
%146 = icmp eq i32 %145, 0
br i1 %146, label %147, label %151
147: ; preds = %142
%148 = load i64, i64* %5
%149 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.11, i64 0, i64 0), i64 %148)
%150 = call i32 @exit(i32 1)
unreachable
151: ; preds = %142
%152 = load i32, i32* %10
%153 = load i32, i32* @EINVAL
%154 = icmp ne i32 %152, %153
br i1 %154, label %155, label %158
155: ; preds = %151
%156 = call i32 @puts(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.12, i64 0, i64 0))
%157 = call i32 @exit(i32 1)
unreachable
158: ; preds = %151
%159 = call i64 @pthread_attr_getschedpolicy(i32* %2, i32* %11)
%160 = icmp ne i64 %159, 0
br i1 %160, label %161, label %164
161: ; preds = %158
%162 = call i32 @puts(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.13, i64 0, i64 0))
%163 = call i32 @exit(i32 1)
unreachable
164: ; preds = %158
%165 = load i32, i32* %11
%166 = sext i32 %165 to i64
%167 = load i64, i64* @SCHED_OTHER
%168 = icmp ne i64 %166, %167
br i1 %168, label %169, label %174
169: ; preds = %164
%170 = load i32, i32* %11
%171 = sext i32 %170 to i64
%172 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.14, i64 0, i64 0), i64 %171)
%173 = call i32 @exit(i32 1)
unreachable
174: ; preds = %164
br label %175
175: ; preds = %174, %138, %134, %130
%176 = load i64, i64* %5
%177 = load i64, i64* @PTHREAD_SCOPE_SYSTEM
%178 = icmp ne i64 %176, %177
br i1 %178, label %179, label %216
179: ; preds = %175
%180 = load i64, i64* %5
%181 = load i64, i64* @PTHREAD_SCOPE_PROCESS
%182 = icmp ne i64 %180, %181
br i1 %182, label %183, label %216
183: ; preds = %179
%184 = load i64, i64* %5
%185 = call i32 @pthread_attr_setscope(i32* %2, i64 %184)
store i32 %185, i32* %12
%186 = load i32, i32* %12
%187 = icmp eq i32 %186, 0
br i1 %187, label %188, label %192
188: ; preds = %183
%189 = load i64, i64* %5
%190 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.15, i64 0, i64 0), i64 %189)
%191 = call i32 @exit(i32 1)
unreachable
192: ; preds = %183
%193 = load i32, i32* %12
%194 = load i32, i32* @EINVAL
%195 = icmp ne i32 %193, %194
br i1 %195, label %196, label %199
196: ; preds = %192
%197 = call i32 @puts(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.16, i64 0, i64 0))
%198 = call i32 @exit(i32 1)
unreachable
199: ; preds = %192
%200 = call i64 @pthread_attr_getscope(i32* %2, i32* %13)
%201 = icmp ne i64 %200, 0
br i1 %201, label %202, label %205
202: ; preds = %199
%203 = call i32 @puts(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.17, i64 0, i64 0))
%204 = call i32 @exit(i32 1)
unreachable
205: ; preds = %199
%206 = load i32, i32* %13
%207 = sext i32 %206 to i64
%208 = load i64, i64* @PTHREAD_SCOPE_SYSTEM
%209 = icmp ne i64 %207, %208
br i1 %209, label %210, label %215
210: ; preds = %205
%211 = load i32, i32* %13
%212 = sext i32 %211 to i64
%213 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.18, i64 0, i64 0), i64 %212)
%214 = call i32 @exit(i32 1)
unreachable
215: ; preds = %205
br label %216
216: ; preds = %215, %179, %175
%217 = load i64, i64* %5
%218 = load i64, i64* @PTHREAD_PROCESS_PRIVATE
%219 = icmp ne i64 %217, %218
br i1 %219, label %220, label %289
220: ; preds = %216
%221 = load i64, i64* %5
%222 = load i64, i64* @PTHREAD_PROCESS_SHARED
%223 = icmp ne i64 %221, %222
br i1 %223, label %224, label %289
224: ; preds = %220
%225 = load i64, i64* %5
%226 = call i32 @pthread_mutexattr_setpshared(i32* %3, i64 %225)
store i32 %226, i32* %14
%227 = load i32, i32* %14
%228 = icmp eq i32 %227, 0
br i1 %228, label %229, label %233
229: ; preds = %224
%230 = load i64, i64* %5
%231 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.19, i64 0, i64 0), i64 %230)
%232 = call i32 @exit(i32 1)
unreachable
233: ; preds = %224
%234 = load i32, i32* %14
%235 = load i32, i32* @EINVAL
%236 = icmp ne i32 %234, %235
br i1 %236, label %237, label %240
237: ; preds = %233
%238 = call i32 @puts(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.20, i64 0, i64 0))
%239 = call i32 @exit(i32 1)
unreachable
240: ; preds = %233
%241 = call i64 @pthread_mutexattr_getpshared(i32* %3, i32* %15)
%242 = icmp ne i64 %241, 0
br i1 %242, label %243, label %246
243: ; preds = %240
%244 = call i32 @puts(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.21, i64 0, i64 0))
%245 = call i32 @exit(i32 1)
unreachable
246: ; preds = %240
%247 = load i32, i32* %15
%248 = sext i32 %247 to i64
%249 = load i64, i64* @PTHREAD_PROCESS_PRIVATE
%250 = icmp ne i64 %248, %249
br i1 %250, label %251, label %256
251: ; preds = %246
%252 = load i32, i32* %15
%253 = sext i32 %252 to i64
%254 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.22, i64 0, i64 0), i64 %253)
%255 = call i32 @exit(i32 1)
unreachable
256: ; preds = %246
%257 = load i64, i64* %5
%258 = call i32 @pthread_rwlockattr_setpshared(i32* %4, i64 %257)
store i32 %258, i32* %14
%259 = load i32, i32* %14
%260 = icmp eq i32 %259, 0
br i1 %260, label %261, label %265
261: ; preds = %256
%262 = load i64, i64* %5
%263 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.23, i64 0, i64 0), i64 %262)
%264 = call i32 @exit(i32 1)
unreachable
265: ; preds = %256
%266 = load i32, i32* %14
%267 = load i32, i32* @EINVAL
%268 = icmp ne i32 %266, %267
br i1 %268, label %269, label %272
269: ; preds = %265
%270 = call i32 @puts(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.24, i64 0, i64 0))
%271 = call i32 @exit(i32 1)
unreachable
272: ; preds = %265
%273 = call i64 @pthread_rwlockattr_getpshared(i32* %4, i32* %15)
%274 = icmp ne i64 %273, 0
br i1 %274, label %275, label %278
275: ; preds = %272
%276 = call i32 @puts(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.25, i64 0, i64 0))
%277 = call i32 @exit(i32 1)
unreachable
278: ; preds = %272
%279 = load i32, i32* %15
%280 = sext i32 %279 to i64
%281 = load i64, i64* @PTHREAD_PROCESS_PRIVATE
%282 = icmp ne i64 %280, %281
br i1 %282, label %283, label %288
283: ; preds = %278
%284 = load i32, i32* %15
%285 = sext i32 %284 to i64
%286 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.26, i64 0, i64 0), i64 %285)
%287 = call i32 @exit(i32 1)
unreachable
288: ; preds = %278
br label %289
289: ; preds = %288, %220, %216
%290 = load i64, i64* %5
%291 = load i64, i64* @PTHREAD_CANCEL_ENABLE
%292 = icmp ne i64 %290, %291
br i1 %292, label %293, label %330
293: ; preds = %289
%294 = load i64, i64* %5
%295 = load i64, i64* @PTHREAD_CANCEL_DISABLE
%296 = icmp ne i64 %294, %295
br i1 %296, label %297, label %330
297: ; preds = %293
%298 = load i64, i64* %5
%299 = call i64 @pthread_setcancelstate(i64 %298, i32* null)
%300 = trunc i64 %299 to i32
store i32 %300, i32* %16
%301 = load i32, i32* %16
%302 = icmp eq i32 %301, 0
br i1 %302, label %303, label %307
303: ; preds = %297
%304 = load i64, i64* %5
%305 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.27, i64 0, i64 0), i64 %304)
%306 = call i32 @exit(i32 1)
unreachable
307: ; preds = %297
%308 = load i32, i32* %16
%309 = load i32, i32* @EINVAL
%310 = icmp ne i32 %308, %309
br i1 %310, label %311, label %314
311: ; preds = %307
%312 = call i32 @puts(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.28, i64 0, i64 0))
%313 = call i32 @exit(i32 1)
unreachable
314: ; preds = %307
%315 = load i64, i64* @PTHREAD_CANCEL_ENABLE
%316 = call i64 @pthread_setcancelstate(i64 %315, i32* %17)
%317 = icmp ne i64 %316, 0
br i1 %317, label %318, label %321
318: ; preds = %314
%319 = call i32 @puts(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.29, i64 0, i64 0))
%320 = call i32 @exit(i32 1)
unreachable
321: ; preds = %314
%322 = load i32, i32* %17
%323 = sext i32 %322 to i64
%324 = load i64, i64* @PTHREAD_CANCEL_ENABLE
%325 = icmp ne i64 %323, %324
br i1 %325, label %326, label %329
326: ; preds = %321
%327 = call i32 @puts(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.30, i64 0, i64 0))
%328 = call i32 @exit(i32 1)
unreachable
329: ; preds = %321
br label %330
330: ; preds = %329, %293, %289
%331 = load i64, i64* %5
%332 = load i64, i64* @PTHREAD_CANCEL_DEFERRED
%333 = icmp ne i64 %331, %332
br i1 %333, label %334, label %371
334: ; preds = %330
%335 = load i64, i64* %5
%336 = load i64, i64* @PTHREAD_CANCEL_ASYNCHRONOUS
%337 = icmp ne i64 %335, %336
br i1 %337, label %338, label %371
338: ; preds = %334
%339 = load i64, i64* %5
%340 = call i64 @pthread_setcanceltype(i64 %339, i32* null)
%341 = trunc i64 %340 to i32
store i32 %341, i32* %18
%342 = load i32, i32* %18
%343 = icmp eq i32 %342, 0
br i1 %343, label %344, label %348
344: ; preds = %338
%345 = load i64, i64* %5
%346 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.31, i64 0, i64 0), i64 %345)
%347 = call i32 @exit(i32 1)
unreachable
348: ; preds = %338
%349 = load i32, i32* %18
%350 = load i32, i32* @EINVAL
%351 = icmp ne i32 %349, %350
br i1 %351, label %352, label %355
352: ; preds = %348
%353 = call i32 @puts(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.32, i64 0, i64 0))
%354 = call i32 @exit(i32 1)
unreachable
355: ; preds = %348
%356 = load i64, i64* @PTHREAD_CANCEL_DEFERRED
%357 = call i64 @pthread_setcanceltype(i64 %356, i32* %19)
%358 = icmp ne i64 %357, 0
br i1 %358, label %359, label %362
359: ; preds = %355
%360 = call i32 @puts(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.33, i64 0, i64 0))
%361 = call i32 @exit(i32 1)
unreachable
362: ; preds = %355
%363 = load i32, i32* %19
%364 = sext i32 %363 to i64
%365 = load i64, i64* @PTHREAD_CANCEL_DEFERRED
%366 = icmp ne i64 %364, %365
br i1 %366, label %367, label %370
367: ; preds = %362
%368 = call i32 @puts(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.34, i64 0, i64 0))
%369 = call i32 @exit(i32 1)
unreachable
370: ; preds = %362
br label %371
371: ; preds = %370, %334, %330
br label %372
372: ; preds = %371
%373 = load i32, i32* %1
%374 = add nsw i32 %373, 1
store i32 %374, i32* %1
br label %44
375: ; preds = %44
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"attr_init failed\00"
@.str.1 = [22 x i8] c"mutexattr_init failed\00"
@.str.2 = [23 x i8] c"rwlockattr_init failed\00"
@PTHREAD_INHERIT_SCHED = global i64 0
@SCHED_OTHER = global i64 0
@PTHREAD_SCOPE_SYSTEM = global i64 0
@PTHREAD_CREATE_DETACHED = global i64 0
@PTHREAD_CREATE_JOINABLE = global i64 0
@.str.3 = [46 x i8] c"attr_setdetachstate with value %ld succeeded\0A\00"
@EINVAL = global i32 0
@.str.4 = [41 x i8] c"attr_setdetachstate didn't return EINVAL\00"
@.str.5 = [27 x i8] c"attr_getdetachstate failed\00"
@.str.6 = [59 x i8] c"detach state changed to %d by invalid setdetachstate call\0A\00"
@PTHREAD_EXPLICIT_SCHED = global i64 0
@.str.7 = [47 x i8] c"attr_setinheritsched with value %ld succeeded\0A\00"
@.str.8 = [42 x i8] c"attr_setinheritsched didn't return EINVAL\00"
@.str.9 = [28 x i8] c"attr_getinheritsched failed\00"
@.str.10 = [60 x i8] c"inheritsched changed to %d by invalid setinheritsched call\0A\00"
@SCHED_RR = global i64 0
@SCHED_FIFO = global i64 0
@.str.11 = [46 x i8] c"attr_setschedpolicy with value %ld succeeded\0A\00"
@.str.12 = [41 x i8] c"attr_setschedpolicy didn't return EINVAL\00"
@.str.13 = [27 x i8] c"attr_getschedpolicy failed\00"
@.str.14 = [58 x i8] c"schedpolicy changed to %d by invalid setschedpolicy call\0A\00"
@PTHREAD_SCOPE_PROCESS = global i64 0
@.str.15 = [40 x i8] c"attr_setscope with value %ld succeeded\0A\00"
@.str.16 = [35 x i8] c"attr_setscope didn't return EINVAL\00"
@.str.17 = [21 x i8] c"attr_getscope failed\00"
@.str.18 = [56 x i8] c"contentionscope changed to %d by invalid setscope call\0A\00"
@PTHREAD_PROCESS_PRIVATE = global i64 0
@PTHREAD_PROCESS_SHARED = global i64 0
@.str.19 = [47 x i8] c"mutexattr_setpshared with value %ld succeeded\0A\00"
@.str.20 = [42 x i8] c"mutexattr_setpshared didn't return EINVAL\00"
@.str.21 = [28 x i8] c"mutexattr_getpshared failed\00"
@.str.22 = [60 x i8] c"pshared changed to %d by invalid mutexattr_setpshared call\0A\00"
@.str.23 = [48 x i8] c"rwlockattr_setpshared with value %ld succeeded\0A\00"
@.str.24 = [43 x i8] c"rwlockattr_setpshared didn't return EINVAL\00"
@.str.25 = [29 x i8] c"rwlockattr_getpshared failed\00"
@.str.26 = [61 x i8] c"pshared changed to %d by invalid rwlockattr_setpshared call\0A\00"
@PTHREAD_CANCEL_ENABLE = global i64 0
@PTHREAD_CANCEL_DISABLE = global i64 0
@.str.27 = [41 x i8] c"setcancelstate with value %ld succeeded\0A\00"
@.str.28 = [36 x i8] c"setcancelstate didn't return EINVAL\00"
@.str.29 = [48 x i8] c"setcancelstate failed for PTHREAD_CANCEL_ENABLE\00"
@.str.30 = [37 x i8] c"invalid setcancelstate changed state\00"
@PTHREAD_CANCEL_DEFERRED = global i64 0
@PTHREAD_CANCEL_ASYNCHRONOUS = global i64 0
@.str.31 = [40 x i8] c"setcanceltype with value %ld succeeded\0A\00"
@.str.32 = [35 x i8] c"setcanceltype didn't return EINVAL\00"
@.str.33 = [49 x i8] c"setcanceltype failed for PTHREAD_CANCEL_DEFERRED\00"
@.str.34 = [36 x i8] c"invalid setcanceltype changed state\00"
define i32 @do_test() {
%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 = bitcast i32* %1 to i8*
%12 = call i64 @pthread_attr_init(i32* %1)
%13 = icmp eq i64 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %0
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %0
%18 = bitcast i32* %2 to i8*
%19 = call i64 @pthread_mutexattr_init(i32* %2)
%20 = icmp eq i64 %19, 0
br i1 %20, label %24, label %21
21: ; preds = %17
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%23 = call i32 @exit(i32 1)
unreachable
24: ; preds = %17
%25 = bitcast i32* %3 to i8*
%26 = call i64 @pthread_rwlockattr_init(i32* %3)
%27 = icmp eq i64 %26, 0
br i1 %27, label %31, label %28
28: ; preds = %24
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%30 = call i32 @exit(i32 1)
unreachable
31: ; preds = %24
%32 = load i64, i64* @PTHREAD_INHERIT_SCHED
%33 = call i32 @pthread_attr_setinheritsched(i32* %1, i64 %32)
%34 = load i64, i64* @SCHED_OTHER
%35 = call i32 @pthread_attr_setschedpolicy(i32* %1, i64 %34)
%36 = load i64, i64* @PTHREAD_SCOPE_SYSTEM
%37 = call i32 @pthread_attr_setscope(i32* %1, i64 %36)
%38 = bitcast i32* %4 to i8*
%39 = bitcast i32* %5 to i8*
%40 = bitcast i32* %6 to i8*
%41 = bitcast i32* %7 to i8*
%42 = bitcast i32* %8 to i8*
%43 = bitcast i32* %9 to i8*
%44 = bitcast i32* %10 to i8*
br label %45
45: ; preds = %31, %317
%46 = phi i32 [ 0, %31 ], [ %318, %317 ]
%47 = call i64 (...) @random()
%48 = load i64, i64* @PTHREAD_CREATE_DETACHED
%49 = icmp eq i64 %47, %48
%50 = load i64, i64* @PTHREAD_CREATE_JOINABLE
%51 = icmp eq i64 %47, %50
%52 = select i1 %49, i1 true, i1 %51
br i1 %52, label %81, label %53
53: ; preds = %45
%54 = call i32 @pthread_attr_setdetachstate(i32* %1, i64 %47)
%55 = icmp eq i32 %54, 0
br i1 %55, label %56, label %59
56: ; preds = %53
%57 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0), i64 %47)
%58 = call i32 @exit(i32 1)
unreachable
59: ; preds = %53
%60 = load i32, i32* @EINVAL
%61 = icmp eq i32 %54, %60
br i1 %61, label %65, label %62
62: ; preds = %59
%63 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0))
%64 = call i32 @exit(i32 1)
unreachable
65: ; preds = %59
%66 = call i64 @pthread_attr_getdetachstate(i32* %1, i32* %4)
%67 = icmp eq i64 %66, 0
br i1 %67, label %71, label %68
68: ; preds = %65
%69 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
%70 = call i32 @exit(i32 1)
unreachable
71: ; preds = %65
%72 = load i32, i32* %4
%73 = sext i32 %72 to i64
%74 = load i64, i64* @PTHREAD_CREATE_JOINABLE
%75 = icmp eq i64 %74, %73
br i1 %75, label %80, label %76
76: ; preds = %71
%77 = sext i32 %72 to i64
%78 = call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.6, i64 0, i64 0), i64 %77)
%79 = call i32 @exit(i32 1)
unreachable
80: ; preds = %71
br label %81
81: ; preds = %80, %45
%82 = load i64, i64* @PTHREAD_INHERIT_SCHED
%83 = icmp eq i64 %47, %82
%84 = load i64, i64* @PTHREAD_EXPLICIT_SCHED
%85 = icmp eq i64 %47, %84
%86 = select i1 %83, i1 true, i1 %85
br i1 %86, label %115, label %87
87: ; preds = %81
%88 = call i32 @pthread_attr_setinheritsched(i32* %1, i64 %47)
%89 = icmp eq i32 %88, 0
br i1 %89, label %90, label %93
90: ; preds = %87
%91 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.7, i64 0, i64 0), i64 %47)
%92 = call i32 @exit(i32 1)
unreachable
93: ; preds = %87
%94 = load i32, i32* @EINVAL
%95 = icmp eq i32 %88, %94
br i1 %95, label %99, label %96
96: ; preds = %93
%97 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.8, i64 0, i64 0))
%98 = call i32 @exit(i32 1)
unreachable
99: ; preds = %93
%100 = call i64 @pthread_attr_getinheritsched(i32* %1, i32* %5)
%101 = icmp eq i64 %100, 0
br i1 %101, label %105, label %102
102: ; preds = %99
%103 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
%104 = call i32 @exit(i32 1)
unreachable
105: ; preds = %99
%106 = load i32, i32* %5
%107 = sext i32 %106 to i64
%108 = load i64, i64* @PTHREAD_INHERIT_SCHED
%109 = icmp eq i64 %108, %107
br i1 %109, label %114, label %110
110: ; preds = %105
%111 = sext i32 %106 to i64
%112 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.10, i64 0, i64 0), i64 %111)
%113 = call i32 @exit(i32 1)
unreachable
114: ; preds = %105
br label %115
115: ; preds = %114, %81
%116 = load i64, i64* @SCHED_OTHER
%117 = icmp eq i64 %47, %116
%118 = load i64, i64* @SCHED_RR
%119 = icmp eq i64 %47, %118
%120 = select i1 %117, i1 true, i1 %119
%121 = load i64, i64* @SCHED_FIFO
%122 = icmp eq i64 %47, %121
%123 = select i1 %120, i1 true, i1 %122
br i1 %123, label %152, label %124
124: ; preds = %115
%125 = call i32 @pthread_attr_setschedpolicy(i32* %1, i64 %47)
%126 = icmp eq i32 %125, 0
br i1 %126, label %127, label %130
127: ; preds = %124
%128 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.11, i64 0, i64 0), i64 %47)
%129 = call i32 @exit(i32 1)
unreachable
130: ; preds = %124
%131 = load i32, i32* @EINVAL
%132 = icmp eq i32 %125, %131
br i1 %132, label %136, label %133
133: ; preds = %130
%134 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.12, i64 0, i64 0))
%135 = call i32 @exit(i32 1)
unreachable
136: ; preds = %130
%137 = call i64 @pthread_attr_getschedpolicy(i32* %1, i32* %6)
%138 = icmp eq i64 %137, 0
br i1 %138, label %142, label %139
139: ; preds = %136
%140 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.13, i64 0, i64 0))
%141 = call i32 @exit(i32 1)
unreachable
142: ; preds = %136
%143 = load i32, i32* %6
%144 = sext i32 %143 to i64
%145 = load i64, i64* @SCHED_OTHER
%146 = icmp eq i64 %145, %144
br i1 %146, label %151, label %147
147: ; preds = %142
%148 = sext i32 %143 to i64
%149 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.14, i64 0, i64 0), i64 %148)
%150 = call i32 @exit(i32 1)
unreachable
151: ; preds = %142
br label %152
152: ; preds = %151, %115
%153 = load i64, i64* @PTHREAD_SCOPE_SYSTEM
%154 = icmp eq i64 %47, %153
%155 = load i64, i64* @PTHREAD_SCOPE_PROCESS
%156 = icmp eq i64 %47, %155
%157 = select i1 %154, i1 true, i1 %156
br i1 %157, label %186, label %158
158: ; preds = %152
%159 = call i32 @pthread_attr_setscope(i32* %1, i64 %47)
%160 = icmp eq i32 %159, 0
br i1 %160, label %161, label %164
161: ; preds = %158
%162 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.15, i64 0, i64 0), i64 %47)
%163 = call i32 @exit(i32 1)
unreachable
164: ; preds = %158
%165 = load i32, i32* @EINVAL
%166 = icmp eq i32 %159, %165
br i1 %166, label %170, label %167
167: ; preds = %164
%168 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.16, i64 0, i64 0))
%169 = call i32 @exit(i32 1)
unreachable
170: ; preds = %164
%171 = call i64 @pthread_attr_getscope(i32* %1, i32* %7)
%172 = icmp eq i64 %171, 0
br i1 %172, label %176, label %173
173: ; preds = %170
%174 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.17, i64 0, i64 0))
%175 = call i32 @exit(i32 1)
unreachable
176: ; preds = %170
%177 = load i32, i32* %7
%178 = sext i32 %177 to i64
%179 = load i64, i64* @PTHREAD_SCOPE_SYSTEM
%180 = icmp eq i64 %179, %178
br i1 %180, label %185, label %181
181: ; preds = %176
%182 = sext i32 %177 to i64
%183 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.18, i64 0, i64 0), i64 %182)
%184 = call i32 @exit(i32 1)
unreachable
185: ; preds = %176
br label %186
186: ; preds = %185, %152
%187 = load i64, i64* @PTHREAD_PROCESS_PRIVATE
%188 = icmp eq i64 %47, %187
%189 = load i64, i64* @PTHREAD_PROCESS_SHARED
%190 = icmp eq i64 %47, %189
%191 = select i1 %188, i1 true, i1 %190
br i1 %191, label %247, label %192
192: ; preds = %186
%193 = call i32 @pthread_mutexattr_setpshared(i32* %2, i64 %47)
%194 = icmp eq i32 %193, 0
br i1 %194, label %195, label %198
195: ; preds = %192
%196 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.19, i64 0, i64 0), i64 %47)
%197 = call i32 @exit(i32 1)
unreachable
198: ; preds = %192
%199 = load i32, i32* @EINVAL
%200 = icmp eq i32 %193, %199
br i1 %200, label %204, label %201
201: ; preds = %198
%202 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.20, i64 0, i64 0))
%203 = call i32 @exit(i32 1)
unreachable
204: ; preds = %198
%205 = call i64 @pthread_mutexattr_getpshared(i32* %2, i32* %8)
%206 = icmp eq i64 %205, 0
br i1 %206, label %210, label %207
207: ; preds = %204
%208 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.21, i64 0, i64 0))
%209 = call i32 @exit(i32 1)
unreachable
210: ; preds = %204
%211 = load i32, i32* %8
%212 = sext i32 %211 to i64
%213 = load i64, i64* @PTHREAD_PROCESS_PRIVATE
%214 = icmp eq i64 %213, %212
br i1 %214, label %219, label %215
215: ; preds = %210
%216 = sext i32 %211 to i64
%217 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.22, i64 0, i64 0), i64 %216)
%218 = call i32 @exit(i32 1)
unreachable
219: ; preds = %210
%220 = call i32 @pthread_rwlockattr_setpshared(i32* %3, i64 %47)
%221 = icmp eq i32 %220, 0
br i1 %221, label %222, label %225
222: ; preds = %219
%223 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.23, i64 0, i64 0), i64 %47)
%224 = call i32 @exit(i32 1)
unreachable
225: ; preds = %219
%226 = load i32, i32* @EINVAL
%227 = icmp eq i32 %220, %226
br i1 %227, label %231, label %228
228: ; preds = %225
%229 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.24, i64 0, i64 0))
%230 = call i32 @exit(i32 1)
unreachable
231: ; preds = %225
%232 = call i64 @pthread_rwlockattr_getpshared(i32* %3, i32* %8)
%233 = icmp eq i64 %232, 0
br i1 %233, label %237, label %234
234: ; preds = %231
%235 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.25, i64 0, i64 0))
%236 = call i32 @exit(i32 1)
unreachable
237: ; preds = %231
%238 = load i32, i32* %8
%239 = sext i32 %238 to i64
%240 = load i64, i64* @PTHREAD_PROCESS_PRIVATE
%241 = icmp eq i64 %240, %239
br i1 %241, label %246, label %242
242: ; preds = %237
%243 = sext i32 %238 to i64
%244 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.26, i64 0, i64 0), i64 %243)
%245 = call i32 @exit(i32 1)
unreachable
246: ; preds = %237
br label %247
247: ; preds = %246, %186
%248 = load i64, i64* @PTHREAD_CANCEL_ENABLE
%249 = icmp eq i64 %47, %248
%250 = load i64, i64* @PTHREAD_CANCEL_DISABLE
%251 = icmp eq i64 %47, %250
%252 = select i1 %249, i1 true, i1 %251
br i1 %252, label %282, label %253
253: ; preds = %247
%254 = call i64 @pthread_setcancelstate(i64 %47, i32* null)
%255 = trunc i64 %254 to i32
%256 = icmp eq i32 %255, 0
br i1 %256, label %257, label %260
257: ; preds = %253
%258 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.27, i64 0, i64 0), i64 %47)
%259 = call i32 @exit(i32 1)
unreachable
260: ; preds = %253
%261 = load i32, i32* @EINVAL
%262 = icmp eq i32 %261, %255
br i1 %262, label %266, label %263
263: ; preds = %260
%264 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.28, i64 0, i64 0))
%265 = call i32 @exit(i32 1)
unreachable
266: ; preds = %260
%267 = load i64, i64* @PTHREAD_CANCEL_ENABLE
%268 = call i64 @pthread_setcancelstate(i64 %267, i32* %9)
%269 = icmp eq i64 %268, 0
br i1 %269, label %273, label %270
270: ; preds = %266
%271 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.29, i64 0, i64 0))
%272 = call i32 @exit(i32 1)
unreachable
273: ; preds = %266
%274 = load i32, i32* %9
%275 = sext i32 %274 to i64
%276 = load i64, i64* @PTHREAD_CANCEL_ENABLE
%277 = icmp eq i64 %276, %275
br i1 %277, label %281, label %278
278: ; preds = %273
%279 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.30, i64 0, i64 0))
%280 = call i32 @exit(i32 1)
unreachable
281: ; preds = %273
br label %282
282: ; preds = %281, %247
%283 = load i64, i64* @PTHREAD_CANCEL_DEFERRED
%284 = icmp eq i64 %47, %283
%285 = load i64, i64* @PTHREAD_CANCEL_ASYNCHRONOUS
%286 = icmp eq i64 %47, %285
%287 = select i1 %284, i1 true, i1 %286
br i1 %287, label %317, label %288
288: ; preds = %282
%289 = call i64 @pthread_setcanceltype(i64 %47, i32* null)
%290 = trunc i64 %289 to i32
%291 = icmp eq i32 %290, 0
br i1 %291, label %292, label %295
292: ; preds = %288
%293 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.31, i64 0, i64 0), i64 %47)
%294 = call i32 @exit(i32 1)
unreachable
295: ; preds = %288
%296 = load i32, i32* @EINVAL
%297 = icmp eq i32 %296, %290
br i1 %297, label %301, label %298
298: ; preds = %295
%299 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.32, i64 0, i64 0))
%300 = call i32 @exit(i32 1)
unreachable
301: ; preds = %295
%302 = load i64, i64* @PTHREAD_CANCEL_DEFERRED
%303 = call i64 @pthread_setcanceltype(i64 %302, i32* %10)
%304 = icmp eq i64 %303, 0
br i1 %304, label %308, label %305
305: ; preds = %301
%306 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.33, i64 0, i64 0))
%307 = call i32 @exit(i32 1)
unreachable
308: ; preds = %301
%309 = load i32, i32* %10
%310 = sext i32 %309 to i64
%311 = load i64, i64* @PTHREAD_CANCEL_DEFERRED
%312 = icmp eq i64 %311, %310
br i1 %312, label %316, label %313
313: ; preds = %308
%314 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.34, i64 0, i64 0))
%315 = call i32 @exit(i32 1)
unreachable
316: ; preds = %308
br label %317
317: ; preds = %316, %282
%318 = add nuw nsw i32 %46, 1
%319 = icmp eq i32 %318, 10000
br i1 %319, label %320, label %45
320: ; preds = %317
ret i32 0
}