double probtree(double atatime, int N, double numdraws) {
  int h, L;
  double res1, res2, res3, res4, result1, result2;
  double fract1, fract2;
  h = (int)atatime;
  L = (int)numdraws;
  fract1 = atatime - (double)h;
  fract2 = numdraws - (double)L;
  res1 = getptree(h, L, N);
  h++;
  res2 = getptree(h, L, N);
  result1 = res1 + (fract1) * (res2 - res1);
  h--;
  L++;
  res3 = getptree(h, L, N);
  h++;
  res4 = getptree(h, L, N);
  result2 = res3 + (fract1) * (res4 - res3);
  return (result1 + (fract2) * (result2 - result1));
}


x86 assembly (clang, -O0):
<probtree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
movsd  %xmm1,-0x18(%rbp)
cvttsd2si -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cvttsd2si -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
cvtsi2sdl -0x1c(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x18(%rbp),%xmm0
cvtsi2sdl -0x20(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    $0x0,%al
call   1030 <getptree@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    $0x0,%al
call   1030 <getptree@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
subsd  -0x28(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    $0x0,%al
call   1030 <getptree@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    $0x0,%al
call   1030 <getptree@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
subsd  -0x38(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x48(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
subsd  -0x48(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<probtree>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %edi,%r14d
cvttsd2si %xmm0,%ebx
cvttsd2si %xmm1,%ebp
cvttpd2dq %xmm0,%xmm2
cvtdq2pd %xmm2,%xmm3
cvttpd2dq %xmm1,%xmm2
subsd  %xmm3,%xmm0
movapd %xmm0,0x10(%rsp)
cvtdq2pd %xmm2,%xmm0
subsd  %xmm0,%xmm1
movapd %xmm1,0x20(%rsp)
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1030 <getptree@plt>
mov    %eax,%r15d
lea    0x1(%rbx),%r12d
mov    %r12d,%edi
mov    %ebp,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1030 <getptree@plt>
mov    %eax,%r13d
add    $0x1,%ebp
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1030 <getptree@plt>
movd   %r15d,%xmm0
movd   %eax,%xmm1
punpckldq %xmm0,%xmm1
cvtdq2pd %xmm1,%xmm0
movaps %xmm0,(%rsp)
mov    %r12d,%edi
mov    %ebp,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1030 <getptree@plt>
movd   %r13d,%xmm0
movd   %eax,%xmm1
punpckldq %xmm0,%xmm1
cvtdq2pd %xmm1,%xmm1
movapd (%rsp),%xmm2
subpd  %xmm2,%xmm1
movapd 0x10(%rsp),%xmm0
unpcklpd %xmm0,%xmm0
mulpd  %xmm1,%xmm0
addpd  %xmm2,%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
subsd  %xmm1,%xmm0
mulsd  0x20(%rsp),%xmm0
addsd  %xmm1,%xmm0
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @probtree(double %0, i32 %1, double %2) {
%4 = alloca double
%5 = alloca i32
%6 = alloca double
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
store double %0, double* %4
store i32 %1, i32* %5
store double %2, double* %6
%17 = load double, double* %4
%18 = fptosi double %17 to i32
store i32 %18, i32* %7
%19 = load double, double* %6
%20 = fptosi double %19 to i32
store i32 %20, i32* %8
%21 = load double, double* %4
%22 = load i32, i32* %7
%23 = sitofp i32 %22 to double
%24 = fsub double %21, %23
store double %24, double* %15
%25 = load double, double* %6
%26 = load i32, i32* %8
%27 = sitofp i32 %26 to double
%28 = fsub double %25, %27
store double %28, double* %16
%29 = load i32, i32* %7
%30 = load i32, i32* %8
%31 = load i32, i32* %5
%32 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @getptree to i32 (i32, i32, i32, ...)*)(i32 %29, i32 %30, i32 %31)
%33 = sitofp i32 %32 to double
store double %33, double* %9
%34 = load i32, i32* %7
%35 = add nsw i32 %34, 1
store i32 %35, i32* %7
%36 = load i32, i32* %7
%37 = load i32, i32* %8
%38 = load i32, i32* %5
%39 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @getptree to i32 (i32, i32, i32, ...)*)(i32 %36, i32 %37, i32 %38)
%40 = sitofp i32 %39 to double
store double %40, double* %10
%41 = load double, double* %9
%42 = load double, double* %15
%43 = load double, double* %10
%44 = load double, double* %9
%45 = fsub double %43, %44
%46 = call double @llvm.fmuladd.f64(double %42, double %45, double %41)
store double %46, double* %13
%47 = load i32, i32* %7
%48 = add nsw i32 %47, -1
store i32 %48, i32* %7
%49 = load i32, i32* %8
%50 = add nsw i32 %49, 1
store i32 %50, i32* %8
%51 = load i32, i32* %7
%52 = load i32, i32* %8
%53 = load i32, i32* %5
%54 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @getptree to i32 (i32, i32, i32, ...)*)(i32 %51, i32 %52, i32 %53)
%55 = sitofp i32 %54 to double
store double %55, double* %11
%56 = load i32, i32* %7
%57 = add nsw i32 %56, 1
store i32 %57, i32* %7
%58 = load i32, i32* %7
%59 = load i32, i32* %8
%60 = load i32, i32* %5
%61 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @getptree to i32 (i32, i32, i32, ...)*)(i32 %58, i32 %59, i32 %60)
%62 = sitofp i32 %61 to double
store double %62, double* %12
%63 = load double, double* %11
%64 = load double, double* %15
%65 = load double, double* %12
%66 = load double, double* %11
%67 = fsub double %65, %66
%68 = call double @llvm.fmuladd.f64(double %64, double %67, double %63)
store double %68, double* %14
%69 = load double, double* %13
%70 = load double, double* %16
%71 = load double, double* %14
%72 = load double, double* %13
%73 = fsub double %71, %72
%74 = call double @llvm.fmuladd.f64(double %70, double %73, double %69)
ret double %74
}

LLVM IR (-O2):
define double @probtree(double %0, i32 %1, double %2) {
%4 = fptosi double %0 to i32
%5 = fptosi double %2 to i32
%6 = sitofp i32 %4 to double
%7 = fsub double %0, %6
%8 = sitofp i32 %5 to double
%9 = fsub double %2, %8
%10 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @getptree to i32 (i32, i32, i32, ...)*)(i32 %4, i32 %5, i32 %1)
%11 = add nsw i32 %4, 1
%12 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @getptree to i32 (i32, i32, i32, ...)*)(i32 %11, i32 %5, i32 %1)
%13 = add nsw i32 %5, 1
%14 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @getptree to i32 (i32, i32, i32, ...)*)(i32 %4, i32 %13, i32 %1)
%15 = insertelement <2 x i32> poison, i32 %14, i64 0
%16 = insertelement <2 x i32> %15, i32 %10, i64 1
%17 = sitofp <2 x i32> %16 to <2 x double>
%18 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @getptree to i32 (i32, i32, i32, ...)*)(i32 %11, i32 %13, i32 %1)
%19 = insertelement <2 x i32> poison, i32 %18, i64 0
%20 = insertelement <2 x i32> %19, i32 %12, i64 1
%21 = sitofp <2 x i32> %20 to <2 x double>
%22 = fsub <2 x double> %21, %17
%23 = insertelement <2 x double> poison, double %7, i64 0
%24 = shufflevector <2 x double> %23, <2 x double> poison, <2 x i32> zeroinitializer
%25 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %24, <2 x double> %22, <2 x double> %17)
%26 = extractelement <2 x double> %25, i64 0
%27 = extractelement <2 x double> %25, i64 1
%28 = fsub double %26, %27
%29 = tail call double @llvm.fmuladd.f64(double %9, double %28, double %27)
ret double %29
}