// File: /workspace/github_c_makefile_star2_O1/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 0xb0008
movq %rax, %r12
movl 0x850(%rsp), %eax
testl %eax, %eax
jle 0xafff9
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 0x19f67
addq $0x20, %rsp
cmpl $0x1, %eax
je 0xb0049
movsd (%r12), %xmm0
movq 0x868(%rsp), %rax
movsd %xmm0, (%rax,%r13,8)
incq %r13
cmpq %r13, %rbp
jne 0xaff97
movq %r12, %rdi
callq 0x8410
xorl %eax, %eax
jmp 0xb008e
leaq 0x40ff5(%rip), %rsi     # 0xf1004
leaq 0x72988(%rip), %rdx     # 0x12299e
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movl $0x8, %ecx
xorl %eax, %eax
callq 0x30c2c
addq $0x96a, %rbx            # imm = 0x96A
leaq 0x40ffc(%rip), %rsi     # 0xf1034
leaq 0x7296d(%rip), %rdx     # 0x1229ac
movq %rbx, %rdi
movl $0xba2, %ecx            # imm = 0xBA2
jmp 0xb007f
leaq 0x413a0(%rip), %rsi     # 0xf13f0
leaq 0x7296e(%rip), %rdx     # 0x1229c5
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x40fc4(%rip), %rsi     # 0xf1034
leaq 0x72935(%rip), %rdx     # 0x1229ac
movq %rbx, %rdi
movl $0xbb2, %ecx            # imm = 0xBB2
movq %r14, %r8
xorl %eax, %eax
callq 0x30c2c
movl $0x1, %eax
addq $0x818, %rsp            # imm = 0x818
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq