#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 */
double v_dot_p6(double *, double const *);
void m_v_m6(double mat[6][6], const double vec[6], double *result) {
  int i;
  for (i = 0; i < 6; i++)
    result[i] = v_dot_p6(mat[i], vec);
}


x86 assembly (clang, -O0):
<m_v_m6>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x6,-0x1c(%rbp)
jge    1168 <m_v_m6+0x58>
mov    -0x8(%rbp),%rdi
movslq -0x1c(%rbp),%rax
imul   $0x30,%rax,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
call   1030 <v_dot_p6@plt>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112b <m_v_m6+0x1b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m_v_m6>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
call   1030 <v_dot_p6@plt>
movsd  %xmm0,(%r14)
lea    0x30(%rbx),%rdi
mov    %r15,%rsi
call   1030 <v_dot_p6@plt>
movsd  %xmm0,0x8(%r14)
lea    0x60(%rbx),%rdi
mov    %r15,%rsi
call   1030 <v_dot_p6@plt>
movsd  %xmm0,0x10(%r14)
lea    0x90(%rbx),%rdi
mov    %r15,%rsi
call   1030 <v_dot_p6@plt>
movsd  %xmm0,0x18(%r14)
lea    0xc0(%rbx),%rdi
mov    %r15,%rsi
call   1030 <v_dot_p6@plt>
movsd  %xmm0,0x20(%r14)
add    $0xf0,%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <v_dot_p6@plt>
movsd  %xmm0,0x28(%r14)
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @m_v_m6([6 x double]* %0, double* %1, double* nocapture writeonly %2) {
%4 = getelementptr inbounds [6 x double], [6 x double]* %0, i64 0, i64 0
%5 = tail call double @v_dot_p6(double* %4, double* %1)
store double %5, double* %2
%6 = getelementptr inbounds [6 x double], [6 x double]* %0, i64 1, i64 0
%7 = tail call double @v_dot_p6(double* %6, double* %1)
%8 = getelementptr inbounds double, double* %2, i64 1
store double %7, double* %8
%9 = getelementptr inbounds [6 x double], [6 x double]* %0, i64 2, i64 0
%10 = tail call double @v_dot_p6(double* %9, double* %1)
%11 = getelementptr inbounds double, double* %2, i64 2
store double %10, double* %11
%12 = getelementptr inbounds [6 x double], [6 x double]* %0, i64 3, i64 0
%13 = tail call double @v_dot_p6(double* %12, double* %1)
%14 = getelementptr inbounds double, double* %2, i64 3
store double %13, double* %14
%15 = getelementptr inbounds [6 x double], [6 x double]* %0, i64 4, i64 0
%16 = tail call double @v_dot_p6(double* %15, double* %1)
%17 = getelementptr inbounds double, double* %2, i64 4
store double %16, double* %17
%18 = getelementptr inbounds [6 x double], [6 x double]* %0, i64 5, i64 0
%19 = tail call double @v_dot_p6(double* %18, double* %1)
%20 = getelementptr inbounds double, double* %2, i64 5
store double %19, double* %20
ret void
}