#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 /*<<< orphan*/ scanf(char *, double *);
int main() {
  double scores[4][3];
  double total;
  int student, exam;
  for (student = 0; student < 4; student++) {
    printf("\nProcessing student # %d\n", student + 1);
    ;
    for (exam = 0; exam < 3; exam++) {
      printf("   - Enter score for exam # %d -- ", exam + 1);
      scanf("%lf", &scores[student][exam]);
    }
  }
  printf("\n-----------------------------------\n");
  printf("Scores for all students, all exams.\n");
  printf("-----------------------------------");
  for (student = 0; student < 4; student++) {
    printf("\nStudent number # %d - \t", student);
    for (exam = 0; exam < 3; exam++)
      printf("%5.2lf\t", scores[student][exam]);
  }
  printf("\n\n-----------------------\n");
  printf("Averages for all exams.\n");
  printf("-----------------------\n");
  for (exam = 0; exam < 3; exam++) {
    total = 0;
    for (student = 0; student < 4; student++)
      total = total + scores[student][exam];
    printf("Average for exam %d = ", exam);
    printf("%5.2lf\n", total / (double)4);
  }
  printf("\n--------------------------\n");
  printf("Averages for all students.\n");
  printf("--------------------------\n");
  for (student = 0; student < 4; student++) {
    total = 0;
    for (exam = 0; exam < 3; exam++)
      total = total + scores[student][exam];
    printf("Average for student %d = ", student);
    printf("%5.2lf\n", total / (double)3);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x7c(%rbp)
cmpl   $0x4,-0x7c(%rbp)
jge    11c3 <main+0xa3>
mov    -0x7c(%rbp),%esi
add    $0x1,%esi
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x80(%rbp)
cmpl   $0x3,-0x80(%rbp)
jge    11b0 <main+0x90>
mov    -0x80(%rbp),%esi
add    $0x1,%esi
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x7c(%rbp),%rax
lea    -0x70(%rbp),%rsi
imul   $0x18,%rax,%rax
add    %rax,%rsi
movslq -0x80(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
lea    0xeb0(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x80(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x80(%rbp)
jmp    115e <main+0x3e>
jmp    11b5 <main+0x95>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    1139 <main+0x19>
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x7c(%rbp)
cmpl   $0x4,-0x7c(%rbp)
jge    1267 <main+0x147>
mov    -0x7c(%rbp),%esi
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x80(%rbp)
cmpl   $0x3,-0x80(%rbp)
jge    1254 <main+0x134>
movslq -0x7c(%rbp),%rcx
lea    -0x70(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x80(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe9a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x80(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x80(%rbp)
jmp    1216 <main+0xf6>
jmp    1259 <main+0x139>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    11f4 <main+0xd4>
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x80(%rbp)
cmpl   $0x3,-0x80(%rbp)
jge    1329 <main+0x209>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x78(%rbp)
movl   $0x0,-0x7c(%rbp)
cmpl   $0x4,-0x7c(%rbp)
jge    12eb <main+0x1cb>
movsd  -0x78(%rbp),%xmm0
movslq -0x7c(%rbp),%rcx
lea    -0x70(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x80(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    12b1 <main+0x191>
mov    -0x80(%rbp),%esi
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x78(%rbp),%xmm0
movsd  0xcff(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe18(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x80(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x80(%rbp)
jmp    1298 <main+0x178>
lea    0xe04(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xde9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x7c(%rbp)
cmpl   $0x4,-0x7c(%rbp)
jge    13eb <main+0x2cb>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x78(%rbp)
movl   $0x0,-0x80(%rbp)
cmpl   $0x3,-0x80(%rbp)
jge    13ad <main+0x28d>
movsd  -0x78(%rbp),%xmm0
movslq -0x7c(%rbp),%rcx
lea    -0x70(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x80(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x80(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x80(%rbp)
jmp    1373 <main+0x253>
mov    -0x7c(%rbp),%esi
lea    0xdb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x78(%rbp),%xmm0
movsd  0xc35(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xd56(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    135a <main+0x23a>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x70,%rsp
lea    0xed8(%rip),%r15
mov    %r15,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xedc(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee9(%rip),%r14
lea    0x10(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x18(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x20(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
mov    %r15,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x28(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x30(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x38(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
mov    %r15,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x40(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x48(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x50(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
mov    %r15,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x58(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x60(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x68(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
lea    0xdd2(%rip),%rdi
call   1030 <puts@plt>
lea    0xdeb(%rip),%rdi
call   1030 <puts@plt>
lea    0xdbb(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd52(%rip),%r14
mov    %r14,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movsd  0x10(%rsp),%xmm0
lea    0xd52(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x18(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x20(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movsd  0x28(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x30(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x38(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movsd  0x40(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x48(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x50(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movsd  0x58(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x60(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x68(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xcee(%rip),%rdi
call   1030 <puts@plt>
lea    0xcfc(%rip),%rdi
call   1030 <puts@plt>
lea    0xcd8(%rip),%rdi
call   1030 <puts@plt>
xorpd  %xmm0,%xmm0
movsd  0x10(%rsp),%xmm1
addsd  %xmm0,%xmm1
addsd  0x28(%rsp),%xmm1
addsd  0x40(%rsp),%xmm1
addsd  0x58(%rsp),%xmm1
movsd  %xmm1,0x8(%rsp)
lea    0xc22(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movsd  0x8(%rsp),%xmm0
mulsd  0xb8e(%rip),%xmm0
lea    0xc18(%rip),%r14
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x18(%rsp),%xmm0
addsd  0xb7f(%rip),%xmm0
addsd  0x30(%rsp),%xmm0
addsd  0x48(%rsp),%xmm0
addsd  0x60(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movsd  0x8(%rsp),%xmm0
mulsd  0xb3a(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x20(%rsp),%xmm0
addsd  0xb32(%rip),%xmm0
addsd  0x38(%rsp),%xmm0
addsd  0x50(%rsp),%xmm0
addsd  0x68(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movsd  0x8(%rsp),%xmm0
mulsd  0xaed(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xc0a(%rip),%rdi
call   1030 <puts@plt>
lea    0xc1a(%rip),%rdi
call   1030 <puts@plt>
lea    0xbf3(%rip),%rdi
call   1030 <puts@plt>
movsd  0x10(%rsp),%xmm0
addsd  0xac1(%rip),%xmm0
addsd  0x18(%rsp),%xmm0
addsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0xb31(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movsd  0x8(%rsp),%xmm0
divsd  0xa86(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x28(%rsp),%xmm0
addsd  0xa76(%rip),%xmm0
addsd  0x30(%rsp),%xmm0
addsd  0x38(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movsd  0x8(%rsp),%xmm0
divsd  0xa3f(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x40(%rsp),%xmm0
addsd  0xa2f(%rip),%xmm0
addsd  0x48(%rsp),%xmm0
addsd  0x50(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movsd  0x8(%rsp),%xmm0
divsd  0x9f8(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xorpd  %xmm0,%xmm0
addsd  0x58(%rsp),%xmm0
addsd  0x60(%rsp),%xmm0
addsd  0x68(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movsd  0x8(%rsp),%xmm0
divsd  0x9b5(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [26 x i8] c"\0AProcessing student # %d\0A\00"
@.str.1 = [35 x i8] c" - Enter score for exam # %d -- \00"
@.str.2 = [4 x i8] c"%lf\00"
@.str.3 = [38 x i8] c"\0A-----------------------------------\0A\00"
@.str.4 = [37 x i8] c"Scores for all students, all exams.\0A\00"
@.str.5 = [36 x i8] c"-----------------------------------\00"
@.str.6 = [25 x i8] c"\0AStudent number # %d - \09\00"
@.str.7 = [8 x i8] c"%5.2lf\09\00"
@.str.8 = [27 x i8] c"\0A\0A-----------------------\0A\00"
@.str.9 = [25 x i8] c"Averages for all exams.\0A\00"
@.str.10 = [25 x i8] c"-----------------------\0A\00"
@.str.11 = [23 x i8] c"Average for exam %d = \00"
@.str.12 = [8 x i8] c"%5.2lf\0A\00"
@.str.13 = [29 x i8] c"\0A--------------------------\0A\00"
@.str.14 = [28 x i8] c"Averages for all students.\0A\00"
@.str.15 = [28 x i8] c"--------------------------\0A\00"
@.str.16 = [26 x i8] c"Average for student %d = \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x [3 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 = %31, %0
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 4
br i1 %8, label %9, label %34
9: ; preds = %6
%10 = load i32, i32* %4
%11 = add nsw i32 %10, 1
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %11)
store i32 0, i32* %5
br label %13
13: ; preds = %27, %9
%14 = load i32, i32* %5
%15 = icmp slt i32 %14, 3
br i1 %15, label %16, label %30
16: ; preds = %13
%17 = load i32, i32* %5
%18 = add nsw i32 %17, 1
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%20 = load i32, i32* %4
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [4 x [3 x double]], [4 x [3 x double]]* %2, i64 0, i64 %21
%23 = load i32, i32* %5
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 %24
%26 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %25)
br label %27
27: ; preds = %16
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
store i32 %29, i32* %5
br label %13
30: ; preds = %13
br label %31
31: ; preds = %30
%32 = load i32, i32* %4
%33 = add nsw i32 %32, 1
store i32 %33, i32* %4
br label %6
34: ; preds = %6
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0))
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0))
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %4
br label %38
38: ; preds = %60, %34
%39 = load i32, i32* %4
%40 = icmp slt i32 %39, 4
br i1 %40, label %41, label %63
41: ; preds = %38
%42 = load i32, i32* %4
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), i32 %42)
store i32 0, i32* %5
br label %44
44: ; preds = %56, %41
%45 = load i32, i32* %5
%46 = icmp slt i32 %45, 3
br i1 %46, label %47, label %59
47: ; preds = %44
%48 = load i32, i32* %4
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [4 x [3 x double]], [4 x [3 x double]]* %2, i64 0, i64 %49
%51 = load i32, i32* %5
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [3 x double], [3 x double]* %50, i64 0, i64 %52
%54 = load double, double* %53
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), double %54)
br label %56
56: ; preds = %47
%57 = load i32, i32* %5
%58 = add nsw i32 %57, 1
store i32 %58, i32* %5
br label %44
59: ; preds = %44
br label %60
60: ; preds = %59
%61 = load i32, i32* %4
%62 = add nsw i32 %61, 1
store i32 %62, i32* %4
br label %38
63: ; preds = %38
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0))
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0))
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0))
store i32 0, i32* %5
br label %67
67: ; preds = %93, %63
%68 = load i32, i32* %5
%69 = icmp slt i32 %68, 3
br i1 %69, label %70, label %96
70: ; preds = %67
store double 0.000000e+00, double* %3
store i32 0, i32* %4
br label %71
71: ; preds = %84, %70
%72 = load i32, i32* %4
%73 = icmp slt i32 %72, 4
br i1 %73, label %74, label %87
74: ; preds = %71
%75 = load double, double* %3
%76 = load i32, i32* %4
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds [4 x [3 x double]], [4 x [3 x double]]* %2, i64 0, i64 %77
%79 = load i32, i32* %5
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds [3 x double], [3 x double]* %78, i64 0, i64 %80
%82 = load double, double* %81
%83 = fadd double %75, %82
store double %83, double* %3
br label %84
84: ; preds = %74
%85 = load i32, i32* %4
%86 = add nsw i32 %85, 1
store i32 %86, i32* %4
br label %71
87: ; preds = %71
%88 = load i32, i32* %5
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 %88)
%90 = load double, double* %3
%91 = fdiv double %90, 4.000000e+00
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), double %91)
br label %93
93: ; preds = %87
%94 = load i32, i32* %5
%95 = add nsw i32 %94, 1
store i32 %95, i32* %5
br label %67
96: ; preds = %67
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.13, i64 0, i64 0))
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.14, i64 0, i64 0))
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.15, i64 0, i64 0))
store i32 0, i32* %4
br label %100
100: ; preds = %126, %96
%101 = load i32, i32* %4
%102 = icmp slt i32 %101, 4
br i1 %102, label %103, label %129
103: ; preds = %100
store double 0.000000e+00, double* %3
store i32 0, i32* %5
br label %104
104: ; preds = %117, %103
%105 = load i32, i32* %5
%106 = icmp slt i32 %105, 3
br i1 %106, label %107, label %120
107: ; preds = %104
%108 = load double, double* %3
%109 = load i32, i32* %4
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds [4 x [3 x double]], [4 x [3 x double]]* %2, i64 0, i64 %110
%112 = load i32, i32* %5
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds [3 x double], [3 x double]* %111, i64 0, i64 %113
%115 = load double, double* %114
%116 = fadd double %108, %115
store double %116, double* %3
br label %117
117: ; preds = %107
%118 = load i32, i32* %5
%119 = add nsw i32 %118, 1
store i32 %119, i32* %5
br label %104
120: ; preds = %104
%121 = load i32, i32* %4
%122 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.16, i64 0, i64 0), i32 %121)
%123 = load double, double* %3
%124 = fdiv double %123, 3.000000e+00
%125 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), double %124)
br label %126
126: ; preds = %120
%127 = load i32, i32* %4
%128 = add nsw i32 %127, 1
store i32 %128, i32* %4
br label %100
129: ; preds = %100
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"\0AProcessing student # %d\0A\00"
@.str.1 = [35 x i8] c" - Enter score for exam # %d -- \00"
@.str.2 = [4 x i8] c"%lf\00"
@.str.5 = [36 x i8] c"-----------------------------------\00"
@.str.6 = [25 x i8] c"\0AStudent number # %d - \09\00"
@.str.7 = [8 x i8] c"%5.2lf\09\00"
@.str.11 = [23 x i8] c"Average for exam %d = \00"
@.str.12 = [8 x i8] c"%5.2lf\0A\00"
@.str.16 = [26 x i8] c"Average for student %d = \00"
@str = [37 x i8] c"\0A-----------------------------------\00"
@str.17 = [36 x i8] c"Scores for all students, all exams.\00"
@str.18 = [26 x i8] c"\0A\0A-----------------------\00"
@str.19 = [24 x i8] c"Averages for all exams.\00"
@str.20 = [24 x i8] c"-----------------------\00"
@str.21 = [28 x i8] c"\0A--------------------------\00"
@str.22 = [27 x i8] c"Averages for all students.\00"
@str.23 = [27 x i8] c"--------------------------\00"
define i32 @main() {
%1 = alloca [4 x [3 x double]]
%2 = bitcast [4 x [3 x double]]* %1 to i8*
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 1)
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 1)
%5 = getelementptr inbounds [4 x [3 x double]], [4 x [3 x double]]* %1, i64 0, i64 0, i64 0
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %5)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 2)
%8 = getelementptr inbounds [4 x [3 x double]], [4 x [3 x double]]* %1, i64 0, i64 0, i64 1
%9 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %8)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 3)
%11 = getelementptr inbounds [4 x [3 x double]], [4 x [3 x double]]* %1, i64 0, i64 0, i64 2
%12 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %11)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 2)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 1)
%15 = getelementptr inbounds [4 x [3 x double]], [4 x [3 x double]]* %1, i64 0, i64 1, i64 0
%16 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %15)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 2)
%18 = getelementptr inbounds [4 x [3 x double]], [4 x [3 x double]]* %1, i64 0, i64 1, i64 1
%19 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %18)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 3)
%21 = getelementptr inbounds [4 x [3 x double]], [4 x [3 x double]]* %1, i64 0, i64 1, i64 2
%22 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %21)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 3)
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 1)
%25 = getelementptr inbounds [4 x [3 x double]], [4 x [3 x double]]* %1, i64 0, i64 2, i64 0
%26 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %25)
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 2)
%28 = getelementptr inbounds [4 x [3 x double]], [4 x [3 x double]]* %1, i64 0, i64 2, i64 1
%29 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %28)
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 3)
%31 = getelementptr inbounds [4 x [3 x double]], [4 x [3 x double]]* %1, i64 0, i64 2, i64 2
%32 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %31)
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 4)
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 1)
%35 = getelementptr inbounds [4 x [3 x double]], [4 x [3 x double]]* %1, i64 0, i64 3, i64 0
%36 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %35)
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 2)
%38 = getelementptr inbounds [4 x [3 x double]], [4 x [3 x double]]* %1, i64 0, i64 3, i64 1
%39 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %38)
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 3)
%41 = getelementptr inbounds [4 x [3 x double]], [4 x [3 x double]]* %1, i64 0, i64 3, i64 2
%42 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %41)
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.17, i64 0, i64 0))
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0))
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), i32 0)
%47 = load double, double* %5
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), double %47)
%49 = load double, double* %8
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), double %49)
%51 = load double, double* %11
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), double %51)
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), i32 1)
%54 = load double, double* %15
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), double %54)
%56 = load double, double* %18
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), double %56)
%58 = load double, double* %21
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), double %58)
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), i32 2)
%61 = load double, double* %25
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), double %61)
%63 = load double, double* %28
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), double %63)
%65 = load double, double* %31
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), double %65)
%67 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), i32 3)
%68 = load double, double* %35
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), double %68)
%70 = load double, double* %38
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), double %70)
%72 = load double, double* %41
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), double %72)
%74 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.18, i64 0, i64 0))
%75 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.19, i64 0, i64 0))
%76 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.20, i64 0, i64 0))
%77 = load double, double* %5
%78 = fadd double %77, 0.000000e+00
%79 = load double, double* %15
%80 = fadd double %78, %79
%81 = load double, double* %25
%82 = fadd double %80, %81
%83 = load double, double* %35
%84 = fadd double %82, %83
%85 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 0)
%86 = fmul double %84, 2.500000e-01
%87 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), double %86)
%88 = load double, double* %8
%89 = fadd double %88, 0.000000e+00
%90 = load double, double* %18
%91 = fadd double %89, %90
%92 = load double, double* %28
%93 = fadd double %91, %92
%94 = load double, double* %38
%95 = fadd double %93, %94
%96 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 1)
%97 = fmul double %95, 2.500000e-01
%98 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), double %97)
%99 = load double, double* %11
%100 = fadd double %99, 0.000000e+00
%101 = load double, double* %21
%102 = fadd double %100, %101
%103 = load double, double* %31
%104 = fadd double %102, %103
%105 = load double, double* %41
%106 = fadd double %104, %105
%107 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 2)
%108 = fmul double %106, 2.500000e-01
%109 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), double %108)
%110 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.21, i64 0, i64 0))
%111 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.22, i64 0, i64 0))
%112 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.23, i64 0, i64 0))
%113 = load double, double* %5
%114 = fadd double %113, 0.000000e+00
%115 = load double, double* %8
%116 = fadd double %114, %115
%117 = load double, double* %11
%118 = fadd double %116, %117
%119 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.16, i64 0, i64 0), i32 0)
%120 = fdiv double %118, 3.000000e+00
%121 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), double %120)
%122 = load double, double* %15
%123 = fadd double %122, 0.000000e+00
%124 = load double, double* %18
%125 = fadd double %123, %124
%126 = load double, double* %21
%127 = fadd double %125, %126
%128 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.16, i64 0, i64 0), i32 1)
%129 = fdiv double %127, 3.000000e+00
%130 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), double %129)
%131 = load double, double* %25
%132 = fadd double %131, 0.000000e+00
%133 = load double, double* %28
%134 = fadd double %132, %133
%135 = load double, double* %31
%136 = fadd double %134, %135
%137 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.16, i64 0, i64 0), i32 2)
%138 = fdiv double %136, 3.000000e+00
%139 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), double %138)
%140 = load double, double* %35
%141 = fadd double %140, 0.000000e+00
%142 = load double, double* %38
%143 = fadd double %141, %142
%144 = load double, double* %41
%145 = fadd double %143, %144
%146 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.16, i64 0, i64 0), i32 3)
%147 = fdiv double %145, 3.000000e+00
%148 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), double %147)
ret i32 0
}