#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 *, int *);
int main() {
  int i, cant, suma = 0, menor = 150, mayor = 0;
  float promedio;
  printf("Indique la cantidad de estudiantes a registrar: ");
  scanf("%d", &cant);
  int edad[cant];
  printf("\n");
  for (i = 0; i <= cant - 1; i++) {
    printf("Indique la edad del estudiante %d :", i + 1);
    scanf("%d", &edad[i]);
    suma = suma + edad[i];
    if (edad[i] < menor) {
      menor = edad[i];
    }
    if (edad[i] > mayor) {
      mayor = edad[i];
    }
  }
  promedio = suma / cant;
  printf("\nLa edad menor es: %d", menor);
  printf("\nLa edad mayor es: %d", mayor);
  printf("\nEl promedio de edad es: %f", promedio);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x96,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf11(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%rbp)
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     1242 <main+0x122>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rsi
movslq -0x8(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe91(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x38(%rbp),%rax
mov    -0x10(%rbp),%ecx
movslq -0x8(%rbp),%rdx
add    (%rax,%rdx,4),%ecx
mov    %ecx,-0x10(%rbp)
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x14(%rbp),%eax
jge    120d <main+0xed>
mov    -0x38(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x14(%rbp)
mov    -0x38(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x18(%rbp),%eax
jle    122f <main+0x10f>
mov    -0x38(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x18(%rbp)
jmp    1234 <main+0x114>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    119e <main+0x7e>
mov    -0x10(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x14(%rbp),%esi
lea    0xdfb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xe00(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdff(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xeb8(%rip),%rdi
xor    %r14d,%r14d
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf0f(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1050 <scanf@plt>
mov    %rsp,%r13
mov    -0x2c(%rbp),%eax
mov    %rsp,%rbx
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x2c(%rbp),%ecx
test   %ecx,%ecx
jle    11fa <main+0xca>
mov    %r13,-0x38(%rbp)
mov    $0x96,%r15d
xor    %r13d,%r13d
xor    %r12d,%r12d
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%r13
lea    0xe76(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe9c(%rip),%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    (%rbx),%eax
add    %eax,%r12d
cmp    %r15d,%eax
cmovl  %eax,%r15d
cmp    %r14d,%eax
cmovg  %eax,%r14d
movslq -0x2c(%rbp),%rcx
add    $0x4,%rbx
cmp    %rcx,%r13
jl     11b0 <main+0x80>
mov    -0x38(%rbp),%r13
jmp    1203 <main+0xd3>
mov    $0x96,%r15d
xor    %r12d,%r12d
mov    %r12d,%eax
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x38(%rbp)
lea    0xe3c(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe41(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movss  -0x38(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe3d(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    %r13,%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [49 x i8] c"Indique la cantidad de estudiantes a registrar: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [36 x i8] c"Indique la edad del estudiante %d :\00"
@.str.4 = [22 x i8] c"\0ALa edad menor es: %d\00"
@.str.5 = [22 x i8] c"\0ALa edad mayor es: %d\00"
@.str.6 = [28 x i8] c"\0AEl promedio de edad es: %f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca float
%8 = alloca i8*
%9 = alloca i64
store i32 0, i32* %1
store i32 0, i32* %4
store i32 150, i32* %5
store i32 0, i32* %6
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%12 = load i32, i32* %3
%13 = zext i32 %12 to i64
%14 = call i8* @llvm.stacksave()
store i8* %14, i8** %8
%15 = alloca i32, i64 %13
store i64 %13, i64* %9
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %2
br label %17
17: ; preds = %60, %0
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = sub nsw i32 %19, 1
%21 = icmp sle i32 %18, %20
br i1 %21, label %22, label %63
22: ; preds = %17
%23 = load i32, i32* %2
%24 = add nsw i32 %23, 1
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 %24)
%26 = load i32, i32* %2
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32, i32* %15, i64 %27
%29 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %28)
%30 = load i32, i32* %4
%31 = load i32, i32* %2
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i32, i32* %15, i64 %32
%34 = load i32, i32* %33
%35 = add nsw i32 %30, %34
store i32 %35, i32* %4
%36 = load i32, i32* %2
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i32, i32* %15, i64 %37
%39 = load i32, i32* %38
%40 = load i32, i32* %5
%41 = icmp slt i32 %39, %40
br i1 %41, label %42, label %47
42: ; preds = %22
%43 = load i32, i32* %2
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i32, i32* %15, i64 %44
%46 = load i32, i32* %45
store i32 %46, i32* %5
br label %47
47: ; preds = %42, %22
%48 = load i32, i32* %2
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i32, i32* %15, i64 %49
%51 = load i32, i32* %50
%52 = load i32, i32* %6
%53 = icmp sgt i32 %51, %52
br i1 %53, label %54, label %59
54: ; preds = %47
%55 = load i32, i32* %2
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i32, i32* %15, i64 %56
%58 = load i32, i32* %57
store i32 %58, i32* %6
br label %59
59: ; preds = %54, %47
br label %60
60: ; preds = %59
%61 = load i32, i32* %2
%62 = add nsw i32 %61, 1
store i32 %62, i32* %2
br label %17
63: ; preds = %17
%64 = load i32, i32* %4
%65 = load i32, i32* %3
%66 = sdiv i32 %64, %65
%67 = sitofp i32 %66 to float
store float %67, float* %7
%68 = load i32, i32* %5
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %68)
%70 = load i32, i32* %6
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i32 %70)
%72 = load float, float* %7
%73 = fpext float %72 to double
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), double %73)
store i32 0, i32* %1
%75 = load i8*, i8** %8
%76 = load i32, i32* %1
ret i32 %76
}

LLVM IR (-O2):
@.str = [49 x i8] c"Indique la cantidad de estudiantes a registrar: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [36 x i8] c"Indique la edad del estudiante %d :\00"
@.str.4 = [22 x i8] c"\0ALa edad menor es: %d\00"
@.str.5 = [22 x i8] c"\0ALa edad mayor es: %d\00"
@.str.6 = [28 x i8] c"\0AEl promedio de edad es: %f\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = zext i32 %5 to i64
%7 = call i8* @llvm.stacksave()
%8 = alloca i32, i64 %6
%9 = call i32 @putchar(i32 10)
%10 = load i32, i32* %1
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %31
12: ; preds = %0, %12
%13 = phi i64 [ %17, %12 ], [ 0, %0 ]
%14 = phi i32 [ %23, %12 ], [ 0, %0 ]
%15 = phi i32 [ %27, %12 ], [ 0, %0 ]
%16 = phi i32 [ %25, %12 ], [ 150, %0 ]
%17 = add nuw nsw i64 %13, 1
%18 = trunc i64 %17 to i32
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 %18)
%20 = getelementptr inbounds i32, i32* %8, i64 %13
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %20)
%22 = load i32, i32* %20
%23 = add nsw i32 %22, %14
%24 = icmp slt i32 %22, %16
%25 = select i1 %24, i32 %22, i32 %16
%26 = icmp sgt i32 %22, %15
%27 = select i1 %26, i32 %22, i32 %15
%28 = load i32, i32* %1
%29 = sext i32 %28 to i64
%30 = icmp slt i64 %17, %29
br i1 %30, label %12, label %31
31: ; preds = %12, %0
%32 = phi i32 [ 150, %0 ], [ %25, %12 ]
%33 = phi i32 [ 0, %0 ], [ %27, %12 ]
%34 = phi i32 [ 0, %0 ], [ %23, %12 ]
%35 = phi i32 [ %10, %0 ], [ %28, %12 ]
%36 = sdiv i32 %34, %35
%37 = sitofp i32 %36 to float
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %32)
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i32 %33)
%40 = fpext float %37 to double
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), double %40)
ret i32 0
}