#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 *, ...);
void main() {
  long int matricula;
  float calf[5], promedio;
  printf("Ingresa tu matricula\n");
  scanf("%ld", &matricula);
  printf("Ingresa la calificacion de 5 materias, separadas por un espacio\n");
  scanf("%f %f %f %f %f", &calf[0], &calf[1], &calf[2], &calf[3], &calf[4]);
  promedio = (calf[0] + calf[1] + calf[2] + calf[3] + calf[4]) / 5;
  if (promedio > 6) {
    printf("Aprobado : %ld ::: %.1f \n", matricula, promedio);
  } else {
    printf("%ld ::: %.1f \n", matricula, promedio);
  }
  return;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rsi
lea    -0x20(%rbp),%rdx
add    $0x4,%rdx
lea    -0x20(%rbp),%rcx
add    $0x8,%rcx
lea    -0x20(%rbp),%r8
add    $0xc,%r8
lea    -0x20(%rbp),%r9
add    $0x10,%r9
lea    0xee2(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x20(%rbp),%xmm0
addss  -0x1c(%rbp),%xmm0
addss  -0x18(%rbp),%xmm0
addss  -0x14(%rbp),%xmm0
addss  -0x10(%rbp),%xmm0
movss  0xe5b(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
movss  0xe41(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    11e8 <main+0xc8>
mov    -0x8(%rbp),%rsi
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe96(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1203 <main+0xe3>
mov    -0x8(%rbp),%rsi
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe81(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
lea    0xefa(%rip),%rdi
call   1030 <puts@plt>
lea    0xec1(%rip),%rdi
lea    0x20(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xef0(%rip),%rdi
call   1030 <puts@plt>
lea    0x4(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0xc(%rsp),%r8
lea    0x10(%rsp),%r9
lea    0xe92(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
addss  0x8(%rsp),%xmm0
addss  0xc(%rsp),%xmm0
addss  0x10(%rsp),%xmm0
divss  0xe57(%rip),%xmm0
ucomiss 0xe54(%rip),%xmm0
mov    0x20(%rsp),%rsi
cvtss2sd %xmm0,%xmm0
lea    0xe5b(%rip),%rax
lea    0xe5f(%rip),%rdi
cmova  %rax,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Ingresa tu matricula\0A\00"
@.str.1 = [4 x i8] c"%ld\00"
@.str.2 = [65 x i8] c"Ingresa la calificacion de 5 materias, separadas por un espacio\0A\00"
@.str.3 = [15 x i8] c"%f %f %f %f %f\00"
@.str.4 = [26 x i8] c"Aprobado : %ld ::: %.1f \0A\00"
@.str.5 = [15 x i8] c"%ld ::: %.1f \0A\00"
define void @main() {
%1 = alloca i64
%2 = alloca [5 x float]
%3 = alloca float
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %1)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.2, i64 0, i64 0))
%7 = getelementptr inbounds [5 x float], [5 x float]* %2, i64 0, i64 0
%8 = getelementptr inbounds [5 x float], [5 x float]* %2, i64 0, i64 1
%9 = getelementptr inbounds [5 x float], [5 x float]* %2, i64 0, i64 2
%10 = getelementptr inbounds [5 x float], [5 x float]* %2, i64 0, i64 3
%11 = getelementptr inbounds [5 x float], [5 x float]* %2, i64 0, i64 4
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), float* %7, float* %8, float* %9, float* %10, float* %11)
%13 = getelementptr inbounds [5 x float], [5 x float]* %2, i64 0, i64 0
%14 = load float, float* %13
%15 = getelementptr inbounds [5 x float], [5 x float]* %2, i64 0, i64 1
%16 = load float, float* %15
%17 = fadd float %14, %16
%18 = getelementptr inbounds [5 x float], [5 x float]* %2, i64 0, i64 2
%19 = load float, float* %18
%20 = fadd float %17, %19
%21 = getelementptr inbounds [5 x float], [5 x float]* %2, i64 0, i64 3
%22 = load float, float* %21
%23 = fadd float %20, %22
%24 = getelementptr inbounds [5 x float], [5 x float]* %2, i64 0, i64 4
%25 = load float, float* %24
%26 = fadd float %23, %25
%27 = fdiv float %26, 5.000000e+00
store float %27, float* %3
%28 = load float, float* %3
%29 = fcmp ogt float %28, 6.000000e+00
br i1 %29, label %30, label %35
30: ; preds = %0
%31 = load i64, i64* %1
%32 = load float, float* %3
%33 = fpext float %32 to double
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i64 %31, double %33)
br label %40
35: ; preds = %0
%36 = load i64, i64* %1
%37 = load float, float* %3
%38 = fpext float %37 to double
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i64 %36, double %38)
br label %40
40: ; preds = %35, %30
ret void
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%ld\00"
@.str.3 = [15 x i8] c"%f %f %f %f %f\00"
@.str.4 = [26 x i8] c"Aprobado : %ld ::: %.1f \0A\00"
@.str.5 = [15 x i8] c"%ld ::: %.1f \0A\00"
@str = [21 x i8] c"Ingresa tu matricula\00"
@str.6 = [64 x i8] c"Ingresa la calificacion de 5 materias, separadas por un espacio\00"
define void @main() {
%1 = alloca i64
%2 = alloca [5 x float]
%3 = bitcast i64* %1 to i8*
%4 = bitcast [5 x float]* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %1)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @str.6, i64 0, i64 0))
%8 = getelementptr inbounds [5 x float], [5 x float]* %2, i64 0, i64 0
%9 = getelementptr inbounds [5 x float], [5 x float]* %2, i64 0, i64 1
%10 = getelementptr inbounds [5 x float], [5 x float]* %2, i64 0, i64 2
%11 = getelementptr inbounds [5 x float], [5 x float]* %2, i64 0, i64 3
%12 = getelementptr inbounds [5 x float], [5 x float]* %2, i64 0, i64 4
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), float* %8, float* %9, float* %10, float* %11, float* %12)
%14 = load float, float* %8
%15 = load float, float* %9
%16 = fadd float %14, %15
%17 = load float, float* %10
%18 = fadd float %16, %17
%19 = load float, float* %11
%20 = fadd float %18, %19
%21 = load float, float* %12
%22 = fadd float %20, %21
%23 = fdiv float %22, 5.000000e+00
%24 = fcmp ogt float %23, 6.000000e+00
%25 = load i64, i64* %1
%26 = fpext float %23 to double
%27 = select i1 %24, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0)
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %27, i64 %25, double %26)
ret void
}