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


x86 assembly (clang, -O0):
<dary2d_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    11a3 <dary2d_print+0x93>
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1184 <dary2d_print+0x74>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe94(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1142 <dary2d_print+0x32>
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    112c <dary2d_print+0x1c>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dary2d_print>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %rsi,%rsi
je     118e <dary2d_print+0x6e>
mov    %rdx,%r13
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
lea    0xebe(%rip),%r12
jmp    1163 <dary2d_print+0x43>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %r14,%rbx
je     118e <dary2d_print+0x6e>
test   %r13,%r13
je     1150 <dary2d_print+0x30>
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    (%r15,%rbx,8),%rax
movsd  (%rax,%rbp,8),%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r13
jne    1170 <dary2d_print+0x50>
jmp    1150 <dary2d_print+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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