#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 */
float media(int, float *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
float variancia(int, float *, float);
int main() {
  float v[10];
  for (int i = 0; i < 10; i++) {
    printf("Digite um numero:\n");
    scanf("%f", &v[i]);
  }
  float med = media(10, v);
  float var = variancia(10, v, med);
  printf("Media = %f Variancia = %f \n", med, var);
}


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    1197 <main+0x57>
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0x34(%rbp),%rax
lea    -0x30(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe8f(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1156 <main+0x16>
lea    -0x30(%rbp),%rsi
mov    $0xa,%edi
call   1060 <media@plt>
movss  %xmm0,-0x38(%rbp)
lea    -0x30(%rbp),%rsi
movss  -0x38(%rbp),%xmm0
mov    $0xa,%edi
call   1030 <variancia@plt>
movss  %xmm0,-0x3c(%rbp)
movss  -0x38(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x3c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe3b(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
lea    0xebf(%rip),%rbx
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xe91(%rip),%r15
lea    0x10(%rsp),%r14
mov    %r15,%rdi
mov    %r14,%rsi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0x14(%rsp),%rsi
mov    %r15,%rdi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0x18(%rsp),%rsi
mov    %r15,%rdi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0x1c(%rsp),%rsi
mov    %r15,%rdi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0x20(%rsp),%rsi
mov    %r15,%rdi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0x24(%rsp),%rsi
mov    %r15,%rdi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0x28(%rsp),%rsi
mov    %r15,%rdi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0x2c(%rsp),%rsi
mov    %r15,%rdi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0x30(%rsp),%rsi
mov    %r15,%rdi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0x34(%rsp),%rsi
mov    %r15,%rdi
call   1060 <scanf@plt>
mov    $0xa,%edi
mov    %r14,%rsi
call   1070 <media@plt>
movss  %xmm0,0xc(%rsp)
mov    $0xa,%edi
mov    %r14,%rsi
call   1030 <variancia@plt>
movss  0xc(%rsp),%xmm1
cvtss2sd %xmm1,%xmm2
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
lea    0xd8f(%rip),%rdi
movaps %xmm2,%xmm0
mov    $0x2,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Digite um numero:\0A\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [28 x i8] c"Media = %f Variancia = %f \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x float]
%3 = alloca i32
%4 = alloca float
%5 = alloca float
store i32 0, i32* %1
store i32 0, i32* %3
br label %6
6: ; preds = %15, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 10
br i1 %8, label %9, label %18
9: ; preds = %6
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* %3
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [10 x float], [10 x float]* %2, i64 0, i64 %12
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %13)
br label %15
15: ; preds = %9
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %6
18: ; preds = %6
%19 = getelementptr inbounds [10 x float], [10 x float]* %2, i64 0, i64 0
%20 = call float @media(i32 10, float* %19)
store float %20, float* %4
%21 = getelementptr inbounds [10 x float], [10 x float]* %2, i64 0, i64 0
%22 = load float, float* %4
%23 = call float @variancia(i32 10, float* %21, float %22)
store float %23, float* %5
%24 = load float, float* %4
%25 = fpext float %24 to double
%26 = load float, float* %5
%27 = fpext float %26 to double
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), double %25, double %27)
%29 = load i32, i32* %1
ret i32 %29
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [28 x i8] c"Media = %f Variancia = %f \0A\00"
@str = [18 x i8] c"Digite um numero:\00"
define i32 @main() {
%1 = alloca [10 x float]
%2 = bitcast [10 x float]* %1 to i8*
%3 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%4 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %4)
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%7 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 1
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %7)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%10 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 2
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %10)
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%13 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 3
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %13)
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%16 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 4
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %16)
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%19 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 5
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %19)
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%22 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 6
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %22)
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%25 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 7
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %25)
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%28 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 8
%29 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %28)
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%31 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 9
%32 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %31)
%33 = call float @media(i32 10, float* %4)
%34 = call float @variancia(i32 10, float* %4, float %33)
%35 = fpext float %33 to double
%36 = fpext float %34 to double
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), double %35, double %36)
ret i32 0
}