#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*/ print_vec(int, double *);
int /*<<< orphan*/ printf(char *);
void print_sq_mat(int n, double **A) {
  printf("[");
  if (n > 0)
    print_vec(n, A[0]);
  int row;
  for (row = 1; row < n; row++) {
    printf(",\n");
    print_vec(n, A[row]);
  }
  printf("]");
}


x86 assembly (clang, -O0):
<print_sq_mat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x0,-0x4(%rbp)
jle    1154 <print_sq_mat+0x34>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
call   1040 <print_vec@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1195 <print_sq_mat+0x75>
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1040 <print_vec@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115b <print_sq_mat+0x3b>
lea    0xe69(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_sq_mat>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r15
mov    %edi,%r12d
mov    $0x5b,%edi
call   1030 <putchar@plt>
test   %r12d,%r12d
jle    118d <print_sq_mat+0x5d>
mov    (%r15),%rsi
mov    %r12d,%edi
call   1050 <print_vec@plt>
cmp    $0x1,%r12d
je     118d <print_sq_mat+0x5d>
mov    %r12d,%ebx
mov    $0x1,%ebp
lea    0xe93(%rip),%r14
nopl   (%rax)
mov    %r14,%rdi
call   1040 <puts@plt>
mov    (%r15,%rbp,8),%rsi
mov    %r12d,%edi
call   1050 <print_vec@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1170 <print_sq_mat+0x40>
mov    $0x5d,%edi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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

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