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


x86 assembly (clang, -O0):
<top>:
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    11c3 <top+0xb3>
movl   $0x0,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    119c <top+0x8c>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1189 <top+0x79>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    118e <top+0x7e>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113f <top+0x2f>
movsd  -0x20(%rbp),%xmm0
lea    0xe58(%rip),%rdi
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112e <top+0x1e>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<top>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
mov    $0xfffffffffffffffb,%rbx
lea    0xee2(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
movsd  0x28(%r15,%rbx,8),%xmm0
maxsd  0xec1(%rip),%xmm0
movsd  0x50(%r15,%rbx,8),%xmm1
maxsd  %xmm0,%xmm1
movsd  0x78(%r15,%rbx,8),%xmm0
maxsd  %xmm1,%xmm0
movsd  0xa0(%r15,%rbx,8),%xmm1
maxsd  %xmm0,%xmm1
movsd  0xc8(%r15,%rbx,8),%xmm0
maxsd  %xmm1,%xmm0
movsd  0xf0(%r15,%rbx,8),%xmm1
maxsd  %xmm0,%xmm1
movsd  0x118(%r15,%rbx,8),%xmm0
maxsd  %xmm1,%xmm0
movsd  0x140(%r15,%rbx,8),%xmm1
maxsd  %xmm0,%xmm1
movsd  0x168(%r15,%rbx,8),%xmm2
maxsd  %xmm1,%xmm2
movsd  0x190(%r15,%rbx,8),%xmm0
maxsd  %xmm2,%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
inc    %rbx
jne    1130 <top+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%.2lf \00"
define void @top([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 = %42, %2
%9 = load i32, i32* %5
%10 = icmp slt i32 %9, 5
br i1 %10, label %11, label %45
11: ; preds = %8
store i32 0, i32* %6
br label %12
12: ; preds = %36, %11
%13 = load i32, i32* %6
%14 = icmp slt i32 %13, 10
br i1 %14, label %15, label %39
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 = fcmp ogt double %23, %24
br i1 %25, label %26, label %35
26: ; preds = %15
%27 = load [5 x double]*, [5 x double]** %3
%28 = load i32, i32* %6
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [5 x double], [5 x double]* %27, i64 %29
%31 = load i32, i32* %5
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [5 x double], [5 x double]* %30, i64 0, i64 %32
%34 = load double, double* %33
store double %34, double* %7
br label %35
35: ; preds = %26, %15
br label %36
36: ; preds = %35
%37 = load i32, i32* %6
%38 = add nsw i32 %37, 1
store i32 %38, i32* %6
br label %12
39: ; preds = %12
%40 = load double, double* %7
%41 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %40)
store double 0.000000e+00, double* %7
br label %42
42: ; preds = %39
%43 = load i32, i32* %5
%44 = add nsw i32 %43, 1
store i32 %44, i32* %5
br label %8
45: ; preds = %8
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%.2lf \00"
define void @top([5 x double]* nocapture %0, i32 %1) {
br label %3
3: ; preds = %2, %3
%4 = phi i64 [ 0, %2 ], [ %46, %3 ]
%5 = getelementptr inbounds [5 x double], [5 x double]* %0, i64 0, i64 %4
%6 = load double, double* %5
%7 = fcmp ogt double %6, 0.000000e+00
%8 = select i1 %7, double %6, double 0.000000e+00
%9 = getelementptr inbounds [5 x double], [5 x double]* %0, i64 1, i64 %4
%10 = load double, double* %9
%11 = fcmp ogt double %10, %8
%12 = select i1 %11, double %10, double %8
%13 = getelementptr inbounds [5 x double], [5 x double]* %0, i64 2, i64 %4
%14 = load double, double* %13
%15 = fcmp ogt double %14, %12
%16 = select i1 %15, double %14, double %12
%17 = getelementptr inbounds [5 x double], [5 x double]* %0, i64 3, i64 %4
%18 = load double, double* %17
%19 = fcmp ogt double %18, %16
%20 = select i1 %19, double %18, double %16
%21 = getelementptr inbounds [5 x double], [5 x double]* %0, i64 4, i64 %4
%22 = load double, double* %21
%23 = fcmp ogt double %22, %20
%24 = select i1 %23, double %22, double %20
%25 = getelementptr inbounds [5 x double], [5 x double]* %0, i64 5, i64 %4
%26 = load double, double* %25
%27 = fcmp ogt double %26, %24
%28 = select i1 %27, double %26, double %24
%29 = getelementptr inbounds [5 x double], [5 x double]* %0, i64 6, i64 %4
%30 = load double, double* %29
%31 = fcmp ogt double %30, %28
%32 = select i1 %31, double %30, double %28
%33 = getelementptr inbounds [5 x double], [5 x double]* %0, i64 7, i64 %4
%34 = load double, double* %33
%35 = fcmp ogt double %34, %32
%36 = select i1 %35, double %34, double %32
%37 = getelementptr inbounds [5 x double], [5 x double]* %0, i64 8, i64 %4
%38 = load double, double* %37
%39 = fcmp ogt double %38, %36
%40 = select i1 %39, double %38, double %36
%41 = getelementptr inbounds [5 x double], [5 x double]* %0, i64 9, i64 %4
%42 = load double, double* %41
%43 = fcmp ogt double %42, %40
%44 = select i1 %43, double %42, double %40
%45 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %44)
%46 = add nuw nsw i64 %4, 1
%47 = icmp eq i64 %46, 5
br i1 %47, label %48, label %3
48: ; preds = %3
ret void
}