#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 MtrxPrnt(double *pM1, int m, int n) {
  printf("\n\nMatrix Print:\n");
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < n; j++) {
      printf("\t%lf", *(pM1 + i * n + j));
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<MtrxPrnt>:
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    11ac <MtrxPrnt+0x9c>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1190 <MtrxPrnt+0x80>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
imul   -0x10(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe96(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114a <MtrxPrnt+0x3a>
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1137 <MtrxPrnt+0x27>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MtrxPrnt>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edx,0xc(%rsp)
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xeb7(%rip),%rdi
call   1040 <puts@plt>
test   %ebp,%ebp
jle    11cb <MtrxPrnt+0x9b>
movslq 0xc(%rsp),%r15
mov    %ebp,%eax
mov    %rax,0x10(%rsp)
mov    %r15d,%ebp
shl    $0x3,%r15
xor    %r14d,%r14d
lea    0xe8c(%rip),%r13
jmp    1198 <MtrxPrnt+0x68>
cs nopw 0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r14
add    %r15,%rbx
cmp    0x10(%rsp),%r14
je     11cb <MtrxPrnt+0x9b>
cmpl   $0x0,0xc(%rsp)
jle    1180 <MtrxPrnt+0x50>
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%rbx,%r12,8),%xmm0
mov    %r13,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%r12
cmp    %r12,%rbp
jne    11b0 <MtrxPrnt+0x80>
jmp    1180 <MtrxPrnt+0x50>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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