#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 */
int cos(double);
int sin(double);
void geom_CM_sph_rtp_B(double xm[], double xp[], double xc[]) {
  double r1 = xm[0];
  double r2 = xp[0];
  double th1 = xm[1];
  double th2 = xp[1];
  double ct1 = cos(th1);
  double ct2 = cos(th2);
  double dcost = 2 * sin(0.5 * (th1 + th2)) * sin(0.5 * (th2 - th1));
  double dsint = 2 * cos(0.5 * (th1 + th2)) * sin(0.5 * (th2 - th1));
  xc[0] = 3.0 * (r1 * r1 * r1 + r1 * r1 * r2 + r1 * r2 * r2 + r2 * r2 * r2) /
          (4.0 * (r1 * r1 + r1 * r2 + r2 * r2));
  xc[1] = (th1 * ct1 - th2 * ct2 + dsint) / dcost;
}


x86 assembly (clang, -O0):
<geom_CM_sph_rtp_B>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
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  -0x30(%rbp),%xmm0
call   1040 <cos@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1040 <cos@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x30(%rbp),%xmm1
addsd  -0x38(%rbp),%xmm1
movsd  0xe6e(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <sin@plt>
shl    $0x1,%eax
mov    %eax,-0x60(%rbp)
movsd  -0x38(%rbp),%xmm1
subsd  -0x30(%rbp),%xmm1
movsd  0xe4d(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <sin@plt>
mov    %eax,%ecx
mov    -0x60(%rbp),%eax
imul   %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x30(%rbp),%xmm1
addsd  -0x38(%rbp),%xmm1
movsd  0xe21(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1040 <cos@plt>
shl    $0x1,%eax
mov    %eax,-0x5c(%rbp)
movsd  -0x38(%rbp),%xmm1
subsd  -0x30(%rbp),%xmm1
movsd  0xe00(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <sin@plt>
mov    %eax,%ecx
mov    -0x5c(%rbp),%eax
imul   %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x20(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm1
mulsd  -0x28(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xd82(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm3
movsd  -0x20(%rbp),%xmm2
mulsd  -0x28(%rbp),%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
movsd  -0x28(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
movsd  0xd40(%rip),%xmm1
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x30(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm1
mulsd  -0x48(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x58(%rbp),%xmm0
divsd  -0x50(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<geom_CM_sph_rtp_B>:
push   %rbp
push   %rbx
sub    $0x98,%rsp
mov    %rdx,%rbx
movsd  (%rdi),%xmm0
movaps %xmm0,0x60(%rsp)
movsd  0x8(%rdi),%xmm0
movaps %xmm0,0x10(%rsp)
movsd  (%rsi),%xmm1
movaps %xmm1,0x70(%rsp)
movsd  0x8(%rsi),%xmm1
movaps %xmm1,(%rsp)
call   1040 <cos@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movapd %xmm0,0x80(%rsp)
movaps (%rsp),%xmm0
call   1040 <cos@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x28(%rsp)
movapd 0x10(%rsp),%xmm0
addsd  (%rsp),%xmm0
mulsd  0xe71(%rip),%xmm0
movapd %xmm0,0x40(%rsp)
call   1030 <sin@plt>
mov    %eax,%ebp
movapd (%rsp),%xmm0
subsd  0x10(%rsp),%xmm0
mulsd  0xe51(%rip),%xmm0
movapd %xmm0,0x30(%rsp)
call   1030 <sin@plt>
imul   %ebp,%eax
add    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movapd %xmm0,0x50(%rsp)
movaps 0x40(%rsp),%xmm0
call   1040 <cos@plt>
mov    %eax,%ebp
movaps 0x30(%rsp),%xmm0
call   1030 <sin@plt>
imul   %ebp,%eax
add    %eax,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movapd 0x60(%rsp),%xmm5
movapd %xmm5,%xmm0
mulsd  %xmm5,%xmm0
movapd %xmm0,%xmm2
movapd 0x70(%rsp),%xmm4
mulsd  %xmm4,%xmm2
movapd %xmm0,%xmm3
mulsd  %xmm5,%xmm3
addsd  %xmm2,%xmm3
mulsd  %xmm4,%xmm5
addsd  %xmm5,%xmm0
mulsd  %xmm4,%xmm5
addsd  %xmm3,%xmm5
movapd %xmm4,%xmm2
mulsd  %xmm4,%xmm2
addsd  %xmm2,%xmm0
mulsd  0xdce(%rip),%xmm0
unpcklpd 0x50(%rsp),%xmm0
movapd (%rsp),%xmm3
xorpd  0xdd3(%rip),%xmm3
mulsd  0x28(%rsp),%xmm3
unpcklpd %xmm3,%xmm5
unpcklpd 0x10(%rsp),%xmm2
unpcklpd 0x80(%rsp),%xmm4
mulpd  %xmm2,%xmm4
addpd  %xmm5,%xmm4
movsd  0xd9a(%rip),%xmm2
movapd %xmm4,%xmm3
mulpd  %xmm2,%xmm3
unpcklpd %xmm1,%xmm2
addpd  %xmm4,%xmm2
movsd  %xmm3,%xmm2
divpd  %xmm0,%xmm2
movupd %xmm2,(%rbx)
add    $0x98,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @geom_CM_sph_rtp_B(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
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
%15 = load double*, double** %4
%16 = getelementptr inbounds double, double* %15, i64 0
%17 = load double, double* %16
store double %17, double* %7
%18 = load double*, double** %5
%19 = getelementptr inbounds double, double* %18, i64 0
%20 = load double, double* %19
store double %20, double* %8
%21 = load double*, double** %4
%22 = getelementptr inbounds double, double* %21, i64 1
%23 = load double, double* %22
store double %23, double* %9
%24 = load double*, double** %5
%25 = getelementptr inbounds double, double* %24, i64 1
%26 = load double, double* %25
store double %26, double* %10
%27 = load double, double* %9
%28 = call i32 @cos(double %27)
%29 = sitofp i32 %28 to double
store double %29, double* %11
%30 = load double, double* %10
%31 = call i32 @cos(double %30)
%32 = sitofp i32 %31 to double
store double %32, double* %12
%33 = load double, double* %9
%34 = load double, double* %10
%35 = fadd double %33, %34
%36 = fmul double 5.000000e-01, %35
%37 = call i32 @sin(double %36)
%38 = mul nsw i32 2, %37
%39 = load double, double* %10
%40 = load double, double* %9
%41 = fsub double %39, %40
%42 = fmul double 5.000000e-01, %41
%43 = call i32 @sin(double %42)
%44 = mul nsw i32 %38, %43
%45 = sitofp i32 %44 to double
store double %45, double* %13
%46 = load double, double* %9
%47 = load double, double* %10
%48 = fadd double %46, %47
%49 = fmul double 5.000000e-01, %48
%50 = call i32 @cos(double %49)
%51 = mul nsw i32 2, %50
%52 = load double, double* %10
%53 = load double, double* %9
%54 = fsub double %52, %53
%55 = fmul double 5.000000e-01, %54
%56 = call i32 @sin(double %55)
%57 = mul nsw i32 %51, %56
%58 = sitofp i32 %57 to double
store double %58, double* %14
%59 = load double, double* %7
%60 = load double, double* %7
%61 = fmul double %59, %60
%62 = load double, double* %7
%63 = load double, double* %7
%64 = load double, double* %7
%65 = fmul double %63, %64
%66 = load double, double* %8
%67 = fmul double %65, %66
%68 = call double @llvm.fmuladd.f64(double %61, double %62, double %67)
%69 = load double, double* %7
%70 = load double, double* %8
%71 = fmul double %69, %70
%72 = load double, double* %8
%73 = call double @llvm.fmuladd.f64(double %71, double %72, double %68)
%74 = load double, double* %8
%75 = load double, double* %8
%76 = fmul double %74, %75
%77 = load double, double* %8
%78 = call double @llvm.fmuladd.f64(double %76, double %77, double %73)
%79 = fmul double 3.000000e+00, %78
%80 = load double, double* %7
%81 = load double, double* %7
%82 = load double, double* %7
%83 = load double, double* %8
%84 = fmul double %82, %83
%85 = call double @llvm.fmuladd.f64(double %80, double %81, double %84)
%86 = load double, double* %8
%87 = load double, double* %8
%88 = call double @llvm.fmuladd.f64(double %86, double %87, double %85)
%89 = fmul double 4.000000e+00, %88
%90 = fdiv double %79, %89
%91 = load double*, double** %6
%92 = getelementptr inbounds double, double* %91, i64 0
store double %90, double* %92
%93 = load double, double* %9
%94 = load double, double* %11
%95 = load double, double* %10
%96 = load double, double* %12
%97 = fmul double %95, %96
%98 = fneg double %97
%99 = call double @llvm.fmuladd.f64(double %93, double %94, double %98)
%100 = load double, double* %14
%101 = fadd double %99, %100
%102 = load double, double* %13
%103 = fdiv double %101, %102
%104 = load double*, double** %6
%105 = getelementptr inbounds double, double* %104, i64 1
store double %103, double* %105
ret void
}

LLVM IR (-O2):
define void @geom_CM_sph_rtp_B(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 = tail call i32 @cos(double %7)
%11 = sitofp i32 %10 to double
%12 = tail call i32 @cos(double %9)
%13 = sitofp i32 %12 to double
%14 = fadd double %7, %9
%15 = fmul double %14, 5.000000e-01
%16 = tail call i32 @sin(double %15)
%17 = shl nsw i32 %16, 1
%18 = fsub double %9, %7
%19 = fmul double %18, 5.000000e-01
%20 = tail call i32 @sin(double %19)
%21 = mul nsw i32 %17, %20
%22 = sitofp i32 %21 to double
%23 = tail call i32 @cos(double %15)
%24 = shl nsw i32 %23, 1
%25 = tail call i32 @sin(double %19)
%26 = mul nsw i32 %24, %25
%27 = sitofp i32 %26 to double
%28 = fmul double %4, %4
%29 = fmul double %28, %5
%30 = tail call double @llvm.fmuladd.f64(double %28, double %4, double %29)
%31 = fmul double %4, %5
%32 = tail call double @llvm.fmuladd.f64(double %31, double %5, double %30)
%33 = fmul double %5, %5
%34 = tail call double @llvm.fmuladd.f64(double %4, double %4, double %31)
%35 = tail call double @llvm.fmuladd.f64(double %5, double %5, double %34)
%36 = fmul double %35, 4.000000e+00
%37 = fneg double %9
%38 = fmul double %37, %13
%39 = insertelement <2 x double> poison, double %33, i64 0
%40 = insertelement <2 x double> %39, double %7, i64 1
%41 = insertelement <2 x double> poison, double %5, i64 0
%42 = insertelement <2 x double> %41, double %11, i64 1
%43 = insertelement <2 x double> poison, double %32, i64 0
%44 = insertelement <2 x double> %43, double %38, i64 1
%45 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %40, <2 x double> %42, <2 x double> %44)
%46 = insertelement <2 x double> <double 3.000000e+00, double poison>, double %27, i64 1
%47 = fmul <2 x double> %45, %46
%48 = fadd <2 x double> %45, %46
%49 = shufflevector <2 x double> %47, <2 x double> %48, <2 x i32> <i32 0, i32 3>
%50 = insertelement <2 x double> poison, double %36, i64 0
%51 = insertelement <2 x double> %50, double %22, i64 1
%52 = fdiv <2 x double> %49, %51
%53 = bitcast double* %2 to <2 x double>*
store <2 x double> %52, <2 x double>* %53
ret void
}