void binlens(double x1, double x2, double d, double m1, double *y1,
             double *y2) {
  double m2;
  double x2sq;
  double del11, del12, n1, n2;
  m2 = 1.0 - m1;
  if (m2 < 0.0) {
    m2 = 0.0;
    m1 = 1.0;
  }
  del11 = x1 + m2 * d;
  del12 = x1 - m1 * d;
  x2sq = x2 * x2;
  n1 = del11 * del11 + x2sq;
  n2 = del12 * del12 + x2sq;
  if (n1 == 0.0 || n2 == 0.0) {
    *y1 = -1.0e30;
    *y2 = -1.0e30;
    return;
  }
  *y1 = x1 - m1 * del11 / n1 - m2 * del12 / n2;
  *y2 = x2 - m1 * x2 / n1 - m2 * x2 / n2;
}


x86 assembly (clang, -O0):
<binlens>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
mov    %rdi,-0x28(%rbp)
mov    %rsi,-0x30(%rbp)
movsd  0xed8(%rip),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x38(%rbp),%xmm0
jbe    1155 <binlens+0x55>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xeb0(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x58(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1208 <binlens+0x108>
jp     1208 <binlens+0x108>
jmp    1220 <binlens+0x120>
movsd  -0x60(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1245 <binlens+0x145>
jp     1245 <binlens+0x145>
mov    -0x28(%rbp),%rax
movsd  0xddc(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x30(%rbp),%rax
movsd  0xdcc(%rip),%xmm0
movsd  %xmm0,(%rax)
jmp    12ab <binlens+0x1ab>
movsd  -0x8(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
mulsd  -0x48(%rbp),%xmm1
divsd  -0x58(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  -0x38(%rbp),%xmm1
mulsd  -0x50(%rbp),%xmm1
divsd  -0x60(%rbp),%xmm1
subsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x10(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
divsd  -0x58(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  -0x38(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
divsd  -0x60(%rbp),%xmm1
subsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<binlens>:
movsd  0xef8(%rip),%xmm4
subsd  %xmm3,%xmm4
xorpd  %xmm5,%xmm5
xor    %eax,%eax
ucomisd %xmm4,%xmm5
seta   %al
movd   %eax,%xmm6
pshufd $0x44,%xmm6,%xmm6
psllq  $0x3f,%xmm6
psrad  $0x1f,%xmm6
pshufd $0xf5,%xmm6,%xmm6
unpcklpd %xmm4,%xmm3
movq   0xec3(%rip),%xmm4
pand   %xmm6,%xmm4
pandn  %xmm3,%xmm6
por    %xmm6,%xmm4
movdqa 0xebf(%rip),%xmm3
pxor   %xmm4,%xmm3
shufpd $0x1,%xmm3,%xmm6
unpcklpd %xmm2,%xmm2
mulpd  %xmm6,%xmm2
movapd %xmm0,%xmm3
unpcklpd %xmm0,%xmm3
addpd  %xmm2,%xmm3
movapd %xmm1,%xmm6
mulsd  %xmm1,%xmm6
unpcklpd %xmm6,%xmm6
movapd %xmm3,%xmm2
mulpd  %xmm3,%xmm2
addpd  %xmm6,%xmm2
ucomisd %xmm5,%xmm2
jne    118e <binlens+0x8e>
jnp    11df <binlens+0xdf>
movapd %xmm2,%xmm6
unpckhpd %xmm2,%xmm6
ucomisd %xmm5,%xmm6
jne    119e <binlens+0x9e>
jnp    11df <binlens+0xdf>
mulpd  %xmm4,%xmm3
movapd %xmm3,%xmm5
divsd  %xmm2,%xmm5
subsd  %xmm5,%xmm0
unpckhpd %xmm3,%xmm3
divsd  %xmm6,%xmm3
subsd  %xmm3,%xmm0
movsd  %xmm0,(%rdi)
movapd %xmm1,%xmm0
unpcklpd %xmm1,%xmm0
mulpd  %xmm4,%xmm0
divpd  %xmm2,%xmm0
subsd  %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
subsd  %xmm0,%xmm1
movsd  %xmm1,(%rsi)
ret
movabs $0xc6293e5939a08cea,%rax
3e 29 c6
mov    %rax,(%rdi)
movsd  0xe14(%rip),%xmm1
movsd  %xmm1,(%rsi)
ret

LLVM IR (-O0):
define void @binlens(double %0, double %1, double %2, double %3, double* %4, double* %5) {
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double*
%12 = alloca double*
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
store double %0, double* %7
store double %1, double* %8
store double %2, double* %9
store double %3, double* %10
store double* %4, double** %11
store double* %5, double** %12
%19 = load double, double* %10
%20 = fsub double 1.000000e+00, %19
store double %20, double* %13
%21 = load double, double* %13
%22 = fcmp olt double %21, 0.000000e+00
br i1 %22, label %23, label %24
23: ; preds = %6
store double 0.000000e+00, double* %13
store double 1.000000e+00, double* %10
br label %24
24: ; preds = %23, %6
%25 = load double, double* %7
%26 = load double, double* %13
%27 = load double, double* %9
%28 = call double @llvm.fmuladd.f64(double %26, double %27, double %25)
store double %28, double* %15
%29 = load double, double* %7
%30 = load double, double* %10
%31 = load double, double* %9
%32 = fneg double %30
%33 = call double @llvm.fmuladd.f64(double %32, double %31, double %29)
store double %33, double* %16
%34 = load double, double* %8
%35 = load double, double* %8
%36 = fmul double %34, %35
store double %36, double* %14
%37 = load double, double* %15
%38 = load double, double* %15
%39 = load double, double* %14
%40 = call double @llvm.fmuladd.f64(double %37, double %38, double %39)
store double %40, double* %17
%41 = load double, double* %16
%42 = load double, double* %16
%43 = load double, double* %14
%44 = call double @llvm.fmuladd.f64(double %41, double %42, double %43)
store double %44, double* %18
%45 = load double, double* %17
%46 = fcmp oeq double %45, 0.000000e+00
br i1 %46, label %50, label %47
47: ; preds = %24
%48 = load double, double* %18
%49 = fcmp oeq double %48, 0.000000e+00
br i1 %49, label %50, label %53
50: ; preds = %47, %24
%51 = load double*, double** %11
store double -1.000000e+30, double* %51
%52 = load double*, double** %12
store double -1.000000e+30, double* %52
br label %82
53: ; preds = %47
%54 = load double, double* %7
%55 = load double, double* %10
%56 = load double, double* %15
%57 = fmul double %55, %56
%58 = load double, double* %17
%59 = fdiv double %57, %58
%60 = fsub double %54, %59
%61 = load double, double* %13
%62 = load double, double* %16
%63 = fmul double %61, %62
%64 = load double, double* %18
%65 = fdiv double %63, %64
%66 = fsub double %60, %65
%67 = load double*, double** %11
store double %66, double* %67
%68 = load double, double* %8
%69 = load double, double* %10
%70 = load double, double* %8
%71 = fmul double %69, %70
%72 = load double, double* %17
%73 = fdiv double %71, %72
%74 = fsub double %68, %73
%75 = load double, double* %13
%76 = load double, double* %8
%77 = fmul double %75, %76
%78 = load double, double* %18
%79 = fdiv double %77, %78
%80 = fsub double %74, %79
%81 = load double*, double** %12
store double %80, double* %81
br label %82
82: ; preds = %53, %50
ret void
}

LLVM IR (-O2):
define void @binlens(double %0, double %1, double %2, double %3, double* nocapture writeonly %4, double* nocapture writeonly %5) {
%7 = fsub double 1.000000e+00, %3
%8 = fcmp olt double %7, 0.000000e+00
%9 = insertelement <2 x i1> poison, i1 %8, i64 0
%10 = shufflevector <2 x i1> %9, <2 x i1> poison, <2 x i32> zeroinitializer
%11 = insertelement <2 x double> poison, double %3, i64 0
%12 = insertelement <2 x double> %11, double %7, i64 1
%13 = select <2 x i1> %10, <2 x double> <double 1.000000e+00, double 0.000000e+00>, <2 x double> %12
%14 = extractelement <2 x double> %13, i64 0
%15 = fneg double %14
%16 = extractelement <2 x double> %13, i64 1
%17 = insertelement <2 x double> poison, double %16, i64 0
%18 = insertelement <2 x double> %17, double %15, i64 1
%19 = insertelement <2 x double> poison, double %2, i64 0
%20 = shufflevector <2 x double> %19, <2 x double> poison, <2 x i32> zeroinitializer
%21 = insertelement <2 x double> poison, double %0, i64 0
%22 = shufflevector <2 x double> %21, <2 x double> poison, <2 x i32> zeroinitializer
%23 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %18, <2 x double> %20, <2 x double> %22)
%24 = fmul double %1, %1
%25 = insertelement <2 x double> poison, double %24, i64 0
%26 = shufflevector <2 x double> %25, <2 x double> poison, <2 x i32> zeroinitializer
%27 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %23, <2 x double> %23, <2 x double> %26)
%28 = extractelement <2 x double> %27, i64 0
%29 = fcmp oeq double %28, 0.000000e+00
%30 = extractelement <2 x double> %27, i64 1
%31 = fcmp oeq double %30, 0.000000e+00
%32 = select i1 %29, i1 true, i1 %31
br i1 %32, label %33, label %34
33: ; preds = %6
store double -1.000000e+30, double* %4
br label %51
34: ; preds = %6
%35 = fmul <2 x double> %13, %23
%36 = extractelement <2 x double> %35, i64 0
%37 = fdiv double %36, %28
%38 = fsub double %0, %37
%39 = fmul <2 x double> %13, %23
%40 = extractelement <2 x double> %39, i64 1
%41 = fdiv double %40, %30
%42 = fsub double %38, %41
store double %42, double* %4
%43 = insertelement <2 x double> poison, double %1, i64 0
%44 = shufflevector <2 x double> %43, <2 x double> poison, <2 x i32> zeroinitializer
%45 = fmul <2 x double> %13, %44
%46 = fdiv <2 x double> %45, %27
%47 = extractelement <2 x double> %46, i64 0
%48 = fsub double %1, %47
%49 = extractelement <2 x double> %46, i64 1
%50 = fsub double %48, %49
br label %51
51: ; preds = %34, %33
%52 = phi double [ %50, %34 ], [ -1.000000e+30, %33 ]
store double %52, double* %5
ret void
}