#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 print(double **a, int sizei, int sizej) {
  for (int j = 0; j < sizej; j++) {
    printf("%d[", j);
    for (int i = 0; i < sizei - 1; i++)
      printf("%lf,", a[j][i]);
    printf("%lf]\n", a[j][sizei - 1]);
  }
}


x86 assembly (clang, -O0):
<print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11c1 <print+0xb1>
cvtsi2sdl -0x14(%rbp),%xmm0
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    118d <print+0x7d>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114d <print+0x3d>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe5b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1129 <print+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,0x8(%rsp)
test   %edx,%edx
jle    11bd <print+0xad>
mov    %rdi,%rbx
mov    0x8(%rsp),%rax
lea    -0x1(%rax),%ebp
movslq %ebp,%rax
mov    %rax,0x10(%rsp)
mov    %edx,%r13d
xor    %r14d,%r14d
lea    0xeb9(%rip),%r12
jmp    1173 <print+0x63>
nopl   (%rax)
mov    (%rbx,%r14,8),%rax
mov    0x10(%rsp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
add    $0x1,%r14
cmp    %r13,%r14
je     11bd <print+0xad>
xorps  %xmm0,%xmm0
cvtsi2sd %r14d,%xmm0
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x2,0x8(%rsp)
jl     1150 <print+0x40>
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%rbx,%r14,8),%rax
movsd  (%rax,%r15,8),%xmm0
mov    %r12,%rdi
call   1030 <printf@plt>
add    $0x1,%r15
cmp    %r15,%rbp
jne    11a0 <print+0x90>
jmp    1150 <print+0x40>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d[\00"
@.str.1 = [5 x i8] c"%lf,\00"
@.str.2 = [6 x i8] c"%lf]\0A\00"
define void @print(double** %0, i32 %1, i32 %2) {
%4 = alloca double**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store double** %0, double*** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %9
9: ; preds = %48, %3
%10 = load i32, i32* %7
%11 = load i32, i32* %6
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %51
13: ; preds = %9
%14 = load i32, i32* %7
%15 = sitofp i32 %14 to double
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %15)
store i32 0, i32* %8
br label %17
17: ; preds = %33, %13
%18 = load i32, i32* %8
%19 = load i32, i32* %5
%20 = sub nsw i32 %19, 1
%21 = icmp slt i32 %18, %20
br i1 %21, label %22, label %36
22: ; preds = %17
%23 = load double**, double*** %4
%24 = load i32, i32* %7
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds double*, double** %23, i64 %25
%27 = load double*, double** %26
%28 = load i32, i32* %8
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds double, double* %27, i64 %29
%31 = load double, double* %30
%32 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double %31)
br label %33
33: ; preds = %22
%34 = load i32, i32* %8
%35 = add nsw i32 %34, 1
store i32 %35, i32* %8
br label %17
36: ; preds = %17
%37 = load double**, double*** %4
%38 = load i32, i32* %7
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds double*, double** %37, i64 %39
%41 = load double*, double** %40
%42 = load i32, i32* %5
%43 = sub nsw i32 %42, 1
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds double, double* %41, i64 %44
%46 = load double, double* %45
%47 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %46)
br label %48
48: ; preds = %36
%49 = load i32, i32* %7
%50 = add nsw i32 %49, 1
store i32 %50, i32* %7
br label %9
51: ; preds = %9
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d[\00"
@.str.1 = [5 x i8] c"%lf,\00"
@.str.2 = [6 x i8] c"%lf]\0A\00"
define void @print(double** nocapture %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %11
5: ; preds = %3
%6 = add i32 %1, -1
%7 = icmp sgt i32 %1, 1
%8 = sext i32 %6 to i64
%9 = zext i32 %2 to i64
%10 = zext i32 %6 to i64
br label %12
11: ; preds = %19, %3
ret void
12: ; preds = %5, %19
%13 = phi i64 [ 0, %5 ], [ %25, %19 ]
%14 = trunc i64 %13 to i32
%15 = sitofp i32 %14 to double
%16 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %15)
br i1 %7, label %17, label %19
17: ; preds = %12
%18 = getelementptr inbounds double*, double** %0, i64 %13
br label %27
19: ; preds = %27, %12
%20 = getelementptr inbounds double*, double** %0, i64 %13
%21 = load double*, double** %20
%22 = getelementptr inbounds double, double* %21, i64 %8
%23 = load double, double* %22
%24 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %23)
%25 = add nuw nsw i64 %13, 1
%26 = icmp eq i64 %25, %9
br i1 %26, label %11, label %12
27: ; preds = %17, %27
%28 = phi i64 [ 0, %17 ], [ %33, %27 ]
%29 = load double*, double** %18
%30 = getelementptr inbounds double, double* %29, i64 %28
%31 = load double, double* %30
%32 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double %31)
%33 = add nuw nsw i64 %28, 1
%34 = icmp eq i64 %33, %10
br i1 %34, label %19, label %27
}