#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 */
struct sched_param {
  size_t sched_priority;
};
typedef int /*<<< orphan*/ pthread_attr_t;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
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 errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *, ...);
int pthread_attr_getdetachstate(int /*<<< orphan*/ *, int *);
int pthread_attr_getguardsize(int /*<<< orphan*/ *, size_t *);
int pthread_attr_getinheritsched(int /*<<< orphan*/ *, int *);
int pthread_attr_getschedparam(int /*<<< orphan*/ *, struct sched_param *);
int pthread_attr_getschedpolicy(int /*<<< orphan*/ *, int *);
int pthread_attr_getscope(int /*<<< orphan*/ *, int *);
int pthread_attr_getstack(int /*<<< orphan*/ *, void **, size_t *);
void display_pthread_attr(pthread_attr_t *attr, char *prefix) {
  int s, i;
  size_t v;
  void *stkaddr;
  struct sched_param sp;
  s = pthread_attr_getdetachstate(attr, &i);
  if (s != 0)
    do {
      errno = s;
      perror("pthread_attr_getdetachstate");
      exit(EXIT_FAILURE);
    } while (0);
  printf("%sDetach state        = %s\n", prefix,
         (i == PTHREAD_CREATE_DETACHED)   ? "PTHREAD_CREATE_DETACHED"
         : (i == PTHREAD_CREATE_JOINABLE) ? "PTHREAD_CREATE_JOINABLE"
                                          : "???");
  s = pthread_attr_getscope(attr, &i);
  if (s != 0)
    do {
      errno = s;
      perror("pthread_attr_getscope");
      exit(EXIT_FAILURE);
    } while (0);
  printf("%sScope               = %s\n", prefix,
         (i == PTHREAD_SCOPE_SYSTEM)    ? "PTHREAD_SCOPE_SYSTEM"
         : (i == PTHREAD_SCOPE_PROCESS) ? "PTHREAD_SCOPE_PROCESS"
                                        : "???");
  s = pthread_attr_getinheritsched(attr, &i);
  if (s != 0)
    do {
      errno = s;
      perror("pthread_attr_getinheritsched");
      exit(EXIT_FAILURE);
    } while (0);
  printf("%sInherit scheduler   = %s\n", prefix,
         (i == PTHREAD_INHERIT_SCHED)    ? "PTHREAD_INHERIT_SCHED"
         : (i == PTHREAD_EXPLICIT_SCHED) ? "PTHREAD_EXPLICIT_SCHED"
                                         : "???");
  s = pthread_attr_getschedpolicy(attr, &i);
  if (s != 0)
    do {
      errno = s;
      perror("pthread_attr_getschedpolicy");
      exit(EXIT_FAILURE);
    } while (0);
  printf("%sScheduling policy   = %s\n", prefix,
         (i == SCHED_OTHER)  ? "SCHED_OTHER"
         : (i == SCHED_FIFO) ? "SCHED_FIFO"
         : (i == SCHED_RR)   ? "SCHED_RR"
                             : "???");
  s = pthread_attr_getschedparam(attr, &sp);
  if (s != 0)
    do {
      errno = s;
      perror("pthread_attr_getschedparam");
      exit(EXIT_FAILURE);
    } while (0);
  printf("%sScheduling priority = %d\n", prefix, sp.sched_priority);
  s = pthread_attr_getguardsize(attr, &v);
  if (s != 0)
    do {
      errno = s;
      perror("pthread_attr_getguardsize");
      exit(EXIT_FAILURE);
    } while (0);
  printf("%sGuard size          = %d bytes\n", prefix, v);
  s = pthread_attr_getstack(attr, &stkaddr, &v);
  if (s != 0)
    do {
      errno = s;
      perror("pthread_attr_getstack");
      exit(EXIT_FAILURE);
    } while (0);
  printf("%sStack address       = %p\n", prefix, stkaddr);
  printf("%sStack size          = %lu bytes\n", prefix, v);
}


x86 assembly (clang, -O0):
<display_pthread_attr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   10c0 <pthread_attr_getdetachstate@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11f8 <display_pthread_attr+0x58>
jmp    11d2 <display_pthread_attr+0x32>
mov    -0x14(%rbp),%ecx
mov    0x2dcc(%rip),%rax
mov    %ecx,(%rax)
lea    0xe1b(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2daf(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%eax
mov    0x2db6(%rip),%rcx
cmp    (%rcx),%eax
jne    1222 <display_pthread_attr+0x82>
lea    0xe1f(%rip),%rax
mov    %rax,-0x40(%rbp)
jmp    1246 <display_pthread_attr+0xa6>
mov    -0x18(%rbp),%edx
mov    0x2dbc(%rip),%rax
mov    (%rax),%esi
lea    0xe33(%rip),%rax
lea    0xe14(%rip),%rcx
cmp    %esi,%edx
cmove  %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x38(%rbp),%rsi
mov    -0x40(%rbp),%rdx
lea    0xdc7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <pthread_attr_getscope@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     12a1 <display_pthread_attr+0x101>
jmp    127b <display_pthread_attr+0xdb>
mov    -0x14(%rbp),%ecx
mov    0x2d23(%rip),%rax
mov    %ecx,(%rax)
lea    0xdde(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2d06(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x18(%rbp),%eax
mov    0x2d25(%rip),%rcx
cmp    (%rcx),%eax
jne    12cb <display_pthread_attr+0x12b>
lea    0xddc(%rip),%rax
mov    %rax,-0x50(%rbp)
jmp    12ef <display_pthread_attr+0x14f>
mov    -0x18(%rbp),%edx
mov    0x2cdb(%rip),%rax
mov    (%rax),%esi
lea    0xd8a(%rip),%rax
lea    0xdce(%rip),%rcx
cmp    %esi,%edx
cmove  %rcx,%rax
mov    %rax,-0x50(%rbp)
mov    -0x48(%rbp),%rsi
mov    -0x50(%rbp),%rdx
lea    0xd84(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1080 <pthread_attr_getinheritsched@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     134a <display_pthread_attr+0x1aa>
jmp    1324 <display_pthread_attr+0x184>
mov    -0x14(%rbp),%ecx
mov    0x2c7a(%rip),%rax
mov    %ecx,(%rax)
lea    0xd92(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2c5d(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x18(%rbp),%eax
mov    0x2c3c(%rip),%rcx
cmp    (%rcx),%eax
jne    1374 <display_pthread_attr+0x1d4>
lea    0xd97(%rip),%rax
mov    %rax,-0x60(%rbp)
jmp    1398 <display_pthread_attr+0x1f8>
mov    -0x18(%rbp),%edx
mov    0x2c62(%rip),%rax
mov    (%rax),%esi
lea    0xce1(%rip),%rax
lea    0xd8a(%rip),%rcx
cmp    %esi,%edx
cmove  %rcx,%rax
mov    %rax,-0x60(%rbp)
mov    -0x58(%rbp),%rsi
mov    -0x60(%rbp),%rdx
lea    0xd3f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1090 <pthread_attr_getschedpolicy@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     13f3 <display_pthread_attr+0x253>
jmp    13cd <display_pthread_attr+0x22d>
mov    -0x14(%rbp),%ecx
mov    0x2bd1(%rip),%rax
mov    %ecx,(%rax)
lea    0xd4f(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2bb4(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x18(%rbp),%eax
mov    0x2bb3(%rip),%rcx
cmp    (%rcx),%eax
jne    141d <display_pthread_attr+0x27d>
lea    0xd53(%rip),%rax
mov    %rax,-0x70(%rbp)
jmp    146b <display_pthread_attr+0x2cb>
mov    -0x18(%rbp),%eax
mov    0x2ba9(%rip),%rcx
cmp    (%rcx),%eax
jne    143f <display_pthread_attr+0x29f>
lea    0xd3d(%rip),%rax
mov    %rax,-0x78(%rbp)
jmp    1463 <display_pthread_attr+0x2c3>
mov    -0x18(%rbp),%edx
mov    0x2b3f(%rip),%rax
mov    (%rax),%esi
lea    0xc16(%rip),%rax
lea    0xd25(%rip),%rcx
cmp    %esi,%edx
cmove  %rcx,%rax
mov    %rax,-0x78(%rbp)
mov    -0x78(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x68(%rbp),%rsi
mov    -0x70(%rbp),%rdx
lea    0xcd1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1050 <pthread_attr_getschedparam@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     14c6 <display_pthread_attr+0x326>
jmp    14a0 <display_pthread_attr+0x300>
mov    -0x14(%rbp),%ecx
mov    0x2afe(%rip),%rax
mov    %ecx,(%rax)
lea    0xcd4(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2ae1(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rsi
mov    -0x30(%rbp),%rdx
lea    0xccd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1070 <pthread_attr_getguardsize@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1521 <display_pthread_attr+0x381>
jmp    14fb <display_pthread_attr+0x35b>
mov    -0x14(%rbp),%ecx
mov    0x2aa3(%rip),%rax
mov    %ecx,(%rax)
lea    0xcb0(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2a86(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xca8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x20(%rbp),%rdx
call   1060 <pthread_attr_getstack@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1580 <display_pthread_attr+0x3e0>
jmp    155a <display_pthread_attr+0x3ba>
mov    -0x14(%rbp),%ecx
mov    0x2a44(%rip),%rax
mov    %ecx,(%rax)
lea    0xc8d(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2a27(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rsi
mov    -0x28(%rbp),%rdx
lea    0xc81(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xc87(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_pthread_attr>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%r15
mov    %rdi,%r14
lea    0x4(%rsp),%rsi
call   10c0 <pthread_attr_getdetachstate@plt>
test   %eax,%eax
jne    13b8 <display_pthread_attr+0x218>
mov    0x4(%rsp),%eax
mov    0x2df4(%rip),%rcx
mov    0x2e15(%rip),%rdx
cmp    (%rdx),%eax
lea    0xe74(%rip),%rsi
lea    0xe85(%rip),%rbx
cmovne %rbx,%rsi
cmp    (%rcx),%eax
lea    0xe48(%rip),%rdx
cmovne %rsi,%rdx
lea    0xe21(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %r14,%rdi
call   1030 <pthread_attr_getscope@plt>
test   %eax,%eax
jne    13ca <display_pthread_attr+0x22a>
mov    0x4(%rsp),%eax
mov    0x2db3(%rip),%rcx
mov    0x2d84(%rip),%rdx
cmp    (%rdx),%eax
lea    0xe7e(%rip),%rsi
cmovne %rbx,%rsi
cmp    (%rcx),%eax
lea    0xe5c(%rip),%rdx
cmovne %rsi,%rdx
lea    0xe35(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %r14,%rdi
call   1080 <pthread_attr_getinheritsched@plt>
test   %eax,%eax
jne    13dc <display_pthread_attr+0x23c>
mov    0x4(%rsp),%eax
mov    0x2d21(%rip),%rcx
mov    0x2d62(%rip),%rdx
cmp    (%rdx),%eax
lea    0xe91(%rip),%rsi
cmovne %rbx,%rsi
cmp    (%rcx),%eax
lea    0xe6e(%rip),%rdx
cmovne %rsi,%rdx
lea    0xe47(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %r14,%rdi
call   1090 <pthread_attr_getschedpolicy@plt>
test   %eax,%eax
jne    13ee <display_pthread_attr+0x24e>
mov    0x4(%rsp),%eax
mov    0x2cef(%rip),%rcx
cmp    (%rcx),%eax
jne    12d6 <display_pthread_attr+0x136>
lea    0xe93(%rip),%rbx
jmp    12fe <display_pthread_attr+0x15e>
mov    0x2cf3(%rip),%rcx
cmp    (%rcx),%eax
jne    12ea <display_pthread_attr+0x14a>
lea    0xe8b(%rip),%rbx
jmp    12fe <display_pthread_attr+0x15e>
mov    0x2c97(%rip),%rcx
cmp    (%rcx),%eax
lea    0xe84(%rip),%rax
cmove  %rax,%rbx
lea    0xe46(%rip),%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %r14,%rdi
call   1050 <pthread_attr_getschedparam@plt>
test   %eax,%eax
jne    1400 <display_pthread_attr+0x260>
mov    0x10(%rsp),%rdx
lea    0xe6f(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1070 <pthread_attr_getguardsize@plt>
test   %eax,%eax
jne    1412 <display_pthread_attr+0x272>
mov    0x8(%rsp),%rdx
lea    0xe7a(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x18(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    %r14,%rdi
call   1060 <pthread_attr_getstack@plt>
test   %eax,%eax
jne    1424 <display_pthread_attr+0x284>
mov    0x18(%rsp),%rdx
lea    0xe82(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%rdx
lea    0xe88(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
mov    0x2be9(%rip),%rcx
mov    %eax,(%rcx)
lea    0xc38(%rip),%rdi
jmp    1434 <display_pthread_attr+0x294>
mov    0x2bd7(%rip),%rcx
mov    %eax,(%rcx)
lea    0xc92(%rip),%rdi
jmp    1434 <display_pthread_attr+0x294>
mov    0x2bc5(%rip),%rcx
mov    %eax,(%rcx)
lea    0xcdd(%rip),%rdi
jmp    1434 <display_pthread_attr+0x294>
mov    0x2bb3(%rip),%rcx
mov    %eax,(%rcx)
lea    0xd31(%rip),%rdi
jmp    1434 <display_pthread_attr+0x294>
mov    0x2ba1(%rip),%rcx
mov    %eax,(%rcx)
lea    0xd77(%rip),%rdi
jmp    1434 <display_pthread_attr+0x294>
mov    0x2b8f(%rip),%rcx
mov    %eax,(%rcx)
lea    0xd9c(%rip),%rdi
jmp    1434 <display_pthread_attr+0x294>
mov    0x2b7d(%rip),%rcx
mov    %eax,(%rcx)
lea    0xdc6(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2b60(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
%struct.sched_param = type { i64 }
@errno = global i32 0
@.str = [28 x i8] c"pthread_attr_getdetachstate\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [28 x i8] c"%sDetach state = %s\0A\00"
@PTHREAD_CREATE_DETACHED = global i32 0
@.str.2 = [24 x i8] c"PTHREAD_CREATE_DETACHED\00"
@PTHREAD_CREATE_JOINABLE = global i32 0
@.str.3 = [24 x i8] c"PTHREAD_CREATE_JOINABLE\00"
@.str.4 = [4 x i8] c"???\00"
@.str.5 = [22 x i8] c"pthread_attr_getscope\00"
@.str.6 = [28 x i8] c"%sScope = %s\0A\00"
@PTHREAD_SCOPE_SYSTEM = global i32 0
@.str.7 = [21 x i8] c"PTHREAD_SCOPE_SYSTEM\00"
@PTHREAD_SCOPE_PROCESS = global i32 0
@.str.8 = [22 x i8] c"PTHREAD_SCOPE_PROCESS\00"
@.str.9 = [29 x i8] c"pthread_attr_getinheritsched\00"
@.str.10 = [28 x i8] c"%sInherit scheduler = %s\0A\00"
@PTHREAD_INHERIT_SCHED = global i32 0
@.str.11 = [22 x i8] c"PTHREAD_INHERIT_SCHED\00"
@PTHREAD_EXPLICIT_SCHED = global i32 0
@.str.12 = [23 x i8] c"PTHREAD_EXPLICIT_SCHED\00"
@.str.13 = [28 x i8] c"pthread_attr_getschedpolicy\00"
@.str.14 = [28 x i8] c"%sScheduling policy = %s\0A\00"
@SCHED_OTHER = global i32 0
@.str.15 = [12 x i8] c"SCHED_OTHER\00"
@SCHED_FIFO = global i32 0
@.str.16 = [11 x i8] c"SCHED_FIFO\00"
@SCHED_RR = global i32 0
@.str.17 = [9 x i8] c"SCHED_RR\00"
@.str.18 = [27 x i8] c"pthread_attr_getschedparam\00"
@.str.19 = [28 x i8] c"%sScheduling priority = %d\0A\00"
@.str.20 = [26 x i8] c"pthread_attr_getguardsize\00"
@.str.21 = [34 x i8] c"%sGuard size = %d bytes\0A\00"
@.str.22 = [22 x i8] c"pthread_attr_getstack\00"
@.str.23 = [28 x i8] c"%sStack address = %p\0A\00"
@.str.24 = [35 x i8] c"%sStack size = %lu bytes\0A\00"
define void @display_pthread_attr(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i64
%8 = alloca i8*
%9 = alloca %struct.sched_param
store i32* %0, i32** %3
store i8* %1, i8** %4
%10 = load i32*, i32** %3
%11 = call i32 @pthread_attr_getdetachstate(i32* %10, i32* %6)
store i32 %11, i32* %5
%12 = load i32, i32* %5
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %21
14: ; preds = %2
br label %15
15: ; preds = %14
%16 = load i32, i32* %5
store i32 %16, i32* @errno
%17 = call i32 @perror(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%18 = load i32, i32* @EXIT_FAILURE
%19 = call i32 @exit(i32 %18)
unreachable
20: ; No predecessors!
br label %21
21: ; preds = %20, %2
%22 = load i8*, i8** %4
%23 = load i32, i32* %6
%24 = load i32, i32* @PTHREAD_CREATE_DETACHED
%25 = icmp eq i32 %23, %24
br i1 %25, label %26, label %27
26: ; preds = %21
br label %33
27: ; preds = %21
%28 = load i32, i32* %6
%29 = load i32, i32* @PTHREAD_CREATE_JOINABLE
%30 = icmp eq i32 %28, %29
%31 = zext i1 %30 to i64
%32 = select i1 %30, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0)
br label %33
33: ; preds = %27, %26
%34 = phi i8* [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), %26 ], [ %32, %27 ]
%35 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %22, i8* %34)
%36 = load i32*, i32** %3
%37 = call i32 @pthread_attr_getscope(i32* %36, i32* %6)
store i32 %37, i32* %5
%38 = load i32, i32* %5
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %47
40: ; preds = %33
br label %41
41: ; preds = %40
%42 = load i32, i32* %5
store i32 %42, i32* @errno
%43 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%44 = load i32, i32* @EXIT_FAILURE
%45 = call i32 @exit(i32 %44)
unreachable
46: ; No predecessors!
br label %47
47: ; preds = %46, %33
%48 = load i8*, i8** %4
%49 = load i32, i32* %6
%50 = load i32, i32* @PTHREAD_SCOPE_SYSTEM
%51 = icmp eq i32 %49, %50
br i1 %51, label %52, label %53
52: ; preds = %47
br label %59
53: ; preds = %47
%54 = load i32, i32* %6
%55 = load i32, i32* @PTHREAD_SCOPE_PROCESS
%56 = icmp eq i32 %54, %55
%57 = zext i1 %56 to i64
%58 = select i1 %56, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0)
br label %59
59: ; preds = %53, %52
%60 = phi i8* [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), %52 ], [ %58, %53 ]
%61 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i8* %48, i8* %60)
%62 = load i32*, i32** %3
%63 = call i32 @pthread_attr_getinheritsched(i32* %62, i32* %6)
store i32 %63, i32* %5
%64 = load i32, i32* %5
%65 = icmp ne i32 %64, 0
br i1 %65, label %66, label %73
66: ; preds = %59
br label %67
67: ; preds = %66
%68 = load i32, i32* %5
store i32 %68, i32* @errno
%69 = call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0))
%70 = load i32, i32* @EXIT_FAILURE
%71 = call i32 @exit(i32 %70)
unreachable
72: ; No predecessors!
br label %73
73: ; preds = %72, %59
%74 = load i8*, i8** %4
%75 = load i32, i32* %6
%76 = load i32, i32* @PTHREAD_INHERIT_SCHED
%77 = icmp eq i32 %75, %76
br i1 %77, label %78, label %79
78: ; preds = %73
br label %85
79: ; preds = %73
%80 = load i32, i32* %6
%81 = load i32, i32* @PTHREAD_EXPLICIT_SCHED
%82 = icmp eq i32 %80, %81
%83 = zext i1 %82 to i64
%84 = select i1 %82, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0)
br label %85
85: ; preds = %79, %78
%86 = phi i8* [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0), %78 ], [ %84, %79 ]
%87 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.10, i64 0, i64 0), i8* %74, i8* %86)
%88 = load i32*, i32** %3
%89 = call i32 @pthread_attr_getschedpolicy(i32* %88, i32* %6)
store i32 %89, i32* %5
%90 = load i32, i32* %5
%91 = icmp ne i32 %90, 0
br i1 %91, label %92, label %99
92: ; preds = %85
br label %93
93: ; preds = %92
%94 = load i32, i32* %5
store i32 %94, i32* @errno
%95 = call i32 @perror(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.13, i64 0, i64 0))
%96 = load i32, i32* @EXIT_FAILURE
%97 = call i32 @exit(i32 %96)
unreachable
98: ; No predecessors!
br label %99
99: ; preds = %98, %85
%100 = load i8*, i8** %4
%101 = load i32, i32* %6
%102 = load i32, i32* @SCHED_OTHER
%103 = icmp eq i32 %101, %102
br i1 %103, label %104, label %105
104: ; preds = %99
br label %118
105: ; preds = %99
%106 = load i32, i32* %6
%107 = load i32, i32* @SCHED_FIFO
%108 = icmp eq i32 %106, %107
br i1 %108, label %109, label %110
109: ; preds = %105
br label %116
110: ; preds = %105
%111 = load i32, i32* %6
%112 = load i32, i32* @SCHED_RR
%113 = icmp eq i32 %111, %112
%114 = zext i1 %113 to i64
%115 = select i1 %113, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.17, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0)
br label %116
116: ; preds = %110, %109
%117 = phi i8* [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0), %109 ], [ %115, %110 ]
br label %118
118: ; preds = %116, %104
%119 = phi i8* [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.15, i64 0, i64 0), %104 ], [ %117, %116 ]
%120 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.14, i64 0, i64 0), i8* %100, i8* %119)
%121 = load i32*, i32** %3
%122 = call i32 @pthread_attr_getschedparam(i32* %121, %struct.sched_param* %9)
store i32 %122, i32* %5
%123 = load i32, i32* %5
%124 = icmp ne i32 %123, 0
br i1 %124, label %125, label %132
125: ; preds = %118
br label %126
126: ; preds = %125
%127 = load i32, i32* %5
store i32 %127, i32* @errno
%128 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.18, i64 0, i64 0))
%129 = load i32, i32* @EXIT_FAILURE
%130 = call i32 @exit(i32 %129)
unreachable
131: ; No predecessors!
br label %132
132: ; preds = %131, %118
%133 = load i8*, i8** %4
%134 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %9, i32 0, i32 0
%135 = load i64, i64* %134
%136 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.19, i64 0, i64 0), i8* %133, i64 %135)
%137 = load i32*, i32** %3
%138 = call i32 @pthread_attr_getguardsize(i32* %137, i64* %7)
store i32 %138, i32* %5
%139 = load i32, i32* %5
%140 = icmp ne i32 %139, 0
br i1 %140, label %141, label %148
141: ; preds = %132
br label %142
142: ; preds = %141
%143 = load i32, i32* %5
store i32 %143, i32* @errno
%144 = call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.20, i64 0, i64 0))
%145 = load i32, i32* @EXIT_FAILURE
%146 = call i32 @exit(i32 %145)
unreachable
147: ; No predecessors!
br label %148
148: ; preds = %147, %132
%149 = load i8*, i8** %4
%150 = load i64, i64* %7
%151 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.21, i64 0, i64 0), i8* %149, i64 %150)
%152 = load i32*, i32** %3
%153 = call i32 @pthread_attr_getstack(i32* %152, i8** %8, i64* %7)
store i32 %153, i32* %5
%154 = load i32, i32* %5
%155 = icmp ne i32 %154, 0
br i1 %155, label %156, label %163
156: ; preds = %148
br label %157
157: ; preds = %156
%158 = load i32, i32* %5
store i32 %158, i32* @errno
%159 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.22, i64 0, i64 0))
%160 = load i32, i32* @EXIT_FAILURE
%161 = call i32 @exit(i32 %160)
unreachable
162: ; No predecessors!
br label %163
163: ; preds = %162, %148
%164 = load i8*, i8** %4
%165 = load i8*, i8** %8
%166 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.23, i64 0, i64 0), i8* %164, i8* %165)
%167 = load i8*, i8** %4
%168 = load i64, i64* %7
%169 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.24, i64 0, i64 0), i8* %167, i64 %168)
ret void
}

LLVM IR (-O2):
%struct.sched_param = type { i64 }
@errno = global i32 0
@.str = [28 x i8] c"pthread_attr_getdetachstate\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [28 x i8] c"%sDetach state = %s\0A\00"
@PTHREAD_CREATE_DETACHED = global i32 0
@.str.2 = [24 x i8] c"PTHREAD_CREATE_DETACHED\00"
@PTHREAD_CREATE_JOINABLE = global i32 0
@.str.3 = [24 x i8] c"PTHREAD_CREATE_JOINABLE\00"
@.str.4 = [4 x i8] c"???\00"
@.str.5 = [22 x i8] c"pthread_attr_getscope\00"
@.str.6 = [28 x i8] c"%sScope = %s\0A\00"
@PTHREAD_SCOPE_SYSTEM = global i32 0
@.str.7 = [21 x i8] c"PTHREAD_SCOPE_SYSTEM\00"
@PTHREAD_SCOPE_PROCESS = global i32 0
@.str.8 = [22 x i8] c"PTHREAD_SCOPE_PROCESS\00"
@.str.9 = [29 x i8] c"pthread_attr_getinheritsched\00"
@.str.10 = [28 x i8] c"%sInherit scheduler = %s\0A\00"
@PTHREAD_INHERIT_SCHED = global i32 0
@.str.11 = [22 x i8] c"PTHREAD_INHERIT_SCHED\00"
@PTHREAD_EXPLICIT_SCHED = global i32 0
@.str.12 = [23 x i8] c"PTHREAD_EXPLICIT_SCHED\00"
@.str.13 = [28 x i8] c"pthread_attr_getschedpolicy\00"
@.str.14 = [28 x i8] c"%sScheduling policy = %s\0A\00"
@SCHED_OTHER = global i32 0
@.str.15 = [12 x i8] c"SCHED_OTHER\00"
@SCHED_FIFO = global i32 0
@.str.16 = [11 x i8] c"SCHED_FIFO\00"
@SCHED_RR = global i32 0
@.str.17 = [9 x i8] c"SCHED_RR\00"
@.str.18 = [27 x i8] c"pthread_attr_getschedparam\00"
@.str.19 = [28 x i8] c"%sScheduling priority = %d\0A\00"
@.str.20 = [26 x i8] c"pthread_attr_getguardsize\00"
@.str.21 = [34 x i8] c"%sGuard size = %d bytes\0A\00"
@.str.22 = [22 x i8] c"pthread_attr_getstack\00"
@.str.23 = [28 x i8] c"%sStack address = %p\0A\00"
@.str.24 = [35 x i8] c"%sStack size = %lu bytes\0A\00"
define void @display_pthread_attr(i32* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca i8*
%6 = alloca %struct.sched_param
%7 = bitcast i32* %3 to i8*
%8 = bitcast i64* %4 to i8*
%9 = bitcast i8** %5 to i8*
%10 = bitcast %struct.sched_param* %6 to i8*
%11 = call i32 @pthread_attr_getdetachstate(i32* %0, i32* %3)
%12 = icmp eq i32 %11, 0
br i1 %12, label %17, label %13
13: ; preds = %2
store i32 %11, i32* @errno
%14 = call i32 @perror(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%15 = load i32, i32* @EXIT_FAILURE
%16 = call i32 @exit(i32 %15)
unreachable
17: ; preds = %2
%18 = load i32, i32* %3
%19 = load i32, i32* @PTHREAD_CREATE_DETACHED
%20 = icmp eq i32 %18, %19
%21 = load i32, i32* @PTHREAD_CREATE_JOINABLE
%22 = icmp eq i32 %18, %21
%23 = select i1 %22, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0)
%24 = select i1 %20, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %23
%25 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %1, i8* %24)
%26 = call i32 @pthread_attr_getscope(i32* %0, i32* %3)
%27 = icmp eq i32 %26, 0
br i1 %27, label %32, label %28
28: ; preds = %17
store i32 %26, i32* @errno
%29 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%30 = load i32, i32* @EXIT_FAILURE
%31 = call i32 @exit(i32 %30)
unreachable
32: ; preds = %17
%33 = load i32, i32* %3
%34 = load i32, i32* @PTHREAD_SCOPE_SYSTEM
%35 = icmp eq i32 %33, %34
%36 = load i32, i32* @PTHREAD_SCOPE_PROCESS
%37 = icmp eq i32 %33, %36
%38 = select i1 %37, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0)
%39 = select i1 %35, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i8* %38
%40 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i8* %1, i8* %39)
%41 = call i32 @pthread_attr_getinheritsched(i32* %0, i32* %3)
%42 = icmp eq i32 %41, 0
br i1 %42, label %47, label %43
43: ; preds = %32
store i32 %41, i32* @errno
%44 = call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0))
%45 = load i32, i32* @EXIT_FAILURE
%46 = call i32 @exit(i32 %45)
unreachable
47: ; preds = %32
%48 = load i32, i32* %3
%49 = load i32, i32* @PTHREAD_INHERIT_SCHED
%50 = icmp eq i32 %48, %49
%51 = load i32, i32* @PTHREAD_EXPLICIT_SCHED
%52 = icmp eq i32 %48, %51
%53 = select i1 %52, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0)
%54 = select i1 %50, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0), i8* %53
%55 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.10, i64 0, i64 0), i8* %1, i8* %54)
%56 = call i32 @pthread_attr_getschedpolicy(i32* %0, i32* %3)
%57 = icmp eq i32 %56, 0
br i1 %57, label %62, label %58
58: ; preds = %47
store i32 %56, i32* @errno
%59 = call i32 @perror(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.13, i64 0, i64 0))
%60 = load i32, i32* @EXIT_FAILURE
%61 = call i32 @exit(i32 %60)
unreachable
62: ; preds = %47
%63 = load i32, i32* %3
%64 = load i32, i32* @SCHED_OTHER
%65 = icmp eq i32 %63, %64
br i1 %65, label %73, label %66
66: ; preds = %62
%67 = load i32, i32* @SCHED_FIFO
%68 = icmp eq i32 %63, %67
br i1 %68, label %73, label %69
69: ; preds = %66
%70 = load i32, i32* @SCHED_RR
%71 = icmp eq i32 %63, %70
%72 = select i1 %71, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.17, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0)
br label %73
73: ; preds = %69, %66, %62
%74 = phi i8* [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.15, i64 0, i64 0), %62 ], [ %72, %69 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0), %66 ]
%75 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.14, i64 0, i64 0), i8* %1, i8* %74)
%76 = call i32 @pthread_attr_getschedparam(i32* %0, %struct.sched_param* %6)
%77 = icmp eq i32 %76, 0
br i1 %77, label %82, label %78
78: ; preds = %73
store i32 %76, i32* @errno
%79 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.18, i64 0, i64 0))
%80 = load i32, i32* @EXIT_FAILURE
%81 = call i32 @exit(i32 %80)
unreachable
82: ; preds = %73
%83 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %6, i64 0, i32 0
%84 = load i64, i64* %83
%85 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.19, i64 0, i64 0), i8* %1, i64 %84)
%86 = call i32 @pthread_attr_getguardsize(i32* %0, i64* %4)
%87 = icmp eq i32 %86, 0
br i1 %87, label %92, label %88
88: ; preds = %82
store i32 %86, i32* @errno
%89 = call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.20, i64 0, i64 0))
%90 = load i32, i32* @EXIT_FAILURE
%91 = call i32 @exit(i32 %90)
unreachable
92: ; preds = %82
%93 = load i64, i64* %4
%94 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.21, i64 0, i64 0), i8* %1, i64 %93)
%95 = call i32 @pthread_attr_getstack(i32* %0, i8** %5, i64* %4)
%96 = icmp eq i32 %95, 0
br i1 %96, label %101, label %97
97: ; preds = %92
store i32 %95, i32* @errno
%98 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.22, i64 0, i64 0))
%99 = load i32, i32* @EXIT_FAILURE
%100 = call i32 @exit(i32 %99)
unreachable
101: ; preds = %92
%102 = load i8*, i8** %5
%103 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.23, i64 0, i64 0), i8* %1, i8* %102)
%104 = load i64, i64* %4
%105 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.24, i64 0, i64 0), i8* %1, i64 %104)
ret void
}