#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(double **m, int n) {
  int i, j;
  for (i = 0; i < n; i++)
    for (j = 0; j <= i; j++) {
      if ((i * n + j) % 20 == 0)
        printf("\n");
      printf("%.2f ", 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    11b2 <printMatrix+0xa2>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     119f <printMatrix+0x8f>
mov    -0x10(%rbp),%eax
imul   -0xc(%rbp),%eax
add    -0x14(%rbp),%eax
mov    $0x14,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    116e <printMatrix+0x5e>
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe78(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1139 <printMatrix+0x29>
jmp    11a4 <printMatrix+0x94>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <printMatrix+0x16>
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printMatrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    11b2 <printMatrix+0x92>
mov    %rdi,%r12
mov    %esi,%eax
mov    %rax,(%rsp)
mov    $0x1,%r13d
xor    %ebx,%ebx
lea    0xeb5(%rip),%r14
xor    %ebp,%ebp
jmp    1164 <printMatrix+0x44>
nop
add    $0x1,%rbp
add    $0x1,%r13
mov    (%rsp),%rax
add    %rax,%rbx
cmp    %rax,%rbp
je     11b2 <printMatrix+0x92>
xor    %r15d,%r15d
jmp    118d <printMatrix+0x6d>
nopl   0x0(%rax)
mov    (%r12,%rbp,8),%rax
movsd  (%rax,%r15,8),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%r15
cmp    %r15,%r13
je     1150 <printMatrix+0x30>
lea    (%rbx,%r15,1),%eax
imul   $0xcccccccd,%eax,%eax
add    $0x19999998,%eax
ror    $0x2,%eax
cmp    $0xccccccc,%eax
ja     1170 <printMatrix+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1170 <printMatrix+0x50>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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

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