#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 *, float *);
int main(int argc, const char *argv[]) {
  float media, num, soma;
  int i;
  soma = 0;
  printf("Digite 5 numeros: \n");
  for (i = 0; i < 5; i++) {
    scanf("%f", &num);
    soma = soma + num;
    media = soma / 5;
  }
  printf("A soma eh: %.2f\n", soma);
  printf("A media eh: %.2f\n", media);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
cmpl   $0x5,-0x20(%rbp)
jge    11a0 <main+0x80>
lea    0xeb4(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x1c(%rbp),%xmm0
addss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  0xe77(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1153 <main+0x33>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe6b(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe65(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xeec(%rip),%rdi
call   1030 <puts@plt>
lea    0xeba(%rip),%rbx
lea    0xc(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
xorps  %xmm0,%xmm0
addss  0xc(%rsp),%xmm0
movss  %xmm0,0x10(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
movss  0x10(%rsp),%xmm0
addss  0xc(%rsp),%xmm0
movss  %xmm0,0x10(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
movss  0x10(%rsp),%xmm0
addss  0xc(%rsp),%xmm0
movss  %xmm0,0x10(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
movss  0x10(%rsp),%xmm0
addss  0xc(%rsp),%xmm0
movss  %xmm0,0x10(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
movss  0x10(%rsp),%xmm1
addss  0xc(%rsp),%xmm1
movaps %xmm1,%xmm0
divss  0xe1e(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xe0d(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe10(%rip),%rdi
movsd  0x10(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [17 x i8] c"A soma eh: %.2f\0A\00"
@.str.3 = [18 x i8] c"A media eh: %.2f\0A\00"
@str = [19 x i8] c"Digite 5 numeros: \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca float
%4 = bitcast float* %3 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%7 = load float, float* %3
%8 = fadd float %7, 0.000000e+00
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%10 = load float, float* %3
%11 = fadd float %8, %10
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%13 = load float, float* %3
%14 = fadd float %11, %13
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%16 = load float, float* %3
%17 = fadd float %14, %16
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%19 = load float, float* %3
%20 = fadd float %17, %19
%21 = fdiv float %20, 5.000000e+00
%22 = fpext float %21 to double
%23 = fpext float %20 to double
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), double %23)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), double %22)
ret i32 0
}