#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 sin(double);
double geom_dV_sph_rtp_B(double xm[], double xp[]) {
  double r1 = xm[0];
  double r2 = xp[0];
  double th1 = xm[1];
  double th2 = xp[1];
  double dcost = 2 * sin(0.5 * (th1 + th2)) * sin(0.5 * (th2 - th1));
  return (r1 * r1 + r1 * r2 + r2 * r2) * (r2 - r1) * dcost / 3.0;
}


x86 assembly (clang, -O0):
<geom_dV_sph_rtp_B>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm1
addsd  -0x30(%rbp),%xmm1
movsd  0xea0(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <sin@plt>
shl    $0x1,%eax
mov    %eax,-0x3c(%rbp)
movsd  -0x30(%rbp),%xmm1
subsd  -0x28(%rbp),%xmm1
movsd  0xe7f(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <sin@plt>
mov    %eax,%ecx
mov    -0x3c(%rbp),%eax
imul   %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm1
subsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  0xe14(%rip),%xmm1
divsd  %xmm1,%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<geom_dV_sph_rtp_B>:
push   %rbx
sub    $0x20,%rsp
movsd  (%rdi),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0x8(%rdi),%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  (%rsi),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsi),%xmm2
movsd  %xmm2,(%rsp)
movapd %xmm1,%xmm0
addsd  %xmm2,%xmm0
mulsd  0xeb2(%rip),%xmm0
call   1030 <sin@plt>
mov    %eax,%ebx
movsd  (%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
mulsd  0xe98(%rip),%xmm0
call   1030 <sin@plt>
imul   %ebx,%eax
add    %eax,%eax
cvtsi2sd %eax,%xmm3
movsd  0x18(%rsp),%xmm4
movapd %xmm4,%xmm1
movsd  0x10(%rsp),%xmm0
mulsd  %xmm0,%xmm1
movapd %xmm4,%xmm2
mulsd  %xmm4,%xmm2
addsd  %xmm1,%xmm2
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
addsd  %xmm2,%xmm1
subsd  %xmm4,%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm3,%xmm0
divsd  0xe52(%rip),%xmm0
add    $0x20,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define double @geom_dV_sph_rtp_B(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %0
%4 = load double, double* %1
%5 = getelementptr inbounds double, double* %0, i64 1
%6 = load double, double* %5
%7 = getelementptr inbounds double, double* %1, i64 1
%8 = load double, double* %7
%9 = fadd double %6, %8
%10 = fmul double %9, 5.000000e-01
%11 = tail call i32 @sin(double %10)
%12 = shl nsw i32 %11, 1
%13 = fsub double %8, %6
%14 = fmul double %13, 5.000000e-01
%15 = tail call i32 @sin(double %14)
%16 = mul nsw i32 %12, %15
%17 = sitofp i32 %16 to double
%18 = fmul double %3, %4
%19 = tail call double @llvm.fmuladd.f64(double %3, double %3, double %18)
%20 = tail call double @llvm.fmuladd.f64(double %4, double %4, double %19)
%21 = fsub double %4, %3
%22 = fmul double %21, %20
%23 = fmul double %22, %17
%24 = fdiv double %23, 3.000000e+00
ret double %24
}