// File: /workspace/github_c_makefile_star2_O2/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 $0x1030, %rsp           # imm = 0x1030
movq %r8, %rbx
movapd %xmm0, %xmm3
movq %rdx, %r14
movq %rdi, %r15
movl %ecx, 0xc(%rsp)
movzwl 0x778(%rsi), %eax
cmpw $0x1, %ax
je 0xabc7e
xorpd %xmm0, %xmm0
cmpw $0x1, 0x77a(%rsi)
jne 0xabe0f
movslq 0x384(%r15), %rcx
movsd (%r14,%rcx,8), %xmm5
movslq 0x380(%r15), %rcx
movsd (%r14,%rcx,8), %xmm6
movslq 0x388(%r15), %rcx
movsd (%r14,%rcx,8), %xmm4
movsd 0x395b3(%rip), %xmm2    # 0xe5260
divsd %xmm6, %xmm2
addsd 0x39b2f(%rip), %xmm2    # 0xe57e8
cmpw $0x1, %ax
jne 0xabd92
movq 0x880(%rsi), %rdi
movsd (%rdi), %xmm0
leaq 0x96a(%rsi), %r12
ucomisd %xmm2, %xmm0
movslq 0x87c(%rsi), %rax
movsd -0x8(%rdi,%rax,8), %xmm1
ja 0xabe17
ucomisd %xmm1, %xmm2
ja 0xabe17
movsd %xmm6, 0x10(%rsp)
movsd %xmm5, 0x18(%rsp)
movsd %xmm4, 0x20(%rsp)
movsd %xmm3, 0x28(%rsp)
movq 0x890(%rsi), %rdx
movq 0x898(%rsi), %rcx
subq $0x8, %rsp
leaq 0x38(%rsp), %r10
pushq $0x1
popq %rbp
leaq 0x14(%rsp), %r9
movl %eax, %esi
movl %ebp, %r8d
movapd %xmm2, %xmm0
pushq %r12
pushq $0x1
pushq %r10
callq 0x1604b
addq $0x20, %rsp
cmpl $0x1, %eax
jne 0xabdc0
leaq 0x3969f(%rip), %rsi     # 0xe53f0
leaq 0x6c2ad(%rip), %rdx     # 0x118005
leaq 0x830(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x392c0(%rip), %rsi     # 0xe5034
leaq 0x6c27b(%rip), %rdx     # 0x117ff6
movq %r12, %rdi
movl $0x14d7, %ecx           # imm = 0x14D7
movq %rbx, %r8
xorl %eax, %eax
callq 0x2e014
jmp 0xabe73
movsd %xmm6, 0x10(%rsp)
movsd %xmm5, 0x18(%rsp)
movsd %xmm4, 0x20(%rsp)
movsd %xmm3, 0x28(%rsp)
leaq 0x830(%rsp), %rsi
leaq 0x30(%rsp), %rdx
movapd %xmm2, %xmm0
callq 0xa7d8d
movsd 0x39f18(%rip), %xmm0    # 0xe5ce0
movsd 0x18(%rsp), %xmm2
divsd %xmm2, %xmm0
movsd 0x10(%rsp), %xmm3
divsd %xmm3, %xmm0
movsd 0x20(%rsp), %xmm1
divsd %xmm2, %xmm1
divsd %xmm2, %xmm1
divsd %xmm3, %xmm1
mulsd 0x28(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd 0x30(%rsp), %xmm1
movslq 0x380(%r15), %rax
divsd (%r14,%rax,8), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, (%rbx)
xorl %ebp, %ebp
jmp 0xabe73
leaq 0x6a82b(%rip), %rsi     # 0x116649
leaq 0x830(%rsp), %rbx
movq %rbx, %rdi
movb $0x3, %al
callq 0x2e014
leaq 0x3924b(%rip), %rsi     # 0xe5082
leaq 0x6c17a(%rip), %rdx     # 0x117fb8
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x391dd(%rip), %rsi     # 0xe5034
leaq 0x6c198(%rip), %rdx     # 0x117ff6
movq %r12, %rdi
movl $0x14c8, %ecx           # imm = 0x14C8
movq %r14, %r8
xorl %eax, %eax
callq 0x2e014
pushq $0x1
popq %rbp
movl %ebp, %eax
addq $0x1030, %rsp           # imm = 0x1030
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop