#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 {
  int sched_priority;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
int /*<<< orphan*/ pthread_getschedparam(int /*<<< orphan*/, int *,
                                         struct sched_param *);
int /*<<< orphan*/ pthread_self();
void *runner(void *p) {
  struct sched_param param;
  int policy;
  pthread_getschedparam(pthread_self(), &policy, &param);
  while (1)
    printf("Esta é a execucao da Thread #%d; Sua prioridade é %d\n",
           (int)(size_t)p, param.sched_priority);
  pthread_exit(NULL);
}


x86 assembly (clang, -O0):
<runner>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1050 <pthread_self@plt>
mov    %eax,%edi
lea    -0x14(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1040 <pthread_getschedparam@plt>
mov    -0x8(%rbp),%rax
mov    %eax,%esi
mov    -0x10(%rbp),%edx
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
jmp    1152 <runner+0x22>

x86 assembly (clang, -O2):
<runner>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %eax,%eax
call   1050 <pthread_self@plt>
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
mov    %eax,%edi
call   1040 <pthread_getschedparam@plt>
lea    0xeac(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%rsp),%edx
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
jmp    1160 <runner+0x30>

LLVM IR (-O0):
%struct.sched_param = type { i32 }
@.str = [56 x i8] c"Esta \C3\A9 a execucao da Thread #%d; Sua prioridade \C3\A9 %d\0A\00"
define i8* @runner(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.sched_param
%4 = alloca i32
store i8* %0, i8** %2
%5 = call i32 (...) @pthread_self()
%6 = call i32 @pthread_getschedparam(i32 %5, i32* %4, %struct.sched_param* %3)
br label %7
7: ; preds = %1, %7
%8 = load i8*, i8** %2
%9 = ptrtoint i8* %8 to i64
%10 = trunc i64 %9 to i32
%11 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %3, i32 0, i32 0
%12 = load i32, i32* %11
%13 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %12)
br label %7
}

LLVM IR (-O2):
%struct.sched_param = type { i32 }
@.str = [56 x i8] c"Esta \C3\A9 a execucao da Thread #%d; Sua prioridade \C3\A9 %d\0A\00"
define noalias i8* @runner(i8* %0) {
%2 = alloca %struct.sched_param
%3 = alloca i32
%4 = bitcast %struct.sched_param* %2 to i8*
%5 = bitcast i32* %3 to i8*
%6 = tail call i32 (...) @pthread_self()
%7 = call i32 @pthread_getschedparam(i32 %6, i32* %3, %struct.sched_param* %2)
%8 = ptrtoint i8* %0 to i64
%9 = trunc i64 %8 to i32
%10 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %2, i64 0, i32 0
br label %11
11: ; preds = %11, %1
%12 = load i32, i32* %10
%13 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %12)
br label %11
}