#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 *, double, double, double);
void printMatrix(double *matrix) {
  for (int i = 0; i < 9; i += 3)
    printf("[ %.4f, %.4f, %.4f ]\n", matrix[i], matrix[i + 1], matrix[i + 2]);
}


x86 assembly (clang, -O0):
<printMatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x9,-0xc(%rbp)
jge    1178 <printMatrix+0x68>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <printMatrix+0x13>
add    $0x10,%rsp
pop    %rbp
ret

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

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

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