// File: /workspace/github_c_makefile_star2_O3/PoulinV[P]AxiCLASS/build/../external/HyRec2020/wrap_hyrec.c
// Function: hyrec_dx_He_dz
int hyrec_dx_He_dz(struct thermodynamics* pth, struct thermohyrec* phy, double x_H, double x_He, double xe, double nH, double z, double Hz, double Tmat, double Trad, double alpha, double me, double *dx_He_dz) {

  /** Summary: */

  /** - define local variables */
  struct injection* pin = &(pth->in);
  double xHeII = x_He*phy->data->cosmo->fHe;    // Different definitions between CLASS and HYREC-2

  /** - do tests */
  class_test(MODEL == FULL, phy->error_message, "FULL mode is currently not allowed for HyRec-2");

  /** - assign variables */
  if (pth->has_exotic_injection == _TRUE_) {
    phy->data->cosmo->inj_params->ion = pin->pvecdeposition[pin->index_dep_ionHe]/nH/(_E_H_ion_*_eV_);
    phy->data->cosmo->inj_params->exclya = pin->pvecdeposition[pin->index_dep_lya]/nH/(_E_H_lya_*_eV_);
  }
  else{
    phy->data->cosmo->inj_params->ion = 0.;
    phy->data->cosmo->inj_params->exclya = 0.;
  }
  if (pth->has_varconst == _TRUE_) {
    phy->data->cosmo->fsR = alpha;
    phy->data->cosmo->meR = me;
  }

  if (xHeII<phy->xHeII_limit) {
    /** - don't evolve He below the limit */
    *dx_He_dz=0;
  }
  else {

    /** - convert to correct units, and retrieve derivative */
    *dx_He_dz = -1./(1.+z)* rec_helium_dxHeIIdlna(phy->data, z, 1.-x_H, xHeII, Hz) / phy->data->cosmo->fHe;

    /** - do error management */
    if(phy->data->error != 0){
      class_call_message(phy->error_message,"rec_helium_dxHeIIdlna",phy->data->error_message);
      return _FAILURE_;
    }
  }

  return _SUCCESS_;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x818, %rsp            # imm = 0x818
movq %rdx, %r14
movapd %xmm1, %xmm2
movq %rsi, %rbx
movq %rdi, %rax
movq (%rsi), %rdi
movq 0x8(%rdi), %rcx
mulsd 0x80(%rcx), %xmm2
cmpw $0x1, 0xb8(%rax)
jne 0xdc8b5
movq 0x610(%rax), %rdx
movslq 0x600(%rax), %rsi
movsd (%rdx,%rsi,8), %xmm1
divsd %xmm3, %xmm1
divsd 0x4eae7(%rip), %xmm1    # 0x12b370
movq 0xb8(%rcx), %rsi
movsd %xmm1, 0x60(%rsi)
movslq 0x604(%rax), %r8
movsd (%rdx,%r8,8), %xmm1
divsd %xmm3, %xmm1
divsd 0x4bad2(%rip), %xmm1    # 0x128380
movsd %xmm1, 0x68(%rsi)
jmp 0xdc8c5
movq 0xb8(%rcx), %rdx
xorpd %xmm1, %xmm1
movupd %xmm1, 0x60(%rdx)
cmpw $0x1, 0xe78(%rax)
jne 0xdc8f1
movsd 0x838(%rsp), %xmm1
movsd 0x830(%rsp), %xmm3
movsd %xmm3, 0x98(%rcx)
movsd %xmm1, 0xa0(%rcx)
movsd 0x18(%rbx), %xmm1
ucomisd %xmm2, %xmm1
jbe 0xdc908
movq $0x0, (%r14)
jmp 0xdc9a7
movsd 0x11950(%rip), %xmm1    # 0xee260
movapd %xmm4, %xmm3
addsd %xmm1, %xmm3
movsd 0x11ec8(%rip), %xmm6    # 0xee7e8
divsd %xmm3, %xmm6
movsd %xmm6, 0x8(%rsp)
subsd %xmm0, %xmm1
movapd %xmm4, %xmm0
movapd %xmm5, %xmm3
callq 0xd44f6
mulsd 0x8(%rsp), %xmm0
movq (%rbx), %rax
movq 0x8(%rax), %rcx
divsd 0x80(%rcx), %xmm0
movsd %xmm0, (%r14)
cmpl $0x0, 0x38(%rax)
je 0xdc9a7
movq 0x48(%rax), %rcx
leaq 0x11a8a(%rip), %rsi     # 0xee3f0
leaq 0x4ea8b(%rip), %rdx     # 0x12b3f8
leaq 0x10(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30af0
addq $0x20, %rbx
leaq 0x116ad(%rip), %rsi     # 0xee034
leaq 0x4ea80(%rip), %rdx     # 0x12b40e
movq %rbx, %rdi
movl $0xcc, %ecx
movq %r14, %r8
xorl %eax, %eax
callq 0x30af0
movl $0x1, %eax
jmp 0xdc9a9
xorl %eax, %eax
addq $0x818, %rsp            # imm = 0x818
popq %rbx
popq %r14
retq