// File: /workspace/github_c_makefile_star2_O3/PoulinV[P]AxiCLASS/build/../source/transfer.c
// Function: transfer_limber_interpolate
int transfer_limber_interpolate(
                                struct transfer * ptr,
                                double * tau0_minus_tau,
                                double * sources,
                                int tau_size,
                                double tau0_minus_tau_limber,
                                double * S
                                ){

  int index_tau;
  double dS,ddS;

  /** - find  bracketing indices.
      index_tau must be at least 1 (so that index_tau-1 is at least 0)
      and at most tau_size-2 (so that index_tau+1 is at most tau_size-1).
  */
  index_tau=1;
  while ((tau0_minus_tau[index_tau] > tau0_minus_tau_limber) && (index_tau<tau_size-2))
    index_tau++;

  /** - interpolate by fitting a polynomial of order two; get source
      and its first two derivatives. Note that we are not
      interpolating S, but the product S*(tau0-tau). Indeed this
      product is regular in tau=tau0, while S alone diverges for
      lensing. */

  /* the case where the last of the three point is the edge (tau0=tau) must be treated separately, see below */
  if (index_tau < tau_size-2) {

    class_call(array_interpolate_parabola(tau0_minus_tau[index_tau-1],
                                          tau0_minus_tau[index_tau],
                                          tau0_minus_tau[index_tau+1],
                                          tau0_minus_tau_limber,
                                          sources[index_tau-1]*tau0_minus_tau[index_tau-1],
                                          sources[index_tau]*tau0_minus_tau[index_tau],
                                          sources[index_tau+1]*tau0_minus_tau[index_tau+1],
                                          S,
                                          &dS,
                                          &ddS,
                                          ptr->error_message),
               ptr->error_message,
               ptr->error_message);

  }

  /* in this case, we have stored a zero for sources[index_k*tau_size+index_tau+1]. But we can use in very good approximation the fact that S*(tau0-tau) is constant near tau=tau0 and replace sources[index_k*tau_size+index_tau+1]*tau0_minus_tau[index_tau+1] by sources[index_k*tau_size+index_tau]*tau0_minus_tau[index_tau] */
  else {

    class_call(array_interpolate_parabola(tau0_minus_tau[index_tau-1],
                                          tau0_minus_tau[index_tau],
                                          tau0_minus_tau[index_tau+1],
                                          tau0_minus_tau_limber,
                                          sources[index_tau-1]*tau0_minus_tau[index_tau-1],
                                          sources[index_tau]*tau0_minus_tau[index_tau],
                                          sources[index_tau]*tau0_minus_tau[index_tau],
                                          S,
                                          &dS,
                                          &ddS,
                                          ptr->error_message),
               ptr->error_message,
               ptr->error_message);
  }

  return _SUCCESS_;

}

// Assembly:
pushq %r14
pushq %rbx
subq $0x818, %rsp            # imm = 0x818
movapd %xmm0, %xmm3
movq %rdi, %rbx
addl $-0x2, %ecx
movslq %ecx, %rcx
movl $0x1, %eax
movq %rax, %rdi
movsd (%rsi,%rax,8), %xmm1
incq %rax
ucomisd %xmm3, %xmm1
jbe 0xb05d9
cmpq %rcx, %rdi
jl 0xb05c3
movsd -0x10(%rsi,%rax,8), %xmm0
cmpq %rcx, %rdi
jge 0xb0661
movsd (%rsi,%rax,8), %xmm2
movsd -0x10(%rdx,%rax,8), %xmm4
mulsd %xmm0, %xmm4
movsd -0x8(%rdx,%rax,8), %xmm5
mulsd %xmm1, %xmm5
movsd (%rdx,%rax,8), %xmm6
mulsd %xmm2, %xmm6
addq $0x96a, %rbx            # imm = 0x96A
leaq 0x8(%rsp), %rsi
movq %rsp, %rdx
movq %r8, %rdi
movq %rbx, %rcx
callq 0x1acc8
cmpl $0x1, %eax
jne 0xb06e4
leaq 0x3ddc0(%rip), %rsi     # 0xee3f0
leaq 0x6fae9(%rip), %rdx     # 0x120120
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x3d9e4(%rip), %rsi     # 0xee034
leaq 0x6fc04(%rip), %rdx     # 0x12025b
movq %rbx, %rdi
movl $0xedc, %ecx            # imm = 0xEDC
jmp 0xb06d3
movsd (%rsi,%rax,8), %xmm2
movsd -0x10(%rdx,%rax,8), %xmm4
mulsd %xmm0, %xmm4
movsd -0x8(%rdx,%rax,8), %xmm5
mulsd %xmm1, %xmm5
addq $0x96a, %rbx            # imm = 0x96A
leaq 0x8(%rsp), %rsi
movq %rsp, %rdx
movapd %xmm5, %xmm6
movq %r8, %rdi
movq %rbx, %rcx
callq 0x1acc8
cmpl $0x1, %eax
jne 0xb06e4
leaq 0x3dd4c(%rip), %rsi     # 0xee3f0
leaq 0x6fbcc(%rip), %rdx     # 0x120277
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x3d970(%rip), %rsi     # 0xee034
leaq 0x6fb90(%rip), %rdx     # 0x12025b
movq %rbx, %rdi
movl $0xeef, %ecx            # imm = 0xEEF
movq %r14, %r8
xorl %eax, %eax
callq 0x30af0
movl $0x1, %eax
jmp 0xb06e6
xorl %eax, %eax
addq $0x818, %rsp            # imm = 0x818
popq %rbx
popq %r14
retq