// File: /workspace/github_c_makefile_star2_O2/PoulinV[P]AxiCLASS/build/../source/transfer.c
// Function: transfer_source_resample
int transfer_source_resample(
                             struct precision * ppr,
                             struct background * pba,
                             struct perturbations * ppt,
                             struct transfer * ptr,
                             int bin,
                             double * tau0_minus_tau,
                             int tau_size,
                             int index_md,
                             double tau0,
                             double * interpolated_sources,
                             double * sources) {

  /* running index on time */
  int index_tau;

  /* array of values of source */
  double * source_at_tau;

  /* array of source values for a given time and for all k's */
  class_alloc(source_at_tau,
              sizeof(double),
              ptr->error_message);

  /* interpolate the sources linearly at the new time values */
  for (index_tau=0; index_tau<tau_size; index_tau++) {

    class_call(array_interpolate_two(ppt->tau_sampling,
                                     1,
                                     0,
                                     interpolated_sources,
                                     1,
                                     ppt->tau_size,
                                     tau0-tau0_minus_tau[index_tau],
                                     source_at_tau,
                                     1,
                                     ptr->error_message),
               ptr->error_message,
               ptr->error_message);

    /* copy the new values in the output sources array */
    sources[index_tau] = source_at_tau[0];
  }

  /* deallocate the temporary array */
  free(source_at_tau);

  return _SUCCESS_;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x818, %rsp            # imm = 0x818
movsd %xmm0, 0x8(%rsp)
movq %r9, (%rsp)
movq %rcx, %rbx
movq %rdx, %r15
pushq $0x8
popq %rdi
callq 0x8490
addq $0x96a, %rbx            # imm = 0x96A
testq %rax, %rax
je 0xa78f6
movq %rax, %r12
movq %rbx, %r14
movl 0x850(%rsp), %r13d
xorl %ebx, %ebx
testl %r13d, %r13d
cmovlel %ebx, %r13d
pushq $0x1
popq %rbp
cmpq %rbx, %r13
je 0xa793b
movq 0x9f0(%r15), %rdi
movl 0x9f8(%r15), %r9d
movsd 0x8(%rsp), %xmm0
movq (%rsp), %rax
subsd (%rax,%rbx,8), %xmm0
subq $0x8, %rsp
movl %ebp, %esi
xorl %edx, %edx
movq 0x868(%rsp), %rcx
movl %ebp, %r8d
pushq %r14
pushq $0x1
pushq %r12
callq 0x17f36
addq $0x20, %rsp
cmpl $0x1, %eax
je 0xa7947
movsd (%r12), %xmm0
movq 0x868(%rsp), %rax
movsd %xmm0, (%rax,%rbx,8)
incq %rbx
jmp 0xa7891
leaq 0x3d707(%rip), %rsi     # 0xe5004
leaq 0x6ef6a(%rip), %rdx     # 0x11686e
leaq 0x10(%rsp), %r14
pushq $0x8
popq %rcx
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
leaq 0x3d717(%rip), %rsi     # 0xe5034
leaq 0x6ef58(%rip), %rdx     # 0x11687c
movq %rbx, %rdi
movl $0xba2, %ecx            # imm = 0xBA2
movq %r14, %r8
xorl %eax, %eax
callq 0x2e014
pushq $0x1
popq %rbp
jmp 0xa7987
movq %r12, %rdi
callq 0x8430
xorl %ebp, %ebp
jmp 0xa7987
leaq 0x3daa2(%rip), %rsi     # 0xe53f0
leaq 0x6ef40(%rip), %rdx     # 0x116895
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x3d6c6(%rip), %rsi     # 0xe5034
leaq 0x6ef07(%rip), %rdx     # 0x11687c
movq %r14, %rdi
movl $0xbb2, %ecx            # imm = 0xBB2
movq %r15, %r8
xorl %eax, %eax
callq 0x2e014
movl %ebp, %eax
addq $0x818, %rsp            # imm = 0x818
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq