// File: /workspace/github_c_makefile_star2_O1/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 0xad8dd
addq $0x10, %rsp
testl %eax, %eax
je 0xafdd7
addq $0x96a, %rbx            # imm = 0x96A
leaq 0x41650(%rip), %rsi     # 0xf13f0
leaq 0x72439(%rip), %rdx     # 0x1221e0
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x41274(%rip), %rsi     # 0xf1034
leaq 0x72b35(%rip), %rdx     # 0x1228fc
movq %rbx, %rdi
movl $0xb28, %ecx            # imm = 0xB28
movq %r14, %r8
jmp 0xaff31
movl 0x1040(%rsp), %edx
testl %edx, %edx
jle 0xafe18
movsd 0x18(%rsp), %xmm1
movsd 0x8(%rsp), %xmm0
ucomisd %xmm0, %xmm1
jne 0xafe73
jp 0xafe73
cmpl $0x1, %edx
jne 0xafed8
movsd 0x310(%r15), %xmm0
subsd 0x10(%rsp), %xmm0
movsd %xmm0, (%r14)
jmp 0xafed4
leaq 0x72af9(%rip), %rsi     # 0x122918
leaq 0x20(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30c2c
leaq 0x4124d(%rip), %rsi     # 0xf1082
leaq 0x72af3(%rip), %rdx     # 0x12292f
leaq 0x820(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c2c
addq $0x96a, %rbx            # imm = 0x96A
leaq 0x411d5(%rip), %rsi     # 0xf1034
leaq 0x72a96(%rip), %rdx     # 0x1228fc
movq %rbx, %rdi
movl $0xb2c, %ecx            # imm = 0xB2C
jmp 0xaff2e
leal -0x1(%rdx), %eax
movl %eax, %eax
cmpl $0x1, %edx
je 0xafec1
cvtsi2sd %edx, %xmm2
addsd 0x4195f(%rip), %xmm2    # 0xf17e8
movapd %xmm0, %xmm3
subsd %xmm1, %xmm3
xorl %ecx, %ecx
movsd 0x310(%r15), %xmm4
subsd %xmm1, %xmm4
xorps %xmm5, %xmm5
cvtsi2sd %ecx, %xmm5
divsd %xmm2, %xmm5
mulsd %xmm3, %xmm5
subsd %xmm5, %xmm4
movsd %xmm4, (%r14,%rcx,8)
incq %rcx
cmpq %rcx, %rax
jne 0xafe93
movsd 0x310(%r15), %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, (%r14,%rax,8)
xorl %eax, %eax
jmp 0xaff3d
leaq 0x72a5e(%rip), %rsi     # 0x12293d
leaq 0x20(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30c2c
leaq 0x4118d(%rip), %rsi     # 0xf1082
leaq 0x72a7b(%rip), %rdx     # 0x122977
leaq 0x820(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c2c
addq $0x96a, %rbx            # imm = 0x96A
leaq 0x41115(%rip), %rsi     # 0xf1034
leaq 0x729d6(%rip), %rdx     # 0x1228fc
movq %rbx, %rdi
movl $0xb32, %ecx            # imm = 0xB32
movq %r15, %r8
xorl %eax, %eax
callq 0x30c2c
movl $0x1, %eax
addq $0x1020, %rsp           # imm = 0x1020
popq %rbx
popq %r14
popq %r15
retq