#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 *, float);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int vetor[10];
  int i;
  for (i = 0; i < 10; i++) {
    printf("Digite o valor da posicao %d do vetor : ", i + 1);
    scanf("%d", &vetor[i]);
  }
  float media = 0;
  for (i = 0; i < 10; i++) {
    media = media + vetor[i];
  }
  media = (float)media / 10;
  printf("A media dos valores e de %.4f ", media);
  return 0;
}


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    117f <main+0x5f>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
cvtsi2ss %eax,%xmm0
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
movslq -0x34(%rbp),%rax
lea    -0x30(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xec1(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1136 <main+0x16>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x38(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    11be <main+0x9e>
movss  -0x38(%rbp),%xmm0
movslq -0x34(%rbp),%rax
cvtsi2ssl -0x30(%rbp,%rax,4),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x38(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    118e <main+0x6e>
movss  -0x38(%rbp),%xmm0
movss  0xe35(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x38(%rbp),%xmm0
lea    0xe50(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
lea    0xefa(%rip),%r14
movss  0xeca(%rip),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
lea    0xf0c(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xeac(%rip),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xe93(%rip),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xe7a(%rip),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xe61(%rip),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xe48(%rip),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xe2f(%rip),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xe16(%rip),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
lea    0x1c(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xdfd(%rip),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
lea    0x20(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xde4(%rip),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
lea    0x24(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movsd  (%rsp),%xmm0
cvtdq2ps %xmm0,%xmm0
movaps %xmm0,%xmm1
cvtsi2ssl 0x8(%rsp),%xmm2
shufps $0x55,%xmm0,%xmm1
cvtsi2ssl 0xc(%rsp),%xmm3
addss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2ssl 0x10(%rsp),%xmm0
addss  %xmm1,%xmm2
xorps  %xmm1,%xmm1
cvtsi2ssl 0x14(%rsp),%xmm1
addss  %xmm2,%xmm3
xorps  %xmm2,%xmm2
cvtsi2ssl 0x18(%rsp),%xmm2
addss  %xmm3,%xmm0
xorps  %xmm3,%xmm3
cvtsi2ssl 0x1c(%rsp),%xmm3
addss  %xmm0,%xmm1
cvtsi2ssl 0x20(%rsp),%xmm4
addss  %xmm1,%xmm2
xorps  %xmm0,%xmm0
cvtsi2ssl 0x24(%rsp),%xmm0
addss  %xmm2,%xmm3
addss  %xmm3,%xmm4
addss  %xmm4,%xmm0
divss  0xd55(%rip),%xmm0
lea    0xd7e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [41 x i8] c"Digite o valor da posicao %d do vetor : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [31 x i8] c"A media dos valores e de %.4f \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = alloca float
store i32 0, i32* %1
store i32 0, i32* %3
br label %5
5: ; preds = %17, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 10
br i1 %7, label %8, label %20
8: ; preds = %5
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 1
%11 = sitofp i32 %10 to float
%12 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), float %11)
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %2, 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 = %8
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %5
20: ; preds = %5
store float 0.000000e+00, float* %4
store i32 0, i32* %3
br label %21
21: ; preds = %32, %20
%22 = load i32, i32* %3
%23 = icmp slt i32 %22, 10
br i1 %23, label %24, label %35
24: ; preds = %21
%25 = load float, float* %4
%26 = load i32, i32* %3
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %27
%29 = load i32, i32* %28
%30 = sitofp i32 %29 to float
%31 = fadd float %25, %30
store float %31, float* %4
br label %32
32: ; preds = %24
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
br label %21
35: ; preds = %21
%36 = load float, float* %4
%37 = fdiv float %36, 1.000000e+01
store float %37, float* %4
%38 = load float, float* %4
%39 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), float %38)
ret i32 0
}

LLVM IR (-O2):
@.str = [41 x i8] c"Digite o valor da posicao %d do vetor : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [31 x i8] c"A media dos valores e de %.4f \00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), float 1.000000e+00)
%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 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), float 2.000000e+00)
%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 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), float 3.000000e+00)
%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 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), float 4.000000e+00)
%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 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), float 5.000000e+00)
%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 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), float 6.000000e+00)
%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 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), float 7.000000e+00)
%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 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), float 8.000000e+00)
%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 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), float 9.000000e+00)
%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 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), float 1.000000e+01)
%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)
%33 = bitcast [10 x i32]* %1 to <2 x i32>*
%34 = load <2 x i32>, <2 x i32>* %33
%35 = sitofp <2 x i32> %34 to <2 x float>
%36 = shufflevector <2 x float> %35, <2 x float> poison, <2 x i32> <i32 1, i32 undef>
%37 = fadd <2 x float> %36, %35
%38 = extractelement <2 x float> %37, i64 0
%39 = load i32, i32* %10
%40 = sitofp i32 %39 to float
%41 = fadd float %38, %40
%42 = load i32, i32* %13
%43 = sitofp i32 %42 to float
%44 = fadd float %41, %43
%45 = load i32, i32* %16
%46 = sitofp i32 %45 to float
%47 = fadd float %44, %46
%48 = load i32, i32* %19
%49 = sitofp i32 %48 to float
%50 = fadd float %47, %49
%51 = load i32, i32* %22
%52 = sitofp i32 %51 to float
%53 = fadd float %50, %52
%54 = load i32, i32* %25
%55 = sitofp i32 %54 to float
%56 = fadd float %53, %55
%57 = load i32, i32* %28
%58 = sitofp i32 %57 to float
%59 = fadd float %56, %58
%60 = load i32, i32* %31
%61 = sitofp i32 %60 to float
%62 = fadd float %59, %61
%63 = fdiv float %62, 1.000000e+01
%64 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), float %63)
ret i32 0
}