#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 */
struct mat3 {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_mat3(struct mat3 *mat) {
  float *arr;
  arr = (float *)mat;
  unsigned i;
  for (i = 0; i < 3; i++)
    printf("%f %f %f\n", arr[0 + i * 3], arr[1 + i * 3], arr[2 + i * 3]);
  printf("\n");
}


x86 assembly (clang, -O0):
<print_mat3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jae    1193 <print_mat3+0x83>
mov    -0x10(%rbp),%rax
imul   $0x3,-0x14(%rbp),%ecx
add    $0x0,%ecx
mov    %ecx,%ecx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x10(%rbp),%rax
imul   $0x3,-0x14(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,%ecx
movss  (%rax,%rcx,4),%xmm1
cvtss2sd %xmm1,%xmm1
mov    -0x10(%rbp),%rax
imul   $0x3,-0x14(%rbp),%ecx
add    $0x2,%ecx
mov    %ecx,%ecx
movss  (%rax,%rcx,4),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xe82(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112b <print_mat3+0x1b>
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_mat3>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
movss  (%rdi),%xmm0
movss  0x4(%rdi),%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
movss  0x8(%rdi),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xeb8(%rip),%r14
mov    %r14,%rdi
mov    $0x3,%al
call   1040 <printf@plt>
movss  0xc(%rbx),%xmm0
movss  0x10(%rbx),%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
movss  0x14(%rbx),%xmm2
cvtss2sd %xmm2,%xmm2
mov    %r14,%rdi
mov    $0x3,%al
call   1040 <printf@plt>
movss  0x18(%rbx),%xmm0
movss  0x1c(%rbx),%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
movss  0x20(%rbx),%xmm2
cvtss2sd %xmm2,%xmm2
mov    %r14,%rdi
mov    $0x3,%al
call   1040 <printf@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
%struct.mat3 = type { i32 }
@.str = [10 x i8] c"%f %f %f\0A\00"
define void @print_mat3(%struct.mat3* nocapture %0) {
%2 = bitcast %struct.mat3* %0 to float*
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = getelementptr inbounds %struct.mat3, %struct.mat3* %0, i64 1
%6 = bitcast %struct.mat3* %5 to float*
%7 = load float, float* %6
%8 = fpext float %7 to double
%9 = getelementptr inbounds %struct.mat3, %struct.mat3* %0, i64 2
%10 = bitcast %struct.mat3* %9 to float*
%11 = load float, float* %10
%12 = fpext float %11 to double
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double %4, double %8, double %12)
%14 = getelementptr inbounds %struct.mat3, %struct.mat3* %0, i64 3
%15 = bitcast %struct.mat3* %14 to float*
%16 = load float, float* %15
%17 = fpext float %16 to double
%18 = getelementptr inbounds %struct.mat3, %struct.mat3* %0, i64 4
%19 = bitcast %struct.mat3* %18 to float*
%20 = load float, float* %19
%21 = fpext float %20 to double
%22 = getelementptr inbounds %struct.mat3, %struct.mat3* %0, i64 5
%23 = bitcast %struct.mat3* %22 to float*
%24 = load float, float* %23
%25 = fpext float %24 to double
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double %17, double %21, double %25)
%27 = getelementptr inbounds %struct.mat3, %struct.mat3* %0, i64 6
%28 = bitcast %struct.mat3* %27 to float*
%29 = load float, float* %28
%30 = fpext float %29 to double
%31 = getelementptr inbounds %struct.mat3, %struct.mat3* %0, i64 7
%32 = bitcast %struct.mat3* %31 to float*
%33 = load float, float* %32
%34 = fpext float %33 to double
%35 = getelementptr inbounds %struct.mat3, %struct.mat3* %0, i64 8
%36 = bitcast %struct.mat3* %35 to float*
%37 = load float, float* %36
%38 = fpext float %37 to double
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double %30, double %34, double %38)
%40 = tail call i32 @putchar(i32 10)
ret void
}