#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 marks[5], sum = 0;
  for (int i = 0; i < 5; i++) {
    scanf("%f", &marks[i]);
    if (marks[i] > 100 || marks[i] < 0)
      printf("Invalid Input\n", i--);
    else
      sum += marks[i];
  }
  printf("Aggregate: %f\nPercentage: %f \%\n", sum / 5, (sum / 5));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
cmpl   $0x5,-0x28(%rbp)
jge    11d9 <main+0xb9>
movslq -0x28(%rbp),%rax
lea    -0x20(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xeaa(%rip),%rdi
call   1040 <scanf@plt>
movslq -0x28(%rbp),%rax
movss  -0x20(%rbp,%rax,4),%xmm0
movss  0xe8f(%rip),%xmm1
ucomiss %xmm1,%xmm0
ja     1190 <main+0x70>
movslq -0x28(%rbp),%rax
xorps  %xmm0,%xmm0
ucomiss -0x20(%rbp,%rax,4),%xmm0
jbe    11b2 <main+0x92>
mov    -0x28(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x28(%rbp)
cvtsi2ss %eax,%xmm0
lea    0xe65(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    11c6 <main+0xa6>
movslq -0x28(%rbp),%rax
movss  -0x20(%rbp,%rax,4),%xmm0
addss  -0x24(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
jmp    11cb <main+0xab>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    113e <main+0x1e>
movss  -0x24(%rbp),%xmm0
movss  0xe1a(%rip),%xmm1
divss  %xmm1,%xmm0
movss  -0x24(%rbp),%xmm1
movss  0xe09(%rip),%xmm2
divss  %xmm2,%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe14(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
xor    %ebx,%ebx
lea    0xed8(%rip),%r15
lea    0xed4(%rip),%r14
xorps  %xmm0,%xmm0
movss  %xmm0,0xc(%rsp)
jmp    116e <main+0x4e>
cs nopw 0x0(%rax,%rax,1)
xorps  %xmm0,%xmm0
cvtsi2ss %ebx,%xmm0
add    $0xffffffff,%ebx
mov    %r14,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0x1(%rbx),%eax
cmp    $0x4,%ebx
mov    %eax,%ebx
jge    11ab <main+0x8b>
movslq %ebx,%r12
lea    (%rsp,%r12,4),%rsi
add    $0x10,%rsi
mov    %r15,%rdi
call   1040 <scanf@plt>
movss  0x10(%rsp,%r12,4),%xmm0
ucomiss 0xe71(%rip),%xmm0
ja     1150 <main+0x30>
xorps  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
ja     1150 <main+0x30>
movss  0xc(%rsp),%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,0xc(%rsp)
jmp    1164 <main+0x44>
movss  0xc(%rsp),%xmm0
divss  0xe4b(%rip),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
lea    0xe57(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
@.str.1 = [15 x i8] c"Invalid Input\0A\00"
@.str.2 = [32 x i8] c"Aggregate: %f\0APercentage: %f %\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x float]
%3 = alloca float
%4 = alloca i32
store i32 0, i32* %1
store float 0.000000e+00, float* %3
store i32 0, i32* %4
br label %5
5: ; preds = %37, %0
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 5
br i1 %7, label %8, label %40
8: ; preds = %5
%9 = load i32, i32* %4
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [5 x float], [5 x float]* %2, i64 0, i64 %10
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %11)
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [5 x float], [5 x float]* %2, i64 0, i64 %14
%16 = load float, float* %15
%17 = fcmp ogt float %16, 1.000000e+02
br i1 %17, label %24, label %18
18: ; preds = %8
%19 = load i32, i32* %4
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [5 x float], [5 x float]* %2, i64 0, i64 %20
%22 = load float, float* %21
%23 = fcmp olt float %22, 0.000000e+00
br i1 %23, label %24, label %29
24: ; preds = %18, %8
%25 = load i32, i32* %4
%26 = add nsw i32 %25, -1
store i32 %26, i32* %4
%27 = sitofp i32 %25 to float
%28 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), float %27)
br label %36
29: ; preds = %18
%30 = load i32, i32* %4
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [5 x float], [5 x float]* %2, i64 0, i64 %31
%33 = load float, float* %32
%34 = load float, float* %3
%35 = fadd float %34, %33
store float %35, float* %3
br label %36
36: ; preds = %29, %24
br label %37
37: ; preds = %36
%38 = load i32, i32* %4
%39 = add nsw i32 %38, 1
store i32 %39, i32* %4
br label %5
40: ; preds = %5
%41 = load float, float* %3
%42 = fdiv float %41, 5.000000e+00
%43 = load float, float* %3
%44 = fdiv float %43, 5.000000e+00
%45 = fpext float %44 to double
%46 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), float %42, double %45)
%47 = load i32, i32* %1
ret i32 %47
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
@.str.1 = [15 x i8] c"Invalid Input\0A\00"
@.str.2 = [32 x i8] c"Aggregate: %f\0APercentage: %f %\0A\00"
define i32 @main() {
%1 = alloca [5 x float]
%2 = bitcast [5 x float]* %1 to i8*
br label %7
3: ; preds = %23
%4 = fdiv float %24, 5.000000e+00
%5 = fpext float %4 to double
%6 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), float %4, double %5)
ret i32 0
7: ; preds = %0, %23
%8 = phi i32 [ 0, %0 ], [ %26, %23 ]
%9 = phi float [ 0.000000e+00, %0 ], [ %24, %23 ]
%10 = sext i32 %8 to i64
%11 = getelementptr inbounds [5 x float], [5 x float]* %1, i64 0, i64 %10
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %11)
%13 = load float, float* %11
%14 = fcmp ogt float %13, 1.000000e+02
%15 = fcmp olt float %13, 0.000000e+00
%16 = or i1 %14, %15
br i1 %16, label %17, label %21
17: ; preds = %7
%18 = add nsw i32 %8, -1
%19 = sitofp i32 %8 to float
%20 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), float %19)
br label %23
21: ; preds = %7
%22 = fadd float %9, %13
br label %23
23: ; preds = %17, %21
%24 = phi float [ %9, %17 ], [ %22, %21 ]
%25 = phi i32 [ %18, %17 ], [ %8, %21 ]
%26 = add nsw i32 %25, 1
%27 = icmp slt i32 %25, 4
br i1 %27, label %7, label %3
}