// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x1068, %rsp           # imm = 0x1068
movq %rdi, 0x1058(%rsp)
movq %rsi, 0x1050(%rsp)
movq %rdx, 0x1048(%rsp)
movl %ecx, 0x1044(%rsp)
movsd %xmm0, 0x1038(%rsp)
movq %r8, 0x1030(%rsp)
movl $0x1, 0x102c(%rsp)
movq 0x1050(%rsp), %rax
movslq 0x102c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
xorl %eax, %eax
ucomisd 0x1038(%rsp), %xmm0
movb %al, 0xf(%rsp)
jbe 0x146fb2
movl 0x102c(%rsp), %eax
movl 0x1044(%rsp), %ecx
subl $0x2, %ecx
cmpl %ecx, %eax
setl %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
testb $0x1, %al
jne 0x146fbc
jmp 0x146fcf
movl 0x102c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x102c(%rsp)
jmp 0x146f72
movl 0x102c(%rsp), %eax
movl 0x1044(%rsp), %ecx
subl $0x2, %ecx
cmpl %ecx, %eax
jge 0x14716f
movq 0x1050(%rsp), %rax
movl 0x102c(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x1050(%rsp), %rax
movslq 0x102c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq 0x1050(%rsp), %rax
movl 0x102c(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm2
movsd 0x1038(%rsp), %xmm3
movq 0x1048(%rsp), %rax
movl 0x102c(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm4
movq 0x1050(%rsp), %rax
movl 0x102c(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
mulsd (%rax,%rcx,8), %xmm4
movq 0x1048(%rsp), %rax
movslq 0x102c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm5
movq 0x1050(%rsp), %rax
movslq 0x102c(%rsp), %rcx
mulsd (%rax,%rcx,8), %xmm5
movq 0x1048(%rsp), %rax
movl 0x102c(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm6
movq 0x1050(%rsp), %rax
movl 0x102c(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
mulsd (%rax,%rcx,8), %xmm6
movq 0x1030(%rsp), %rdi
movq 0x1058(%rsp), %rcx
addq $0x96a, %rcx            # imm = 0x96A
leaq 0x1020(%rsp), %rsi
leaq 0x1018(%rsp), %rdx
callq 0x29a40
cmpl $0x1, %eax
jne 0x14716a
leaq 0x810(%rsp), %rdi
movq 0x1058(%rsp), %rcx
addq $0x96a, %rcx            # imm = 0x96A
leaq 0x8b2bd(%rip), %rsi     # 0x1d23d8
leaq 0xbd5c0(%rip), %rdx     # 0x2046e2
movb $0x0, %al
callq 0x5b9c0
movq 0x1058(%rsp), %rdi
addq $0x96a, %rdi            # imm = 0x96A
leaq 0x810(%rsp), %r8
leaq 0x8aeed(%rip), %rsi     # 0x1d2034
leaq 0xbd6cf(%rip), %rdx     # 0x20481d
movl $0xedc, %ecx            # imm = 0xEDC
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x1064(%rsp)
jmp 0x1472eb
jmp 0x1472e0
movq 0x1050(%rsp), %rax
movl 0x102c(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x1050(%rsp), %rax
movslq 0x102c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq 0x1050(%rsp), %rax
movl 0x102c(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm2
movsd 0x1038(%rsp), %xmm3
movq 0x1048(%rsp), %rax
movl 0x102c(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm4
movq 0x1050(%rsp), %rax
movl 0x102c(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
mulsd (%rax,%rcx,8), %xmm4
movq 0x1048(%rsp), %rax
movslq 0x102c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm5
movq 0x1050(%rsp), %rax
movslq 0x102c(%rsp), %rcx
mulsd (%rax,%rcx,8), %xmm5
movq 0x1048(%rsp), %rax
movslq 0x102c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm6
movq 0x1050(%rsp), %rax
movslq 0x102c(%rsp), %rcx
mulsd (%rax,%rcx,8), %xmm6
movq 0x1030(%rsp), %rdi
movq 0x1058(%rsp), %rcx
addq $0x96a, %rcx            # imm = 0x96A
leaq 0x1020(%rsp), %rsi
leaq 0x1018(%rsp), %rdx
callq 0x29a40
cmpl $0x1, %eax
jne 0x1472de
leaq 0x10(%rsp), %rdi
movq 0x1058(%rsp), %rcx
addq $0x96a, %rcx            # imm = 0x96A
leaq 0x8b143(%rip), %rsi     # 0x1d23d8
leaq 0xbd59d(%rip), %rdx     # 0x204839
movb $0x0, %al
callq 0x5b9c0
movq 0x1058(%rsp), %rdi
addq $0x96a, %rdi            # imm = 0x96A
leaq 0x10(%rsp), %r8
leaq 0x8ad76(%rip), %rsi     # 0x1d2034
leaq 0xbd558(%rip), %rdx     # 0x20481d
movl $0xeef, %ecx            # imm = 0xEEF
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x1064(%rsp)
jmp 0x1472eb
jmp 0x1472e0
movl $0x0, 0x1064(%rsp)
movl 0x1064(%rsp), %eax
addq $0x1068, %rsp           # imm = 0x1068
retq
nopw (%rax,%rax)