#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, float);
int main() {
  int grades[2][5];
  float average;
  int i;
  int j;
  grades[0][0] = 80;
  grades[0][1] = 70;
  grades[0][2] = 65;
  grades[0][3] = 89;
  grades[0][4] = 90;
  grades[1][0] = 85;
  grades[1][1] = 80;
  grades[1][2] = 80;
  grades[1][3] = 82;
  grades[1][4] = 87;
  for (i = 0; i < 2; i++) {
    average = 0;
    for (j = 0; j < 5; j++) {
      average += grades[i][j];
    }
    average = average / 5;
    printf("The average marks obtained in subject %d is: %.2f\n", i, average);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x50,-0x30(%rbp)
movl   $0x46,-0x2c(%rbp)
movl   $0x41,-0x28(%rbp)
movl   $0x59,-0x24(%rbp)
movl   $0x5a,-0x20(%rbp)
movl   $0x55,-0x1c(%rbp)
movl   $0x50,-0x18(%rbp)
movl   $0x50,-0x14(%rbp)
movl   $0x52,-0x10(%rbp)
movl   $0x57,-0xc(%rbp)
movl   $0x0,-0x38(%rbp)
cmpl   $0x2,-0x38(%rbp)
jge    11f7 <main+0xe7>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x34(%rbp)
movl   $0x0,-0x3c(%rbp)
cmpl   $0x5,-0x3c(%rbp)
jge    11bf <main+0xaf>
movslq -0x38(%rbp),%rcx
lea    -0x30(%rbp),%rax
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movslq -0x3c(%rbp),%rcx
cvtsi2ssl (%rax,%rcx,4),%xmm0
addss  -0x34(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1185 <main+0x75>
movss  -0x34(%rbp),%xmm0
movss  0xe34(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x34(%rbp)
mov    -0x38(%rbp),%esi
movss  -0x34(%rbp),%xmm0
lea    0xe20(%rip),%rdi
call   1030 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    116c <main+0x5c>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xef0(%rip),%rbx
movss  0xee0(%rip),%xmm0
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
movss  0xed2(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [51 x i8] c"The average marks obtained in subject %d is: %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x [5 x i32]]
%3 = alloca float
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = getelementptr inbounds [2 x [5 x i32]], [2 x [5 x i32]]* %2, i64 0, i64 0
%7 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 0
store i32 80, i32* %7
%8 = getelementptr inbounds [2 x [5 x i32]], [2 x [5 x i32]]* %2, i64 0, i64 0
%9 = getelementptr inbounds [5 x i32], [5 x i32]* %8, i64 0, i64 1
store i32 70, i32* %9
%10 = getelementptr inbounds [2 x [5 x i32]], [2 x [5 x i32]]* %2, i64 0, i64 0
%11 = getelementptr inbounds [5 x i32], [5 x i32]* %10, i64 0, i64 2
store i32 65, i32* %11
%12 = getelementptr inbounds [2 x [5 x i32]], [2 x [5 x i32]]* %2, i64 0, i64 0
%13 = getelementptr inbounds [5 x i32], [5 x i32]* %12, i64 0, i64 3
store i32 89, i32* %13
%14 = getelementptr inbounds [2 x [5 x i32]], [2 x [5 x i32]]* %2, i64 0, i64 0
%15 = getelementptr inbounds [5 x i32], [5 x i32]* %14, i64 0, i64 4
store i32 90, i32* %15
%16 = getelementptr inbounds [2 x [5 x i32]], [2 x [5 x i32]]* %2, i64 0, i64 1
%17 = getelementptr inbounds [5 x i32], [5 x i32]* %16, i64 0, i64 0
store i32 85, i32* %17
%18 = getelementptr inbounds [2 x [5 x i32]], [2 x [5 x i32]]* %2, i64 0, i64 1
%19 = getelementptr inbounds [5 x i32], [5 x i32]* %18, i64 0, i64 1
store i32 80, i32* %19
%20 = getelementptr inbounds [2 x [5 x i32]], [2 x [5 x i32]]* %2, i64 0, i64 1
%21 = getelementptr inbounds [5 x i32], [5 x i32]* %20, i64 0, i64 2
store i32 80, i32* %21
%22 = getelementptr inbounds [2 x [5 x i32]], [2 x [5 x i32]]* %2, i64 0, i64 1
%23 = getelementptr inbounds [5 x i32], [5 x i32]* %22, i64 0, i64 3
store i32 82, i32* %23
%24 = getelementptr inbounds [2 x [5 x i32]], [2 x [5 x i32]]* %2, i64 0, i64 1
%25 = getelementptr inbounds [5 x i32], [5 x i32]* %24, i64 0, i64 4
store i32 87, i32* %25
store i32 0, i32* %4
br label %26
26: ; preds = %53, %0
%27 = load i32, i32* %4
%28 = icmp slt i32 %27, 2
br i1 %28, label %29, label %56
29: ; preds = %26
store float 0.000000e+00, float* %3
store i32 0, i32* %5
br label %30
30: ; preds = %44, %29
%31 = load i32, i32* %5
%32 = icmp slt i32 %31, 5
br i1 %32, label %33, label %47
33: ; preds = %30
%34 = load i32, i32* %4
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [2 x [5 x i32]], [2 x [5 x i32]]* %2, i64 0, i64 %35
%37 = load i32, i32* %5
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [5 x i32], [5 x i32]* %36, i64 0, i64 %38
%40 = load i32, i32* %39
%41 = sitofp i32 %40 to float
%42 = load float, float* %3
%43 = fadd float %42, %41
store float %43, float* %3
br label %44
44: ; preds = %33
%45 = load i32, i32* %5
%46 = add nsw i32 %45, 1
store i32 %46, i32* %5
br label %30
47: ; preds = %30
%48 = load float, float* %3
%49 = fdiv float %48, 5.000000e+00
store float %49, float* %3
%50 = load i32, i32* %4
%51 = load float, float* %3
%52 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 %50, float %51)
br label %53
53: ; preds = %47
%54 = load i32, i32* %4
%55 = add nsw i32 %54, 1
store i32 %55, i32* %4
br label %26
56: ; preds = %26
ret i32 0
}

LLVM IR (-O2):
@.str = [51 x i8] c"The average marks obtained in subject %d is: %.2f\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 0, float 0x4053B33340000000)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 1, float 0x4054B33340000000)
ret i32 0
}