#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 /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(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 {
      printf("[err=%d][line = %d] %s\n", s, 96, "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 {
      printf("[err=%d][line = %d] %s\n", s, 104, "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 {
      printf("[err=%d][line = %d] %s\n", s, 112,
             "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 {
      printf("[err=%d][line = %d] %s\n", s, 120, "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 {
      printf("[err=%d][line = %d] %s\n", s, 129, "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 {
      printf("[err=%d][line = %d] %s\n", s, 134, "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 {
      printf("[err=%d][line = %d] %s\n", s, 139, "pthread_attr_getstack");
      exit(EXIT_FAILURE);
    } while (0);
  printf("%sStack address       = %p\n", prefix, stkaddr);
  printf("%sStack size          = 0x%x 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   10b0 <pthread_attr_getdetachstate@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11ed <display_pthread_attr+0x5d>
jmp    11c2 <display_pthread_attr+0x32>
mov    -0x14(%rbp),%esi
lea    0xe34(%rip),%rdi
mov    $0x60,%edx
lea    0xe40(%rip),%rcx
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2dc2(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%eax
mov    0x2dc1(%rip),%rcx
cmp    (%rcx),%eax
jne    1217 <display_pthread_attr+0x87>
lea    0xe42(%rip),%rax
mov    %rax,-0x40(%rbp)
jmp    123b <display_pthread_attr+0xab>
mov    -0x18(%rbp),%edx
mov    0x2dc7(%rip),%rax
mov    (%rax),%esi
lea    0xe56(%rip),%rax
lea    0xe37(%rip),%rcx
cmp    %esi,%edx
cmove  %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x38(%rbp),%rsi
mov    -0x40(%rbp),%rdx
lea    0xdea(%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     129b <display_pthread_attr+0x10b>
jmp    1270 <display_pthread_attr+0xe0>
mov    -0x14(%rbp),%esi
lea    0xd86(%rip),%rdi
mov    $0x68,%edx
lea    0xdfe(%rip),%rcx
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2d14(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x18(%rbp),%eax
mov    0x2d2b(%rip),%rcx
cmp    (%rcx),%eax
jne    12c5 <display_pthread_attr+0x135>
lea    0xdfa(%rip),%rax
mov    %rax,-0x50(%rbp)
jmp    12e9 <display_pthread_attr+0x159>
mov    -0x18(%rbp),%edx
mov    0x2ce1(%rip),%rax
mov    (%rax),%esi
lea    0xda8(%rip),%rax
lea    0xdec(%rip),%rcx
cmp    %esi,%edx
cmove  %rcx,%rax
mov    %rax,-0x50(%rbp)
mov    -0x48(%rbp),%rsi
mov    -0x50(%rbp),%rdx
lea    0xda2(%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     1349 <display_pthread_attr+0x1b9>
jmp    131e <display_pthread_attr+0x18e>
mov    -0x14(%rbp),%esi
lea    0xcd8(%rip),%rdi
mov    $0x70,%edx
lea    0xdad(%rip),%rcx
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2c66(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x18(%rbp),%eax
mov    0x2c45(%rip),%rcx
cmp    (%rcx),%eax
jne    1373 <display_pthread_attr+0x1e3>
lea    0xdb0(%rip),%rax
mov    %rax,-0x60(%rbp)
jmp    1397 <display_pthread_attr+0x207>
mov    -0x18(%rbp),%edx
mov    0x2c63(%rip),%rax
mov    (%rax),%esi
lea    0xcfa(%rip),%rax
lea    0xda3(%rip),%rcx
cmp    %esi,%edx
cmove  %rcx,%rax
mov    %rax,-0x60(%rbp)
mov    -0x58(%rbp),%rsi
mov    -0x60(%rbp),%rdx
lea    0xd58(%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     13f7 <display_pthread_attr+0x267>
jmp    13cc <display_pthread_attr+0x23c>
mov    -0x14(%rbp),%esi
lea    0xc2a(%rip),%rdi
mov    $0x78,%edx
lea    0xd65(%rip),%rcx
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2bb8(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x18(%rbp),%eax
mov    0x2baf(%rip),%rcx
cmp    (%rcx),%eax
jne    1421 <display_pthread_attr+0x291>
lea    0xd67(%rip),%rax
mov    %rax,-0x70(%rbp)
jmp    146f <display_pthread_attr+0x2df>
mov    -0x18(%rbp),%eax
mov    0x2ba5(%rip),%rcx
cmp    (%rcx),%eax
jne    1443 <display_pthread_attr+0x2b3>
lea    0xd51(%rip),%rax
mov    %rax,-0x78(%rbp)
jmp    1467 <display_pthread_attr+0x2d7>
mov    -0x18(%rbp),%edx
mov    0x2b43(%rip),%rax
mov    (%rax),%esi
lea    0xc2a(%rip),%rax
lea    0xd39(%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    0xce5(%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     14cf <display_pthread_attr+0x33f>
jmp    14a4 <display_pthread_attr+0x314>
mov    -0x14(%rbp),%esi
lea    0xb52(%rip),%rdi
mov    $0x81,%edx
lea    0xce5(%rip),%rcx
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2ae0(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rsi
mov    -0x30(%rbp),%rdx
lea    0xcdc(%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     152f <display_pthread_attr+0x39f>
jmp    1504 <display_pthread_attr+0x374>
mov    -0x14(%rbp),%esi
lea    0xaf2(%rip),%rdi
mov    $0x86,%edx
lea    0xcbc(%rip),%rcx
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2a80(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xcb2(%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     1593 <display_pthread_attr+0x403>
jmp    1568 <display_pthread_attr+0x3d8>
mov    -0x14(%rbp),%esi
lea    0xa8e(%rip),%rdi
mov    $0x8b,%edx
lea    0xc94(%rip),%rcx
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2a1c(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rsi
mov    -0x28(%rbp),%rdx
lea    0xc86(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xc8c(%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   10b0 <pthread_attr_getdetachstate@plt>
test   %eax,%eax
jne    13a8 <display_pthread_attr+0x218>
mov    0x4(%rsp),%eax
mov    0x2e04(%rip),%rcx
mov    0x2e25(%rip),%rdx
cmp    (%rdx),%eax
lea    0xe9c(%rip),%rsi
lea    0xead(%rip),%rbx
cmovne %rbx,%rsi
cmp    (%rcx),%eax
lea    0xe70(%rip),%rdx
cmovne %rsi,%rdx
lea    0xe49(%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    13c2 <display_pthread_attr+0x232>
mov    0x4(%rsp),%eax
mov    0x2dc3(%rip),%rcx
mov    0x2d94(%rip),%rdx
cmp    (%rdx),%eax
lea    0xea6(%rip),%rsi
cmovne %rbx,%rsi
cmp    (%rcx),%eax
lea    0xe84(%rip),%rdx
cmovne %rsi,%rdx
lea    0xe5d(%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    13d9 <display_pthread_attr+0x249>
mov    0x4(%rsp),%eax
mov    0x2d39(%rip),%rcx
mov    0x2d72(%rip),%rdx
cmp    (%rdx),%eax
lea    0xeb9(%rip),%rsi
cmovne %rbx,%rsi
cmp    (%rcx),%eax
lea    0xe96(%rip),%rdx
cmovne %rsi,%rdx
lea    0xe6f(%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    13f0 <display_pthread_attr+0x260>
mov    0x4(%rsp),%eax
mov    0x2cff(%rip),%rcx
cmp    (%rcx),%eax
jne    12c6 <display_pthread_attr+0x136>
lea    0xebb(%rip),%rbx
jmp    12ee <display_pthread_attr+0x15e>
mov    0x2d03(%rip),%rcx
cmp    (%rcx),%eax
jne    12da <display_pthread_attr+0x14a>
lea    0xeb3(%rip),%rbx
jmp    12ee <display_pthread_attr+0x15e>
mov    0x2caf(%rip),%rcx
cmp    (%rcx),%eax
lea    0xeac(%rip),%rax
cmove  %rax,%rbx
lea    0xe6e(%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    1407 <display_pthread_attr+0x277>
mov    0x10(%rsp),%rdx
lea    0xe97(%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    141e <display_pthread_attr+0x28e>
mov    0x8(%rsp),%rdx
lea    0xea2(%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    1435 <display_pthread_attr+0x2a5>
mov    0x18(%rsp),%rdx
lea    0xeaa(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%rdx
lea    0xeb0(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xc51(%rip),%rdi
lea    0xc62(%rip),%rcx
mov    %eax,%esi
mov    $0x60,%edx
jmp    144a <display_pthread_attr+0x2ba>
lea    0xc37(%rip),%rdi
lea    0xcb4(%rip),%rcx
mov    %eax,%esi
mov    $0x68,%edx
jmp    144a <display_pthread_attr+0x2ba>
lea    0xc20(%rip),%rdi
lea    0xcfa(%rip),%rcx
mov    %eax,%esi
mov    $0x70,%edx
jmp    144a <display_pthread_attr+0x2ba>
lea    0xc09(%rip),%rdi
lea    0xd49(%rip),%rcx
mov    %eax,%esi
mov    $0x78,%edx
jmp    144a <display_pthread_attr+0x2ba>
lea    0xbf2(%rip),%rdi
lea    0xd8a(%rip),%rcx
mov    %eax,%esi
mov    $0x81,%edx
jmp    144a <display_pthread_attr+0x2ba>
lea    0xbdb(%rip),%rdi
lea    0xdaa(%rip),%rcx
mov    %eax,%esi
mov    $0x86,%edx
jmp    144a <display_pthread_attr+0x2ba>
lea    0xbc4(%rip),%rdi
lea    0xdcf(%rip),%rcx
mov    %eax,%esi
mov    $0x8b,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2b50(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
%struct.sched_param = type { i64 }
@.str = [24 x i8] c"[err=%d][line = %d] %s\0A\00"
@.str.1 = [28 x i8] c"pthread_attr_getdetachstate\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [28 x i8] c"%sDetach state = %s\0A\00"
@PTHREAD_CREATE_DETACHED = global i32 0
@.str.3 = [24 x i8] c"PTHREAD_CREATE_DETACHED\00"
@PTHREAD_CREATE_JOINABLE = global i32 0
@.str.4 = [24 x i8] c"PTHREAD_CREATE_JOINABLE\00"
@.str.5 = [4 x i8] c"???\00"
@.str.6 = [22 x i8] c"pthread_attr_getscope\00"
@.str.7 = [28 x i8] c"%sScope = %s\0A\00"
@PTHREAD_SCOPE_SYSTEM = global i32 0
@.str.8 = [21 x i8] c"PTHREAD_SCOPE_SYSTEM\00"
@PTHREAD_SCOPE_PROCESS = global i32 0
@.str.9 = [22 x i8] c"PTHREAD_SCOPE_PROCESS\00"
@.str.10 = [29 x i8] c"pthread_attr_getinheritsched\00"
@.str.11 = [28 x i8] c"%sInherit scheduler = %s\0A\00"
@PTHREAD_INHERIT_SCHED = global i32 0
@.str.12 = [22 x i8] c"PTHREAD_INHERIT_SCHED\00"
@PTHREAD_EXPLICIT_SCHED = global i32 0
@.str.13 = [23 x i8] c"PTHREAD_EXPLICIT_SCHED\00"
@.str.14 = [28 x i8] c"pthread_attr_getschedpolicy\00"
@.str.15 = [28 x i8] c"%sScheduling policy = %s\0A\00"
@SCHED_OTHER = global i32 0
@.str.16 = [12 x i8] c"SCHED_OTHER\00"
@SCHED_FIFO = global i32 0
@.str.17 = [11 x i8] c"SCHED_FIFO\00"
@SCHED_RR = global i32 0
@.str.18 = [9 x i8] c"SCHED_RR\00"
@.str.19 = [27 x i8] c"pthread_attr_getschedparam\00"
@.str.20 = [28 x i8] c"%sScheduling priority = %d\0A\00"
@.str.21 = [26 x i8] c"pthread_attr_getguardsize\00"
@.str.22 = [34 x i8] c"%sGuard size = %d bytes\0A\00"
@.str.23 = [22 x i8] c"pthread_attr_getstack\00"
@.str.24 = [28 x i8] c"%sStack address = %p\0A\00"
@.str.25 = [36 x i8] c"%sStack size = 0x%x 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
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %16, i32 96, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, 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.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0)
br label %33
33: ; preds = %27, %26
%34 = phi i8* [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), %26 ], [ %32, %27 ]
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, 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
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %42, i32 104, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, 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.9, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0)
br label %59
59: ; preds = %53, %52
%60 = phi i8* [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), %52 ], [ %58, %53 ]
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, 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
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %68, i32 112, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.10, 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.13, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0)
br label %85
85: ; preds = %79, %78
%86 = phi i8* [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0), %78 ], [ %84, %79 ]
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, 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
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %94, i32 120, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.14, 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.18, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0)
br label %116
116: ; preds = %110, %109
%117 = phi i8* [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.17, 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.16, i64 0, i64 0), %104 ], [ %117, %116 ]
%120 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.15, 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
%128 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %127, i32 129, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.19, 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*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.20, 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
%144 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %143, i32 134, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.21, 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*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.22, 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
%159 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %158, i32 139, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.23, 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*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.24, i64 0, i64 0), i8* %164, i8* %165)
%167 = load i8*, i8** %4
%168 = load i64, i64* %7
%169 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.25, i64 0, i64 0), i8* %167, i64 %168)
ret void
}

LLVM IR (-O2):
%struct.sched_param = type { i64 }
@.str = [24 x i8] c"[err=%d][line = %d] %s\0A\00"
@.str.1 = [28 x i8] c"pthread_attr_getdetachstate\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [28 x i8] c"%sDetach state = %s\0A\00"
@PTHREAD_CREATE_DETACHED = global i32 0
@.str.3 = [24 x i8] c"PTHREAD_CREATE_DETACHED\00"
@PTHREAD_CREATE_JOINABLE = global i32 0
@.str.4 = [24 x i8] c"PTHREAD_CREATE_JOINABLE\00"
@.str.5 = [4 x i8] c"???\00"
@.str.6 = [22 x i8] c"pthread_attr_getscope\00"
@.str.7 = [28 x i8] c"%sScope = %s\0A\00"
@PTHREAD_SCOPE_SYSTEM = global i32 0
@.str.8 = [21 x i8] c"PTHREAD_SCOPE_SYSTEM\00"
@PTHREAD_SCOPE_PROCESS = global i32 0
@.str.9 = [22 x i8] c"PTHREAD_SCOPE_PROCESS\00"
@.str.10 = [29 x i8] c"pthread_attr_getinheritsched\00"
@.str.11 = [28 x i8] c"%sInherit scheduler = %s\0A\00"
@PTHREAD_INHERIT_SCHED = global i32 0
@.str.12 = [22 x i8] c"PTHREAD_INHERIT_SCHED\00"
@PTHREAD_EXPLICIT_SCHED = global i32 0
@.str.13 = [23 x i8] c"PTHREAD_EXPLICIT_SCHED\00"
@.str.14 = [28 x i8] c"pthread_attr_getschedpolicy\00"
@.str.15 = [28 x i8] c"%sScheduling policy = %s\0A\00"
@SCHED_OTHER = global i32 0
@.str.16 = [12 x i8] c"SCHED_OTHER\00"
@SCHED_FIFO = global i32 0
@.str.17 = [11 x i8] c"SCHED_FIFO\00"
@SCHED_RR = global i32 0
@.str.18 = [9 x i8] c"SCHED_RR\00"
@.str.19 = [27 x i8] c"pthread_attr_getschedparam\00"
@.str.20 = [28 x i8] c"%sScheduling priority = %d\0A\00"
@.str.21 = [26 x i8] c"pthread_attr_getguardsize\00"
@.str.22 = [34 x i8] c"%sGuard size = %d bytes\0A\00"
@.str.23 = [22 x i8] c"pthread_attr_getstack\00"
@.str.24 = [28 x i8] c"%sStack address = %p\0A\00"
@.str.25 = [36 x i8] c"%sStack size = 0x%x 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
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %11, i32 96, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, 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.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0)
%24 = select i1 %20, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %23
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, 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
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %26, i32 104, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, 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.9, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0)
%39 = select i1 %35, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), i8* %38
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, 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
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %41, i32 112, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.10, 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.13, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0)
%54 = select i1 %50, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0), i8* %53
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, 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
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %56, i32 120, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.14, 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.18, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0)
br label %73
73: ; preds = %69, %66, %62
%74 = phi i8* [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.16, i64 0, i64 0), %62 ], [ %72, %69 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.17, i64 0, i64 0), %66 ]
%75 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.15, 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
%79 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %76, i32 129, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.19, 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*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.20, 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
%89 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %86, i32 134, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.21, 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*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.22, 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
%98 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %95, i32 139, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.23, 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*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.24, i64 0, i64 0), i8* %1, i8* %102)
%104 = load i64, i64* %4
%105 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.25, i64 0, i64 0), i8* %1, i64 %104)
ret void
}