#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 *, ...);
printMatrix(int size, double *data, char *name) {
  int i, j;
  printf("%s[%d, %d]:\n", name, size, size);
  for (i = 0; i < size; i++) {
    for (j = 0; j < size; j++) {
      printf("\t%.3f", data[i * size + j]);
    }
    printf("\n");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<printMatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x8(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11af <printMatrix+0x9f>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1193 <printMatrix+0x83>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x20(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe8f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1155 <printMatrix+0x45>
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1142 <printMatrix+0x32>
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
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
mov    %rsi,%r13
mov    %edi,%ebp
lea    0xec9(%rip),%rdi
mov    %rdx,%rsi
mov    %ebp,%edx
mov    %ebp,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebp,%ebp
jle    11a0 <printMatrix+0x80>
mov    %ebp,%ebp
lea    0x0(,%rbp,8),%r15
xor    %r12d,%r12d
lea    0xeb0(%rip),%r14
nopl   (%rax)
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  0x0(%r13,%rbx,8),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1170 <printMatrix+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r12
add    %r15,%r13
cmp    %rbp,%r12
jne    1160 <printMatrix+0x40>
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 = [13 x i8] c"%s[%d, %d]:\0A\00"
@.str.1 = [6 x i8] c"\09%.3f\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @printMatrix(i32 %0, double* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca double*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %5
store double* %1, double** %6
store i8* %2, i8** %7
%10 = load i8*, i8** %7
%11 = load i32, i32* %5
%12 = load i32, i32* %5
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %10, i32 %11, i32 %12)
store i32 0, i32* %8
br label %14
14: ; preds = %39, %3
%15 = load i32, i32* %8
%16 = load i32, i32* %5
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %42
18: ; preds = %14
store i32 0, i32* %9
br label %19
19: ; preds = %34, %18
%20 = load i32, i32* %9
%21 = load i32, i32* %5
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %37
23: ; preds = %19
%24 = load double*, double** %6
%25 = load i32, i32* %8
%26 = load i32, i32* %5
%27 = mul nsw i32 %25, %26
%28 = load i32, i32* %9
%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 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %32)
br label %34
34: ; preds = %23
%35 = load i32, i32* %9
%36 = add nsw i32 %35, 1
store i32 %36, i32* %9
br label %19
37: ; preds = %19
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %39
39: ; preds = %37
%40 = load i32, i32* %8
%41 = add nsw i32 %40, 1
store i32 %41, i32* %8
br label %14
42: ; preds = %14
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%44 = load i32, i32* %4
ret i32 %44
}

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