float *Vector3ScaleAndAccumulate(const float v[3], float scalar,
                                 float result[3]) {
  result[0] += v[0] * scalar;
  result[1] += v[1] * scalar;
  result[2] += v[2] * scalar;
  return result;
}


x86 assembly (clang, -O0):
<Vector3ScaleAndAccumulate>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
movss  -0xc(%rbp),%xmm2
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
movss  -0xc(%rbp),%xmm2
mov    -0x18(%rbp),%rax
movss  0x4(%rax),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,0x4(%rax)
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm0
movss  -0xc(%rbp),%xmm2
mov    -0x18(%rbp),%rax
movss  0x8(%rax),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,0x8(%rax)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Vector3ScaleAndAccumulate>:
mov    %rsi,%rax
movss  (%rdi),%xmm1
mulss  %xmm0,%xmm1
addss  (%rsi),%xmm1
movss  %xmm1,(%rsi)
movss  0x4(%rdi),%xmm1
mulss  %xmm0,%xmm1
addss  0x4(%rsi),%xmm1
movss  %xmm1,0x4(%rsi)
mulss  0x8(%rdi),%xmm0
addss  0x8(%rsi),%xmm0
movss  %xmm0,0x8(%rsi)
ret

LLVM IR (-O0):
define float* @Vector3ScaleAndAccumulate(float* %0, float %1, float* %2) {
%4 = alloca float*
%5 = alloca float
%6 = alloca float*
store float* %0, float** %4
store float %1, float* %5
store float* %2, float** %6
%7 = load float*, float** %4
%8 = getelementptr inbounds float, float* %7, i64 0
%9 = load float, float* %8
%10 = load float, float* %5
%11 = load float*, float** %6
%12 = getelementptr inbounds float, float* %11, i64 0
%13 = load float, float* %12
%14 = call float @llvm.fmuladd.f32(float %9, float %10, float %13)
store float %14, float* %12
%15 = load float*, float** %4
%16 = getelementptr inbounds float, float* %15, i64 1
%17 = load float, float* %16
%18 = load float, float* %5
%19 = load float*, float** %6
%20 = getelementptr inbounds float, float* %19, i64 1
%21 = load float, float* %20
%22 = call float @llvm.fmuladd.f32(float %17, float %18, float %21)
store float %22, float* %20
%23 = load float*, float** %4
%24 = getelementptr inbounds float, float* %23, i64 2
%25 = load float, float* %24
%26 = load float, float* %5
%27 = load float*, float** %6
%28 = getelementptr inbounds float, float* %27, i64 2
%29 = load float, float* %28
%30 = call float @llvm.fmuladd.f32(float %25, float %26, float %29)
store float %30, float* %28
%31 = load float*, float** %6
ret float* %31
}

LLVM IR (-O2):
define float* @Vector3ScaleAndAccumulate(float* nocapture %0, float %1, float* returned %2) {
%4 = load float, float* %0
%5 = load float, float* %2
%6 = tail call float @llvm.fmuladd.f32(float %4, float %1, float %5)
store float %6, float* %2
%7 = getelementptr inbounds float, float* %0, i64 1
%8 = load float, float* %7
%9 = getelementptr inbounds float, float* %2, i64 1
%10 = load float, float* %9
%11 = tail call float @llvm.fmuladd.f32(float %8, float %1, float %10)
store float %11, float* %9
%12 = getelementptr inbounds float, float* %0, i64 2
%13 = load float, float* %12
%14 = getelementptr inbounds float, float* %2, i64 2
%15 = load float, float* %14
%16 = tail call float @llvm.fmuladd.f32(float %13, float %1, float %15)
store float %16, float* %14
ret float* %2
}