#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 *, int, ...);
void mdisplay(double *A, int row, int col) {
  int i, j;
  printf("\n MATRIX Order : %d X %d \n \n", row, col);
  for (i = 0; i < row; i++) {
    printf("R%d: ", i);
    for (j = 0; j < col; j++) {
      printf("%g ", A[i * col + j]);
    }
    printf(":R%d \n", i);
  }
}


x86 assembly (clang, -O0):
<mdisplay>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11be <mdisplay+0xae>
mov    -0x14(%rbp),%esi
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    119f <mdisplay+0x8f>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
imul   -0x10(%rbp),%ecx
add    -0x18(%rbp),%ecx
movslq %ecx,%rcx
cvttsd2si (%rax,%rcx,8),%esi
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1161 <mdisplay+0x51>
mov    -0x14(%rbp),%esi
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113d <mdisplay+0x2d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mdisplay>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xed6(%rip),%rdi
mov    %edx,0xc(%rsp)
xor    %eax,%eax
call   1030 <printf@plt>
test   %ebp,%ebp
jle    11bb <mdisplay+0xab>
mov    0xc(%rsp),%eax
movslq %eax,%r14
mov    %ebp,%ecx
mov    %rcx,0x10(%rsp)
mov    %eax,%r15d
shl    $0x3,%r14
lea    0xeca(%rip),%rbp
xor    %r13d,%r13d
jmp    117f <mdisplay+0x6f>
xchg   %ax,%ax
lea    0xec0(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%r13
add    %r14,%rbx
cmp    0x10(%rsp),%r13
je     11bb <mdisplay+0xab>
lea    0xe97(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1160 <mdisplay+0x50>
xor    %r12d,%r12d
nopw   0x0(%rax,%rax,1)
cvttsd2si (%rbx,%r12,8),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%r12
cmp    %r12,%r15
jne    11a0 <mdisplay+0x90>
jmp    1160 <mdisplay+0x50>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [29 x i8] c"\0A MATRIX Order : %d X %d \0A \0A\00"
@.str.1 = [6 x i8] c"R%d: \00"
@.str.2 = [4 x i8] c"%g \00"
@.str.3 = [7 x i8] c":R%d \0A\00"
define void @mdisplay(double* nocapture %0, i32 %1, i32 %2) {
%4 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %30
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, %26
%12 = phi i64 [ 0, %6 ], [ %28, %26 ]
%13 = trunc i64 %12 to i32
%14 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %13)
br i1 %7, label %15, label %26
15: ; preds = %11
%16 = mul nsw i64 %12, %8
br label %17
17: ; preds = %15, %17
%18 = phi i64 [ 0, %15 ], [ %24, %17 ]
%19 = add nsw i64 %18, %16
%20 = getelementptr inbounds double, double* %0, i64 %19
%21 = load double, double* %20
%22 = fptosi double %21 to i32
%23 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %22)
%24 = add nuw nsw i64 %18, 1
%25 = icmp eq i64 %24, %10
br i1 %25, label %26, label %17
26: ; preds = %17, %11
%27 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %13)
%28 = add nuw nsw i64 %12, 1
%29 = icmp eq i64 %28, %9
br i1 %29, label %30, label %11
30: ; preds = %26, %3
ret void
}