double cox_deboor(unsigned int n, unsigned int p, const double t[n + 1],
                  const double v[n + 1 - p], double x) {
  int i = find_span(n, t, x);
  return cox_deboor_i(x, p, p, t + i - p, v + i - p);
}


x86 assembly (clang, -O0):
<cox_deboor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
movsd  -0x20(%rbp),%xmm0
mov    $0x1,%al
call   1040 <find_span@plt>
mov    %eax,-0x24(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
movslq -0x24(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
xor    %eax,%eax
sub    %rcx,%rax
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x18(%rbp),%rcx
movslq -0x24(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rcx
mov    -0x8(%rbp),%eax
mov    %eax,%r8d
xor    %eax,%eax
sub    %r8,%rax
shl    $0x3,%rax
add    %rax,%rcx
mov    $0x1,%al
call   1030 <cox_deboor_i@plt>
cvtsi2sd %eax,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cox_deboor>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
movsd  %xmm0,0x8(%rsp)
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %esi,%ebp
mov    %rdx,%rsi
mov    $0x1,%al
call   1040 <find_span@plt>
cltq
lea    (%rbx,%rax,8),%rdx
mov    %ebp,%esi
shl    $0x3,%rsi
sub    %rsi,%rdx
lea    (%r14,%rax,8),%rcx
sub    %rsi,%rcx
movsd  0x8(%rsp),%xmm0
mov    %ebp,%edi
mov    %ebp,%esi
mov    $0x1,%al
call   1030 <cox_deboor_i@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define double @cox_deboor(i32 %0, i32 %1, double* %2, double* %3, double %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca double*
%9 = alloca double*
%10 = alloca double
%11 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store double* %2, double** %8
store double* %3, double** %9
store double %4, double* %10
%12 = load i32, i32* %6
%13 = add i32 %12, 1
%14 = zext i32 %13 to i64
%15 = load i32, i32* %6
%16 = add i32 %15, 1
%17 = load i32, i32* %7
%18 = sub i32 %16, %17
%19 = zext i32 %18 to i64
%20 = load i32, i32* %6
%21 = load double*, double** %8
%22 = load double, double* %10
%23 = call i32 (i32, double*, double, ...) bitcast (i32 (...)* @find_span to i32 (i32, double*, double, ...)*)(i32 %20, double* %21, double %22)
store i32 %23, i32* %11
%24 = load double, double* %10
%25 = load i32, i32* %7
%26 = load i32, i32* %7
%27 = load double*, double** %8
%28 = load i32, i32* %11
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds double, double* %27, i64 %29
%31 = load i32, i32* %7
%32 = zext i32 %31 to i64
%33 = sub i64 0, %32
%34 = getelementptr inbounds double, double* %30, i64 %33
%35 = load double*, double** %9
%36 = load i32, i32* %11
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds double, double* %35, i64 %37
%39 = load i32, i32* %7
%40 = zext i32 %39 to i64
%41 = sub i64 0, %40
%42 = getelementptr inbounds double, double* %38, i64 %41
%43 = call i32 (double, i32, i32, double*, double*, ...) bitcast (i32 (...)* @cox_deboor_i to i32 (double, i32, i32, double*, double*, ...)*)(double %24, i32 %25, i32 %26, double* %34, double* %42)
%44 = sitofp i32 %43 to double
ret double %44
}

LLVM IR (-O2):
define double @cox_deboor(i32 %0, i32 %1, double* %2, double* %3, double %4) {
%6 = tail call i32 (i32, double*, double, ...) bitcast (i32 (...)* @find_span to i32 (i32, double*, double, ...)*)(i32 %0, double* %2, double %4)
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds double, double* %2, i64 %7
%9 = zext i32 %1 to i64
%10 = sub nsw i64 0, %9
%11 = getelementptr inbounds double, double* %8, i64 %10
%12 = getelementptr inbounds double, double* %3, i64 %7
%13 = getelementptr inbounds double, double* %12, i64 %10
%14 = tail call i32 (double, i32, i32, double*, double*, ...) bitcast (i32 (...)* @cox_deboor_i to i32 (double, i32, i32, double*, double*, ...)*)(double %4, i32 %1, i32 %1, double* %11, double* %13)
%15 = sitofp i32 %14 to double
ret double %15
}