#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 main() {
  float average(float array[], int n);
  float score_class1[5] = {98.5, 97, 91.5, 60, 55};
  float score_class2[10] = {67.5, 89.5, 99, 69.5, 77, 89.5, 76.5, 54, 60, 99.5};
  printf("The average score of class 1 is: %f\n", average(score_class1, 5));
  printf("The average score of class 2 is: %f\n", average(score_class2, 10));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeb5(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xeb7(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1050 <average@plt>
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    $0xa,%esi
call   1050 <average@plt>
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x48,%rsp
mov    0xee6(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xecb(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    0xf00(%rip),%rax
mov    %rax,0x40(%rsp)
movaps 0xee4(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
mov    %rsp,%rdi
mov    $0x5,%esi
call   1040 <average@plt>
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
lea    0x20(%rsp),%rdi
mov    $0xa,%esi
call   1040 <average@plt>
lea    0xee1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x48,%rsp
ret

LLVM IR (-O0):
@__const.main.score_class1 = [5 x float] [float 9.850000e+01, float 9.700000e+01, float 9.150000e+01, float 6.000000e+01, float 5.500000e+01]
@__const.main.score_class2 = [10 x float] [float 6.750000e+01, float 8.950000e+01, float 9.900000e+01, float 6.950000e+01, float 7.700000e+01, float 8.950000e+01, float 7.650000e+01, float 5.400000e+01, float 6.000000e+01, float 9.950000e+01]
@.str = [37 x i8] c"The average score of class 1 is: %f\0A\00"
@.str.1 = [37 x i8] c"The average score of class 2 is: %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x float]
%3 = alloca [10 x float]
store i32 0, i32* %1
%4 = bitcast [5 x float]* %2 to i8*
%5 = bitcast [10 x float]* %3 to i8*
%6 = getelementptr inbounds [5 x float], [5 x float]* %2, i64 0, i64 0
%7 = call float @average(float* %6, i32 5)
%8 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), float %7)
%9 = getelementptr inbounds [10 x float], [10 x float]* %3, i64 0, i64 0
%10 = call float @average(float* %9, i32 10)
%11 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), float %10)
ret i32 0
}

LLVM IR (-O2):
@__const.main.score_class1 = [5 x float] [float 9.850000e+01, float 9.700000e+01, float 9.150000e+01, float 6.000000e+01, float 5.500000e+01]
@__const.main.score_class2 = [10 x float] [float 6.750000e+01, float 8.950000e+01, float 9.900000e+01, float 6.950000e+01, float 7.700000e+01, float 8.950000e+01, float 7.650000e+01, float 5.400000e+01, float 6.000000e+01, float 9.950000e+01]
@.str = [37 x i8] c"The average score of class 1 is: %f\0A\00"
@.str.1 = [37 x i8] c"The average score of class 2 is: %f\0A\00"
define i32 @main() {
%1 = alloca [5 x float]
%2 = alloca [10 x float]
%3 = bitcast [5 x float]* %1 to i8*
%4 = bitcast [10 x float]* %2 to i8*
%5 = getelementptr inbounds [5 x float], [5 x float]* %1, i64 0, i64 0
%6 = call float @average(float* %5, i32 5)
%7 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), float %6)
%8 = getelementptr inbounds [10 x float], [10 x float]* %2, i64 0, i64 0
%9 = call float @average(float* %8, i32 10)
%10 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), float %9)
ret i32 0
}