// File: /workspace/github_c_makefile_star2_O3/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, %r14
movq %rcx, %rbx
movq %rdx, %r15
movl $0x8, %edi
callq 0x8460
testq %rax, %rax
je 0xacfa5
movq %rax, %r12
movl 0x850(%rsp), %eax
testl %eax, %eax
jle 0xacf96
addq $0x96a, %rbx            # imm = 0x96A
movl %eax, %ebp
xorl %r13d, %r13d
movq 0x9f0(%r15), %rdi
movl 0x9f8(%r15), %r9d
movsd 0x8(%rsp), %xmm0
subsd (%r14,%r13,8), %xmm0
subq $0x8, %rsp
movl $0x1, %esi
xorl %edx, %edx
movq 0x868(%rsp), %rcx
movl $0x1, %r8d
pushq %rbx
pushq $0x1
pushq %r12
callq 0x1a08a
addq $0x20, %rsp
cmpl $0x1, %eax
je 0xacfe6
movsd (%r12), %xmm0
movq 0x868(%rsp), %rax
movsd %xmm0, (%rax,%r13,8)
incq %r13
cmpq %r13, %rbp
jne 0xacf34
movq %r12, %rdi
callq 0x8410
xorl %eax, %eax
jmp 0xad02b
leaq 0x41058(%rip), %rsi     # 0xee004
leaq 0x72a2b(%rip), %rdx     # 0x11f9de
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movl $0x8, %ecx
xorl %eax, %eax
callq 0x30af0
addq $0x96a, %rbx            # imm = 0x96A
leaq 0x4105f(%rip), %rsi     # 0xee034
leaq 0x72a10(%rip), %rdx     # 0x11f9ec
movq %rbx, %rdi
movl $0xba2, %ecx            # imm = 0xBA2
jmp 0xad01c
leaq 0x41403(%rip), %rsi     # 0xee3f0
leaq 0x72a11(%rip), %rdx     # 0x11fa05
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x41027(%rip), %rsi     # 0xee034
leaq 0x729d8(%rip), %rdx     # 0x11f9ec
movq %rbx, %rdi
movl $0xbb2, %ecx            # imm = 0xBB2
movq %r14, %r8
xorl %eax, %eax
callq 0x30af0
movl $0x1, %eax
addq $0x818, %rsp            # imm = 0x818
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq