#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 LD, float M[][LD], int N) {
  int i, j;
  for (i = 0; i < N; i++) {
    for (j = 0; j < N; j++) {
      printf("[%2.1f] ", M[i][j]);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<printMatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11ab <printMatrix+0x9b>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    118f <printMatrix+0x7f>
mov    -0x28(%rbp),%rdx
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
imul   %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x1c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe86(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1143 <printMatrix+0x33>
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1130 <printMatrix+0x20>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printMatrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edx,%edx
jle    1192 <printMatrix+0x72>
mov    %rsi,%rbx
mov    %edi,%r15d
mov    %edx,%r12d
shl    $0x2,%r15
xor    %r13d,%r13d
lea    0xeba(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movss  (%rbx,%rbp,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r12
jne    1160 <printMatrix+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r13
add    %r15,%rbx
cmp    %r12,%r13
jne    1150 <printMatrix+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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