void sum_3d(double *out, double *a, double *b) {
  *(out++) = *(a++) + *(b++);
  *(out++) = *(a++) + *(b++);
  *(out) = *(a) + *(b);
}


x86 assembly (clang, -O0):
<sum_3d>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x18(%rbp)
addsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x8(%rbp)
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x18(%rbp)
addsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x8(%rbp)
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
addsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<sum_3d>:
movsd  (%rsi),%xmm0
addsd  (%rdx),%xmm0
movsd  %xmm0,(%rdi)
movsd  0x8(%rsi),%xmm0
addsd  0x8(%rdx),%xmm0
movsd  %xmm0,0x8(%rdi)
movsd  0x10(%rsi),%xmm0
addsd  0x10(%rdx),%xmm0
movsd  %xmm0,0x10(%rdi)
ret

LLVM IR (-O0):
define void @sum_3d(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
%7 = load double*, double** %5
%8 = getelementptr inbounds double, double* %7, i32 1
store double* %8, double** %5
%9 = load double, double* %7
%10 = load double*, double** %6
%11 = getelementptr inbounds double, double* %10, i32 1
store double* %11, double** %6
%12 = load double, double* %10
%13 = fadd double %9, %12
%14 = load double*, double** %4
%15 = getelementptr inbounds double, double* %14, i32 1
store double* %15, double** %4
store double %13, double* %14
%16 = load double*, double** %5
%17 = getelementptr inbounds double, double* %16, i32 1
store double* %17, double** %5
%18 = load double, double* %16
%19 = load double*, double** %6
%20 = getelementptr inbounds double, double* %19, i32 1
store double* %20, double** %6
%21 = load double, double* %19
%22 = fadd double %18, %21
%23 = load double*, double** %4
%24 = getelementptr inbounds double, double* %23, i32 1
store double* %24, double** %4
store double %22, double* %23
%25 = load double*, double** %5
%26 = load double, double* %25
%27 = load double*, double** %6
%28 = load double, double* %27
%29 = fadd double %26, %28
%30 = load double*, double** %4
store double %29, double* %30
ret void
}

LLVM IR (-O2):
define void @sum_3d(double* nocapture writeonly %0, double* nocapture %1, double* nocapture %2) {
%4 = getelementptr inbounds double, double* %1, i64 1
%5 = load double, double* %1
%6 = getelementptr inbounds double, double* %2, i64 1
%7 = load double, double* %2
%8 = fadd double %5, %7
%9 = getelementptr inbounds double, double* %0, i64 1
store double %8, double* %0
%10 = getelementptr inbounds double, double* %1, i64 2
%11 = load double, double* %4
%12 = getelementptr inbounds double, double* %2, i64 2
%13 = load double, double* %6
%14 = fadd double %11, %13
%15 = getelementptr inbounds double, double* %0, i64 2
store double %14, double* %9
%16 = load double, double* %10
%17 = load double, double* %12
%18 = fadd double %16, %17
store double %18, double* %15
ret void
}