#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, float *);
int /*<<< orphan*/ printf(char *, float, ...);
int main() {
  FILE *datos;
  float valores[5];
  float promedio;
  datos = fopen("medicion.txt", "r");
  fscanf(datos, "%f", &valores[0]);
  fscanf(datos, "%f", &valores[1]);
  fscanf(datos, "%f", &valores[2]);
  fscanf(datos, "%f", &valores[3]);
  fscanf(datos, "%f", &valores[4]);
  printf("Leí estos números: %2.2f, %2.2f, %2.2f, %2.2f, y %2.2f.\n",
         valores[0], valores[1], valores[2], valores[3], valores[4]);
  promedio =
      (valores[0] + valores[1] + valores[2] + valores[3] + valores[4]) / 5;
  printf("El promedio es %2.2f.\n", promedio);
  return fclose(datos);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeae(%rip),%rdi
lea    0xeb4(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rdx
lea    0xe9e(%rip),%rsi
call   1050 <fscanf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rdx
add    $0x4,%rdx
lea    0xe86(%rip),%rsi
call   1050 <fscanf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rdx
add    $0x8,%rdx
lea    0xe6e(%rip),%rsi
call   1050 <fscanf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rdx
add    $0xc,%rdx
lea    0xe56(%rip),%rsi
call   1050 <fscanf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rdx
add    $0x10,%rdx
lea    0xe3e(%rip),%rsi
call   1050 <fscanf@plt>
movss  -0x30(%rbp),%xmm0
movss  -0x2c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x28(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
movss  -0x24(%rbp),%xmm3
cvtss2sd %xmm3,%xmm3
movss  -0x20(%rbp),%xmm4
cvtss2sd %xmm4,%xmm4
lea    0xe0c(%rip),%rdi
mov    $0x5,%al
call   1040 <printf@plt>
movss  -0x30(%rbp),%xmm0
addss  -0x2c(%rbp),%xmm0
addss  -0x28(%rbp),%xmm0
addss  -0x24(%rbp),%xmm0
addss  -0x20(%rbp),%xmm0
movss  0xdce(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x34(%rbp),%xmm0
lea    0xe0a(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xeb6(%rip),%rdi
lea    0xebc(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
lea    0xeaf(%rip),%r14
mov    %rsp,%rdx
mov    %rax,%rdi
mov    %r14,%rsi
call   1050 <fscanf@plt>
lea    0x4(%rsp),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <fscanf@plt>
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <fscanf@plt>
lea    0xc(%rsp),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <fscanf@plt>
lea    0x10(%rsp),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <fscanf@plt>
movss  (%rsp),%xmm0
movss  0x4(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  0x8(%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
movss  0xc(%rsp),%xmm3
cvtss2sd %xmm3,%xmm3
movss  0x10(%rsp),%xmm4
cvtss2sd %xmm4,%xmm4
lea    0xe30(%rip),%rdi
mov    $0x5,%al
call   1040 <printf@plt>
movss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
addss  0x8(%rsp),%xmm0
addss  0xc(%rsp),%xmm0
addss  0x10(%rsp),%xmm0
divss  0xdee(%rip),%xmm0
lea    0xe38(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [13 x i8] c"medicion.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [59 x i8] c"Le\C3\AD estos n\C3\BAmeros: %2.2f, %2.2f, %2.2f, %2.2f, y %2.2f.\0A\00"
@.str.4 = [23 x i8] c"El promedio es %2.2f.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca [5 x float]
%4 = alloca float
store i32 0, i32* %1
%5 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %5, i32** %2
%6 = load i32*, i32** %2
%7 = getelementptr inbounds [5 x float], [5 x float]* %3, i64 0, i64 0
%8 = call i32 @fscanf(i32* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %7)
%9 = load i32*, i32** %2
%10 = getelementptr inbounds [5 x float], [5 x float]* %3, i64 0, i64 1
%11 = call i32 @fscanf(i32* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %10)
%12 = load i32*, i32** %2
%13 = getelementptr inbounds [5 x float], [5 x float]* %3, i64 0, i64 2
%14 = call i32 @fscanf(i32* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %13)
%15 = load i32*, i32** %2
%16 = getelementptr inbounds [5 x float], [5 x float]* %3, i64 0, i64 3
%17 = call i32 @fscanf(i32* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %16)
%18 = load i32*, i32** %2
%19 = getelementptr inbounds [5 x float], [5 x float]* %3, i64 0, i64 4
%20 = call i32 @fscanf(i32* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %19)
%21 = getelementptr inbounds [5 x float], [5 x float]* %3, i64 0, i64 0
%22 = load float, float* %21
%23 = getelementptr inbounds [5 x float], [5 x float]* %3, i64 0, i64 1
%24 = load float, float* %23
%25 = fpext float %24 to double
%26 = getelementptr inbounds [5 x float], [5 x float]* %3, i64 0, i64 2
%27 = load float, float* %26
%28 = fpext float %27 to double
%29 = getelementptr inbounds [5 x float], [5 x float]* %3, i64 0, i64 3
%30 = load float, float* %29
%31 = fpext float %30 to double
%32 = getelementptr inbounds [5 x float], [5 x float]* %3, i64 0, i64 4
%33 = load float, float* %32
%34 = fpext float %33 to double
%35 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0), float %22, double %25, double %28, double %31, double %34)
%36 = getelementptr inbounds [5 x float], [5 x float]* %3, i64 0, i64 0
%37 = load float, float* %36
%38 = getelementptr inbounds [5 x float], [5 x float]* %3, i64 0, i64 1
%39 = load float, float* %38
%40 = fadd float %37, %39
%41 = getelementptr inbounds [5 x float], [5 x float]* %3, i64 0, i64 2
%42 = load float, float* %41
%43 = fadd float %40, %42
%44 = getelementptr inbounds [5 x float], [5 x float]* %3, i64 0, i64 3
%45 = load float, float* %44
%46 = fadd float %43, %45
%47 = getelementptr inbounds [5 x float], [5 x float]* %3, i64 0, i64 4
%48 = load float, float* %47
%49 = fadd float %46, %48
%50 = fdiv float %49, 5.000000e+00
store float %50, float* %4
%51 = load float, float* %4
%52 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), float %51)
%53 = load i32*, i32** %2
%54 = call i32 @fclose(i32* %53)
ret i32 %54
}

LLVM IR (-O2):
@.str = [13 x i8] c"medicion.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [59 x i8] c"Le\C3\AD estos n\C3\BAmeros: %2.2f, %2.2f, %2.2f, %2.2f, y %2.2f.\0A\00"
@.str.4 = [23 x i8] c"El promedio es %2.2f.\0A\00"
define i32 @main() {
%1 = alloca [5 x float]
%2 = bitcast [5 x float]* %1 to i8*
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = getelementptr inbounds [5 x float], [5 x float]* %1, i64 0, i64 0
%5 = call i32 @fscanf(i32* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %4)
%6 = getelementptr inbounds [5 x float], [5 x float]* %1, i64 0, i64 1
%7 = call i32 @fscanf(i32* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %6)
%8 = getelementptr inbounds [5 x float], [5 x float]* %1, i64 0, i64 2
%9 = call i32 @fscanf(i32* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %8)
%10 = getelementptr inbounds [5 x float], [5 x float]* %1, i64 0, i64 3
%11 = call i32 @fscanf(i32* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %10)
%12 = getelementptr inbounds [5 x float], [5 x float]* %1, i64 0, i64 4
%13 = call i32 @fscanf(i32* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %12)
%14 = load float, float* %4
%15 = load float, float* %6
%16 = fpext float %15 to double
%17 = load float, float* %8
%18 = fpext float %17 to double
%19 = load float, float* %10
%20 = fpext float %19 to double
%21 = load float, float* %12
%22 = fpext float %21 to double
%23 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0), float %14, double %16, double %18, double %20, double %22)
%24 = load float, float* %4
%25 = load float, float* %6
%26 = fadd float %24, %25
%27 = load float, float* %8
%28 = fadd float %26, %27
%29 = load float, float* %10
%30 = fadd float %28, %29
%31 = load float, float* %12
%32 = fadd float %30, %31
%33 = fdiv float %32, 5.000000e+00
%34 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), float %33)
%35 = call i32 @fclose(i32* %3)
ret i32 %35
}