#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);
void mat22Print(double m[2][2]) {
  for (int i = 0; i < 2; i++) {
    printf("%f  %f\n", m[i][0], m[i][1]);
  }
}


x86 assembly (clang, -O0):
<mat22Print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jge    116e <mat22Print+0x5e>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movsd  0x8(%rax),%xmm1
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <mat22Print+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mat22Print>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
movsd  (%rdi),%xmm0
movsd  0x8(%rdi),%xmm1
lea    0xed9(%rip),%r14
mov    %r14,%rdi
call   1030 <printf@plt>
movsd  0x10(%rbx),%xmm0
movsd  0x18(%rbx),%xmm1
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [8 x i8] c"%f %f\0A\00"
define void @mat22Print([2 x double]* nocapture %0) {
%2 = getelementptr inbounds [2 x double], [2 x double]* %0, i64 0, i64 0
%3 = load double, double* %2
%4 = getelementptr inbounds [2 x double], [2 x double]* %0, i64 0, i64 1
%5 = load double, double* %4
%6 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), double %3, double %5)
%7 = getelementptr inbounds [2 x double], [2 x double]* %0, i64 1, i64 0
%8 = load double, double* %7
%9 = getelementptr inbounds [2 x double], [2 x double]* %0, i64 1, i64 1
%10 = load double, double* %9
%11 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), double %8, double %10)
ret void
}