void geom_CM_sph_rtp(double xm[], double xp[], double xc[]) {
  double r1 = xm[0];
  double r2 = xp[0];
  double th1 = xm[1];
  double th2 = xp[1];
  xc[0] = 2.0 * (r1 * r1 + r1 * r2 + r2 * r2) / (3.0 * (r1 + r2));
  xc[1] = 0.5 * (th1 + th2);
}


x86 assembly (clang, -O0):
<geom_CM_sph_rtp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm1
mulsd  -0x28(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xe94(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm2
addsd  -0x28(%rbp),%xmm2
movsd  0xe76(%rip),%xmm1
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x30(%rbp),%xmm1
addsd  -0x38(%rbp),%xmm1
movsd  0xe4c(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<geom_CM_sph_rtp>:
movsd  (%rsi),%xmm0
movsd  (%rdi),%xmm1
movsd  0x8(%rdi),%xmm2
movapd %xmm1,%xmm3
mulsd  %xmm0,%xmm3
movapd %xmm1,%xmm4
mulsd  %xmm1,%xmm4
addsd  %xmm3,%xmm4
addsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm4,%xmm0
mulsd  0xecb(%rip),%xmm1
addsd  %xmm0,%xmm0
divsd  %xmm1,%xmm0
addsd  0x8(%rsi),%xmm2
movsd  %xmm0,(%rdx)
mulsd  0xeba(%rip),%xmm2
movsd  %xmm2,0x8(%rdx)
ret

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

LLVM IR (-O2):
define void @geom_CM_sph_rtp(double* nocapture %0, double* nocapture %1, double* nocapture writeonly %2) {
%4 = load double, double* %0
%5 = load double, double* %1
%6 = getelementptr inbounds double, double* %0, i64 1
%7 = load double, double* %6
%8 = getelementptr inbounds double, double* %1, i64 1
%9 = load double, double* %8
%10 = fmul double %4, %5
%11 = tail call double @llvm.fmuladd.f64(double %4, double %4, double %10)
%12 = tail call double @llvm.fmuladd.f64(double %5, double %5, double %11)
%13 = fmul double %12, 2.000000e+00
%14 = fadd double %4, %5
%15 = fmul double %14, 3.000000e+00
%16 = fdiv double %13, %15
store double %16, double* %2
%17 = fadd double %7, %9
%18 = fmul double %17, 5.000000e-01
%19 = getelementptr inbounds double, double* %2, i64 1
store double %18, double* %19
ret void
}