#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 *, ...);
int /*<<< orphan*/ scanf(char *, int *);
void main() {
  int vetor[10], m1, m2, m3;
  for (int i = 0; i < 10; i++) {
    printf("Informe o valor da posicao %d: ", i + 1);
    scanf("%d", &vetor[i]);
  }
  for (int i = 0, aux; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
      if (vetor[i] < vetor[j]) {
        aux = vetor[i];
        vetor[i] = vetor[j];
        vetor[j] = aux;
      }
    }
  }
  for (int i = 0; i < 3; i++) {
    printf("%d ", vetor[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x40(%rbp)
cmpl   $0xa,-0x40(%rbp)
jge    1176 <main+0x56>
mov    -0x40(%rbp),%esi
add    $0x1,%esi
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x40(%rbp),%rax
lea    -0x30(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xebd(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    112f <main+0xf>
movl   $0x0,-0x44(%rbp)
cmpl   $0xa,-0x44(%rbp)
jge    11fa <main+0xda>
movl   $0x0,-0x4c(%rbp)
cmpl   $0xa,-0x4c(%rbp)
jge    11e7 <main+0xc7>
movslq -0x44(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
movslq -0x4c(%rbp),%rcx
cmp    -0x30(%rbp,%rcx,4),%eax
jge    11d4 <main+0xb4>
movslq -0x44(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x48(%rbp)
movslq -0x4c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%ecx
movslq -0x44(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x48(%rbp),%ecx
movslq -0x4c(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
jmp    11d9 <main+0xb9>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    118e <main+0x6e>
jmp    11ec <main+0xcc>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    117d <main+0x5d>
movl   $0x0,-0x50(%rbp)
cmpl   $0x3,-0x50(%rbp)
jge    122f <main+0x10f>
movslq -0x50(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    1201 <main+0xe1>
lea    0xdf1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
lea    0xec0(%rip),%r14
xor    %ebx,%ebx
mov    %r14,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec8(%rip),%r15
mov    %rsp,%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x14(%rsp),%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x18(%rsp),%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x1c(%rsp),%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x20(%rsp),%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x24(%rsp),%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
jmp    127e <main+0x14e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    $0xa,%rbx
je     1339 <main+0x209>
mov    (%rsp,%rbx,4),%eax
mov    (%rsp),%ecx
cmp    %ecx,%eax
jge    1291 <main+0x161>
mov    %ecx,(%rsp,%rbx,4)
mov    %eax,(%rsp)
mov    (%rsp,%rbx,4),%eax
mov    0x4(%rsp),%ecx
cmp    %ecx,%eax
jge    12a3 <main+0x173>
mov    %ecx,(%rsp,%rbx,4)
mov    %eax,0x4(%rsp)
mov    (%rsp,%rbx,4),%eax
mov    0x8(%rsp),%ecx
cmp    %ecx,%eax
jge    12b5 <main+0x185>
mov    %ecx,(%rsp,%rbx,4)
mov    %eax,0x8(%rsp)
mov    (%rsp,%rbx,4),%eax
mov    0xc(%rsp),%ecx
cmp    %ecx,%eax
jge    12c7 <main+0x197>
mov    %ecx,(%rsp,%rbx,4)
mov    %eax,0xc(%rsp)
mov    (%rsp,%rbx,4),%eax
mov    0x10(%rsp),%ecx
cmp    %ecx,%eax
jge    12d9 <main+0x1a9>
mov    %ecx,(%rsp,%rbx,4)
mov    %eax,0x10(%rsp)
mov    (%rsp,%rbx,4),%eax
mov    0x14(%rsp),%ecx
cmp    %ecx,%eax
jge    12eb <main+0x1bb>
mov    %ecx,(%rsp,%rbx,4)
mov    %eax,0x14(%rsp)
mov    (%rsp,%rbx,4),%eax
mov    0x18(%rsp),%ecx
cmp    %ecx,%eax
jge    12fd <main+0x1cd>
mov    %ecx,(%rsp,%rbx,4)
mov    %eax,0x18(%rsp)
mov    (%rsp,%rbx,4),%eax
mov    0x1c(%rsp),%ecx
cmp    %ecx,%eax
jge    130f <main+0x1df>
mov    %ecx,(%rsp,%rbx,4)
mov    %eax,0x1c(%rsp)
mov    (%rsp,%rbx,4),%eax
mov    0x20(%rsp),%ecx
cmp    %ecx,%eax
jge    1321 <main+0x1f1>
mov    %ecx,(%rsp,%rbx,4)
mov    %eax,0x20(%rsp)
mov    (%rsp,%rbx,4),%eax
mov    0x24(%rsp),%ecx
cmp    %ecx,%eax
jge    1270 <main+0x140>
mov    %ecx,(%rsp,%rbx,4)
mov    %eax,0x24(%rsp)
jmp    1270 <main+0x140>
mov    (%rsp),%esi
lea    0xce0(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Informe o valor da posicao %d: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d \00"
@.str.3 = [2 x i8] c"\0A\00"
define void @main() {
%1 = alloca [10 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %5
br label %10
10: ; preds = %21, %0
%11 = load i32, i32* %5
%12 = icmp slt i32 %11, 10
br i1 %12, label %13, label %24
13: ; preds = %10
%14 = load i32, i32* %5
%15 = add nsw i32 %14, 1
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = load i32, i32* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %18
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %19)
br label %21
21: ; preds = %13
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
store i32 %23, i32* %5
br label %10
24: ; preds = %10
store i32 0, i32* %6
br label %25
25: ; preds = %63, %24
%26 = load i32, i32* %6
%27 = icmp slt i32 %26, 10
br i1 %27, label %28, label %66
28: ; preds = %25
store i32 0, i32* %8
br label %29
29: ; preds = %59, %28
%30 = load i32, i32* %8
%31 = icmp slt i32 %30, 10
br i1 %31, label %32, label %62
32: ; preds = %29
%33 = load i32, i32* %6
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %34
%36 = load i32, i32* %35
%37 = load i32, i32* %8
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %38
%40 = load i32, i32* %39
%41 = icmp slt i32 %36, %40
br i1 %41, label %42, label %58
42: ; preds = %32
%43 = load i32, i32* %6
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %44
%46 = load i32, i32* %45
store i32 %46, i32* %7
%47 = load i32, i32* %8
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %48
%50 = load i32, i32* %49
%51 = load i32, i32* %6
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %52
store i32 %50, i32* %53
%54 = load i32, i32* %7
%55 = load i32, i32* %8
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %56
store i32 %54, i32* %57
br label %58
58: ; preds = %42, %32
br label %59
59: ; preds = %58
%60 = load i32, i32* %8
%61 = add nsw i32 %60, 1
store i32 %61, i32* %8
br label %29
62: ; preds = %29
br label %63
63: ; preds = %62
%64 = load i32, i32* %6
%65 = add nsw i32 %64, 1
store i32 %65, i32* %6
br label %25
66: ; preds = %25
store i32 0, i32* %9
br label %67
67: ; preds = %76, %66
%68 = load i32, i32* %9
%69 = icmp slt i32 %68, 3
br i1 %69, label %70, label %79
70: ; preds = %67
%71 = load i32, i32* %9
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %72
%74 = load i32, i32* %73
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %74)
br label %76
76: ; preds = %70
%77 = load i32, i32* %9
%78 = add nsw i32 %77, 1
store i32 %78, i32* %9
br label %67
79: ; preds = %67
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"Informe o valor da posicao %d: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d \00"
define void @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 1)
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 2)
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 3)
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %10)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 4)
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %13)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 5)
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %16)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 6)
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %19)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 7)
%22 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %22)
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 8)
%25 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %25)
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 9)
%28 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
%29 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %28)
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 10)
%31 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
%32 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %31)
br label %33
33: ; preds = %0, %102
%34 = phi i64 [ 0, %0 ], [ %103, %102 ]
%35 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %34
%36 = load i32, i32* %35
%37 = load i32, i32* %4
%38 = icmp slt i32 %36, %37
br i1 %38, label %47, label %49
39: ; preds = %102
%40 = load i32, i32* %4
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %40)
%42 = load i32, i32* %7
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %42)
%44 = load i32, i32* %10
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %44)
%46 = call i32 @putchar(i32 10)
ret void
47: ; preds = %33
store i32 %37, i32* %35
store i32 %36, i32* %4
%48 = load i32, i32* %35
br label %49
49: ; preds = %33, %47
%50 = phi i32 [ %36, %33 ], [ %48, %47 ]
%51 = load i32, i32* %7
%52 = icmp slt i32 %50, %51
br i1 %52, label %53, label %55
53: ; preds = %49
store i32 %51, i32* %35
store i32 %50, i32* %7
%54 = load i32, i32* %35
br label %55
55: ; preds = %53, %49
%56 = phi i32 [ %54, %53 ], [ %50, %49 ]
%57 = load i32, i32* %10
%58 = icmp slt i32 %56, %57
br i1 %58, label %59, label %61
59: ; preds = %55
store i32 %57, i32* %35
store i32 %56, i32* %10
%60 = load i32, i32* %35
br label %61
61: ; preds = %59, %55
%62 = phi i32 [ %60, %59 ], [ %56, %55 ]
%63 = load i32, i32* %13
%64 = icmp slt i32 %62, %63
br i1 %64, label %65, label %67
65: ; preds = %61
store i32 %63, i32* %35
store i32 %62, i32* %13
%66 = load i32, i32* %35
br label %67
67: ; preds = %65, %61
%68 = phi i32 [ %66, %65 ], [ %62, %61 ]
%69 = load i32, i32* %16
%70 = icmp slt i32 %68, %69
br i1 %70, label %71, label %73
71: ; preds = %67
store i32 %69, i32* %35
store i32 %68, i32* %16
%72 = load i32, i32* %35
br label %73
73: ; preds = %71, %67
%74 = phi i32 [ %72, %71 ], [ %68, %67 ]
%75 = load i32, i32* %19
%76 = icmp slt i32 %74, %75
br i1 %76, label %77, label %79
77: ; preds = %73
store i32 %75, i32* %35
store i32 %74, i32* %19
%78 = load i32, i32* %35
br label %79
79: ; preds = %77, %73
%80 = phi i32 [ %78, %77 ], [ %74, %73 ]
%81 = load i32, i32* %22
%82 = icmp slt i32 %80, %81
br i1 %82, label %83, label %85
83: ; preds = %79
store i32 %81, i32* %35
store i32 %80, i32* %22
%84 = load i32, i32* %35
br label %85
85: ; preds = %83, %79
%86 = phi i32 [ %84, %83 ], [ %80, %79 ]
%87 = load i32, i32* %25
%88 = icmp slt i32 %86, %87
br i1 %88, label %89, label %91
89: ; preds = %85
store i32 %87, i32* %35
store i32 %86, i32* %25
%90 = load i32, i32* %35
br label %91
91: ; preds = %89, %85
%92 = phi i32 [ %90, %89 ], [ %86, %85 ]
%93 = load i32, i32* %28
%94 = icmp slt i32 %92, %93
br i1 %94, label %95, label %97
95: ; preds = %91
store i32 %93, i32* %35
store i32 %92, i32* %28
%96 = load i32, i32* %35
br label %97
97: ; preds = %95, %91
%98 = phi i32 [ %96, %95 ], [ %92, %91 ]
%99 = load i32, i32* %31
%100 = icmp slt i32 %98, %99
br i1 %100, label %101, label %102
101: ; preds = %97
store i32 %99, i32* %35
store i32 %98, i32* %31
br label %102
102: ; preds = %101, %97
%103 = add nuw nsw i64 %34, 1
%104 = icmp eq i64 %103, 10
br i1 %104, label %39, label %33
}