#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 *, float *);
int main() {
  float nums[4];
  float num, sum;
  for (int i = 0; i < 4; i++) {
    printf("Ingresa el numero %d: ", i + 1);
    scanf("%f", &num);
    nums[i] = num;
    sum += num;
  }
  printf("\nLa media es: %.2f y los numeros son:\n\t", sum / 4);
  for (int i = 0; i < 4; i++)
    printf("%.2f%s", nums[i], (i == 3) ? "\n" : ", ");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x4,-0x2c(%rbp)
jge    1194 <main+0x74>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
cvtsi2ss %eax,%xmm0
lea    0xeb3(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xebc(%rip),%rdi
lea    -0x24(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x24(%rbp),%xmm0
movslq -0x2c(%rbp),%rax
movss  %xmm0,-0x20(%rbp,%rax,4)
movss  -0x24(%rbp),%xmm0
addss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1136 <main+0x16>
movss  -0x28(%rbp),%xmm0
movss  0xe5f(%rip),%xmm1
divss  %xmm1,%xmm0
lea    0xe72(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movl   $0x0,-0x30(%rbp)
cmpl   $0x4,-0x30(%rbp)
jge    1202 <main+0xe2>
movslq -0x30(%rbp),%rax
movss  -0x20(%rbp,%rax,4),%xmm0
mov    -0x30(%rbp),%ecx
lea    0xe77(%rip),%rsi
lea    0xe6e(%rip),%rax
cmp    $0x3,%ecx
cmove  %rax,%rsi
lea    0xe59(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11ba <main+0x9a>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
lea    0xee4(%rip),%r14
movss  0xec8(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xee2(%rip),%rbx
lea    0xc(%rsp),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
movss  %xmm0,0x1c(%rsp)
movss  0xe97(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
movss  %xmm0,0x18(%rsp)
movss  0xe72(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
movss  %xmm0,0x14(%rsp)
movss  0xe4d(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
movss  %xmm0,0x10(%rsp)
lea    0xe47(%rip),%rdi
movss  0xe21(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe59(%rip),%rbx
lea    0xe5b(%rip),%r14
mov    %rbx,%rdi
movss  0x1c(%rsp),%xmm0
mov    %r14,%rsi
mov    $0x1,%al
call   1030 <printf@plt>
mov    %rbx,%rdi
movss  0x18(%rsp),%xmm0
mov    %r14,%rsi
mov    $0x1,%al
call   1030 <printf@plt>
mov    %rbx,%rdi
movss  0x14(%rsp),%xmm0
mov    %r14,%rsi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe19(%rip),%rsi
mov    %rbx,%rdi
movss  0x10(%rsp),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Ingresa el numero %d: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [40 x i8] c"\0ALa media es: %.2f y los numeros son:\0A\09\00"
@.str.3 = [7 x i8] c"%.2f%s\00"
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [3 x i8] c", \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x float]
%3 = alloca float
%4 = alloca float
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
br label %7
7: ; preds = %23, %0
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 4
br i1 %9, label %10, label %26
10: ; preds = %7
%11 = load i32, i32* %5
%12 = add nsw i32 %11, 1
%13 = sitofp i32 %12 to float
%14 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), float %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 = load i32, i32* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [4 x float], [4 x float]* %2, i64 0, i64 %18
store float %16, float* %19
%20 = load float, float* %3
%21 = load float, float* %4
%22 = fadd float %21, %20
store float %22, float* %4
br label %23
23: ; preds = %10
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
store i32 %25, i32* %5
br label %7
26: ; preds = %7
%27 = load float, float* %4
%28 = fdiv float %27, 4.000000e+00
%29 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), float %28)
store i32 0, i32* %6
br label %30
30: ; preds = %43, %26
%31 = load i32, i32* %6
%32 = icmp slt i32 %31, 4
br i1 %32, label %33, label %46
33: ; preds = %30
%34 = load i32, i32* %6
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [4 x float], [4 x float]* %2, i64 0, i64 %35
%37 = load float, float* %36
%38 = load i32, i32* %6
%39 = icmp eq i32 %38, 3
%40 = zext i1 %39 to i64
%41 = select i1 %39, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0)
%42 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), float %37, i8* %41)
br label %43
43: ; preds = %33
%44 = load i32, i32* %6
%45 = add nsw i32 %44, 1
store i32 %45, i32* %6
br label %30
46: ; preds = %30
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"Ingresa el numero %d: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [40 x i8] c"\0ALa media es: %.2f y los numeros son:\0A\09\00"
@.str.3 = [7 x i8] c"%.2f%s\00"
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [3 x i8] c", \00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), float 1.000000e+00)
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%5 = load float, float* %1
%6 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), float 2.000000e+00)
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%8 = load float, float* %1
%9 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), float 3.000000e+00)
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%11 = load float, float* %1
%12 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), float 4.000000e+00)
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%14 = load float, float* %1
%15 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), float 0x7FF8000000000000)
%16 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), float %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%17 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), float %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%18 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), float %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%19 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), float %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}