#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 *, ...);
void average2(double a[][5], int n) {
  int i, j;
  double sum = 0;
  for (i = 0; i < 5; i++) {
    for (j = 0; j < 10; j++) {
      sum += a[j][i];
    }
    printf("%.2lf ", sum / 10.0);
    sum = 0;
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<average2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x5,-0x10(%rbp)
jge    11ae <average2+0x9e>
movl   $0x0,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    1179 <average2+0x69>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113f <average2+0x2f>
movsd  -0x20(%rbp),%xmm0
movsd  0xe7a(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe77(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112e <average2+0x1e>
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<average2>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
xorpd  %xmm1,%xmm1
movsd  (%rdi),%xmm0
addsd  %xmm1,%xmm0
addsd  0x28(%rdi),%xmm0
addsd  0x50(%rdi),%xmm0
addsd  0x78(%rdi),%xmm0
addsd  0xa0(%rdi),%xmm0
addsd  0xc8(%rdi),%xmm0
addsd  0xf0(%rdi),%xmm0
addsd  0x118(%rdi),%xmm0
addsd  0x140(%rdi),%xmm0
addsd  0x168(%rdi),%xmm0
divsd  0xe86(%rip),%xmm0
lea    0xe8f(%rip),%r14
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x8(%rbx),%xmm0
addsd  0xe70(%rip),%xmm0
addsd  0x30(%rbx),%xmm0
addsd  0x58(%rbx),%xmm0
addsd  0x80(%rbx),%xmm0
addsd  0xa8(%rbx),%xmm0
addsd  0xd0(%rbx),%xmm0
addsd  0xf8(%rbx),%xmm0
addsd  0x120(%rbx),%xmm0
addsd  0x148(%rbx),%xmm0
addsd  0x170(%rbx),%xmm0
divsd  0xe1e(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x10(%rbx),%xmm0
addsd  0xe0f(%rip),%xmm0
addsd  0x38(%rbx),%xmm0
addsd  0x60(%rbx),%xmm0
addsd  0x88(%rbx),%xmm0
addsd  0xb0(%rbx),%xmm0
addsd  0xd8(%rbx),%xmm0
addsd  0x100(%rbx),%xmm0
addsd  0x128(%rbx),%xmm0
addsd  0x150(%rbx),%xmm0
addsd  0x178(%rbx),%xmm0
divsd  0xdbd(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x18(%rbx),%xmm0
addsd  0xdae(%rip),%xmm0
addsd  0x40(%rbx),%xmm0
addsd  0x68(%rbx),%xmm0
addsd  0x90(%rbx),%xmm0
addsd  0xb8(%rbx),%xmm0
addsd  0xe0(%rbx),%xmm0
addsd  0x108(%rbx),%xmm0
addsd  0x130(%rbx),%xmm0
addsd  0x158(%rbx),%xmm0
addsd  0x180(%rbx),%xmm0
divsd  0xd5c(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xorpd  %xmm0,%xmm0
addsd  0x20(%rbx),%xmm0
addsd  0x48(%rbx),%xmm0
addsd  0x70(%rbx),%xmm0
addsd  0x98(%rbx),%xmm0
addsd  0xc0(%rbx),%xmm0
addsd  0xe8(%rbx),%xmm0
addsd  0x110(%rbx),%xmm0
addsd  0x138(%rbx),%xmm0
addsd  0x160(%rbx),%xmm0
addsd  0x188(%rbx),%xmm0
divsd  0xcff(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"%.2lf \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @average2([5 x double]* %0, i32 %1) {
%3 = alloca [5 x double]*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
store [5 x double]* %0, [5 x double]** %3
store i32 %1, i32* %4
store double 0.000000e+00, double* %7
store i32 0, i32* %5
br label %8
8: ; preds = %33, %2
%9 = load i32, i32* %5
%10 = icmp slt i32 %9, 5
br i1 %10, label %11, label %36
11: ; preds = %8
store i32 0, i32* %6
br label %12
12: ; preds = %26, %11
%13 = load i32, i32* %6
%14 = icmp slt i32 %13, 10
br i1 %14, label %15, label %29
15: ; preds = %12
%16 = load [5 x double]*, [5 x double]** %3
%17 = load i32, i32* %6
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [5 x double], [5 x double]* %16, i64 %18
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [5 x double], [5 x double]* %19, i64 0, i64 %21
%23 = load double, double* %22
%24 = load double, double* %7
%25 = fadd double %24, %23
store double %25, double* %7
br label %26
26: ; preds = %15
%27 = load i32, i32* %6
%28 = add nsw i32 %27, 1
store i32 %28, i32* %6
br label %12
29: ; preds = %12
%30 = load double, double* %7
%31 = fdiv double %30, 1.000000e+01
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %31)
store double 0.000000e+00, double* %7
br label %33
33: ; preds = %29
%34 = load i32, i32* %5
%35 = add nsw i32 %34, 1
store i32 %35, i32* %5
br label %8
36: ; preds = %8
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

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