#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*/ average(double **, int);
int /*<<< orphan*/ average2(double **, int);
int /*<<< orphan*/ scanf(char *, double *);
int /*<<< orphan*/ top(double **, int);
int main() {
  double a[10][5];
  int i, j;
  for (i = 0; i < 10; i++)
    for (j = 0; j < 5; j++)
      scanf("%lf", &a[i][j]);
  average(a, 10);
  average2(a, 10);
  top(a, 10);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1a4(%rbp)
cmpl   $0xa,-0x1a4(%rbp)
jge    11dc <main+0x9c>
movl   $0x0,-0x1a8(%rbp)
cmpl   $0x5,-0x1a8(%rbp)
jge    11c3 <main+0x83>
movslq -0x1a4(%rbp),%rax
lea    -0x1a0(%rbp),%rsi
imul   $0x28,%rax,%rax
add    %rax,%rsi
movslq -0x1a8(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
lea    0xe56(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x1a8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a8(%rbp)
jmp    1173 <main+0x33>
jmp    11c8 <main+0x88>
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    115c <main+0x1c>
lea    -0x1a0(%rbp),%rdi
mov    $0xa,%esi
call   1050 <average@plt>
lea    -0x1a0(%rbp),%rdi
mov    $0xa,%esi
call   1030 <average2@plt>
lea    -0x1a0(%rbp),%rdi
mov    $0xa,%esi
call   1040 <top@plt>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x190,%rsp
mov    %rsp,%rbx
mov    $0xa,%r15d
lea    0xea4(%rip),%r14
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
lea    0x8(%rbx),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
lea    0x10(%rbx),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
lea    0x18(%rbx),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
lea    0x20(%rbx),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
add    $0x28,%rbx
add    $0xffffffffffffffff,%r15
jne    1160 <main+0x20>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1050 <average@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <average2@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <top@plt>
xor    %eax,%eax
add    $0x190,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
define i32 @main() {
%1 = alloca [10 x [5 x double]]
%2 = bitcast [10 x [5 x double]]* %1 to i8*
br label %3
3: ; preds = %0, %3
%4 = phi i64 [ 0, %0 ], [ %15, %3 ]
%5 = getelementptr inbounds [10 x [5 x double]], [10 x [5 x double]]* %1, i64 0, i64 %4, i64 0
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %5)
%7 = getelementptr inbounds [10 x [5 x double]], [10 x [5 x double]]* %1, i64 0, i64 %4, i64 1
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %7)
%9 = getelementptr inbounds [10 x [5 x double]], [10 x [5 x double]]* %1, i64 0, i64 %4, i64 2
%10 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %9)
%11 = getelementptr inbounds [10 x [5 x double]], [10 x [5 x double]]* %1, i64 0, i64 %4, i64 3
%12 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %11)
%13 = getelementptr inbounds [10 x [5 x double]], [10 x [5 x double]]* %1, i64 0, i64 %4, i64 4
%14 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %13)
%15 = add nuw nsw i64 %4, 1
%16 = icmp eq i64 %15, 10
br i1 %16, label %17, label %3
17: ; preds = %3
%18 = bitcast [10 x [5 x double]]* %1 to double**
%19 = call i32 @average(double** %18, i32 10)
%20 = call i32 @average2(double** %18, i32 10)
%21 = call i32 @top(double** %18, i32 10)
ret i32 0
}