#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*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stdout;
void DisplayMatrix(char *name, float **matrix, int num_rows, int num_cols) {
  int nrow, ncol;
  fprintf(stdout, "\n%s Matrix: %d rows X %d columns\n", name, num_rows,
          num_cols);
  for (nrow = 0; nrow < num_rows; nrow++) {
    for (ncol = 0; ncol < num_cols; ncol++)
      fprintf(stdout, "%.1e ", matrix[nrow][ncol]);
    fprintf(stdout, "\n");
  }
  fprintf(stdout, "\n");
}


x86 assembly (clang, -O0):
<DisplayMatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    0x2eb3(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
lea    0xebf(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11d1 <DisplayMatrix+0xc1>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11ac <DisplayMatrix+0x9c>
mov    0x2e6b(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe8b(%rip),%rsi
mov    $0x1,%al
call   1030 <fprintf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1162 <DisplayMatrix+0x52>
mov    0x2e2d(%rip),%rax
mov    (%rax),%edi
lea    0xe64(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114f <DisplayMatrix+0x3f>
mov    0x2e08(%rip),%rax
mov    (%rax),%edi
lea    0xe3f(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DisplayMatrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %ecx,%r8d
mov    %edx,%ebp
mov    %rsi,%rbx
mov    %rdi,%rdx
mov    0x2eb0(%rip),%r12
mov    (%r12),%edi
lea    0xec5(%rip),%rsi
mov    %ebp,%ecx
mov    %r8d,0xc(%rsp)
xor    %eax,%eax
call   1030 <fprintf@plt>
test   %ebp,%ebp
jle    11c7 <DisplayMatrix+0xb7>
mov    %ebp,%eax
mov    %rax,0x10(%rsp)
mov    0xc(%rsp),%r15d
lea    0xec2(%rip),%rbp
xor    %r14d,%r14d
jmp    118d <DisplayMatrix+0x7d>
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r12),%edi
lea    0xea5(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
add    $0x1,%r14
cmp    0x10(%rsp),%r14
je     11c7 <DisplayMatrix+0xb7>
cmpl   $0x0,0xc(%rsp)
jle    1170 <DisplayMatrix+0x60>
xor    %r13d,%r13d
nopw   0x0(%rax,%rax,1)
mov    (%r12),%edi
mov    (%rbx,%r14,8),%rax
movss  (%rax,%r13,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbp,%rsi
mov    $0x1,%al
call   1030 <fprintf@plt>
add    $0x1,%r13
cmp    %r13,%r15
jne    11a0 <DisplayMatrix+0x90>
jmp    1170 <DisplayMatrix+0x60>
mov    (%r12),%edi
lea    0xe4e(%rip),%rsi
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fprintf@plt>

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

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