// File: /workspace/github_c_makefile_star2_O1/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
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %r12
movl %ecx, 0xc(%rsp)
movzwl 0x778(%rsi), %eax
cmpw $0x1, %ax
je 0xb4efd
xorpd %xmm2, %xmm2
cmpw $0x1, 0x77a(%r14)
jne 0xb50ad
movslq 0x384(%r12), %rcx
movsd (%r15,%rcx,8), %xmm3
movslq 0x380(%r12), %rcx
movsd (%r15,%rcx,8), %xmm4
movslq 0x388(%r12), %rcx
movsd (%r15,%rcx,8), %xmm5
movsd 0x3c331(%rip), %xmm2    # 0xf1260
divsd %xmm4, %xmm2
addsd 0x3c8ad(%rip), %xmm2    # 0xf17e8
cmpw $0x1, %ax
jne 0xb4fe4
movq 0x880(%r14), %rdi
movsd (%rdi), %xmm1
ucomisd %xmm2, %xmm1
ja 0xb4f69
movslq 0x87c(%r14), %rsi
ucomisd -0x8(%rdi,%rsi,8), %xmm2
jbe 0xb50c5
movsd (%rdi), %xmm0
movslq 0x87c(%r14), %rax
movsd -0x8(%rdi,%rax,8), %xmm1
leaq 0x6d7f8(%rip), %rsi     # 0x122779
leaq 0x840(%rsp), %rbx
movq %rbx, %rdi
movb $0x3, %al
callq 0x30c2c
leaq 0x3c0e8(%rip), %rsi     # 0xf1082
leaq 0x6f147(%rip), %rdx     # 0x1240e8
leaq 0x40(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
addq $0x96a, %r14            # imm = 0x96A
leaq 0x3c073(%rip), %rsi     # 0xf1034
leaq 0x6f15e(%rip), %rdx     # 0x124126
movq %r14, %rdi
movl $0x14c8, %ecx           # imm = 0x14C8
movq %r15, %r8
xorl %eax, %eax
callq 0x30c2c
movl $0x1, %ebp
jmp 0xb50b3
movsd %xmm4, 0x10(%rsp)
movsd %xmm3, 0x18(%rsp)
movsd %xmm5, 0x20(%rsp)
movsd %xmm0, 0x28(%rsp)
movapd %xmm2, %xmm0
divsd 0x6c308(%rip), %xmm0    # 0x121310
movsd %xmm0, 0x30(%rsp)
movsd 0x3efa2(%rip), %xmm1    # 0xf3fb8
movsd %xmm2, 0x38(%rsp)
callq 0x8620
xorpd 0x3c207(%rip), %xmm0    # 0xf1230
callq 0x8670
movsd 0x30(%rsp), %xmm0
movsd 0x3ef7c(%rip), %xmm1    # 0xf3fb8
callq 0x8620
movsd 0x3ccb7(%rip), %xmm2    # 0xf1d00
mulsd 0x3ef67(%rip), %xmm0    # 0xf3fb8
movapd %xmm2, %xmm1
subsd %xmm0, %xmm1
divsd 0x38(%rsp), %xmm1
movsd %xmm1, 0x40(%rsp)
movsd 0x18(%rsp), %xmm1
divsd %xmm1, %xmm2
movsd 0x10(%rsp), %xmm3
divsd %xmm3, %xmm2
movsd 0x20(%rsp), %xmm0
divsd %xmm1, %xmm0
divsd %xmm1, %xmm0
divsd %xmm3, %xmm0
mulsd 0x28(%rsp), %xmm2
addsd %xmm0, %xmm2
movsd 0x40(%rsp), %xmm0
movslq 0x380(%r12), %rax
divsd (%r15,%rax,8), %xmm0
subsd %xmm0, %xmm2
movsd %xmm2, (%rbx)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x1040, %rsp           # imm = 0x1040
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movsd %xmm4, 0x10(%rsp)
movsd %xmm3, 0x18(%rsp)
movsd %xmm5, 0x20(%rsp)
movsd %xmm0, 0x28(%rsp)
movq 0x890(%r14), %rdx
movq 0x898(%r14), %rcx
addq $0x96a, %r14            # imm = 0x96A
subq $0x8, %rsp
leaq 0x48(%rsp), %rax
movl $0x1, %ebp
leaq 0x14(%rsp), %r9
movl $0x1, %r8d
movapd %xmm2, %xmm0
pushq %r14
pushq $0x1
pushq %rax
callq 0x17ee6
movsd 0x3cbdf(%rip), %xmm2    # 0xf1d00
addq $0x20, %rsp
cmpl $0x1, %eax
jne 0xb5065
leaq 0x3c2bb(%rip), %rsi     # 0xf13f0
leaq 0x6eff9(%rip), %rdx     # 0x124135
leaq 0x840(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x3bedc(%rip), %rsi     # 0xf1034
leaq 0x6efc7(%rip), %rdx     # 0x124126
movq %r14, %rdi
movl $0x14d7, %ecx           # imm = 0x14D7
movq %rbx, %r8
xorl %eax, %eax
callq 0x30c2c
jmp 0xb50b3