#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 */
double calcStudentMark(int);
int /*<<< orphan*/ printf(char *, double, ...);
int /*<<< orphan*/ studentMarkPrint(double);
int main() {
  double studentsMarks[10], sumOfAllPoints;
  for (int inputMarks = 0; inputMarks < 10; inputMarks++) {
    studentsMarks[inputMarks] = calcStudentMark(inputMarks);
    sumOfAllPoints += studentsMarks[inputMarks];
  }
  for (int printMarks = 0; printMarks < 10; printMarks++) {
    printf("Final result for student %d : %0.2f - ", printMarks + 1,
           studentsMarks[printMarks]);
    studentMarkPrint(studentsMarks[printMarks]);
  }
  printf("The average mark of the class is : %0.2f - ",
         (double)sumOfAllPoints / 10);
  studentMarkPrint((double)sumOfAllPoints / 10);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x6c(%rbp)
cmpl   $0xa,-0x6c(%rbp)
jge    1184 <main+0x54>
mov    -0x6c(%rbp),%edi
call   1050 <calcStudentMark@plt>
movslq -0x6c(%rbp),%rax
movsd  %xmm0,-0x60(%rbp,%rax,8)
movslq -0x6c(%rbp),%rax
movsd  -0x60(%rbp,%rax,8),%xmm0
addsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    1146 <main+0x16>
movl   $0x0,-0x70(%rbp)
cmpl   $0xa,-0x70(%rbp)
jge    11d4 <main+0xa4>
mov    -0x70(%rbp),%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm0
movslq -0x70(%rbp),%rax
movsd  -0x60(%rbp,%rax,8),%xmm1
lea    0xe58(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movslq -0x70(%rbp),%rax
movsd  -0x60(%rbp,%rax,8),%xmm0
call   1030 <studentMarkPrint@plt>
mov    -0x70(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x70(%rbp)
jmp    118b <main+0x5b>
movsd  -0x68(%rbp),%xmm0
movsd  0xe1f(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe43(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x68(%rbp),%xmm0
movsd  0xe00(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <studentMarkPrint@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
xor    %edi,%edi
call   1050 <calcStudentMark@plt>
movsd  %xmm0,(%rsp)
mov    $0x1,%edi
call   1050 <calcStudentMark@plt>
movsd  %xmm0,0x8(%rsp)
mov    $0x2,%edi
call   1050 <calcStudentMark@plt>
movsd  %xmm0,0x10(%rsp)
mov    $0x3,%edi
call   1050 <calcStudentMark@plt>
movsd  %xmm0,0x18(%rsp)
mov    $0x4,%edi
call   1050 <calcStudentMark@plt>
movsd  %xmm0,0x20(%rsp)
mov    $0x5,%edi
call   1050 <calcStudentMark@plt>
movsd  %xmm0,0x28(%rsp)
mov    $0x6,%edi
call   1050 <calcStudentMark@plt>
movsd  %xmm0,0x30(%rsp)
mov    $0x7,%edi
call   1050 <calcStudentMark@plt>
movsd  %xmm0,0x38(%rsp)
mov    $0x8,%edi
call   1050 <calcStudentMark@plt>
movsd  %xmm0,0x40(%rsp)
mov    $0x9,%edi
call   1050 <calcStudentMark@plt>
movsd  %xmm0,0x48(%rsp)
lea    0xe80(%rip),%rbx
movsd  0xe20(%rip),%xmm0
mov    %rbx,%rdi
movsd  (%rsp),%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
movsd  (%rsp),%xmm0
call   1030 <studentMarkPrint@plt>
movsd  0xe07(%rip),%xmm0
mov    %rbx,%rdi
movsd  0x8(%rsp),%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0x8(%rsp),%xmm0
call   1030 <studentMarkPrint@plt>
movsd  0xdec(%rip),%xmm0
mov    %rbx,%rdi
movsd  0x10(%rsp),%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0x10(%rsp),%xmm0
call   1030 <studentMarkPrint@plt>
movsd  0xdd1(%rip),%xmm0
mov    %rbx,%rdi
movsd  0x18(%rsp),%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0x18(%rsp),%xmm0
call   1030 <studentMarkPrint@plt>
movsd  0xdb6(%rip),%xmm0
mov    %rbx,%rdi
movsd  0x20(%rsp),%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0x20(%rsp),%xmm0
call   1030 <studentMarkPrint@plt>
movsd  0xd9b(%rip),%xmm0
mov    %rbx,%rdi
movsd  0x28(%rsp),%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0x28(%rsp),%xmm0
call   1030 <studentMarkPrint@plt>
movsd  0xd80(%rip),%xmm0
mov    %rbx,%rdi
movsd  0x30(%rsp),%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0x30(%rsp),%xmm0
call   1030 <studentMarkPrint@plt>
movsd  0xd65(%rip),%xmm0
mov    %rbx,%rdi
movsd  0x38(%rsp),%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0x38(%rsp),%xmm0
call   1030 <studentMarkPrint@plt>
movsd  0xd4a(%rip),%xmm0
mov    %rbx,%rdi
movsd  0x40(%rsp),%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0x40(%rsp),%xmm0
call   1030 <studentMarkPrint@plt>
movsd  0xd2f(%rip),%xmm0
mov    %rbx,%rdi
movsd  0x48(%rsp),%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0x48(%rsp),%xmm0
call   1030 <studentMarkPrint@plt>
lea    0xd44(%rip),%rdi
movsd  0xd0d(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0xcfe(%rip),%xmm0
call   1030 <studentMarkPrint@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [39 x i8] c"Final result for student %d : %0.2f - \00"
@.str.1 = [44 x i8] c"The average mark of the class is : %0.2f - \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x double]
%3 = alloca double
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
br label %6
6: ; preds = %21, %0
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 10
br i1 %8, label %9, label %24
9: ; preds = %6
%10 = load i32, i32* %4
%11 = call double @calcStudentMark(i32 %10)
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [10 x double], [10 x double]* %2, i64 0, i64 %13
store double %11, double* %14
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [10 x double], [10 x double]* %2, i64 0, i64 %16
%18 = load double, double* %17
%19 = load double, double* %3
%20 = fadd double %19, %18
store double %20, double* %3
br label %21
21: ; preds = %9
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
br label %6
24: ; preds = %6
store i32 0, i32* %5
br label %25
25: ; preds = %42, %24
%26 = load i32, i32* %5
%27 = icmp slt i32 %26, 10
br i1 %27, label %28, label %45
28: ; preds = %25
%29 = load i32, i32* %5
%30 = add nsw i32 %29, 1
%31 = sitofp i32 %30 to double
%32 = load i32, i32* %5
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [10 x double], [10 x double]* %2, i64 0, i64 %33
%35 = load double, double* %34
%36 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), double %31, double %35)
%37 = load i32, i32* %5
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [10 x double], [10 x double]* %2, i64 0, i64 %38
%40 = load double, double* %39
%41 = call i32 @studentMarkPrint(double %40)
br label %42
42: ; preds = %28
%43 = load i32, i32* %5
%44 = add nsw i32 %43, 1
store i32 %44, i32* %5
br label %25
45: ; preds = %25
%46 = load double, double* %3
%47 = fdiv double %46, 1.000000e+01
%48 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), double %47)
%49 = load double, double* %3
%50 = fdiv double %49, 1.000000e+01
%51 = call i32 @studentMarkPrint(double %50)
ret i32 0
}

LLVM IR (-O2):
@.str = [39 x i8] c"Final result for student %d : %0.2f - \00"
@.str.1 = [44 x i8] c"The average mark of the class is : %0.2f - \00"
define i32 @main() {
%1 = tail call double @calcStudentMark(i32 0)
%2 = tail call double @calcStudentMark(i32 1)
%3 = tail call double @calcStudentMark(i32 2)
%4 = tail call double @calcStudentMark(i32 3)
%5 = tail call double @calcStudentMark(i32 4)
%6 = tail call double @calcStudentMark(i32 5)
%7 = tail call double @calcStudentMark(i32 6)
%8 = tail call double @calcStudentMark(i32 7)
%9 = tail call double @calcStudentMark(i32 8)
%10 = tail call double @calcStudentMark(i32 9)
%11 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), double 1.000000e+00, double %1)
%12 = tail call i32 @studentMarkPrint(double %1)
%13 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), double 2.000000e+00, double %2)
%14 = tail call i32 @studentMarkPrint(double %2)
%15 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), double 3.000000e+00, double %3)
%16 = tail call i32 @studentMarkPrint(double %3)
%17 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), double 4.000000e+00, double %4)
%18 = tail call i32 @studentMarkPrint(double %4)
%19 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), double 5.000000e+00, double %5)
%20 = tail call i32 @studentMarkPrint(double %5)
%21 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), double 6.000000e+00, double %6)
%22 = tail call i32 @studentMarkPrint(double %6)
%23 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), double 7.000000e+00, double %7)
%24 = tail call i32 @studentMarkPrint(double %7)
%25 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), double 8.000000e+00, double %8)
%26 = tail call i32 @studentMarkPrint(double %8)
%27 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), double 9.000000e+00, double %9)
%28 = tail call i32 @studentMarkPrint(double %9)
%29 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), double 1.000000e+01, double %10)
%30 = tail call i32 @studentMarkPrint(double %10)
%31 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), double 0x7FF8000000000000)
%32 = tail call i32 @studentMarkPrint(double 0x7FF8000000000000)
ret i32 0
}