#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 print_matrix(double m[3][3], char *title) {
  int i = 0;
  printf("%s\n", title);
  for (; i < 3; ++i) {
    printf("%7.3f %7.3f %7.3f\n\n", m[i][0], m[i][1], m[i][2]);
  }
}


x86 assembly (clang, -O0):
<print_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x3,-0x14(%rbp)
jge    119a <print_matrix+0x8a>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x8(%rax),%xmm1
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x10(%rax),%xmm2
lea    0xe7f(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1139 <print_matrix+0x29>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_matrix>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1030 <puts@plt>
movsd  (%rbx),%xmm0
movsd  0x8(%rbx),%xmm1
movsd  0x10(%rbx),%xmm2
lea    0xebc(%rip),%r14
mov    %r14,%rdi
mov    $0x3,%al
call   1040 <printf@plt>
movsd  0x18(%rbx),%xmm0
movsd  0x20(%rbx),%xmm1
movsd  0x28(%rbx),%xmm2
mov    %r14,%rdi
mov    $0x3,%al
call   1040 <printf@plt>
movsd  0x30(%rbx),%xmm0
movsd  0x38(%rbx),%xmm1
movsd  0x40(%rbx),%xmm2
mov    %r14,%rdi
mov    $0x3,%al
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <printf@plt>

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

LLVM IR (-O2):
@.str.1 = [20 x i8] c"%7.3f %7.3f %7.3f\0A\0A\00"
define void @print_matrix([3 x double]* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) %1)
%4 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 0
%5 = load double, double* %4
%6 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 1
%7 = load double, double* %6
%8 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 2
%9 = load double, double* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), double %5, double %7, double %9)
%11 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 0
%12 = load double, double* %11
%13 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 1
%14 = load double, double* %13
%15 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 2
%16 = load double, double* %15
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), double %12, double %14, double %16)
%18 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 0
%19 = load double, double* %18
%20 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 1
%21 = load double, double* %20
%22 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 2
%23 = load double, double* %22
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), double %19, double %21, double %23)
ret void
}