// File: /workspace/github_c_makefile_star2_O3/PoulinV[P]AxiCLASS/build/../source/transfer.c
// Function: transfer_f_evo
int transfer_f_evo(
                   struct background* pba,
                   struct transfer * ptr,
                   double* pvecback,
                   int last_index,
                   double cotKgen, /* Should be FILLED with values of corresponding time */
                   double* f_evo
                   ){
  /* Allocate temporary variables for calculation of f_evo */
  double z;
  double dNdz;
  double dln_dNdz_dz;
  double temp_f_evo;

  if ((ptr->has_nz_evo_file == _TRUE_) || (ptr->has_nz_evo_analytic == _TRUE_)){

    temp_f_evo = 2./pvecback[pba->index_bg_H]/pvecback[pba->index_bg_a]*cotKgen
      + pvecback[pba->index_bg_H_prime]/pvecback[pba->index_bg_H]/pvecback[pba->index_bg_H]/pvecback[pba->index_bg_a];

    /* z = a_0/a-1 (remember that a in the code is in fact a/a_0) */
    z = 1./pvecback[pba->index_bg_a]-1.;

    if (ptr->has_nz_evo_file ==_TRUE_) {

      class_test((z<ptr->nz_evo_z[0]) || (z>ptr->nz_evo_z[ptr->nz_evo_size-1]),
                 ptr->error_message,
                 "Your input file for the selection function only covers the redshift range [%f : %f]. However, your input for the selection function requires z=%f",
                 ptr->nz_evo_z[0],
                 ptr->nz_evo_z[ptr->nz_evo_size-1],
                 z);


      class_call(array_interpolate_spline(
                                          ptr->nz_evo_z,
                                          ptr->nz_evo_size,
                                          ptr->nz_evo_dlog_nz,
                                          ptr->nz_evo_dd_dlog_nz,
                                          1,
                                          z,
                                          &last_index,
                                          &dln_dNdz_dz,
                                          1,
                                          ptr->error_message),
                 ptr->error_message,
                 ptr->error_message);

    }
    else {

      class_call(transfer_dNdz_analytic(ptr,
                                        z,
                                        &dNdz,
                                        &dln_dNdz_dz),
                 ptr->error_message,
                 ptr->error_message);
    }

    temp_f_evo -= dln_dNdz_dz/pvecback[pba->index_bg_a];
  }
  else {
    temp_f_evo = 0.;
  }

  /* after obtaining f_evo, store it in output */
  *f_evo = temp_f_evo;

  return _SUCCESS_;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1040, %rsp           # imm = 0x1040
movq %r8, %rbx
movapd %xmm0, %xmm2
movq %rdx, %r14
movq %rdi, %r15
movl %ecx, 0xc(%rsp)
movzwl 0x778(%rsi), %eax
cmpw $0x1, %ax
je 0xb1d52
xorpd %xmm3, %xmm3
cmpw $0x1, 0x77a(%rsi)
jne 0xb1f2b
movslq 0x384(%r15), %rcx
movsd (%r14,%rcx,8), %xmm4
movslq 0x380(%r15), %rcx
movsd (%r14,%rcx,8), %xmm5
movslq 0x388(%r15), %rcx
movsd (%r14,%rcx,8), %xmm3
movsd 0x3c4df(%rip), %xmm6    # 0xee260
divsd %xmm5, %xmm6
addsd 0x3ca5b(%rip), %xmm6    # 0xee7e8
cmpw $0x1, %ax
jne 0xb1e6f
movq 0x880(%rsi), %rdi
movsd (%rdi), %xmm0
leaq 0x96a(%rsi), %r12
ucomisd %xmm6, %xmm0
movslq 0x87c(%rsi), %rax
movsd -0x8(%rdi,%rax,8), %xmm1
ja 0xb1f33
ucomisd %xmm1, %xmm6
ja 0xb1f33
movsd %xmm5, 0x10(%rsp)
movsd %xmm4, 0x18(%rsp)
movsd %xmm3, 0x20(%rsp)
movsd %xmm2, 0x28(%rsp)
movq 0x890(%rsi), %rdx
movq 0x898(%rsi), %rcx
subq $0x8, %rsp
leaq 0x48(%rsp), %r10
movl $0x1, %ebp
leaq 0x14(%rsp), %r9
movl %eax, %esi
movl $0x1, %r8d
movapd %xmm6, %xmm0
pushq %r12
pushq $0x1
pushq %r10
callq 0x18071
addq $0x20, %rsp
cmpl $0x1, %eax
jne 0xb1fa7
leaq 0x3c5c2(%rip), %rsi     # 0xee3f0
leaq 0x6f340(%rip), %rdx     # 0x121175
leaq 0x840(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x3c1e3(%rip), %rsi     # 0xee034
leaq 0x6f30e(%rip), %rdx     # 0x121166
movq %r12, %rdi
movl $0x14d7, %ecx           # imm = 0x14D7
movq %rbx, %r8
xorl %eax, %eax
callq 0x30af0
jmp 0xb1f95
movsd %xmm5, 0x10(%rsp)
movsd %xmm4, 0x18(%rsp)
movsd %xmm3, 0x20(%rsp)
movsd %xmm2, 0x28(%rsp)
movapd %xmm6, %xmm0
divsd 0x6c4bd(%rip), %xmm0    # 0x11e350
movsd %xmm0, 0x30(%rsp)
movsd 0x3f127(%rip), %xmm1    # 0xf0fc8
movsd %xmm6, 0x38(%rsp)
callq 0x8620
xorpd 0x3c37c(%rip), %xmm0    # 0xee230
callq 0x8670
movsd 0x30(%rsp), %xmm0
movsd 0x3f101(%rip), %xmm1    # 0xf0fc8
callq 0x8620
movsd 0x3ce2c(%rip), %xmm3    # 0xeed00
mulsd 0x3f0ec(%rip), %xmm0    # 0xf0fc8
movapd %xmm3, %xmm1
subsd %xmm0, %xmm1
divsd 0x38(%rsp), %xmm1
movsd 0x18(%rsp), %xmm2
divsd %xmm2, %xmm3
movsd 0x10(%rsp), %xmm4
divsd %xmm4, %xmm3
movsd 0x20(%rsp), %xmm0
divsd %xmm2, %xmm0
divsd %xmm2, %xmm0
divsd %xmm4, %xmm0
mulsd 0x28(%rsp), %xmm3
addsd %xmm0, %xmm3
movslq 0x380(%r15), %rax
divsd (%r14,%rax,8), %xmm1
subsd %xmm1, %xmm3
movsd %xmm3, (%rbx)
xorl %ebp, %ebp
jmp 0xb1f95
leaq 0x6d87f(%rip), %rsi     # 0x11f7b9
leaq 0x840(%rsp), %rbx
movq %rbx, %rdi
movapd %xmm6, %xmm2
movb $0x3, %al
callq 0x30af0
leaq 0x3c12b(%rip), %rsi     # 0xee082
leaq 0x6f1ca(%rip), %rdx     # 0x121128
leaq 0x40(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x3c0bd(%rip), %rsi     # 0xee034
leaq 0x6f1e8(%rip), %rdx     # 0x121166
movq %r12, %rdi
movl $0x14c8, %ecx           # imm = 0x14C8
movq %r14, %r8
xorl %eax, %eax
callq 0x30af0
movl $0x1, %ebp
movl %ebp, %eax
addq $0x1040, %rsp           # imm = 0x1040
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movsd 0x40(%rsp), %xmm1
movsd 0x3cd4b(%rip), %xmm3    # 0xeed00
jmp 0xb1eea