// File: /workspace/github_c_makefile_star2_O2/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 0x82e0
movl 0xa60(%rbx), %esi
cmpl $0x2, %esi
jl 0x6d1d7
movq 0xa58(%rbx), %rdi
ucomisd (%rdi), %xmm0
jae 0x6d28b
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
pushq $0x1
popq %rbp
xorl %r15d, %r15d
movl %ebp, %esi
xorl %edx, %edx
movsd 0x8(%rsp), %xmm0
pushq %rbx
pushq %r8
pushq %r14
callq 0x181f8
addq $0x20, %rsp
cmpl $0x1, %eax
jne 0x6d331
leaq 0x781a4(%rip), %rsi     # 0xe53f0
leaq 0x9c97f(%rip), %rdx     # 0x109bd2
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x77dc8(%rip), %rsi     # 0xe5034
leaq 0x9c942(%rip), %rdx     # 0x109bb5
pushq $0x73
popq %rcx
movq %rbx, %rdi
movq %r14, %r8
xorl %eax, %eax
callq 0x2e014
movl %ebp, %r15d
jmp 0x6d331
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 0x1604b
addq $0x20, %rsp
xorl %r15d, %r15d
cmpl $0x1, %eax
jne 0x6d331
leaq 0x780fa(%rip), %rsi     # 0xe53f0
leaq 0x9c783(%rip), %rdx     # 0x109a80
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x77d1e(%rip), %rsi     # 0xe5034
leaq 0x9c898(%rip), %rdx     # 0x109bb5
pushq $0x5e
popq %rcx
movq %rbx, %rdi
movq %r14, %r8
xorl %eax, %eax
callq 0x2e014
pushq $0x1
popq %r15
movl %r15d, %eax
addq $0x810, %rsp            # imm = 0x810
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq