#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 vet[5] = {0};
  int aux;
  for (int i = 0; i < 5; i++) {
    printf("Informe a posicao %d: ", i + 1);
    scanf("%d", &vet[i]);
  }
  for (int i = 0; i < 5; i++) {
    for (int j = 0; j < 5; j++) {
      if (vet[i] < vet[j]) {
        aux = vet[i];
        vet[i] = vet[j];
        vet[j] = aux;
      }
    }
  }
  printf("\n");
  for (int i = 0; i < 5; i++) {
    printf("%d ", vet[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1040 <memset@plt>
movl   $0x0,-0x28(%rbp)
cmpl   $0x5,-0x28(%rbp)
jge    1196 <main+0x66>
mov    -0x28(%rbp),%esi
add    $0x1,%esi
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x28(%rbp),%rax
lea    -0x20(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe94(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    114f <main+0x1f>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x5,-0x2c(%rbp)
jge    121a <main+0xea>
movl   $0x0,-0x30(%rbp)
cmpl   $0x5,-0x30(%rbp)
jge    1207 <main+0xd7>
movslq -0x2c(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%eax
movslq -0x30(%rbp),%rcx
cmp    -0x20(%rbp,%rcx,4),%eax
jge    11f4 <main+0xc4>
movslq -0x2c(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%eax
mov    %eax,-0x24(%rbp)
movslq -0x30(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%ecx
movslq -0x2c(%rbp),%rax
mov    %ecx,-0x20(%rbp,%rax,4)
mov    -0x24(%rbp),%ecx
movslq -0x30(%rbp),%rax
mov    %ecx,-0x20(%rbp,%rax,4)
jmp    11f9 <main+0xc9>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11ae <main+0x7e>
jmp    120c <main+0xdc>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    119d <main+0x6d>
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0x5,-0x34(%rbp)
jge    125d <main+0x12d>
movslq -0x34(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%esi
lea    0xdd4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    122f <main+0xff>
lea    0xdb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movl   $0x0,0x10(%rsp)
lea    0x10(%rsp),%r14
lea    0xeaa(%rip),%r15
xor    %ebx,%ebx
mov    %r15,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea9(%rip),%r12
mov    %rsp,%rsi
mov    %r12,%rdi
call   1050 <scanf@plt>
mov    %r15,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %r12,%rdi
call   1050 <scanf@plt>
mov    %r15,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %r12,%rdi
call   1050 <scanf@plt>
mov    %r15,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %r12,%rdi
call   1050 <scanf@plt>
mov    %r15,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
jmp    11fa <main+0xca>
nopl   0x0(%rax)
add    $0x1,%rbx
cmp    $0x5,%rbx
je     1254 <main+0x124>
mov    (%rsp,%rbx,4),%eax
mov    (%rsp),%ecx
cmp    %ecx,%eax
jge    120d <main+0xdd>
mov    %ecx,(%rsp,%rbx,4)
mov    %eax,(%rsp)
mov    (%rsp,%rbx,4),%eax
mov    0x4(%rsp),%ecx
cmp    %ecx,%eax
jge    121f <main+0xef>
mov    %ecx,(%rsp,%rbx,4)
mov    %eax,0x4(%rsp)
mov    (%rsp,%rbx,4),%eax
mov    0x8(%rsp),%ecx
cmp    %ecx,%eax
jge    1231 <main+0x101>
mov    %ecx,(%rsp,%rbx,4)
mov    %eax,0x8(%rsp)
mov    (%rsp,%rbx,4),%eax
mov    0xc(%rsp),%ecx
cmp    %ecx,%eax
jge    1243 <main+0x113>
mov    %ecx,(%rsp,%rbx,4)
mov    %eax,0xc(%rsp)
mov    (%rsp,%rbx,4),%eax
mov    0x10(%rsp),%ecx
cmp    %ecx,%eax
jge    11f0 <main+0xc0>
mov    %ecx,(%rsp,%rbx,4)
mov    %eax,0x10(%rsp)
jmp    11f0 <main+0xc0>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    (%rsp),%esi
lea    0xdb2(%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    $0xa,%edi
call   1030 <putchar@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [23 x i8] c"Informe a posicao %d: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [4 x i8] c"%d \00"
define void @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 1)
%4 = getelementptr inbounds [5 x i32], [5 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 ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 2)
%7 = getelementptr inbounds [5 x i32], [5 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 ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 3)
%10 = getelementptr inbounds [5 x i32], [5 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 ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 4)
%13 = getelementptr inbounds [5 x i32], [5 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 ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 5)
%16 = getelementptr inbounds [5 x i32], [5 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)
br label %18
18: ; preds = %0, %62
%19 = phi i64 [ 0, %0 ], [ %63, %62 ]
%20 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 %19
%21 = load i32, i32* %20
%22 = load i32, i32* %4
%23 = icmp slt i32 %21, %22
br i1 %23, label %37, label %39
24: ; preds = %62
%25 = call i32 @putchar(i32 10)
%26 = load i32, i32* %4
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %7
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %28)
%30 = load i32, i32* %10
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %30)
%32 = load i32, i32* %13
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %32)
%34 = load i32, i32* %16
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %34)
%36 = call i32 @putchar(i32 10)
ret void
37: ; preds = %18
store i32 %22, i32* %20
store i32 %21, i32* %4
%38 = load i32, i32* %20
br label %39
39: ; preds = %18, %37
%40 = phi i32 [ %21, %18 ], [ %38, %37 ]
%41 = load i32, i32* %7
%42 = icmp slt i32 %40, %41
br i1 %42, label %43, label %45
43: ; preds = %39
store i32 %41, i32* %20
store i32 %40, i32* %7
%44 = load i32, i32* %20
br label %45
45: ; preds = %43, %39
%46 = phi i32 [ %44, %43 ], [ %40, %39 ]
%47 = load i32, i32* %10
%48 = icmp slt i32 %46, %47
br i1 %48, label %49, label %51
49: ; preds = %45
store i32 %47, i32* %20
store i32 %46, i32* %10
%50 = load i32, i32* %20
br label %51
51: ; preds = %49, %45
%52 = phi i32 [ %50, %49 ], [ %46, %45 ]
%53 = load i32, i32* %13
%54 = icmp slt i32 %52, %53
br i1 %54, label %55, label %57
55: ; preds = %51
store i32 %53, i32* %20
store i32 %52, i32* %13
%56 = load i32, i32* %20
br label %57
57: ; preds = %55, %51
%58 = phi i32 [ %56, %55 ], [ %52, %51 ]
%59 = load i32, i32* %16
%60 = icmp slt i32 %58, %59
br i1 %60, label %61, label %62
61: ; preds = %57
store i32 %59, i32* %20
store i32 %58, i32* %16
br label %62
62: ; preds = %61, %57
%63 = add nuw nsw i64 %19, 1
%64 = icmp eq i64 %63, 5
br i1 %64, label %24, label %18
}