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

/* Variables and functions */
int EINVAL;
int ENOTSUP;
int PTHREAD_CREATE_DETACHED;
int PTHREAD_CREATE_JOINABLE;
int PTHREAD_EXPLICIT_SCHED;
int PTHREAD_INHERIT_SCHED;
int PTHREAD_SCOPE_PROCESS;
int PTHREAD_SCOPE_SYSTEM;
int SCHED_FIFO;
int SCHED_OTHER;
int SCHED_RR;
int /*<<< orphan*/ _SC_PAGESIZE;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, int, ...);
scalar_t__ pthread_attr_getdetachstate(int /*<<< orphan*/ *, int *);
scalar_t__ pthread_attr_getguardsize(int /*<<< orphan*/ *, size_t *);
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*/ *, int);
int pthread_attr_setguardsize(int /*<<< orphan*/ *, int);
int pthread_attr_setinheritsched(int /*<<< orphan*/ *, int);
int pthread_attr_setschedpolicy(int /*<<< orphan*/ *, int);
int pthread_attr_setscope(int /*<<< orphan*/ *, int);
int pthread_attr_setstack(int /*<<< orphan*/ *, char *, int);
int pthread_attr_setstacksize(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ puts(char *);
scalar_t__ sysconf(int /*<<< orphan*/);
int do_test(void) {
  pthread_attr_t a;
  if (pthread_attr_init(&a) != 0) {
    puts("attr_init failed");
    exit(1);
  }
  int s;
  if (pthread_attr_getdetachstate(&a, &s) != 0) {
    puts("1st attr_getdestachstate failed");
    exit(1);
  }
  if (s != PTHREAD_CREATE_JOINABLE) {
    printf("default detach state wrong: %d, expected %d "
           "(PTHREAD_CREATE_JOINABLE)\n",
           s, PTHREAD_CREATE_JOINABLE);
    exit(1);
  }
  int e = pthread_attr_setdetachstate(&a, PTHREAD_CREATE_DETACHED);
  if (e != 0) {
    puts("1st attr_setdetachstate failed");
    exit(1);
  }
  if (pthread_attr_getdetachstate(&a, &s) != 0) {
    puts("2nd attr_getdestachstate failed");
    exit(1);
  }
  if (s != PTHREAD_CREATE_DETACHED) {
    puts("PTHREAD_CREATE_DETACHED set, but not given back");
    exit(1);
  }
  e = pthread_attr_setdetachstate(&a, PTHREAD_CREATE_JOINABLE);
  if (e != 0) {
    puts("2nd attr_setdetachstate failed");
    exit(1);
  }
  if (pthread_attr_getdetachstate(&a, &s) != 0) {
    puts("3rd attr_getdestachstate failed");
    exit(1);
  }
  if (s != PTHREAD_CREATE_JOINABLE) {
    puts("PTHREAD_CREATE_JOINABLE set, but not given back");
    exit(1);
  }
  size_t g;
  if (pthread_attr_getguardsize(&a, &g) != 0) {
    puts("1st attr_getguardsize failed");
    exit(1);
  }
  if (g != (size_t)sysconf(_SC_PAGESIZE)) {
    printf("default guardsize %zu, expected %ld (PAGESIZE)\n", g,
           sysconf(_SC_PAGESIZE));
    exit(1);
  }
  e = pthread_attr_setguardsize(&a, 0);
  if (e != 0) {
    puts("1st attr_setguardsize failed");
    exit(1);
  }
  if (pthread_attr_getguardsize(&a, &g) != 0) {
    puts("2nd attr_getguardsize failed");
    exit(1);
  }
  if (g != 0) {
    printf("guardsize set to zero but %zu returned\n", g);
    exit(1);
  }
  e = pthread_attr_setguardsize(&a, 1);
  if (e != 0) {
    puts("2nd attr_setguardsize failed");
    exit(1);
  }
  if (pthread_attr_getguardsize(&a, &g) != 0) {
    puts("3rd attr_getguardsize failed");
    exit(1);
  }
  if (g != 1) {
    printf("guardsize set to 1 but %zu returned\n", g);
    exit(1);
  }
  if (pthread_attr_getinheritsched(&a, &s) != 0) {
    puts("1st attr_getinheritsched failed");
    exit(1);
  }
  if (s != PTHREAD_INHERIT_SCHED && s != PTHREAD_EXPLICIT_SCHED) {
    puts("incorrect default value for inheritsched");
    exit(1);
  }
  e = pthread_attr_setinheritsched(&a, PTHREAD_EXPLICIT_SCHED);
  if (e != 0) {
    puts("1st attr_setinheritsched failed");
    exit(1);
  }
  if (pthread_attr_getinheritsched(&a, &s) != 0) {
    puts("2nd attr_getinheritsched failed");
    exit(1);
  }
  if (s != PTHREAD_EXPLICIT_SCHED) {
    printf("inheritsched set to PTHREAD_EXPLICIT_SCHED, but got %d\n", s);
    exit(1);
  }
  e = pthread_attr_setinheritsched(&a, PTHREAD_INHERIT_SCHED);
  if (e != 0) {
    puts("2nd attr_setinheritsched failed");
    exit(1);
  }
  if (pthread_attr_getinheritsched(&a, &s) != 0) {
    puts("3rd attr_getinheritsched failed");
    exit(1);
  }
  if (s != PTHREAD_INHERIT_SCHED) {
    printf("inheritsched set to PTHREAD_INHERIT_SCHED, but got %d\n", s);
    exit(1);
  }
  if (pthread_attr_getschedpolicy(&a, &s) != 0) {
    puts("1st attr_getschedpolicy failed");
    exit(1);
  }
  if (s != SCHED_OTHER && s != SCHED_FIFO && s != SCHED_RR) {
    puts("incorrect default value for schedpolicy");
    exit(1);
  }
  e = pthread_attr_setschedpolicy(&a, SCHED_RR);
  if (e != 0) {
    puts("1st attr_setschedpolicy failed");
    exit(1);
  }
  if (pthread_attr_getschedpolicy(&a, &s) != 0) {
    puts("2nd attr_getschedpolicy failed");
    exit(1);
  }
  if (s != SCHED_RR) {
    printf("schedpolicy set to SCHED_RR, but got %d\n", s);
    exit(1);
  }
  e = pthread_attr_setschedpolicy(&a, SCHED_FIFO);
  if (e != 0) {
    puts("2nd attr_setschedpolicy failed");
    exit(1);
  }
  if (pthread_attr_getschedpolicy(&a, &s) != 0) {
    puts("3rd attr_getschedpolicy failed");
    exit(1);
  }
  if (s != SCHED_FIFO) {
    printf("schedpolicy set to SCHED_FIFO, but got %d\n", s);
    exit(1);
  }
  e = pthread_attr_setschedpolicy(&a, SCHED_OTHER);
  if (e != 0) {
    puts("3rd attr_setschedpolicy failed");
    exit(1);
  }
  if (pthread_attr_getschedpolicy(&a, &s) != 0) {
    puts("4th attr_getschedpolicy failed");
    exit(1);
  }
  if (s != SCHED_OTHER) {
    printf("schedpolicy set to SCHED_OTHER, but got %d\n", s);
    exit(1);
  }
  if (pthread_attr_getscope(&a, &s) != 0) {
    puts("1st attr_getscope failed");
    exit(1);
  }
  if (s != PTHREAD_SCOPE_SYSTEM && s != PTHREAD_SCOPE_PROCESS) {
    puts("incorrect default value for contentionscope");
    exit(1);
  }
  e = pthread_attr_setscope(&a, PTHREAD_SCOPE_PROCESS);
  if (e != ENOTSUP) {
    if (e != 0) {
      puts("1st attr_setscope failed");
      exit(1);
    }
    if (pthread_attr_getscope(&a, &s) != 0) {
      puts("2nd attr_getscope failed");
      exit(1);
    }
    if (s != PTHREAD_SCOPE_PROCESS) {
      printf("contentionscope set to PTHREAD_SCOPE_PROCESS, but got %d\n", s);
      exit(1);
    }
  }
  e = pthread_attr_setscope(&a, PTHREAD_SCOPE_SYSTEM);
  if (e != 0) {
    puts("2nd attr_setscope failed");
    exit(1);
  }
  if (pthread_attr_getscope(&a, &s) != 0) {
    puts("3rd attr_getscope failed");
    exit(1);
  }
  if (s != PTHREAD_SCOPE_SYSTEM) {
    printf("contentionscope set to PTHREAD_SCOPE_SYSTEM, but got %d\n", s);
    exit(1);
  }
  char buf[1];
  e = pthread_attr_setstack(&a, buf, 1);
  if (e != EINVAL) {
    puts("setstack with size 1 did not produce EINVAL");
    exit(1);
  }
  e = pthread_attr_setstacksize(&a, 1);
  if (e != EINVAL) {
    puts("setstacksize with size 1 did not produce EINVAL");
    exit(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<do_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x4(%rbp),%rdi
call   1080 <pthread_attr_init@plt>
cmp    $0x0,%rax
je     1241 <do_test+0x31>
lea    0xdce(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1120 <pthread_attr_getdetachstate@plt>
cmp    $0x0,%rax
je     126e <do_test+0x5e>
lea    0xdb2(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x8(%rbp),%eax
mov    0x2d70(%rip),%rcx
cmp    (%rcx),%eax
je     12a4 <do_test+0x94>
mov    -0x8(%rbp),%esi
mov    0x2d5e(%rip),%rax
mov    (%rax),%edx
lea    0xd9e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    0x2d05(%rip),%rax
mov    (%rax),%esi
lea    -0x4(%rbp),%rdi
call   10a0 <pthread_attr_setdetachstate@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     12d9 <do_test+0xc9>
lea    0xdae(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1120 <pthread_attr_getdetachstate@plt>
cmp    $0x0,%rax
je     1306 <do_test+0xf6>
lea    0xda0(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x8(%rbp),%eax
mov    0x2ca0(%rip),%rcx
cmp    (%rcx),%eax
je     132e <do_test+0x11e>
lea    0xd98(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    0x2cb3(%rip),%rax
mov    (%rax),%esi
lea    -0x4(%rbp),%rdi
call   10a0 <pthread_attr_setdetachstate@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1363 <do_test+0x153>
lea    0xd93(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1120 <pthread_attr_getdetachstate@plt>
cmp    $0x0,%rax
je     1390 <do_test+0x180>
lea    0xd85(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x8(%rbp),%eax
mov    0x2c4e(%rip),%rcx
cmp    (%rcx),%eax
je     13b8 <do_test+0x1a8>
lea    0xd7d(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    -0x4(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   10b0 <pthread_attr_getguardsize@plt>
cmp    $0x0,%rax
je     13e5 <do_test+0x1d5>
lea    0xd80(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    0x2bec(%rip),%rax
mov    (%rax),%edi
call   1100 <sysconf@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
je     143e <do_test+0x22e>
mov    -0x18(%rbp),%rax
mov    %eax,-0x2c(%rbp)
mov    0x2bc7(%rip),%rax
mov    (%rax),%edi
call   1100 <sysconf@plt>
mov    -0x2c(%rbp),%esi
mov    %rax,%rdx
lea    0xd46(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    -0x4(%rbp),%rdi
xor    %esi,%esi
call   10c0 <pthread_attr_setguardsize@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     146c <do_test+0x25c>
lea    0xd46(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    -0x4(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   10b0 <pthread_attr_getguardsize@plt>
cmp    $0x0,%rax
je     1499 <do_test+0x289>
lea    0xd36(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
cmpq   $0x0,-0x18(%rbp)
je     14c2 <do_test+0x2b2>
mov    -0x18(%rbp),%rax
mov    %eax,%esi
lea    0xd2c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    -0x4(%rbp),%rdi
mov    $0x1,%esi
call   10c0 <pthread_attr_setguardsize@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     14f3 <do_test+0x2e3>
lea    0xd21(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    -0x4(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   10b0 <pthread_attr_getguardsize@plt>
cmp    $0x0,%rax
je     1520 <do_test+0x310>
lea    0xd11(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
cmpq   $0x1,-0x18(%rbp)
je     1549 <do_test+0x339>
mov    -0x18(%rbp),%rax
mov    %eax,%esi
lea    0xd07(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   10d0 <pthread_attr_getinheritsched@plt>
cmp    $0x0,%rax
je     1576 <do_test+0x366>
lea    0xcfd(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x8(%rbp),%eax
mov    0x2a18(%rip),%rcx
cmp    (%rcx),%eax
je     15b0 <do_test+0x3a0>
mov    -0x8(%rbp),%eax
mov    0x2a3e(%rip),%rcx
cmp    (%rcx),%eax
je     15b0 <do_test+0x3a0>
lea    0xce3(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    0x2a19(%rip),%rax
mov    (%rax),%esi
lea    -0x4(%rbp),%rdi
call   1040 <pthread_attr_setinheritsched@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     15e5 <do_test+0x3d5>
lea    0xcd7(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   10d0 <pthread_attr_getinheritsched@plt>
cmp    $0x0,%rax
je     1612 <do_test+0x402>
lea    0xcca(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x8(%rbp),%eax
mov    0x29b4(%rip),%rcx
cmp    (%rcx),%eax
je     163f <do_test+0x42f>
mov    -0x8(%rbp),%esi
lea    0xcbf(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    0x2952(%rip),%rax
mov    (%rax),%esi
lea    -0x4(%rbp),%rdi
call   1040 <pthread_attr_setinheritsched@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1674 <do_test+0x464>
lea    0xcc0(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   10d0 <pthread_attr_getinheritsched@plt>
cmp    $0x0,%rax
je     16a1 <do_test+0x491>
lea    0xcb3(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x8(%rbp),%eax
mov    0x28ed(%rip),%rcx
cmp    (%rcx),%eax
je     16ce <do_test+0x4be>
mov    -0x8(%rbp),%esi
lea    0xca8(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   10e0 <pthread_attr_getschedpolicy@plt>
cmp    $0x0,%rax
je     16fb <do_test+0x4eb>
lea    0xcb0(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x8(%rbp),%eax
mov    0x28a3(%rip),%rcx
cmp    (%rcx),%eax
je     1747 <do_test+0x537>
mov    -0x8(%rbp),%eax
mov    0x28a9(%rip),%rcx
cmp    (%rcx),%eax
je     1747 <do_test+0x537>
mov    -0x8(%rbp),%eax
mov    0x2857(%rip),%rcx
cmp    (%rcx),%eax
je     1747 <do_test+0x537>
lea    0xc83(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    0x2832(%rip),%rax
mov    (%rax),%esi
lea    -0x4(%rbp),%rdi
call   1070 <pthread_attr_setschedpolicy@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     177c <do_test+0x56c>
lea    0xc76(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   10e0 <pthread_attr_getschedpolicy@plt>
cmp    $0x0,%rax
je     17a9 <do_test+0x599>
lea    0xc68(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x8(%rbp),%eax
mov    0x27cd(%rip),%rcx
cmp    (%rcx),%eax
je     17d6 <do_test+0x5c6>
mov    -0x8(%rbp),%esi
lea    0xc5c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    0x27e3(%rip),%rax
mov    (%rax),%esi
lea    -0x4(%rbp),%rdi
call   1070 <pthread_attr_setschedpolicy@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     180b <do_test+0x5fb>
lea    0xc4e(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   10e0 <pthread_attr_getschedpolicy@plt>
cmp    $0x0,%rax
je     1838 <do_test+0x628>
lea    0xc40(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x8(%rbp),%eax
mov    0x277e(%rip),%rcx
cmp    (%rcx),%eax
je     1865 <do_test+0x655>
mov    -0x8(%rbp),%esi
lea    0xc34(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    0x273c(%rip),%rax
mov    (%rax),%esi
lea    -0x4(%rbp),%rdi
call   1070 <pthread_attr_setschedpolicy@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     189a <do_test+0x68a>
lea    0xc28(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   10e0 <pthread_attr_getschedpolicy@plt>
cmp    $0x0,%rax
je     18c7 <do_test+0x6b7>
lea    0xc1a(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x8(%rbp),%eax
mov    0x26d7(%rip),%rcx
cmp    (%rcx),%eax
je     18f4 <do_test+0x6e4>
mov    -0x8(%rbp),%esi
lea    0xc0e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <pthread_attr_getscope@plt>
cmp    $0x0,%rax
je     1921 <do_test+0x711>
lea    0xc0b(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x8(%rbp),%eax
mov    0x269d(%rip),%rcx
cmp    (%rcx),%eax
je     195b <do_test+0x74b>
mov    -0x8(%rbp),%eax
mov    0x2663(%rip),%rcx
cmp    (%rcx),%eax
je     195b <do_test+0x74b>
lea    0xbea(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    0x263e(%rip),%rax
mov    (%rax),%esi
lea    -0x4(%rbp),%rdi
call   1090 <pthread_attr_setscope@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    0x265e(%rip),%rcx
cmp    (%rcx),%eax
je     1a01 <do_test+0x7f1>
cmpl   $0x0,-0xc(%rbp)
je     19a2 <do_test+0x792>
lea    0xbcf(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <pthread_attr_getscope@plt>
cmp    $0x0,%rax
je     19cf <do_test+0x7bf>
lea    0xbbb(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x8(%rbp),%eax
mov    0x25c7(%rip),%rcx
cmp    (%rcx),%eax
je     19fc <do_test+0x7ec>
mov    -0x8(%rbp),%esi
lea    0xba9(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
jmp    1a01 <do_test+0x7f1>
mov    0x25c0(%rip),%rax
mov    (%rax),%esi
lea    -0x4(%rbp),%rdi
call   1090 <pthread_attr_setscope@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1a36 <do_test+0x826>
lea    0xba7(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <pthread_attr_getscope@plt>
cmp    $0x0,%rax
je     1a63 <do_test+0x853>
lea    0xb93(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x8(%rbp),%eax
mov    0x255b(%rip),%rcx
cmp    (%rcx),%eax
je     1a90 <do_test+0x880>
mov    -0x8(%rbp),%esi
lea    0xb81(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    -0x19(%rbp),%rsi
lea    -0x4(%rbp),%rdi
mov    $0x1,%edx
call   10f0 <pthread_attr_setstack@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    0x24e1(%rip),%rcx
cmp    (%rcx),%eax
je     1acd <do_test+0x8bd>
lea    0xb7b(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    -0x4(%rbp),%rdi
mov    $0x1,%esi
call   1130 <pthread_attr_setstacksize@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    0x24a8(%rip),%rcx
cmp    (%rcx),%eax
je     1b06 <do_test+0x8f6>
lea    0xb6e(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_test>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0x4(%rsp),%rdi
call   1080 <pthread_attr_init@plt>
test   %rax,%rax
jne    1612 <do_test+0x402>
lea    0x4(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1120 <pthread_attr_getdetachstate@plt>
test   %rax,%rax
jne    161e <do_test+0x40e>
mov    0x8(%rsp),%esi
mov    0x2d98(%rip),%r14
mov    (%r14),%edx
cmp    %edx,%esi
jne    162a <do_test+0x41a>
mov    0x2d4e(%rip),%rbx
mov    (%rbx),%esi
lea    0x4(%rsp),%rdi
call   10a0 <pthread_attr_setdetachstate@plt>
test   %eax,%eax
jne    1642 <do_test+0x432>
lea    0x4(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1120 <pthread_attr_getdetachstate@plt>
test   %rax,%rax
jne    164e <do_test+0x43e>
mov    0x8(%rsp),%eax
cmp    (%rbx),%eax
jne    165a <do_test+0x44a>
mov    (%r14),%esi
lea    0x4(%rsp),%rdi
call   10a0 <pthread_attr_setdetachstate@plt>
test   %eax,%eax
jne    1666 <do_test+0x456>
lea    0x4(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1120 <pthread_attr_getdetachstate@plt>
test   %rax,%rax
jne    1672 <do_test+0x462>
mov    0x8(%rsp),%eax
cmp    (%r14),%eax
jne    167e <do_test+0x46e>
lea    0x4(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   10b0 <pthread_attr_getguardsize@plt>
test   %rax,%rax
jne    168a <do_test+0x47a>
mov    0x10(%rsp),%rbp
mov    0x2ce8(%rip),%rbx
mov    (%rbx),%edi
call   1100 <sysconf@plt>
cmp    %rax,%rbp
jne    1696 <do_test+0x486>
lea    0x4(%rsp),%rdi
xor    %esi,%esi
call   10c0 <pthread_attr_setguardsize@plt>
test   %eax,%eax
jne    16be <do_test+0x4ae>
lea    0x4(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   10b0 <pthread_attr_getguardsize@plt>
test   %rax,%rax
jne    16ca <do_test+0x4ba>
mov    0x10(%rsp),%rsi
test   %rsi,%rsi
jne    16d6 <do_test+0x4c6>
lea    0x4(%rsp),%rdi
mov    $0x1,%esi
call   10c0 <pthread_attr_setguardsize@plt>
test   %eax,%eax
jne    16df <do_test+0x4cf>
lea    0x4(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   10b0 <pthread_attr_getguardsize@plt>
test   %rax,%rax
jne    16eb <do_test+0x4db>
mov    0x10(%rsp),%rsi
cmp    $0x1,%rsi
jne    16f7 <do_test+0x4e7>
lea    0x4(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   10d0 <pthread_attr_getinheritsched@plt>
test   %rax,%rax
jne    1703 <do_test+0x4f3>
mov    0x8(%rsp),%eax
mov    0x2bf5(%rip),%r14
mov    0x2c26(%rip),%rbx
mov    (%rbx),%esi
cmp    (%r14),%eax
je     13b9 <do_test+0x1a9>
cmp    %esi,%eax
jne    170f <do_test+0x4ff>
lea    0x4(%rsp),%rdi
call   1040 <pthread_attr_setinheritsched@plt>
test   %eax,%eax
jne    171b <do_test+0x50b>
lea    0x4(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   10d0 <pthread_attr_getinheritsched@plt>
test   %rax,%rax
jne    1727 <do_test+0x517>
mov    0x8(%rsp),%esi
cmp    (%rbx),%esi
jne    1733 <do_test+0x523>
mov    (%r14),%esi
lea    0x4(%rsp),%rdi
call   1040 <pthread_attr_setinheritsched@plt>
test   %eax,%eax
jne    173f <do_test+0x52f>
lea    0x4(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   10d0 <pthread_attr_getinheritsched@plt>
test   %rax,%rax
jne    174b <do_test+0x53b>
mov    0x8(%rsp),%esi
cmp    (%r14),%esi
jne    1757 <do_test+0x547>
lea    0x4(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   10e0 <pthread_attr_getschedpolicy@plt>
test   %rax,%rax
jne    1763 <do_test+0x553>
mov    0x8(%rsp),%eax
mov    0x2b5c(%rip),%r14
mov    0x2b6d(%rip),%r15
mov    0x2b26(%rip),%rbx
mov    (%rbx),%esi
cmp    (%r14),%eax
je     146e <do_test+0x25e>
cmp    (%r15),%eax
je     146e <do_test+0x25e>
cmp    %esi,%eax
jne    176f <do_test+0x55f>
lea    0x4(%rsp),%rdi
call   1070 <pthread_attr_setschedpolicy@plt>
test   %eax,%eax
jne    177b <do_test+0x56b>
lea    0x4(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   10e0 <pthread_attr_getschedpolicy@plt>
test   %rax,%rax
jne    1787 <do_test+0x577>
mov    0x8(%rsp),%esi
cmp    (%rbx),%esi
jne    1793 <do_test+0x583>
mov    (%r15),%esi
lea    0x4(%rsp),%rdi
call   1070 <pthread_attr_setschedpolicy@plt>
test   %eax,%eax
jne    179f <do_test+0x58f>
lea    0x4(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   10e0 <pthread_attr_getschedpolicy@plt>
test   %rax,%rax
jne    17a8 <do_test+0x598>
mov    0x8(%rsp),%esi
cmp    (%r15),%esi
jne    17b1 <do_test+0x5a1>
mov    (%r14),%esi
lea    0x4(%rsp),%rdi
call   1070 <pthread_attr_setschedpolicy@plt>
test   %eax,%eax
jne    17bd <do_test+0x5ad>
lea    0x4(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   10e0 <pthread_attr_getschedpolicy@plt>
test   %rax,%rax
jne    17c6 <do_test+0x5b6>
mov    0x8(%rsp),%esi
cmp    (%r14),%esi
jne    17cf <do_test+0x5bf>
lea    0x4(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1030 <pthread_attr_getscope@plt>
test   %rax,%rax
jne    17d8 <do_test+0x5c8>
mov    0x8(%rsp),%eax
mov    0x2a8d(%rip),%rbx
mov    0x2a5e(%rip),%r14
mov    (%r14),%esi
cmp    (%rbx),%eax
je     1551 <do_test+0x341>
cmp    %esi,%eax
jne    17e1 <do_test+0x5d1>
lea    0x4(%rsp),%rdi
call   1090 <pthread_attr_setscope@plt>
mov    0x2a76(%rip),%rcx
cmp    (%rcx),%eax
je     1593 <do_test+0x383>
test   %eax,%eax
jne    1817 <do_test+0x607>
lea    0x4(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1030 <pthread_attr_getscope@plt>
test   %rax,%rax
jne    1820 <do_test+0x610>
mov    0x8(%rsp),%esi
cmp    (%r14),%esi
jne    1836 <do_test+0x626>
mov    (%rbx),%esi
lea    0x4(%rsp),%rdi
call   1090 <pthread_attr_setscope@plt>
test   %eax,%eax
jne    17ea <do_test+0x5da>
lea    0x4(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1030 <pthread_attr_getscope@plt>
test   %rax,%rax
jne    17f3 <do_test+0x5e3>
mov    0x8(%rsp),%esi
cmp    (%rbx),%esi
jne    17fc <do_test+0x5ec>
lea    0x4(%rsp),%rdi
lea    0xf(%rsp),%rsi
mov    $0x1,%edx
call   10f0 <pthread_attr_setstack@plt>
mov    0x29aa(%rip),%rbx
cmp    (%rbx),%eax
jne    1805 <do_test+0x5f5>
lea    0x4(%rsp),%rdi
mov    $0x1,%esi
call   1130 <pthread_attr_setstacksize@plt>
cmp    (%rbx),%eax
jne    180e <do_test+0x5fe>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x9e7(%rip),%rdi
jmp    1827 <do_test+0x617>
lea    0x9ec(%rip),%rdi
jmp    1827 <do_test+0x617>
lea    0xa00(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    0xa2f(%rip),%rdi
jmp    1827 <do_test+0x617>
lea    0xa42(%rip),%rdi
jmp    1827 <do_test+0x617>
lea    0xa56(%rip),%rdi
jmp    1827 <do_test+0x617>
lea    0xa7a(%rip),%rdi
jmp    1827 <do_test+0x617>
lea    0xa8d(%rip),%rdi
jmp    1827 <do_test+0x617>
lea    0xaa1(%rip),%rdi
jmp    1827 <do_test+0x617>
lea    0xac5(%rip),%rdi
jmp    1827 <do_test+0x617>
mov    0x10(%rsp),%ebp
mov    (%rbx),%edi
call   1100 <sysconf@plt>
lea    0xacb(%rip),%rdi
mov    %ebp,%esi
mov    %rax,%rdx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    0xade(%rip),%rdi
jmp    1827 <do_test+0x617>
lea    0xaef(%rip),%rdi
jmp    1827 <do_test+0x617>
lea    0xb00(%rip),%rdi
jmp    16fe <do_test+0x4ee>
lea    0xb1f(%rip),%rdi
jmp    1827 <do_test+0x617>
lea    0xb30(%rip),%rdi
jmp    1827 <do_test+0x617>
lea    0xb41(%rip),%rdi
jmp    183d <do_test+0x62d>
lea    0xb5a(%rip),%rdi
jmp    1827 <do_test+0x617>
lea    0xb6e(%rip),%rdi
jmp    1827 <do_test+0x617>
lea    0xb8b(%rip),%rdi
jmp    1827 <do_test+0x617>
lea    0xb9f(%rip),%rdi
jmp    1827 <do_test+0x617>
lea    0xbb3(%rip),%rdi
jmp    183d <do_test+0x62d>
lea    0xbdf(%rip),%rdi
jmp    1827 <do_test+0x617>
lea    0xbf3(%rip),%rdi
jmp    1827 <do_test+0x617>
lea    0xc07(%rip),%rdi
jmp    183d <do_test+0x62d>
lea    0xc32(%rip),%rdi
jmp    1827 <do_test+0x617>
lea    0xc45(%rip),%rdi
jmp    1827 <do_test+0x617>
lea    0xc61(%rip),%rdi
jmp    1827 <do_test+0x617>
lea    0xc74(%rip),%rdi
jmp    1827 <do_test+0x617>
lea    0xc87(%rip),%rdi
jmp    183d <do_test+0x62d>
lea    0xca4(%rip),%rdi
jmp    1827 <do_test+0x617>
lea    0xcba(%rip),%rdi
jmp    1827 <do_test+0x617>
lea    0xcd0(%rip),%rdi
jmp    183d <do_test+0x62d>
lea    0xcef(%rip),%rdi
jmp    1827 <do_test+0x617>
lea    0xd05(%rip),%rdi
jmp    1827 <do_test+0x617>
lea    0xd1b(%rip),%rdi
jmp    183d <do_test+0x62d>
lea    0xd3e(%rip),%rdi
jmp    1827 <do_test+0x617>
lea    0xd4e(%rip),%rdi
jmp    1827 <do_test+0x617>
lea    0xddd(%rip),%rdi
jmp    1827 <do_test+0x617>
lea    0xded(%rip),%rdi
jmp    1827 <do_test+0x617>
lea    0xdfd(%rip),%rdi
jmp    183d <do_test+0x62d>
lea    0xe2d(%rip),%rdi
jmp    1827 <do_test+0x617>
lea    0xe50(%rip),%rdi
jmp    1827 <do_test+0x617>
lea    0xd44(%rip),%rdi
jmp    1827 <do_test+0x617>
lea    0xd54(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    0xd57(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>

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

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