#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 printarray(size_t n, double a[(n)][(n)]) {
  size_t i, j;
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      printf("%5.1f ", a[i][j]);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<printarray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    11af <printarray+0x9f>
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    1190 <printarray+0x80>
mov    -0x28(%rbp),%rcx
mov    -0x10(%rbp),%rax
imul   -0x18(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe88(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1146 <printarray+0x36>
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1130 <printarray+0x20>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printarray>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %rdi,%rdi
je     118e <printarray+0x6e>
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0x0(,%rdi,8),%r12
xor    %r13d,%r13d
lea    0xeb8(%rip),%r15
nopl   0x0(%rax,%rax,1)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%rbx,%rbp,8),%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r14
jne    1160 <printarray+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r13
add    %r12,%rbx
cmp    %r14,%r13
jne    1150 <printarray+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"%5.1f \00"
define void @printarray(i64 %0, double* nocapture %1) {
%3 = icmp eq i64 %0, 0
br i1 %3, label %19, label %4
4: ; preds = %2, %15
%5 = phi i64 [ %17, %15 ], [ 0, %2 ]
%6 = mul nsw i64 %5, %0
%7 = getelementptr inbounds double, double* %1, i64 %6
br label %8
8: ; preds = %4, %8
%9 = phi i64 [ 0, %4 ], [ %13, %8 ]
%10 = getelementptr inbounds double, double* %7, i64 %9
%11 = load double, double* %10
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %11)
%13 = add nuw i64 %9, 1
%14 = icmp eq i64 %13, %0
br i1 %14, label %15, label %8
15: ; preds = %8
%16 = tail call i32 @putchar(i32 10)
%17 = add nuw i64 %5, 1
%18 = icmp eq i64 %17, %0
br i1 %18, label %19, label %4
19: ; preds = %15, %2
ret void
}