void GetRange(double SiteX, double SiteY, double SiteZ, double SiteVX,
              double SiteVY, double SatX, double SatY, double SatZ,
              double SatVX, double SatVY, double SatVZ, double *Range,
              double *RangeRate) {
  double DX, DY, DZ;
  DX = SatX - SiteX;
  DY = SatY - SiteY;
  DZ = SatZ - SiteZ;
  *Range = sqrt(((DX) * (DX)) + ((DY) * (DY)) + ((DZ) * (DZ)));
  *RangeRate =
      ((SatVX - SiteVX) * DX + (SatVY - SiteVY) * DY + SatVZ * DZ) / *Range;
}


x86 assembly (clang, -O0):
<GetRange>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movsd  0x20(%rbp),%xmm8
movsd  0x18(%rbp),%xmm8
movsd  0x10(%rbp),%xmm8
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
movsd  %xmm6,-0x38(%rbp)
movsd  %xmm7,-0x40(%rbp)
mov    %rdi,-0x48(%rbp)
mov    %rsi,-0x50(%rbp)
movsd  -0x30(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x38(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x40(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x58(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm2
movsd  -0x60(%rbp),%xmm0
mulsd  -0x60(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
mov    -0x48(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  0x10(%rbp),%xmm1
subsd  -0x20(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm2
movsd  0x18(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
mulsd  -0x60(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0x20(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x48(%rbp),%rax
divsd  (%rax),%xmm0
mov    -0x50(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetRange>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movapd %xmm4,%xmm8
movapd %xmm3,%xmm9
movsd  0x50(%rsp),%xmm3
movsd  0x48(%rsp),%xmm10
movsd  0x40(%rsp),%xmm4
subsd  %xmm0,%xmm5
subsd  %xmm1,%xmm6
subsd  %xmm2,%xmm7
movapd %xmm6,%xmm0
mulsd  %xmm6,%xmm0
movapd %xmm5,%xmm1
mulsd  %xmm5,%xmm1
addsd  %xmm0,%xmm1
movapd %xmm7,%xmm0
mulsd  %xmm7,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1176 <GetRange+0x66>
sqrtsd %xmm0,%xmm0
jmp    11cc <GetRange+0xbc>
movsd  %xmm7,0x20(%rsp)
movsd  %xmm6,0x18(%rsp)
movsd  %xmm5,0x10(%rsp)
movsd  %xmm8,0x8(%rsp)
movsd  %xmm9,(%rsp)
call   1030 <sqrt@plt>
movsd  0x48(%rsp),%xmm10
movsd  (%rsp),%xmm9
movsd  0x8(%rsp),%xmm8
movsd  0x40(%rsp),%xmm4
movsd  0x10(%rsp),%xmm5
movsd  0x50(%rsp),%xmm3
movsd  0x18(%rsp),%xmm6
movsd  0x20(%rsp),%xmm7
movsd  %xmm0,(%rbx)
subsd  %xmm9,%xmm4
subsd  %xmm8,%xmm10
mulsd  %xmm10,%xmm6
mulsd  %xmm5,%xmm4
addsd  %xmm6,%xmm4
mulsd  %xmm7,%xmm3
addsd  %xmm4,%xmm3
divsd  %xmm0,%xmm3
movsd  %xmm3,(%r14)
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @GetRange(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8, double %9, double %10, double* %11, double* %12) {
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double*
%26 = alloca double*
%27 = alloca double
%28 = alloca double
%29 = alloca double
store double %0, double* %14
store double %1, double* %15
store double %2, double* %16
store double %3, double* %17
store double %4, double* %18
store double %5, double* %19
store double %6, double* %20
store double %7, double* %21
store double %8, double* %22
store double %9, double* %23
store double %10, double* %24
store double* %11, double** %25
store double* %12, double** %26
%30 = load double, double* %19
%31 = load double, double* %14
%32 = fsub double %30, %31
store double %32, double* %27
%33 = load double, double* %20
%34 = load double, double* %15
%35 = fsub double %33, %34
store double %35, double* %28
%36 = load double, double* %21
%37 = load double, double* %16
%38 = fsub double %36, %37
store double %38, double* %29
%39 = load double, double* %27
%40 = load double, double* %27
%41 = load double, double* %28
%42 = load double, double* %28
%43 = fmul double %41, %42
%44 = call double @llvm.fmuladd.f64(double %39, double %40, double %43)
%45 = load double, double* %29
%46 = load double, double* %29
%47 = call double @llvm.fmuladd.f64(double %45, double %46, double %44)
%48 = call double @sqrt(double %47)
%49 = load double*, double** %25
store double %48, double* %49
%50 = load double, double* %22
%51 = load double, double* %17
%52 = fsub double %50, %51
%53 = load double, double* %27
%54 = load double, double* %23
%55 = load double, double* %18
%56 = fsub double %54, %55
%57 = load double, double* %28
%58 = fmul double %56, %57
%59 = call double @llvm.fmuladd.f64(double %52, double %53, double %58)
%60 = load double, double* %24
%61 = load double, double* %29
%62 = call double @llvm.fmuladd.f64(double %60, double %61, double %59)
%63 = load double*, double** %25
%64 = load double, double* %63
%65 = fdiv double %62, %64
%66 = load double*, double** %26
store double %65, double* %66
ret void
}

LLVM IR (-O2):
define void @GetRange(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8, double %9, double %10, double* nocapture writeonly %11, double* nocapture writeonly %12) {
%14 = fsub double %5, %0
%15 = fsub double %6, %1
%16 = fsub double %7, %2
%17 = fmul double %15, %15
%18 = tail call double @llvm.fmuladd.f64(double %14, double %14, double %17)
%19 = tail call double @llvm.fmuladd.f64(double %16, double %16, double %18)
%20 = tail call double @sqrt(double %19)
store double %20, double* %11
%21 = fsub double %8, %3
%22 = fsub double %9, %4
%23 = fmul double %15, %22
%24 = tail call double @llvm.fmuladd.f64(double %21, double %14, double %23)
%25 = tail call double @llvm.fmuladd.f64(double %10, double %16, double %24)
%26 = fdiv double %25, %20
store double %26, double* %12
ret void
}