double ge_mi(double redchan, double nirchan) {
  double result;
  if ((nirchan + redchan) == 0.0) {
    result = -1.0;
  } else {
    result = (((2 * ((nirchan * nirchan) - (redchan * redchan)) +
                1.5 * nirchan + 0.5 * redchan) /
               (nirchan + redchan + 0.5)) *
              (1 - 0.25 *
                       (2 * ((nirchan * nirchan) - (redchan * redchan)) +
                        1.5 * nirchan + 0.5 * redchan) /
                       (nirchan + redchan + 0.5))) -
             ((redchan - 0.125) / (1 - redchan));
  }
  return result;
}


x86 assembly (clang, -O0):
<ge_mi>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
addsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    113d <ge_mi+0x3d>
jp     113d <ge_mi+0x3d>
movsd  0xef5(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1289 <ge_mi+0x189>
movsd  -0x10(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xea8(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
addsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x8(%rbp),%xmm0
movsd  0xe7e(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm1
addsd  -0x8(%rbp),%xmm1
movsd  0xe64(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm3
movsd  -0x8(%rbp),%xmm2
mulsd  -0x8(%rbp),%xmm2
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
movsd  0xe31(%rip),%xmm2
mulsd  -0x10(%rbp),%xmm2
addsd  %xmm1,%xmm1
addsd  %xmm2,%xmm1
movsd  -0x8(%rbp),%xmm2
movsd  0xe07(%rip),%xmm3
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
movsd  0xdff(%rip),%xmm1
mulsd  %xmm2,%xmm1
movsd  -0x10(%rbp),%xmm2
addsd  -0x8(%rbp),%xmm2
movsd  0xde1(%rip),%xmm3
addsd  %xmm3,%xmm2
divsd  %xmm2,%xmm1
movsd  0xdc1(%rip),%xmm2
subsd  %xmm1,%xmm2
movsd  -0x8(%rbp),%xmm1
movsd  0xdb8(%rip),%xmm3
subsd  %xmm3,%xmm1
movsd  0xda4(%rip),%xmm3
subsd  -0x8(%rbp),%xmm3
divsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ge_mi>:
movapd %xmm0,%xmm2
addsd  %xmm1,%xmm2
xorpd  %xmm3,%xmm3
ucomisd %xmm3,%xmm2
jne    111d <ge_mi+0x1d>
jp     111d <ge_mi+0x1d>
movsd  0xf0c(%rip),%xmm0
ret
movapd %xmm0,%xmm3
mulsd  %xmm0,%xmm3
movapd %xmm1,%xmm4
mulsd  %xmm1,%xmm4
subsd  %xmm3,%xmm4
mulsd  0xec7(%rip),%xmm1
addsd  %xmm4,%xmm4
addsd  %xmm1,%xmm4
movsd  0xebf(%rip),%xmm3
movapd %xmm0,%xmm1
mulsd  %xmm3,%xmm1
addsd  %xmm4,%xmm1
addsd  %xmm3,%xmm2
movapd %xmm1,%xmm3
divsd  %xmm2,%xmm3
mulsd  0xea7(%rip),%xmm1
divsd  %xmm2,%xmm1
movsd  0xea3(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm3,%xmm1
subsd  %xmm0,%xmm2
addsd  0xe97(%rip),%xmm0
divsd  %xmm2,%xmm0
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @ge_mi(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
store double %1, double* %4
%6 = load double, double* %4
%7 = load double, double* %3
%8 = fadd double %6, %7
%9 = fcmp oeq double %8, 0.000000e+00
br i1 %9, label %10, label %11
10: ; preds = %2
store double -1.000000e+00, double* %5
br label %55
11: ; preds = %2
%12 = load double, double* %4
%13 = load double, double* %4
%14 = load double, double* %3
%15 = load double, double* %3
%16 = fmul double %14, %15
%17 = fneg double %16
%18 = call double @llvm.fmuladd.f64(double %12, double %13, double %17)
%19 = load double, double* %4
%20 = fmul double 1.500000e+00, %19
%21 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %18, double %20)
%22 = load double, double* %3
%23 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %22, double %21)
%24 = load double, double* %4
%25 = load double, double* %3
%26 = fadd double %24, %25
%27 = fadd double %26, 5.000000e-01
%28 = fdiv double %23, %27
%29 = load double, double* %4
%30 = load double, double* %4
%31 = load double, double* %3
%32 = load double, double* %3
%33 = fmul double %31, %32
%34 = fneg double %33
%35 = call double @llvm.fmuladd.f64(double %29, double %30, double %34)
%36 = load double, double* %4
%37 = fmul double 1.500000e+00, %36
%38 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %35, double %37)
%39 = load double, double* %3
%40 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %39, double %38)
%41 = fmul double 2.500000e-01, %40
%42 = load double, double* %4
%43 = load double, double* %3
%44 = fadd double %42, %43
%45 = fadd double %44, 5.000000e-01
%46 = fdiv double %41, %45
%47 = fsub double 1.000000e+00, %46
%48 = load double, double* %3
%49 = fsub double %48, 1.250000e-01
%50 = load double, double* %3
%51 = fsub double 1.000000e+00, %50
%52 = fdiv double %49, %51
%53 = fneg double %52
%54 = call double @llvm.fmuladd.f64(double %28, double %47, double %53)
store double %54, double* %5
br label %55
55: ; preds = %11, %10
%56 = load double, double* %5
ret double %56
}

LLVM IR (-O2):
define double @ge_mi(double %0, double %1) {
%3 = fadd double %0, %1
%4 = fcmp oeq double %3, 0.000000e+00
br i1 %4, label %22, label %5
5: ; preds = %2
%6 = fneg double %0
%7 = fmul double %6, %0
%8 = tail call double @llvm.fmuladd.f64(double %1, double %1, double %7)
%9 = fmul double %1, 1.500000e+00
%10 = tail call double @llvm.fmuladd.f64(double %8, double 2.000000e+00, double %9)
%11 = tail call double @llvm.fmuladd.f64(double %0, double 5.000000e-01, double %10)
%12 = fadd double %3, 5.000000e-01
%13 = fdiv double %11, %12
%14 = fmul double %11, 2.500000e-01
%15 = fdiv double %14, %12
%16 = fsub double 1.000000e+00, %15
%17 = fadd double %0, -1.250000e-01
%18 = fsub double 1.000000e+00, %0
%19 = fneg double %17
%20 = fdiv double %19, %18
%21 = tail call double @llvm.fmuladd.f64(double %13, double %16, double %20)
br label %22
22: ; preds = %2, %5
%23 = phi double [ %21, %5 ], [ -1.000000e+00, %2 ]
ret double %23
}