// File: /workspace/github_c_makefile_star2_O1/PoulinV[P]AxiCLASS/build/../source/perturbations.c
// Function: perturbations_sources_at_tau
int perturbations_sources_at_tau(
                                 struct perturbations * ppt,
                                 int index_md,
                                 int index_ic,
                                 int index_tp,
                                 double tau,
                                 double * psource_at_tau
                                 ) {

  /** Summary: */

  /** - define local variables */

  int last_index;
  double logtau;

  short do_spline = _FALSE_;

  logtau = log(tau);

  /** - If we have defined a z_max_pk > 0, then we have already an
     array of sources and of their second derivative with respect to
     time in the range 0 < z < z_max_pk, that can be used for an
     accurate spline interpolation at a given tau. Check whether we
     are in this situation and whether the value of tau is in the
     right range. */

  if (ppt->ln_tau_size > 1) {
    if (logtau >= ppt->ln_tau[0]) {
      do_spline = _TRUE_;
    }
  }

  /** - If yes, we do such a spline */

  if (do_spline == _TRUE_) {

    class_call(array_interpolate_spline(ppt->ln_tau,
                                        ppt->ln_tau_size,
                                        ppt->late_sources[index_md][index_ic * ppt->tp_size[index_md] + index_tp],
                                        ppt->ddlate_sources[index_md][index_ic*ppt->tp_size[index_md] + index_tp],
                                        ppt->k_size[index_md],
                                        logtau,
                                        &last_index,
                                        psource_at_tau,
                                        ppt->k_size[index_md],
                                        ppt->error_message),
               ppt->error_message,
               ppt->error_message);
  }


  /** - otherwise, we just go for a quick linear interpolation. This
        is made available for developpers for completeness, but it is
        actually never used by the default version of CLASS */

  else {

    class_call(array_interpolate_two_bis(ppt->tau_sampling,
                                         1,
                                         0,
                                         ppt->sources[index_md][index_ic*ppt->tp_size[index_md]+index_tp],
                                         ppt->k_size[index_md],
                                         ppt->tau_size,
                                         tau,
                                         psource_at_tau,
                                         ppt->k_size[index_md],
                                         ppt->error_message),
               ppt->error_message,
               ppt->error_message);
  }

  return _SUCCESS_;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x810, %rsp            # imm = 0x810
movq %r8, %r14
movl %ecx, %r15d
movl %edx, %ebp
movl %esi, %r12d
movq %rdi, %rbx
movsd %xmm0, (%rsp)
callq 0x82c0
movl 0xa60(%rbx), %esi
cmpl $0x2, %esi
jl 0x742eb
movq 0xa58(%rbx), %rdi
ucomisd (%rdi), %xmm0
jae 0x74393
movq 0x9f0(%rbx), %rdi
movq 0xa38(%rbx), %rax
movslq %r12d, %rdx
movq (%rax,%rdx,8), %rax
movq 0x998(%rbx), %rcx
movq 0x9c8(%rbx), %rsi
imull (%rcx,%rdx,4), %ebp
addl %r15d, %ebp
movslq %ebp, %rcx
movq (%rax,%rcx,8), %rcx
movl (%rsi,%rdx,4), %r8d
movl 0x9f8(%rbx), %r9d
addq $0x6c8a, %rbx           # imm = 0x6C8A
subq $0x8, %rsp
xorl %ebp, %ebp
movl $0x1, %esi
xorl %edx, %edx
movsd 0x8(%rsp), %xmm0
pushq %rbx
pushq %r8
pushq %r14
callq 0x1a24f
addq $0x20, %rsp
cmpl $0x1, %eax
jne 0x7443b
leaq 0x7d091(%rip), %rsi     # 0xf13f0
leaq 0xa198c(%rip), %rdx     # 0x115cf2
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x7ccb5(%rip), %rsi     # 0xf1034
leaq 0xa194f(%rip), %rdx     # 0x115cd5
movq %rbx, %rdi
movl $0x73, %ecx
jmp 0x7442c
movq 0xa68(%rbx), %rax
movslq %r12d, %r8
movq (%rax,%r8,8), %rax
movq 0x998(%rbx), %rcx
movq 0x9c8(%rbx), %r9
imull (%rcx,%r8,4), %ebp
addl %r15d, %ebp
movslq %ebp, %rcx
movq (%rax,%rcx,8), %rdx
movq 0xa70(%rbx), %rax
movq (%rax,%r8,8), %rax
movq (%rax,%rcx,8), %rcx
movl (%r9,%r8,4), %r8d
addq $0x6c8a, %rbx           # imm = 0x6C8A
subq $0x8, %rsp
leaq 0x14(%rsp), %r9
pushq %rbx
pushq %r8
pushq %r14
callq 0x17ee6
addq $0x20, %rsp
xorl %ebp, %ebp
cmpl $0x1, %eax
jne 0x7443b
leaq 0x7cff3(%rip), %rsi     # 0xf13f0
leaq 0xa179c(%rip), %rdx     # 0x115ba0
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x7cc17(%rip), %rsi     # 0xf1034
leaq 0xa18b1(%rip), %rdx     # 0x115cd5
movq %rbx, %rdi
movl $0x5e, %ecx
movq %r14, %r8
xorl %eax, %eax
callq 0x30c2c
movl $0x1, %ebp
movl %ebp, %eax
addq $0x810, %rsp            # imm = 0x810
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq