#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 print_double_mat(double **mat, int dim1, int dim2) {
  int i, j;
  printf("\n");
  for (i = 0; i < dim1; i++) {
    printf("#%d\t", i);
    for (j = 0; j < dim2; j++) {
      printf("%.2e ", mat[i][j]);
    }
    printf("\n");
  }
  printf("\n");
  return;
}


x86 assembly (clang, -O0):
<print_double_mat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11b4 <print_double_mat+0xa4>
mov    -0x14(%rbp),%esi
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1198 <print_double_mat+0x88>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe84(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    115b <print_double_mat+0x4b>
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1137 <print_double_mat+0x27>
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_double_mat>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,0x4(%rsp)
mov    %esi,%ebp
mov    %rdi,%rbx
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %ebp,%ebp
jle    11af <print_double_mat+0x8f>
mov    %ebp,%r13d
mov    0x4(%rsp),%r14d
lea    0xeb4(%rip),%r12
xor    %ebp,%ebp
jmp    1173 <print_double_mat+0x53>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
cmp    %r13,%rbp
je     11af <print_double_mat+0x8f>
lea    0xe86(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x0,0x4(%rsp)
jle    1160 <print_double_mat+0x40>
xor    %r15d,%r15d
nopl   (%rax)
mov    (%rbx,%rbp,8),%rax
movsd  (%rax,%r15,8),%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%r15
cmp    %r15,%r14
jne    1190 <print_double_mat+0x70>
jmp    1160 <print_double_mat+0x40>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [5 x i8] c"#%d\09\00"
@.str.2 = [6 x i8] c"%.2e \00"
define void @print_double_mat(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
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %7
br label %10
10: ; preds = %37, %3
%11 = load i32, i32* %7
%12 = load i32, i32* %5
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %40
14: ; preds = %10
%15 = load i32, i32* %7
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %15)
store i32 0, i32* %8
br label %17
17: ; preds = %32, %14
%18 = load i32, i32* %8
%19 = load i32, i32* %6
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %35
21: ; preds = %17
%22 = load double**, double*** %4
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds double*, double** %22, i64 %24
%26 = load double*, double** %25
%27 = load i32, i32* %8
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds double, double* %26, i64 %28
%30 = load double, double* %29
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %30)
br label %32
32: ; preds = %21
%33 = load i32, i32* %8
%34 = add nsw i32 %33, 1
store i32 %34, i32* %8
br label %17
35: ; preds = %17
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %37
37: ; preds = %35
%38 = load i32, i32* %7
%39 = add nsw i32 %38, 1
store i32 %39, i32* %7
br label %10
40: ; preds = %10
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}

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