#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 *);
int main(void) {
  int troca, vetorA[10];
  for (int i = 0; i < 10; i++) {
    printf("Digite o valor do elemento:");
    scanf("%d", &vetorA[i]);
  }
  for (int i = 0; i < 10; i++) {
    for (int j = i + 1; j < 10; j++) {
      if (vetorA[i] > vetorA[j]) {
        troca = vetorA[i];
        vetorA[i] = vetorA[j];
        vetorA[j] = troca;
      }
    }
  }
  printf("\nvetor ordenado\n");
  for (int i = 0; i < 10; i++) {
    printf("%d - ", vetorA[i]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    1177 <main+0x57>
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x34(%rbp),%rax
lea    -0x30(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xeb8(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1136 <main+0x16>
movl   $0x0,-0x38(%rbp)
cmpl   $0xa,-0x38(%rbp)
jge    11fd <main+0xdd>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
cmpl   $0xa,-0x3c(%rbp)
jge    11ea <main+0xca>
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
movslq -0x3c(%rbp),%rcx
cmp    -0x30(%rbp,%rcx,4),%eax
jle    11d7 <main+0xb7>
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x8(%rbp)
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%ecx
movslq -0x38(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x8(%rbp),%ecx
movslq -0x3c(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
jmp    11dc <main+0xbc>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1191 <main+0x71>
jmp    11ef <main+0xcf>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    117e <main+0x5e>
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x40(%rbp)
cmpl   $0xa,-0x40(%rbp)
jge    1240 <main+0x120>
movslq -0x40(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xe05(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    1212 <main+0xf2>
mov    -0x4(%rbp),%eax
add    $0x40,%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
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec9(%rip),%r15
mov    %rsp,%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x14(%rsp),%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x18(%rsp),%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x1c(%rsp),%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x20(%rsp),%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x24(%rsp),%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
mov    $0x1,%eax
jmp    124a <main+0x11a>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rax
cmp    $0xa,%rbx
je     127c <main+0x14c>
mov    %rbx,%rcx
add    $0x1,%rbx
cmp    $0x8,%rcx
ja     1240 <main+0x110>
mov    %rax,%rdx
jmp    126a <main+0x13a>
nopl   0x0(%rax)
add    $0x1,%rdx
cmp    $0xa,%rdx
je     1240 <main+0x110>
mov    (%rsp,%rcx,4),%esi
mov    (%rsp,%rdx,4),%edi
cmp    %edi,%esi
jle    1260 <main+0x130>
mov    %edi,(%rsp,%rcx,4)
mov    %esi,(%rsp,%rdx,4)
jmp    1260 <main+0x130>
lea    0xda2(%rip),%rdi
call   1030 <puts@plt>
mov    (%rsp),%esi
lea    0xd8d(%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    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x1c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x20(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x24(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [28 x i8] c"Digite o valor do elemento:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [6 x i8] c"%d - \00"
@str = [16 x i8] c"\0Avetor ordenado\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%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 ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%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 ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%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 ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%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 ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%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 ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%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 ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%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 ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%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 ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%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 ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%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 %58
33: ; preds = %72, %58
%34 = add nuw nsw i64 %60, 1
%35 = icmp eq i64 %61, 10
br i1 %35, label %36, label %58
36: ; preds = %33
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%38 = load i32, i32* %4
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %38)
%40 = load i32, i32* %7
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %40)
%42 = load i32, i32* %10
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %42)
%44 = load i32, i32* %13
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %44)
%46 = load i32, i32* %16
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %46)
%48 = load i32, i32* %19
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %48)
%50 = load i32, i32* %22
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %50)
%52 = load i32, i32* %25
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %52)
%54 = load i32, i32* %28
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %54)
%56 = load i32, i32* %31
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %56)
ret i32 0
58: ; preds = %0, %33
%59 = phi i64 [ 0, %0 ], [ %61, %33 ]
%60 = phi i64 [ 1, %0 ], [ %34, %33 ]
%61 = add nuw nsw i64 %59, 1
%62 = icmp ult i64 %59, 9
br i1 %62, label %63, label %33
63: ; preds = %58
%64 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %59
br label %65
65: ; preds = %63, %72
%66 = phi i64 [ %60, %63 ], [ %73, %72 ]
%67 = load i32, i32* %64
%68 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %66
%69 = load i32, i32* %68
%70 = icmp sgt i32 %67, %69
br i1 %70, label %71, label %72
71: ; preds = %65
store i32 %69, i32* %64
store i32 %67, i32* %68
br label %72
72: ; preds = %65, %71
%73 = add nuw nsw i64 %66, 1
%74 = icmp eq i64 %73, 10
br i1 %74, label %33, label %65
}