#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 */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, ...);
int /*<<< orphan*/ task_exit(int /*<<< orphan*/);
int task_getprio(int /*<<< orphan*/ *);
int /*<<< orphan*/ task_yield();
void Body(void *arg) {
  int i;
  printf("%s iniciando com prioridade %d\n", (char *)arg, task_getprio(NULL));
  for (i = 0; i < 10; i++) {
    printf("%s %d\n", (char *)arg, i);
    task_yield();
  }
  printf("%s FIM\n", (char *)arg);
  task_exit(0);
}


x86 assembly (clang, -O0):
<Body>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <task_getprio@plt>
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    11ac <Body+0x6c>
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <task_yield@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1178 <Body+0x38>
mov    -0x8(%rbp),%rsi
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1030 <task_exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Body>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %edi,%edi
call   1050 <task_getprio@plt>
lea    0xeab(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb8(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <task_yield@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x1,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <task_yield@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x2,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <task_yield@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x3,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <task_yield@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x4,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <task_yield@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x5,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <task_yield@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x6,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <task_yield@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x7,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <task_yield@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x8,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <task_yield@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x9,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <task_yield@plt>
lea    0xdc1(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <task_exit@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"%s iniciando com prioridade %d\0A\00"
@.str.1 = [7 x i8] c"%s %d\0A\00"
@.str.2 = [8 x i8] c"%s FIM\0A\00"
define void @Body(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @task_getprio(i32* null)
%6 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %4, i32 %5)
store i32 0, i32* %3
br label %7
7: ; preds = %15, %1
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 10
br i1 %9, label %10, label %18
10: ; preds = %7
%11 = load i8*, i8** %2
%12 = load i32, i32* %3
%13 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %11, i32 %12)
%14 = call i32 (...) @task_yield()
br label %15
15: ; preds = %10
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %7
18: ; preds = %7
%19 = load i8*, i8** %2
%20 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %19)
%21 = call i32 @task_exit(i32 0)
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"%s iniciando com prioridade %d\0A\00"
@.str.1 = [7 x i8] c"%s %d\0A\00"
@.str.2 = [8 x i8] c"%s FIM\0A\00"
define void @Body(i8* %0) {
%2 = tail call i32 @task_getprio(i32* null)
%3 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %2)
%4 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32 0)
%5 = tail call i32 (...) @task_yield()
%6 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32 1)
%7 = tail call i32 (...) @task_yield()
%8 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32 2)
%9 = tail call i32 (...) @task_yield()
%10 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32 3)
%11 = tail call i32 (...) @task_yield()
%12 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32 4)
%13 = tail call i32 (...) @task_yield()
%14 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32 5)
%15 = tail call i32 (...) @task_yield()
%16 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32 6)
%17 = tail call i32 (...) @task_yield()
%18 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32 7)
%19 = tail call i32 (...) @task_yield()
%20 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32 8)
%21 = tail call i32 (...) @task_yield()
%22 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32 9)
%23 = tail call i32 (...) @task_yield()
%24 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%25 = tail call i32 @task_exit(i32 0)
ret void
}