#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 mat4 {
  int dummy;
};

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


x86 assembly (clang, -O0):
<print_mat4>:
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   $0x4,-0x14(%rbp)
jae    11b1 <print_mat4+0xa1>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
shl    $0x2,%ecx
add    $0x0,%ecx
mov    %ecx,%ecx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
shl    $0x2,%ecx
add    $0x1,%ecx
mov    %ecx,%ecx
movss  (%rax,%rcx,4),%xmm1
cvtss2sd %xmm1,%xmm1
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
shl    $0x2,%ecx
add    $0x2,%ecx
mov    %ecx,%ecx
movss  (%rax,%rcx,4),%xmm2
cvtss2sd %xmm2,%xmm2
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
mov    %ecx,%ecx
movss  (%rax,%rcx,4),%xmm3
cvtss2sd %xmm3,%xmm3
lea    0xe64(%rip),%rdi
mov    $0x4,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112b <print_mat4+0x1b>
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_mat4>:
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
movss  0xc(%rdi),%xmm3
cvtss2sd %xmm3,%xmm3
lea    0xeaf(%rip),%r14
mov    %r14,%rdi
mov    $0x4,%al
call   1040 <printf@plt>
movss  0x10(%rbx),%xmm0
movss  0x14(%rbx),%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
movss  0x18(%rbx),%xmm2
cvtss2sd %xmm2,%xmm2
movss  0x1c(%rbx),%xmm3
cvtss2sd %xmm3,%xmm3
mov    %r14,%rdi
mov    $0x4,%al
call   1040 <printf@plt>
movss  0x20(%rbx),%xmm0
movss  0x24(%rbx),%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
movss  0x28(%rbx),%xmm2
cvtss2sd %xmm2,%xmm2
movss  0x2c(%rbx),%xmm3
cvtss2sd %xmm3,%xmm3
mov    %r14,%rdi
mov    $0x4,%al
call   1040 <printf@plt>
movss  0x30(%rbx),%xmm0
movss  0x34(%rbx),%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
movss  0x38(%rbx),%xmm2
cvtss2sd %xmm2,%xmm2
movss  0x3c(%rbx),%xmm3
cvtss2sd %xmm3,%xmm3
mov    %r14,%rdi
mov    $0x4,%al
call   1040 <printf@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putchar@plt>

LLVM IR (-O0):
%struct.mat4 = type { i32 }
@.str = [13 x i8] c"%f %f %f %f\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @print_mat4(%struct.mat4* %0) {
%2 = alloca %struct.mat4*
%3 = alloca float*
%4 = alloca i32
store %struct.mat4* %0, %struct.mat4** %2
%5 = load %struct.mat4*, %struct.mat4** %2
%6 = bitcast %struct.mat4* %5 to float*
store float* %6, float** %3
store i32 0, i32* %4
br label %7
7: ; preds = %44, %1
%8 = load i32, i32* %4
%9 = icmp ult i32 %8, 4
br i1 %9, label %10, label %47
10: ; preds = %7
%11 = load float*, float** %3
%12 = load i32, i32* %4
%13 = mul i32 %12, 4
%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, 4
%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, 4
%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 = load float*, float** %3
%36 = load i32, i32* %4
%37 = mul i32 %36, 4
%38 = add i32 3, %37
%39 = zext i32 %38 to i64
%40 = getelementptr inbounds float, float* %35, i64 %39
%41 = load float, float* %40
%42 = fpext float %41 to double
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), double %18, double %26, double %34, double %42)
br label %44
44: ; preds = %10
%45 = load i32, i32* %4
%46 = add i32 %45, 1
store i32 %46, i32* %4
br label %7
47: ; preds = %7
%48 = 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.mat4 = type { i32 }
@.str = [13 x i8] c"%f %f %f %f\0A\00"
define void @print_mat4(%struct.mat4* nocapture %0) {
%2 = bitcast %struct.mat4* %0 to float*
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = getelementptr inbounds %struct.mat4, %struct.mat4* %0, i64 1
%6 = bitcast %struct.mat4* %5 to float*
%7 = load float, float* %6
%8 = fpext float %7 to double
%9 = getelementptr inbounds %struct.mat4, %struct.mat4* %0, i64 2
%10 = bitcast %struct.mat4* %9 to float*
%11 = load float, float* %10
%12 = fpext float %11 to double
%13 = getelementptr inbounds %struct.mat4, %struct.mat4* %0, i64 3
%14 = bitcast %struct.mat4* %13 to float*
%15 = load float, float* %14
%16 = fpext float %15 to double
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), double %4, double %8, double %12, double %16)
%18 = getelementptr inbounds %struct.mat4, %struct.mat4* %0, i64 4
%19 = bitcast %struct.mat4* %18 to float*
%20 = load float, float* %19
%21 = fpext float %20 to double
%22 = getelementptr inbounds %struct.mat4, %struct.mat4* %0, i64 5
%23 = bitcast %struct.mat4* %22 to float*
%24 = load float, float* %23
%25 = fpext float %24 to double
%26 = getelementptr inbounds %struct.mat4, %struct.mat4* %0, i64 6
%27 = bitcast %struct.mat4* %26 to float*
%28 = load float, float* %27
%29 = fpext float %28 to double
%30 = getelementptr inbounds %struct.mat4, %struct.mat4* %0, i64 7
%31 = bitcast %struct.mat4* %30 to float*
%32 = load float, float* %31
%33 = fpext float %32 to double
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), double %21, double %25, double %29, double %33)
%35 = getelementptr inbounds %struct.mat4, %struct.mat4* %0, i64 8
%36 = bitcast %struct.mat4* %35 to float*
%37 = load float, float* %36
%38 = fpext float %37 to double
%39 = getelementptr inbounds %struct.mat4, %struct.mat4* %0, i64 9
%40 = bitcast %struct.mat4* %39 to float*
%41 = load float, float* %40
%42 = fpext float %41 to double
%43 = getelementptr inbounds %struct.mat4, %struct.mat4* %0, i64 10
%44 = bitcast %struct.mat4* %43 to float*
%45 = load float, float* %44
%46 = fpext float %45 to double
%47 = getelementptr inbounds %struct.mat4, %struct.mat4* %0, i64 11
%48 = bitcast %struct.mat4* %47 to float*
%49 = load float, float* %48
%50 = fpext float %49 to double
%51 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), double %38, double %42, double %46, double %50)
%52 = getelementptr inbounds %struct.mat4, %struct.mat4* %0, i64 12
%53 = bitcast %struct.mat4* %52 to float*
%54 = load float, float* %53
%55 = fpext float %54 to double
%56 = getelementptr inbounds %struct.mat4, %struct.mat4* %0, i64 13
%57 = bitcast %struct.mat4* %56 to float*
%58 = load float, float* %57
%59 = fpext float %58 to double
%60 = getelementptr inbounds %struct.mat4, %struct.mat4* %0, i64 14
%61 = bitcast %struct.mat4* %60 to float*
%62 = load float, float* %61
%63 = fpext float %62 to double
%64 = getelementptr inbounds %struct.mat4, %struct.mat4* %0, i64 15
%65 = bitcast %struct.mat4* %64 to float*
%66 = load float, float* %65
%67 = fpext float %66 to double
%68 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), double %55, double %59, double %63, double %67)
%69 = tail call i32 @putchar(i32 10)
ret void
}