#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_p4(double *, double const *);
void m_v_m4(double mat[4][4], const double vec[4], double *result) {
  int i;
  for (i = 0; i < 4; i++)
    result[i] = v_dot_p4(mat[i], vec);
}


x86 assembly (clang, -O0):
<m_v_m4>:
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   $0x4,-0x1c(%rbp)
jge    1168 <m_v_m4+0x58>
mov    -0x8(%rbp),%rdi
movslq -0x1c(%rbp),%rax
shl    $0x5,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
call   1030 <v_dot_p4@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_m4+0x1b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m_v_m4>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
call   1030 <v_dot_p4@plt>
movsd  %xmm0,(%r14)
lea    0x20(%rbx),%rdi
mov    %r15,%rsi
call   1030 <v_dot_p4@plt>
movsd  %xmm0,0x8(%r14)
lea    0x40(%rbx),%rdi
mov    %r15,%rsi
call   1030 <v_dot_p4@plt>
movsd  %xmm0,0x10(%r14)
add    $0x60,%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <v_dot_p4@plt>
movsd  %xmm0,0x18(%r14)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @m_v_m4([4 x double]* %0, double* %1, double* %2) {
%4 = alloca [4 x double]*
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
store [4 x double]* %0, [4 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, 4
br i1 %10, label %11, label %26
11: ; preds = %8
%12 = load [4 x double]*, [4 x double]** %4
%13 = load i32, i32* %7
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [4 x double], [4 x double]* %12, i64 %14
%16 = getelementptr inbounds [4 x double], [4 x double]* %15, i64 0, i64 0
%17 = load double*, double** %5
%18 = call double @v_dot_p4(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_m4([4 x double]* %0, double* %1, double* nocapture writeonly %2) {
%4 = getelementptr inbounds [4 x double], [4 x double]* %0, i64 0, i64 0
%5 = tail call double @v_dot_p4(double* %4, double* %1)
store double %5, double* %2
%6 = getelementptr inbounds [4 x double], [4 x double]* %0, i64 1, i64 0
%7 = tail call double @v_dot_p4(double* %6, double* %1)
%8 = getelementptr inbounds double, double* %2, i64 1
store double %7, double* %8
%9 = getelementptr inbounds [4 x double], [4 x double]* %0, i64 2, i64 0
%10 = tail call double @v_dot_p4(double* %9, double* %1)
%11 = getelementptr inbounds double, double* %2, i64 2
store double %10, double* %11
%12 = getelementptr inbounds [4 x double], [4 x double]* %0, i64 3, i64 0
%13 = tail call double @v_dot_p4(double* %12, double* %1)
%14 = getelementptr inbounds double, double* %2, i64 3
store double %13, double* %14
ret void
}