#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 printMatrix(int **m, int length) {
  int i, j;
  for (i = 0; i < length; i++) {
    for (j = 0; j < length; j++) {
      printf(" %3.0f ", (float)m[i][j]);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<printMatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1196 <printMatrix+0x86>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    117a <printMatrix+0x6a>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x14(%rbp),%rcx
cvtsi2ssl (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe9b(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1139 <printMatrix+0x29>
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <printMatrix+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printMatrix>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %esi,%esi
jle    1186 <printMatrix+0x66>
mov    %rdi,%r15
mov    %esi,%r12d
xor    %r13d,%r13d
lea    0xec3(%rip),%r14
nopl   (%rax)
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r15,%r13,8),%rax
xorps  %xmm0,%xmm0
cvtsi2ssl (%rax,%rbx,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1150 <printMatrix+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r13
cmp    %r12,%r13
jne    1140 <printMatrix+0x20>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

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