#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 *, char *, float);
int main() {
  float average;
  int grades[2][5], i, j;
  char *subject[2] = {"Physics", "Mathematics"};
  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 /= 5;
    printf("The average marks obtained in subject %s is: %.2f\n", subject[i],
           average);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2cea(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0x2ce7(%rip),%rax
mov    %rax,-0x48(%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,-0x34(%rbp)
cmpl   $0x2,-0x34(%rbp)
jge    1213 <main+0x103>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movl   $0x0,-0x38(%rbp)
cmpl   $0x5,-0x38(%rbp)
jge    11d5 <main+0xc5>
movslq -0x34(%rbp),%rcx
lea    -0x30(%rbp),%rax
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movslq -0x38(%rbp),%rcx
cvtsi2ssl (%rax,%rcx,4),%xmm0
addss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    119b <main+0x8b>
movss  -0x8(%rbp),%xmm0
movss  0xe1e(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movslq -0x34(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rsi
movss  -0x8(%rbp),%xmm0
lea    0xe18(%rip),%rdi
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1182 <main+0x72>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xf04(%rip),%rbx
lea    0xee9(%rip),%rsi
movss  0xed9(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xeda(%rip),%rsi
movss  0xec6(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

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