#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 *, int *);
int main(int argc, const char *argv[]) {
  int score[3 + 1][4 + 1];
  for (int i = 0; i < 3; ++i) {
    printf("Student%d: ", i + 1);
    for (int j = 0; j < 4; ++j) {
      scanf("%d", &score[i][j]);
    }
  }
  for (int i = 0; i < 3; ++i) {
    int sum = 0;
    for (int j = 0; j < 4; ++j) {
      sum += score[i][j];
    }
    score[i][4] = sum / 4;
  }
  for (int j = 0; j <= 4; ++j) {
    int sum = 0;
    for (int i = 0; i < 3; ++i) {
      sum += score[i][j];
    }
    score[3][j] = sum / 3;
  }
  for (int i = -1; i <= 3; ++i) {
    if (i == 3) {
      printf("average   ");
    } else if (i == -1) {
      printf("          ");
    } else {
      printf("student%d  ", i + 1);
    }
    for (int j = 0; j <= 4; ++j) {
      if (i == -1) {
        if (j == 4) {
          printf(" average");
        } else {
          printf("subject%d  ", j + 1);
        }
      } else {
        printf("%8d  ", score[i][j]);
      }
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x64(%rbp)
cmpl   $0x3,-0x64(%rbp)
jge    11b6 <main+0x96>
mov    -0x64(%rbp),%esi
add    $0x1,%esi
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x68(%rbp)
cmpl   $0x4,-0x68(%rbp)
jge    11a3 <main+0x83>
movslq -0x64(%rbp),%rax
lea    -0x60(%rbp),%rsi
imul   $0x14,%rax,%rax
add    %rax,%rsi
movslq -0x68(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe7c(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    1165 <main+0x45>
jmp    11a8 <main+0x88>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1140 <main+0x20>
movl   $0x0,-0x6c(%rbp)
cmpl   $0x3,-0x6c(%rbp)
jge    1236 <main+0x116>
movl   $0x0,-0x70(%rbp)
movl   $0x0,-0x74(%rbp)
cmpl   $0x4,-0x74(%rbp)
jge    1209 <main+0xe9>
movslq -0x6c(%rbp),%rcx
lea    -0x60(%rbp),%rax
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movslq -0x74(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
add    -0x70(%rbp),%eax
mov    %eax,-0x70(%rbp)
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    11d5 <main+0xb5>
mov    -0x70(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
movslq -0x6c(%rbp),%rdx
lea    -0x60(%rbp),%rax
imul   $0x14,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0x10(%rax)
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    11bd <main+0x9d>
movl   $0x0,-0x78(%rbp)
cmpl   $0x4,-0x78(%rbp)
jg     12ac <main+0x18c>
movl   $0x0,-0x7c(%rbp)
movl   $0x0,-0x80(%rbp)
cmpl   $0x3,-0x80(%rbp)
jge    1289 <main+0x169>
movslq -0x80(%rbp),%rcx
lea    -0x60(%rbp),%rax
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movslq -0x78(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
add    -0x7c(%rbp),%eax
mov    %eax,-0x7c(%rbp)
mov    -0x80(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x80(%rbp)
jmp    1255 <main+0x135>
mov    -0x7c(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
movslq -0x78(%rbp),%rax
mov    %ecx,-0x24(%rbp,%rax,4)
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    123d <main+0x11d>
movl   $0xffffffff,-0x84(%rbp)
ff ff ff
cmpl   $0x3,-0x84(%rbp)
jg     13e4 <main+0x2c4>
cmpl   $0x3,-0x84(%rbp)
jne    12e3 <main+0x1c3>
lea    0xd38(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    131f <main+0x1ff>
cmpl   $0xffffffff,-0x84(%rbp)
jne    1303 <main+0x1e3>
lea    0xd23(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    131a <main+0x1fa>
mov    -0x84(%rbp),%esi
add    $0x1,%esi
lea    0xd12(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    131f <main+0x1ff>
movl   $0x0,-0x88(%rbp)
cmpl   $0x4,-0x88(%rbp)
jg     13c2 <main+0x2a2>
cmpl   $0xffffffff,-0x84(%rbp)
jne    137f <main+0x25f>
cmpl   $0x4,-0x88(%rbp)
jne    1363 <main+0x243>
lea    0xcda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    137a <main+0x25a>
mov    -0x88(%rbp),%esi
add    $0x1,%esi
lea    0xcc7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    13a9 <main+0x289>
movslq -0x84(%rbp),%rcx
lea    -0x60(%rbp),%rax
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movslq -0x88(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xca4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    13ae <main+0x28e>
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
jmp    1329 <main+0x209>
lea    0xc83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    12b6 <main+0x196>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
lea    0xebb(%rip),%r14
mov    %r14,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb1(%rip),%rbx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0x1c(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x24(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0x28(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0x2c(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0x30(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x38(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0x3c(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0x40(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0x44(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0x10(%rsp),%r11d
mov    0x14(%rsp),%r9d
lea    (%r9,%r11,1),%eax
mov    0x18(%rsp),%ecx
mov    %ecx,0xc(%rsp)
add    %ecx,%eax
mov    0x1c(%rsp),%r10d
mov    %r10d,%ecx
add    %eax,%ecx
lea    0x3(%r10,%rax,1),%r13d
cmovns %ecx,%r13d
sar    $0x2,%r13d
mov    %r13d,0x20(%rsp)
mov    0x24(%rsp),%ebp
mov    0x28(%rsp),%ecx
lea    (%rcx,%rbp,1),%edx
mov    0x2c(%rsp),%esi
add    %esi,%edx
mov    0x30(%rsp),%edi
mov    %edi,%ebx
add    %edx,%ebx
lea    0x3(%rdi,%rdx,1),%edx
cmovns %ebx,%edx
sar    $0x2,%edx
mov    %edx,0x34(%rsp)
mov    0x38(%rsp),%r8d
mov    0x3c(%rsp),%r12d
lea    (%r12,%r8,1),%ebx
mov    0x40(%rsp),%r14d
add    %r14d,%ebx
mov    0x44(%rsp),%r15d
mov    %r15d,%eax
add    %ebx,%eax
lea    0x3(%r15,%rbx,1),%ebx
cmovns %eax,%ebx
add    %r11d,%ebp
add    %r8d,%ebp
movslq %ebp,%rax
imul   $0x55555556,%rax,%rax
mov    %rax,%rbp
shr    $0x3f,%rbp
shr    $0x20,%rax
add    %ebp,%eax
sar    $0x2,%ebx
mov    %ebx,0x48(%rsp)
mov    %eax,0x4c(%rsp)
add    %r9d,%ecx
add    %r12d,%ecx
movslq %ecx,%rax
imul   $0x55555556,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
add    %ecx,%eax
mov    %eax,0x50(%rsp)
add    0xc(%rsp),%esi
add    %r14d,%esi
movslq %esi,%rax
imul   $0x55555556,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
add    %ecx,%eax
mov    %eax,0x54(%rsp)
add    %r10d,%edi
add    %r15d,%edi
movslq %edi,%rax
imul   $0x55555556,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
add    %ecx,%eax
mov    %eax,0x58(%rsp)
add    %r13d,%edx
add    %ebx,%edx
movslq %edx,%rax
imul   $0x55555556,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
add    %ecx,%eax
mov    %eax,0x5c(%rsp)
lea    0x20(%rsp),%rbx
lea    0xcca(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xcd9(%rip),%r15
mov    %r15,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc8d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xc8a(%rip),%r13
lea    0xc4c(%rip),%r15
lea    0xc5b(%rip),%r12
xor    %ebp,%ebp
jmp    1435 <main+0x305>
xchg   %ax,%ax
lea    0x1(%rbp),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    -0x10(%rbx),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    -0xc(%rbx),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    -0x8(%rbx),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    -0x4(%rbx),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rbx),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
add    $0x14,%rbx
cmp    $0x4,%rbp
je     145c <main+0x32c>
cmp    $0xffffffff,%ebp
je     1450 <main+0x320>
cmp    $0x3,%ebp
jne    13d0 <main+0x2a0>
mov    %r15,%rdi
jmp    1453 <main+0x323>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    13dd <main+0x2ad>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Student%d: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [11 x i8] c"average \00"
@.str.3 = [11 x i8] c" \00"
@.str.4 = [12 x i8] c"student%d \00"
@.str.5 = [9 x i8] c" average\00"
@.str.6 = [12 x i8] c"subject%d \00"
@.str.7 = [6 x i8] c"%8d \00"
@.str.8 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [4 x [5 x i32]]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
br label %17
17: ; preds = %39, %2
%18 = load i32, i32* %7
%19 = icmp slt i32 %18, 3
br i1 %19, label %20, label %42
20: ; preds = %17
%21 = load i32, i32* %7
%22 = add nsw i32 %21, 1
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %22)
store i32 0, i32* %8
br label %24
24: ; preds = %35, %20
%25 = load i32, i32* %8
%26 = icmp slt i32 %25, 4
br i1 %26, label %27, label %38
27: ; preds = %24
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [4 x [5 x i32]], [4 x [5 x i32]]* %6, i64 0, i64 %29
%31 = load i32, i32* %8
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [5 x i32], [5 x i32]* %30, i64 0, i64 %32
%34 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %33)
br label %35
35: ; preds = %27
%36 = load i32, i32* %8
%37 = add nsw i32 %36, 1
store i32 %37, i32* %8
br label %24
38: ; preds = %24
br label %39
39: ; preds = %38
%40 = load i32, i32* %7
%41 = add nsw i32 %40, 1
store i32 %41, i32* %7
br label %17
42: ; preds = %17
store i32 0, i32* %9
br label %43
43: ; preds = %70, %42
%44 = load i32, i32* %9
%45 = icmp slt i32 %44, 3
br i1 %45, label %46, label %73
46: ; preds = %43
store i32 0, i32* %10
store i32 0, i32* %11
br label %47
47: ; preds = %60, %46
%48 = load i32, i32* %11
%49 = icmp slt i32 %48, 4
br i1 %49, label %50, label %63
50: ; preds = %47
%51 = load i32, i32* %9
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [4 x [5 x i32]], [4 x [5 x i32]]* %6, i64 0, i64 %52
%54 = load i32, i32* %11
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [5 x i32], [5 x i32]* %53, i64 0, i64 %55
%57 = load i32, i32* %56
%58 = load i32, i32* %10
%59 = add nsw i32 %58, %57
store i32 %59, i32* %10
br label %60
60: ; preds = %50
%61 = load i32, i32* %11
%62 = add nsw i32 %61, 1
store i32 %62, i32* %11
br label %47
63: ; preds = %47
%64 = load i32, i32* %10
%65 = sdiv i32 %64, 4
%66 = load i32, i32* %9
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [4 x [5 x i32]], [4 x [5 x i32]]* %6, i64 0, i64 %67
%69 = getelementptr inbounds [5 x i32], [5 x i32]* %68, i64 0, i64 4
store i32 %65, i32* %69
br label %70
70: ; preds = %63
%71 = load i32, i32* %9
%72 = add nsw i32 %71, 1
store i32 %72, i32* %9
br label %43
73: ; preds = %43
store i32 0, i32* %12
br label %74
74: ; preds = %101, %73
%75 = load i32, i32* %12
%76 = icmp sle i32 %75, 4
br i1 %76, label %77, label %104
77: ; preds = %74
store i32 0, i32* %13
store i32 0, i32* %14
br label %78
78: ; preds = %91, %77
%79 = load i32, i32* %14
%80 = icmp slt i32 %79, 3
br i1 %80, label %81, label %94
81: ; preds = %78
%82 = load i32, i32* %14
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds [4 x [5 x i32]], [4 x [5 x i32]]* %6, i64 0, i64 %83
%85 = load i32, i32* %12
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds [5 x i32], [5 x i32]* %84, i64 0, i64 %86
%88 = load i32, i32* %87
%89 = load i32, i32* %13
%90 = add nsw i32 %89, %88
store i32 %90, i32* %13
br label %91
91: ; preds = %81
%92 = load i32, i32* %14
%93 = add nsw i32 %92, 1
store i32 %93, i32* %14
br label %78
94: ; preds = %78
%95 = load i32, i32* %13
%96 = sdiv i32 %95, 3
%97 = getelementptr inbounds [4 x [5 x i32]], [4 x [5 x i32]]* %6, i64 0, i64 3
%98 = load i32, i32* %12
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds [5 x i32], [5 x i32]* %97, i64 0, i64 %99
store i32 %96, i32* %100
br label %101
101: ; preds = %94
%102 = load i32, i32* %12
%103 = add nsw i32 %102, 1
store i32 %103, i32* %12
br label %74
104: ; preds = %74
store i32 -1, i32* %15
br label %105
105: ; preds = %155, %104
%106 = load i32, i32* %15
%107 = icmp sle i32 %106, 3
br i1 %107, label %108, label %158
108: ; preds = %105
%109 = load i32, i32* %15
%110 = icmp eq i32 %109, 3
br i1 %110, label %111, label %113
111: ; preds = %108
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
br label %123
113: ; preds = %108
%114 = load i32, i32* %15
%115 = icmp eq i32 %114, -1
br i1 %115, label %116, label %118
116: ; preds = %113
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
br label %122
118: ; preds = %113
%119 = load i32, i32* %15
%120 = add nsw i32 %119, 1
%121 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %120)
br label %122
122: ; preds = %118, %116
br label %123
123: ; preds = %122, %111
store i32 0, i32* %16
br label %124
124: ; preds = %150, %123
%125 = load i32, i32* %16
%126 = icmp sle i32 %125, 4
br i1 %126, label %127, label %153
127: ; preds = %124
%128 = load i32, i32* %15
%129 = icmp eq i32 %128, -1
br i1 %129, label %130, label %140
130: ; preds = %127
%131 = load i32, i32* %16
%132 = icmp eq i32 %131, 4
br i1 %132, label %133, label %135
133: ; preds = %130
%134 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
br label %139
135: ; preds = %130
%136 = load i32, i32* %16
%137 = add nsw i32 %136, 1
%138 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32 %137)
br label %139
139: ; preds = %135, %133
br label %149
140: ; preds = %127
%141 = load i32, i32* %15
%142 = sext i32 %141 to i64
%143 = getelementptr inbounds [4 x [5 x i32]], [4 x [5 x i32]]* %6, i64 0, i64 %142
%144 = load i32, i32* %16
%145 = sext i32 %144 to i64
%146 = getelementptr inbounds [5 x i32], [5 x i32]* %143, i64 0, i64 %145
%147 = load i32, i32* %146
%148 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 %147)
br label %149
149: ; preds = %140, %139
br label %150
150: ; preds = %149
%151 = load i32, i32* %16
%152 = add nsw i32 %151, 1
store i32 %152, i32* %16
br label %124
153: ; preds = %124
%154 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
br label %155
155: ; preds = %153
%156 = load i32, i32* %15
%157 = add nsw i32 %156, 1
store i32 %157, i32* %15
br label %105
158: ; preds = %105
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"Student%d: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [11 x i8] c"average \00"
@.str.3 = [11 x i8] c" \00"
@.str.4 = [12 x i8] c"student%d \00"
@.str.5 = [9 x i8] c" average\00"
@.str.6 = [12 x i8] c"subject%d \00"
@.str.7 = [6 x i8] c"%8d \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [4 x [5 x i32]]
%4 = bitcast [4 x [5 x i32]]* %3 to i8*
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 1)
%6 = getelementptr inbounds [4 x [5 x i32]], [4 x [5 x i32]]* %3, i64 0, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%8 = getelementptr inbounds [4 x [5 x i32]], [4 x [5 x i32]]* %3, i64 0, i64 0, i64 1
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
%10 = getelementptr inbounds [4 x [5 x i32]], [4 x [5 x i32]]* %3, i64 0, i64 0, i64 2
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %10)
%12 = getelementptr inbounds [4 x [5 x i32]], [4 x [5 x i32]]* %3, i64 0, i64 0, i64 3
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %12)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 2)
%15 = getelementptr inbounds [4 x [5 x i32]], [4 x [5 x i32]]* %3, i64 0, i64 1, i64 0
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %15)
%17 = getelementptr inbounds [4 x [5 x i32]], [4 x [5 x i32]]* %3, i64 0, i64 1, i64 1
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %17)
%19 = getelementptr inbounds [4 x [5 x i32]], [4 x [5 x i32]]* %3, i64 0, i64 1, i64 2
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %19)
%21 = getelementptr inbounds [4 x [5 x i32]], [4 x [5 x i32]]* %3, i64 0, i64 1, i64 3
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %21)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 3)
%24 = getelementptr inbounds [4 x [5 x i32]], [4 x [5 x i32]]* %3, i64 0, i64 2, i64 0
%25 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %24)
%26 = getelementptr inbounds [4 x [5 x i32]], [4 x [5 x i32]]* %3, i64 0, i64 2, i64 1
%27 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %26)
%28 = getelementptr inbounds [4 x [5 x i32]], [4 x [5 x i32]]* %3, i64 0, i64 2, i64 2
%29 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %28)
%30 = getelementptr inbounds [4 x [5 x i32]], [4 x [5 x i32]]* %3, i64 0, i64 2, i64 3
%31 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %30)
%32 = load i32, i32* %6
%33 = load i32, i32* %8
%34 = add nsw i32 %33, %32
%35 = load i32, i32* %10
%36 = add nsw i32 %35, %34
%37 = load i32, i32* %12
%38 = add nsw i32 %37, %36
%39 = sdiv i32 %38, 4
%40 = getelementptr inbounds [4 x [5 x i32]], [4 x [5 x i32]]* %3, i64 0, i64 0, i64 4
store i32 %39, i32* %40
%41 = load i32, i32* %15
%42 = load i32, i32* %17
%43 = add nsw i32 %42, %41
%44 = load i32, i32* %19
%45 = add nsw i32 %44, %43
%46 = load i32, i32* %21
%47 = add nsw i32 %46, %45
%48 = sdiv i32 %47, 4
%49 = getelementptr inbounds [4 x [5 x i32]], [4 x [5 x i32]]* %3, i64 0, i64 1, i64 4
store i32 %48, i32* %49
%50 = load i32, i32* %24
%51 = load i32, i32* %26
%52 = add nsw i32 %51, %50
%53 = load i32, i32* %28
%54 = add nsw i32 %53, %52
%55 = load i32, i32* %30
%56 = add nsw i32 %55, %54
%57 = sdiv i32 %56, 4
%58 = getelementptr inbounds [4 x [5 x i32]], [4 x [5 x i32]]* %3, i64 0, i64 2, i64 4
store i32 %57, i32* %58
%59 = add nsw i32 %41, %32
%60 = add nsw i32 %50, %59
%61 = sdiv i32 %60, 3
%62 = getelementptr inbounds [4 x [5 x i32]], [4 x [5 x i32]]* %3, i64 0, i64 3, i64 0
store i32 %61, i32* %62
%63 = add nsw i32 %42, %33
%64 = add nsw i32 %51, %63
%65 = sdiv i32 %64, 3
%66 = getelementptr inbounds [4 x [5 x i32]], [4 x [5 x i32]]* %3, i64 0, i64 3, i64 1
store i32 %65, i32* %66
%67 = add nsw i32 %44, %35
%68 = add nsw i32 %53, %67
%69 = sdiv i32 %68, 3
%70 = getelementptr inbounds [4 x [5 x i32]], [4 x [5 x i32]]* %3, i64 0, i64 3, i64 2
store i32 %69, i32* %70
%71 = add nsw i32 %46, %37
%72 = add nsw i32 %55, %71
%73 = sdiv i32 %72, 3
%74 = getelementptr inbounds [4 x [5 x i32]], [4 x [5 x i32]]* %3, i64 0, i64 3, i64 3
store i32 %73, i32* %74
%75 = add nsw i32 %48, %39
%76 = add nsw i32 %57, %75
%77 = sdiv i32 %76, 3
%78 = getelementptr inbounds [4 x [5 x i32]], [4 x [5 x i32]]* %3, i64 0, i64 3, i64 4
store i32 %77, i32* %78
%79 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%80 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32 1)
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32 2)
%82 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32 3)
%83 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32 4)
%84 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%85 = call i32 @putchar(i32 10)
br label %87
86: ; preds = %98
ret i32 0
87: ; preds = %2, %98
%88 = phi i64 [ 0, %2 ], [ %115, %98 ]
%89 = trunc i64 %88 to i32
switch i32 %89, label %94 [
i32 3, label %90
i32 -1, label %92
]
90: ; preds = %87
%91 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
br label %98
92: ; preds = %87
%93 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
br label %98
94: ; preds = %87
%95 = trunc i64 %88 to i32
%96 = add nuw nsw i32 %95, 1
%97 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %96)
br label %98
98: ; preds = %90, %94, %92
%99 = getelementptr inbounds [4 x [5 x i32]], [4 x [5 x i32]]* %3, i64 0, i64 %88, i64 0
%100 = load i32, i32* %99
%101 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 %100)
%102 = getelementptr inbounds [4 x [5 x i32]], [4 x [5 x i32]]* %3, i64 0, i64 %88, i64 1
%103 = load i32, i32* %102
%104 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 %103)
%105 = getelementptr inbounds [4 x [5 x i32]], [4 x [5 x i32]]* %3, i64 0, i64 %88, i64 2
%106 = load i32, i32* %105
%107 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 %106)
%108 = getelementptr inbounds [4 x [5 x i32]], [4 x [5 x i32]]* %3, i64 0, i64 %88, i64 3
%109 = load i32, i32* %108
%110 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 %109)
%111 = getelementptr inbounds [4 x [5 x i32]], [4 x [5 x i32]]* %3, i64 0, i64 %88, i64 4
%112 = load i32, i32* %111
%113 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 %112)
%114 = call i32 @putchar(i32 10)
%115 = add nuw nsw i64 %88, 1
%116 = icmp eq i64 %115, 4
br i1 %116, label %86, label %87
}