#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*/ Selecao(int, int *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ system(char *);
int main(void) {
  int i;
  int v[10] = {7, 4, 3, 9, 0, 8, 5, 2, 6, 1};
  Selecao(10, v);
  for (i = 0; i < 10; i++)
    printf("%d", v[i]);
  putchar('\n');
  system("pause");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xe96(%rip),%rsi
mov    $0x28,%edx
call   1060 <memcpy@plt>
lea    -0x30(%rbp),%rsi
mov    $0xa,%edi
call   1070 <Selecao@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    11b5 <main+0x65>
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xe86(%rip),%rdi
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1189 <main+0x39>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe65(%rip),%rdi
call   1040 <system@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
mov    0xed4(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xeb8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe9c(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rsi
mov    $0xa,%edi
call   1060 <Selecao@plt>
mov    (%rsp),%esi
lea    0xea9(%rip),%rbx
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    0x18(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    0x1c(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    0x20(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    0x24(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe27(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.v = [10 x i32] [i32 7, i32 4, i32 3, i32 9, i32 0, i32 8, i32 5, i32 2, i32 6, i32 1]
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10 x i32]
store i32 0, i32* %1
%4 = bitcast [10 x i32]* %3 to i8*
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%6 = call i32 @Selecao(i32 10, i32* %5)
store i32 0, i32* %2
br label %7
7: ; preds = %16, %0
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 10
br i1 %9, label %10, label %19
10: ; preds = %7
%11 = load i32, i32* %2
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %12
%14 = load i32, i32* %13
%15 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %14)
br label %16
16: ; preds = %10
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 1
store i32 %18, i32* %2
br label %7
19: ; preds = %7
%20 = call i32 @putchar(i8 signext 10)
%21 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%22 = load i32, i32* %1
ret i32 %22
}

LLVM IR (-O2):
@__const.main.v = [10 x i32] [i32 7, i32 4, i32 3, i32 9, i32 0, i32 8, i32 5, i32 2, i32 6, i32 1]
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32 @Selecao(i32 10, i32* %3)
%5 = load i32, i32* %3
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%8 = load i32, i32* %7
%9 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
%11 = load i32, i32* %10
%12 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
%14 = load i32, i32* %13
%15 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%17 = load i32, i32* %16
%18 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%20 = load i32, i32* %19
%21 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %20)
%22 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%23 = load i32, i32* %22
%24 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %23)
%25 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
%26 = load i32, i32* %25
%27 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %26)
%28 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
%29 = load i32, i32* %28
%30 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %29)
%31 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
%32 = load i32, i32* %31
%33 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %32)
%34 = call i32 @putchar(i8 signext 10)
%35 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}