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

  /* running index on time */
  int index_tau;

  /* minimum and maximal value of time in new sampled interval */
  double tau_min,tau_mean,tau_max;

  /* time interval for this bin */
  class_call(transfer_selection_times(ppr,
                                      pba,
                                      ppt,
                                      ptr,
                                      bin,
                                      &tau_min,
                                      &tau_mean,
                                      &tau_max),
             ptr->error_message,
             ptr->error_message);

  class_test(tau_size <= 0,
             ptr->error_message,
             "should be at least one");

  /* case selection == dirac */
  if (tau_min == tau_max) {
    class_test(tau_size !=1,
               ptr->error_message,
               "for Dirac selection function tau_size should be 1, not %d",tau_size);
    tau0_minus_tau[0] = pba->conformal_age - tau_mean;
  }
  /* for other cases (gaussian, tophat...) define new sampled values
     of (tau0-tau) with even spacing */
  else {
    for (index_tau=0; index_tau<tau_size-1; index_tau++) {
      tau0_minus_tau[index_tau]=pba->conformal_age-tau_min-((double)index_tau)/((double)tau_size-1.)*(tau_max-tau_min);
    }
    tau0_minus_tau[tau_size-1]=pba->conformal_age-tau_max;
  }

  return _SUCCESS_;

}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x1020, %rsp           # imm = 0x1020
movq %r9, %r14
movq %rcx, %rbx
movq %rsi, %r15
leaq 0x8(%rsp), %rax
leaq 0x10(%rsp), %rcx
leaq 0x18(%rsp), %r9
pushq %rax
pushq %rcx
callq 0xa53d0
popq %rcx
popq %rdx
testl %eax, %eax
je 0xa76e3
addq $0x96a, %rbx            # imm = 0x96A
leaq 0x3dd44(%rip), %rsi     # 0xe53f0
leaq 0x6e9fd(%rip), %rdx     # 0x1160b0
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x3d968(%rip), %rsi     # 0xe5034
leaq 0x6f0f9(%rip), %rdx     # 0x1167cc
movq %rbx, %rdi
movl $0xb28, %ecx            # imm = 0xB28
movq %r14, %r8
jmp 0xa782b
movl 0x1040(%rsp), %edx
testl %edx, %edx
jle 0xa7724
movsd 0x18(%rsp), %xmm1
movsd 0x8(%rsp), %xmm0
ucomisd %xmm0, %xmm1
jne 0xa777f
jp 0xa777f
cmpl $0x1, %edx
jne 0xa77d2
movsd 0x310(%r15), %xmm0
subsd 0x10(%rsp), %xmm0
movsd %xmm0, (%r14)
jmp 0xa77ce
leaq 0x6f0bd(%rip), %rsi     # 0x1167e8
leaq 0x20(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
leaq 0x3d941(%rip), %rsi     # 0xe5082
leaq 0x6f0b7(%rip), %rdx     # 0x1167ff
leaq 0x820(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x2e014
addq $0x96a, %rbx            # imm = 0x96A
leaq 0x3d8c9(%rip), %rsi     # 0xe5034
leaq 0x6f05a(%rip), %rdx     # 0x1167cc
movq %rbx, %rdi
movl $0xb2c, %ecx            # imm = 0xB2C
jmp 0xa7828
cvtsi2sd %edx, %xmm2
addsd 0x3e05d(%rip), %xmm2    # 0xe57e8
decl %edx
movapd %xmm0, %xmm3
subsd %xmm1, %xmm3
xorl %eax, %eax
movsd 0x310(%r15), %xmm4
cmpq %rax, %rdx
je 0xa77c4
subsd %xmm1, %xmm4
cvtsi2sd %eax, %xmm5
divsd %xmm2, %xmm5
mulsd %xmm3, %xmm5
subsd %xmm5, %xmm4
movsd %xmm4, (%r14,%rax,8)
incq %rax
jmp 0xa7797
subsd %xmm0, %xmm4
movsd %xmm4, (%r14,%rdx,8)
xorl %eax, %eax
jmp 0xa7835
leaq 0x6f034(%rip), %rsi     # 0x11680d
leaq 0x20(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
leaq 0x3d893(%rip), %rsi     # 0xe5082
leaq 0x6f051(%rip), %rdx     # 0x116847
leaq 0x820(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x2e014
addq $0x96a, %rbx            # imm = 0x96A
leaq 0x3d81b(%rip), %rsi     # 0xe5034
leaq 0x6efac(%rip), %rdx     # 0x1167cc
movq %rbx, %rdi
movl $0xb32, %ecx            # imm = 0xB32
movq %r15, %r8
xorl %eax, %eax
callq 0x2e014
pushq $0x1
popq %rax
addq $0x1020, %rsp           # imm = 0x1020
popq %rbx
popq %r14
popq %r15
retq