// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../external/HyRec2020/helium.c
// Function: rec_helium_dxHeIIdlna
double rec_helium_dxHeIIdlna(HYREC_DATA *data, double z, double xH1, double xHeII, double H) {
  double nH0 = data->cosmo->nH0, Tr0 = data->cosmo->T0, fHe = data->cosmo->fHe;
  double fsR = data->cosmo->fsR, meR = data->cosmo->meR;
  int *error = &data->error;
  double Tr, nH, ainv, s, s0;
  double xe, xHeI, y2s, y2p, ydown;
  double etacinv, g2pinc, dnuline, tau2p, pesc, tauc, enh;
  char sub_message[256];
  if (*error == 1) return 0.;

  xe   = xHeII + (1.-xH1);
  xHeI = fHe - xHeII;
  /* First catch potential errors */
  if (xHeI < 0.){
    sprintf(sub_message, "xHeI = %E < 0 at z = %f in rec_helium_dxHeIIdlna.\nYou should try and extend the hydrogen post-saha phase by increasing DXHII_MAX in history.h\n", xHeI, z);
    strcat(data->error_message, sub_message);
    *error = 1;
  }

  /* Current conditions */
  Tr = Tr0*(ainv=1+z) /fsR/fsR/meR;  /* Rescaled temperature to account for different alpha or me */
  nH = nH0*ainv*ainv*ainv;

  /* Saha abundance ratio, and ratio for zero ionization potential */
  s0 = fsR*fsR*fsR*meR*meR*meR *2.414194e15*Tr*sqrt(Tr)/nH * 4.;
  s = s0 * exp(-285325./Tr);

  /* Abundances of excited levels.  y is defined as x_i = y_i * xe * xHeII */
  y2s = exp(46090./Tr)/s0;
  y2p = exp(39101./Tr)/s0 * 3.;

  /* Continuum opacity */
  /* coeff is 1/(sigma lambda) in cm^(-3). Result is in s^{-1}  */

  etacinv = fsR*fsR*fsR *meR*meR*meR* 9.15776e22 * H/nH/xH1;

  /* Incoherent width of 2(1)P incl. ->2s, 3s, 3d, 4s, 4d, 5s, 5d */
  g2pinc = 1.976e6 / (1.-exp(-6989./Tr))
          + 6.03e6 / (exp(19754./Tr)-1.)
          + 1.06e8 / (exp(21539./Tr)-1.)
          + 2.18e6 / (exp(28496./Tr)-1.)
          + 3.37e7 / (exp(29224./Tr)-1.)
          + 1.04e6 / (exp(32414./Tr)-1.)
          + 1.51e7 / (exp(32781./Tr)-1.);

  g2pinc *= fsR*fsR*fsR*fsR*fsR*meR ;

  /* Optical depth, escape prob in x2p */
  tau2p   = 4.277e-8 * nH/H * xHeI /(fsR*meR*meR);
  dnuline = g2pinc * tau2p / (4.*M_PI*M_PI);
  tauc    = dnuline/etacinv;
  enh     = sqrt(1.+M_PI*M_PI*tauc) + 7.74*tauc/(1.+70.*tauc);
  pesc    = enh / tau2p;


  /* Effective increase in escape probability via intercombination line
    * ratio of optical depth to allowed line = 1.023e-7
    * 1-e^-tau23 = absorption prob. in intercom line
    * e^[(E21P-E23P)/T] - e^[-(E21P-E23P)*eta_c] = step in intercom line
    *   relative to N_line in 21P
    * divide by tau2p to get effective increase in escape prob.
    * factor of 0.964525 is phase space factor for intercom vs allowed line -- (584/591)^3
  */
  pesc = pesc + (1.-exp(-1.023e-7*tau2p))*(0.964525*exp(2947./Tr)-enh*exp(-6.14e13*fsR*fsR*meR/etacinv))/tau2p;

  /* Total decay rate */

  ydown = fsR*fsR*fsR*fsR*fsR*fsR*fsR*fsR*meR *50.94*y2s  /*prefactor correcting 2-photon decay rate given alpha, me*/
        + fsR*fsR*fsR*fsR*fsR*meR* 1.7989e9*y2p*pesc;     /*prefactor correcting 1-photon dipole rate */


  return  ydown*(xHeI*s - xHeII*xe)/H;   /* Excitation is obtained by detailed balance */

}

// Assembly:
subq $0x248, %rsp            # imm = 0x248
movq %rdi, 0x238(%rsp)
movsd %xmm0, 0x230(%rsp)
movsd %xmm1, 0x228(%rsp)
movsd %xmm2, 0x220(%rsp)
movsd %xmm3, 0x218(%rsp)
movq 0x238(%rsp), %rax
movq 0x8(%rax), %rax
movsd 0x88(%rax), %xmm0
movsd %xmm0, 0x210(%rsp)
movq 0x238(%rsp), %rax
movq 0x8(%rax), %rax
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x208(%rsp)
movq 0x238(%rsp), %rax
movq 0x8(%rax), %rax
movsd 0x80(%rax), %xmm0
movsd %xmm0, 0x200(%rsp)
movq 0x238(%rsp), %rax
movq 0x8(%rax), %rax
movsd 0x98(%rax), %xmm0
movsd %xmm0, 0x1f8(%rsp)
movq 0x238(%rsp), %rax
movq 0x8(%rax), %rax
movsd 0xa0(%rax), %xmm0
movsd %xmm0, 0x1f0(%rsp)
movq 0x238(%rsp), %rax
addq $0x38, %rax
movq %rax, 0x1e8(%rsp)
movq 0x1e8(%rsp), %rax
cmpl $0x1, (%rax)
jne 0x1a6f83
xorps %xmm0, %xmm0
movsd %xmm0, 0x240(%rsp)
jmp 0x1a7752
movsd 0x220(%rsp), %xmm0
movsd 0x2b2b4(%rip), %xmm1    # 0x1d2248
subsd 0x228(%rsp), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0x1b8(%rsp)
movsd 0x200(%rsp), %xmm0
subsd 0x220(%rsp), %xmm0
movsd %xmm0, 0x1b0(%rsp)
xorps %xmm0, %xmm0
ucomisd 0x1b0(%rsp), %xmm0
jbe 0x1a701c
leaq 0x60(%rsp), %rdi
movsd 0x1b0(%rsp), %xmm0
movsd 0x230(%rsp), %xmm1
leaq 0x67857(%rip), %rsi     # 0x20e848
movb $0x2, %al
callq 0x8090
movq 0x238(%rsp), %rax
movq 0x48(%rax), %rdi
leaq 0x60(%rsp), %rsi
callq 0x8660
movq 0x1e8(%rsp), %rax
movl $0x1, (%rax)
movsd 0x208(%rsp), %xmm0
movsd 0x2b21b(%rip), %xmm1    # 0x1d2248
addsd 0x230(%rsp), %xmm1
movsd %xmm1, 0x1d0(%rsp)
mulsd %xmm1, %xmm0
divsd 0x1f8(%rsp), %xmm0
divsd 0x1f8(%rsp), %xmm0
divsd 0x1f0(%rsp), %xmm0
movsd %xmm0, 0x1e0(%rsp)
movsd 0x210(%rsp), %xmm0
mulsd 0x1d0(%rsp), %xmm0
mulsd 0x1d0(%rsp), %xmm0
mulsd 0x1d0(%rsp), %xmm0
movsd %xmm0, 0x1d8(%rsp)
movsd 0x1f8(%rsp), %xmm0
mulsd 0x1f8(%rsp), %xmm0
mulsd 0x1f8(%rsp), %xmm0
mulsd 0x1f0(%rsp), %xmm0
mulsd 0x1f0(%rsp), %xmm0
mulsd 0x1f0(%rsp), %xmm0
movsd 0x6767e(%rip), %xmm1    # 0x20e750
mulsd %xmm1, %xmm0
mulsd 0x1e0(%rsp), %xmm0
movsd %xmm0, (%rsp)
movsd 0x1e0(%rsp), %xmm0
callq 0x82e0
movaps %xmm0, %xmm1
movsd (%rsp), %xmm0
mulsd %xmm1, %xmm0
divsd 0x1d8(%rsp), %xmm0
movsd 0x2e3b9(%rip), %xmm1    # 0x1d54c8
mulsd %xmm1, %xmm0
movsd %xmm0, 0x1c0(%rsp)
movsd 0x1c0(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x67625(%rip), %xmm0    # 0x20e758
divsd 0x1e0(%rsp), %xmm0
callq 0x8670
movaps %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x1c8(%rsp)
movsd 0x676e1(%rip), %xmm0    # 0x20e840
divsd 0x1e0(%rsp), %xmm0
callq 0x8670
divsd 0x1c0(%rsp), %xmm0
movsd %xmm0, 0x1a8(%rsp)
movsd 0x676b1(%rip), %xmm0    # 0x20e838
divsd 0x1e0(%rsp), %xmm0
callq 0x8670
divsd 0x1c0(%rsp), %xmm0
movsd 0x2c4f2(%rip), %xmm1    # 0x1d3698
mulsd %xmm1, %xmm0
movsd %xmm0, 0x1a0(%rsp)
movsd 0x1f8(%rsp), %xmm0
mulsd 0x1f8(%rsp), %xmm0
mulsd 0x1f8(%rsp), %xmm0
mulsd 0x1f0(%rsp), %xmm0
mulsd 0x1f0(%rsp), %xmm0
mulsd 0x1f0(%rsp), %xmm0
movsd 0x6763f(%rip), %xmm1    # 0x20e830
mulsd %xmm1, %xmm0
mulsd 0x218(%rsp), %xmm0
divsd 0x1d8(%rsp), %xmm0
divsd 0x228(%rsp), %xmm0
movsd %xmm0, 0x190(%rsp)
movsd 0x67607(%rip), %xmm0    # 0x20e828
divsd 0x1e0(%rsp), %xmm0
callq 0x8670
movsd 0x2b011(%rip), %xmm1    # 0x1d2248
subsd %xmm0, %xmm1
movsd 0x675dd(%rip), %xmm0    # 0x20e820
divsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x675c3(%rip), %xmm0    # 0x20e818
divsd 0x1e0(%rsp), %xmm0
callq 0x8670
movaps %xmm0, %xmm2
movsd 0x10(%rsp), %xmm0
movsd 0x2afd4(%rip), %xmm1    # 0x1d2248
subsd %xmm1, %xmm2
movsd 0x67590(%rip), %xmm1    # 0x20e810
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x67572(%rip), %xmm0    # 0x20e808
divsd 0x1e0(%rsp), %xmm0
callq 0x8670
movaps %xmm0, %xmm2
movsd 0x18(%rsp), %xmm0
movsd 0x2af93(%rip), %xmm1    # 0x1d2248
subsd %xmm1, %xmm2
movsd 0x6753f(%rip), %xmm1    # 0x20e800
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x67521(%rip), %xmm0    # 0x20e7f8
divsd 0x1e0(%rsp), %xmm0
callq 0x8670
movaps %xmm0, %xmm2
movsd 0x20(%rsp), %xmm0
movsd 0x2af52(%rip), %xmm1    # 0x1d2248
subsd %xmm1, %xmm2
movsd 0x674ee(%rip), %xmm1    # 0x20e7f0
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x674d0(%rip), %xmm0    # 0x20e7e8
divsd 0x1e0(%rsp), %xmm0
callq 0x8670
movaps %xmm0, %xmm2
movsd 0x28(%rsp), %xmm0
movsd 0x2af11(%rip), %xmm1    # 0x1d2248
subsd %xmm1, %xmm2
movsd 0x6749d(%rip), %xmm1    # 0x20e7e0
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x6747f(%rip), %xmm0    # 0x20e7d8
divsd 0x1e0(%rsp), %xmm0
callq 0x8670
movaps %xmm0, %xmm2
movsd 0x30(%rsp), %xmm0
movsd 0x2aed0(%rip), %xmm1    # 0x1d2248
subsd %xmm1, %xmm2
movsd 0x6744c(%rip), %xmm1    # 0x20e7d0
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0x38(%rsp)
movsd 0x6742e(%rip), %xmm0    # 0x20e7c8
divsd 0x1e0(%rsp), %xmm0
callq 0x8670
movaps %xmm0, %xmm2
movsd 0x38(%rsp), %xmm0
movsd 0x2ae8f(%rip), %xmm1    # 0x1d2248
subsd %xmm1, %xmm2
movsd 0x673fb(%rip), %xmm1    # 0x20e7c0
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0x188(%rsp)
movsd 0x1f8(%rsp), %xmm0
mulsd 0x1f8(%rsp), %xmm0
mulsd 0x1f8(%rsp), %xmm0
mulsd 0x1f8(%rsp), %xmm0
mulsd 0x1f8(%rsp), %xmm0
mulsd 0x1f0(%rsp), %xmm0
mulsd 0x188(%rsp), %xmm0
movsd %xmm0, 0x188(%rsp)
movsd 0x67392(%rip), %xmm0    # 0x20e7b8
mulsd 0x1d8(%rsp), %xmm0
divsd 0x218(%rsp), %xmm0
mulsd 0x1b0(%rsp), %xmm0
movsd 0x1f8(%rsp), %xmm1
mulsd 0x1f0(%rsp), %xmm1
mulsd 0x1f0(%rsp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x178(%rsp)
movsd 0x188(%rsp), %xmm0
mulsd 0x178(%rsp), %xmm0
movsd 0x6732d(%rip), %xmm1    # 0x20e7b0
divsd %xmm1, %xmm0
movsd %xmm0, 0x180(%rsp)
movsd 0x180(%rsp), %xmm0
divsd 0x190(%rsp), %xmm0
movsd %xmm0, 0x168(%rsp)
movsd 0x168(%rsp), %xmm0
movsd 0x672ec(%rip), %xmm1    # 0x20e7a8
mulsd %xmm1, %xmm0
movsd 0x2ad80(%rip), %xmm1    # 0x1d2248
addsd %xmm1, %xmm0
callq 0x82e0
movsd 0x672c7(%rip), %xmm1    # 0x20e7a0
mulsd 0x168(%rsp), %xmm1
movsd 0x168(%rsp), %xmm2
movsd 0x2f085(%rip), %xmm3    # 0x1d6578
mulsd %xmm3, %xmm2
movsd 0x2ad49(%rip), %xmm3    # 0x1d2248
addsd %xmm3, %xmm2
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0x160(%rsp)
movsd 0x160(%rsp), %xmm0
divsd 0x178(%rsp), %xmm0
movsd %xmm0, 0x170(%rsp)
movsd 0x170(%rsp), %xmm0
movsd %xmm0, 0x58(%rsp)
movsd 0x67252(%rip), %xmm0    # 0x20e798
mulsd 0x178(%rsp), %xmm0
callq 0x8670
movaps %xmm0, %xmm1
movsd 0x2ace9(%rip), %xmm0    # 0x1d2248
subsd %xmm1, %xmm0
movsd %xmm0, 0x50(%rsp)
movsd 0x6721f(%rip), %xmm0    # 0x20e790
divsd 0x1e0(%rsp), %xmm0
callq 0x8670
movsd %xmm0, 0x48(%rsp)
movsd 0x160(%rsp), %xmm0
movsd %xmm0, 0x40(%rsp)
movsd 0x671ec(%rip), %xmm0    # 0x20e788
mulsd 0x1f8(%rsp), %xmm0
mulsd 0x1f8(%rsp), %xmm0
mulsd 0x1f0(%rsp), %xmm0
divsd 0x190(%rsp), %xmm0
callq 0x8670
movsd 0x40(%rsp), %xmm3
movsd 0x48(%rsp), %xmm2
movsd 0x50(%rsp), %xmm1
movaps %xmm0, %xmm4
movsd 0x58(%rsp), %xmm0
mulsd %xmm4, %xmm3
movq %xmm3, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm3
movsd 0x6717d(%rip), %xmm4    # 0x20e780
mulsd %xmm4, %xmm2
addsd %xmm3, %xmm2
mulsd %xmm2, %xmm1
divsd 0x178(%rsp), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0x170(%rsp)
movsd 0x1f8(%rsp), %xmm0
mulsd 0x1f8(%rsp), %xmm0
mulsd 0x1f8(%rsp), %xmm0
mulsd 0x1f8(%rsp), %xmm0
mulsd 0x1f8(%rsp), %xmm0
mulsd 0x1f8(%rsp), %xmm0
mulsd 0x1f8(%rsp), %xmm0
mulsd 0x1f8(%rsp), %xmm0
mulsd 0x1f0(%rsp), %xmm0
movsd 0x670fa(%rip), %xmm1    # 0x20e778
mulsd %xmm1, %xmm0
movsd 0x1a8(%rsp), %xmm2
movsd 0x1f8(%rsp), %xmm1
mulsd 0x1f8(%rsp), %xmm1
mulsd 0x1f8(%rsp), %xmm1
mulsd 0x1f8(%rsp), %xmm1
mulsd 0x1f8(%rsp), %xmm1
mulsd 0x1f0(%rsp), %xmm1
movsd 0x670a7(%rip), %xmm3    # 0x20e770
mulsd %xmm3, %xmm1
mulsd 0x1a0(%rsp), %xmm1
mulsd 0x170(%rsp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x198(%rsp)
movsd 0x198(%rsp), %xmm0
movsd 0x1b0(%rsp), %xmm1
movsd 0x1c8(%rsp), %xmm3
movsd 0x220(%rsp), %xmm2
mulsd 0x1b8(%rsp), %xmm2
movq %xmm2, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
divsd 0x218(%rsp), %xmm0
movsd %xmm0, 0x240(%rsp)
movsd 0x240(%rsp), %xmm0
addq $0x248, %rsp            # imm = 0x248
retq
nopw %cs:(%rax,%rax)
nopl (%rax)