void centroid(double *out, double *a, double *b, double *c) {
  *(out++) = (*(a++) + *(b++) + *(c++)) / 3.;
  *(out++) = (*(a++) + *(b++) + *(c++)) / 3.;
  *(out) = (*(a) + *(b) + *(c)) / 3.;
}


x86 assembly (clang, -O0):
<centroid>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%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    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x20(%rbp)
addsd  (%rax),%xmm0
movsd  0xeab(%rip),%xmm1
divsd  %xmm1,%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    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x20(%rbp)
addsd  (%rax),%xmm0
movsd  0xe53(%rip),%xmm1
divsd  %xmm1,%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    -0x20(%rbp),%rax
addsd  (%rax),%xmm0
movsd  0xe1c(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<centroid>:
movsd  (%rsi),%xmm0
addsd  (%rdx),%xmm0
addsd  (%rcx),%xmm0
movsd  0xeec(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rdi)
movsd  0x8(%rsi),%xmm0
addsd  0x8(%rdx),%xmm0
addsd  0x8(%rcx),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rdi)
movsd  0x10(%rsi),%xmm0
addsd  0x10(%rdx),%xmm0
addsd  0x10(%rcx),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rdi)
ret

LLVM IR (-O0):
define void @centroid(double* %0, double* %1, double* %2, double* %3) {
%5 = alloca double*
%6 = alloca double*
%7 = alloca double*
%8 = alloca double*
store double* %0, double** %5
store double* %1, double** %6
store double* %2, double** %7
store double* %3, double** %8
%9 = load double*, double** %6
%10 = getelementptr inbounds double, double* %9, i32 1
store double* %10, double** %6
%11 = load double, double* %9
%12 = load double*, double** %7
%13 = getelementptr inbounds double, double* %12, i32 1
store double* %13, double** %7
%14 = load double, double* %12
%15 = fadd double %11, %14
%16 = load double*, double** %8
%17 = getelementptr inbounds double, double* %16, i32 1
store double* %17, double** %8
%18 = load double, double* %16
%19 = fadd double %15, %18
%20 = fdiv double %19, 3.000000e+00
%21 = load double*, double** %5
%22 = getelementptr inbounds double, double* %21, i32 1
store double* %22, double** %5
store double %20, double* %21
%23 = load double*, double** %6
%24 = getelementptr inbounds double, double* %23, i32 1
store double* %24, double** %6
%25 = load double, double* %23
%26 = load double*, double** %7
%27 = getelementptr inbounds double, double* %26, i32 1
store double* %27, double** %7
%28 = load double, double* %26
%29 = fadd double %25, %28
%30 = load double*, double** %8
%31 = getelementptr inbounds double, double* %30, i32 1
store double* %31, double** %8
%32 = load double, double* %30
%33 = fadd double %29, %32
%34 = fdiv double %33, 3.000000e+00
%35 = load double*, double** %5
%36 = getelementptr inbounds double, double* %35, i32 1
store double* %36, double** %5
store double %34, double* %35
%37 = load double*, double** %6
%38 = load double, double* %37
%39 = load double*, double** %7
%40 = load double, double* %39
%41 = fadd double %38, %40
%42 = load double*, double** %8
%43 = load double, double* %42
%44 = fadd double %41, %43
%45 = fdiv double %44, 3.000000e+00
%46 = load double*, double** %5
store double %45, double* %46
ret void
}

LLVM IR (-O2):
define void @centroid(double* nocapture writeonly %0, double* nocapture %1, double* nocapture %2, double* nocapture %3) {
%5 = getelementptr inbounds double, double* %1, i64 1
%6 = load double, double* %1
%7 = getelementptr inbounds double, double* %2, i64 1
%8 = load double, double* %2
%9 = fadd double %6, %8
%10 = getelementptr inbounds double, double* %3, i64 1
%11 = load double, double* %3
%12 = fadd double %9, %11
%13 = fdiv double %12, 3.000000e+00
%14 = getelementptr inbounds double, double* %0, i64 1
store double %13, double* %0
%15 = getelementptr inbounds double, double* %1, i64 2
%16 = load double, double* %5
%17 = getelementptr inbounds double, double* %2, i64 2
%18 = load double, double* %7
%19 = fadd double %16, %18
%20 = getelementptr inbounds double, double* %3, i64 2
%21 = load double, double* %10
%22 = fadd double %19, %21
%23 = fdiv double %22, 3.000000e+00
%24 = getelementptr inbounds double, double* %0, i64 2
store double %23, double* %14
%25 = load double, double* %15
%26 = load double, double* %17
%27 = fadd double %25, %26
%28 = load double, double* %20
%29 = fadd double %27, %28
%30 = fdiv double %29, 3.000000e+00
store double %30, double* %24
ret void
}