// File: /workspace/github_c_makefile_star2_O1/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 0xdfe14
movq 0x610(%rax), %rdx
movslq 0x600(%rax), %rsi
movsd (%rdx,%rsi,8), %xmm1
divsd %xmm3, %xmm1
divsd 0x4e558(%rip), %xmm1    # 0x12e340
movq 0xb8(%rcx), %rsi
movsd %xmm1, 0x60(%rsi)
movslq 0x604(%rax), %r8
movsd (%rdx,%r8,8), %xmm1
divsd %xmm3, %xmm1
divsd 0x4b543(%rip), %xmm1    # 0x12b350
movsd %xmm1, 0x68(%rsi)
jmp 0xdfe24
movq 0xb8(%rcx), %rdx
xorpd %xmm1, %xmm1
movupd %xmm1, 0x60(%rdx)
cmpw $0x1, 0xe78(%rax)
jne 0xdfe50
movsd 0x838(%rsp), %xmm1
movsd 0x830(%rsp), %xmm3
movsd %xmm3, 0x98(%rcx)
movsd %xmm1, 0xa0(%rcx)
movsd 0x18(%rbx), %xmm1
ucomisd %xmm2, %xmm1
jbe 0xdfe67
movq $0x0, (%r14)
jmp 0xdff06
movsd 0x113f1(%rip), %xmm1    # 0xf1260
movapd %xmm4, %xmm3
addsd %xmm1, %xmm3
movsd 0x11969(%rip), %xmm6    # 0xf17e8
divsd %xmm3, %xmm6
movsd %xmm6, 0x8(%rsp)
subsd %xmm0, %xmm1
movapd %xmm4, %xmm0
movapd %xmm5, %xmm3
callq 0xd7cf2
mulsd 0x8(%rsp), %xmm0
movq (%rbx), %rax
movq 0x8(%rax), %rcx
divsd 0x80(%rcx), %xmm0
movsd %xmm0, (%r14)
cmpl $0x0, 0x38(%rax)
je 0xdff06
movq 0x48(%rax), %rcx
leaq 0x1152b(%rip), %rsi     # 0xf13f0
leaq 0x4e4fc(%rip), %rdx     # 0x12e3c8
leaq 0x10(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30c2c
addq $0x20, %rbx
leaq 0x1114e(%rip), %rsi     # 0xf1034
leaq 0x4e4f1(%rip), %rdx     # 0x12e3de
movq %rbx, %rdi
movl $0xcc, %ecx
movq %r14, %r8
xorl %eax, %eax
callq 0x30c2c
movl $0x1, %eax
jmp 0xdff08
xorl %eax, %eax
addq $0x818, %rsp            # imm = 0x818
popq %rbx
popq %r14
retq
nop