// File: /workspace/github_c_makefile_star2_O2/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 0xd485a
movq 0x610(%rax), %rdx
movslq 0x600(%rax), %rsi
movsd (%rdx,%rsi,8), %xmm1
divsd %xmm3, %xmm1
divsd 0x4d9b2(%rip), %xmm1    # 0x1221e0
movq 0xb8(%rcx), %rsi
movsd %xmm1, 0x60(%rsi)
movslq 0x604(%rax), %r8
movsd (%rdx,%r8,8), %xmm1
divsd %xmm3, %xmm1
divsd 0x4a9dd(%rip), %xmm1    # 0x11f230
movsd %xmm1, 0x68(%rsi)
jmp 0xd486a
movq 0xb8(%rcx), %rdx
xorpd %xmm1, %xmm1
movupd %xmm1, 0x60(%rdx)
cmpw $0x1, 0xe78(%rax)
jne 0xd4896
movsd 0x838(%rsp), %xmm1
movsd 0x830(%rsp), %xmm3
movsd %xmm3, 0x98(%rcx)
movsd %xmm1, 0xa0(%rcx)
movsd 0x18(%rbx), %xmm1
ucomisd %xmm2, %xmm1
jbe 0xd48aa
andq $0x0, (%r14)
jmp 0xd4947
movsd 0x109ae(%rip), %xmm1    # 0xe5260
movapd %xmm4, %xmm3
addsd %xmm1, %xmm3
movsd 0x10f26(%rip), %xmm6    # 0xe57e8
divsd %xmm3, %xmm6
movsd %xmm6, 0x8(%rsp)
subsd %xmm0, %xmm1
movapd %xmm4, %xmm0
movapd %xmm5, %xmm3
callq 0xccaf5
mulsd 0x8(%rsp), %xmm0
movq (%rbx), %rax
movq 0x8(%rax), %rcx
divsd 0x80(%rcx), %xmm0
movsd %xmm0, (%r14)
cmpl $0x0, 0x38(%rax)
je 0xd4947
movq 0x48(%rax), %rcx
leaq 0x10ae8(%rip), %rsi     # 0xe53f0
leaq 0x4d959(%rip), %rdx     # 0x122268
leaq 0x10(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
addq $0x20, %rbx
leaq 0x1070b(%rip), %rsi     # 0xe5034
leaq 0x4d94e(%rip), %rdx     # 0x12227e
movq %rbx, %rdi
movl $0xcc, %ecx
movq %r14, %r8
xorl %eax, %eax
callq 0x2e014
pushq $0x1
popq %rax
jmp 0xd4949
xorl %eax, %eax
addq $0x818, %rsp            # imm = 0x818
popq %rbx
popq %r14
retq