// File: /workspace/github_c_makefile_star2_O1/PoulinV[P]AxiCLASS/build/../external/HyRec2020/hydrogen.c
// Function: rec_HMLA_dxHIIdlna
double rec_HMLA_dxHIIdlna(HYREC_DATA *data, double xe, double xHII, double nH, double H, double TM, double TR) {

  REC_COSMOPARAMS *cosmo = data->cosmo;
  HYREC_ATOMIC *atomic = data->atomic;
  int *error = &data->error;
  double fsR = cosmo->fsR, meR = cosmo->meR;

  double Alpha[2], DAlpha[2], Beta[2], R2p2s, RLya;
  double Gamma_2s, Gamma_2p, C2s, C2p, s, Dxe2;
  double ratio;
  char sub_message[128];
  if (*error == 1) return 0.;
  ratio = TM/TR;
  rescale_T(&TR, fsR, meR);
  TM = ratio * TR;   /* This way ensure that TM<=TR is preserved */
  interpolate_rates(Alpha, DAlpha, Beta, &R2p2s, TR, TM/TR, atomic, fsR, meR, error, data->error_message);
  if (*error == 1) {
    sprintf(sub_message, "  called from rec_HMLA_dxHIIdlna\n");
    strcat(data->error_message, sub_message);
    return 0.;
  }

  RLya = LYA_FACT(fsR, meR) *H/nH/(1.-xHII);   /* 8 PI H/(3 nH x1s lambda_Lya^3) */

  /* Effective inverse lifetimes of 2s and 2p states */
  Gamma_2s = Beta[0] + 3.*R2p2s + L2s_rescaled(fsR, meR);
  Gamma_2p = Beta[1] + R2p2s + RLya;

  /* Generalization of Peebles' C factor */
  C2s = (L2s_rescaled(fsR, meR) + 3.*R2p2s * RLya/Gamma_2p)/(Gamma_2s - 3.*R2p2s*R2p2s/Gamma_2p);
  C2p = (RLya  +   R2p2s * L2s_rescaled(fsR, meR)/Gamma_2s)/(Gamma_2p - 3.*R2p2s*R2p2s/Gamma_2s);

  s    = SAHA_FACT(fsR, meR) *TR*sqrt(TR) *exp(-EI/TR)/nH;
  Dxe2 = xe*xHII - s*(1.-xHII); /* xe^2 - xe^2[Saha eq with 1s] -- gives more compact expressions */

  return -nH/H *( (s*(1.-xHII)*DAlpha[0] + Alpha[0]*Dxe2)*C2s + (s*(1.-xHII)*DAlpha[1] + Alpha[1]*Dxe2)*C2p )
         + (cosmo->inj_params->ion + (0.25*(1.-C2s) + 0.75*(1.-C2p))*cosmo->inj_params->exclya)/H ;

}

// Assembly:
pushq %r14
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
cmpl $0x1, 0x38(%rdi)
je 0xd9b7f
movq %rdi, %rbx
movsd %xmm1, 0x58(%rsp)
movsd %xmm0, 0x80(%rsp)
movsd %xmm2, 0x60(%rsp)
movsd %xmm3, 0x68(%rsp)
movq (%rdi), %r8
movq 0x8(%rdi), %r14
leaq 0x38(%rdi), %r9
movsd 0x98(%r14), %xmm2
movsd 0xa0(%r14), %xmm3
movapd %xmm2, %xmm0
mulsd %xmm2, %xmm0
movsd %xmm0, 0x10(%rsp)
mulsd %xmm3, %xmm0
unpcklpd %xmm5, %xmm4            # xmm4 = xmm4[0],xmm5[0]
movapd %xmm0, 0x30(%rsp)
unpcklpd %xmm0, %xmm5            # xmm5 = xmm5[0],xmm0[0]
divpd %xmm5, %xmm4
movapd %xmm4, %xmm0
unpckhpd %xmm4, %xmm0            # xmm0 = xmm0[1],xmm4[1]
mulsd %xmm0, %xmm4
divsd %xmm0, %xmm4
movq 0x48(%rdi), %rax
movq %rax, (%rsp)
leaq 0xc0(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
leaq 0xa0(%rsp), %rdx
leaq 0x88(%rsp), %rcx
movapd %xmm0, 0x90(%rsp)
movapd %xmm4, %xmm1
movsd %xmm2, 0x50(%rsp)
movsd %xmm3, 0x8(%rsp)
callq 0xd8f27
cmpl $0x1, 0x38(%rbx)
jne 0xd9b88
movaps 0x53b58(%rip), %xmm0    # 0x12d6b0
leaq 0xd0(%rsp), %rsi
movaps %xmm0, 0x10(%rsi)
movapd 0x53b34(%rip), %xmm0    # 0x12d6a0
movapd %xmm0, (%rsi)
movw $0xa, 0x20(%rsi)
movq 0x48(%rbx), %rdi
callq 0x8660
xorpd %xmm0, %xmm0
jmp 0xd9e3d
movapd 0x30(%rsp), %xmm0
callq 0xd6f51
movapd %xmm0, %xmm1
mulsd 0x53789(%rip), %xmm1    # 0x12d328
mulsd 0x68(%rsp), %xmm1
divsd 0x60(%rsp), %xmm1
movsd 0x176ad(%rip), %xmm0    # 0xf1260
subsd 0x58(%rsp), %xmm0
movsd %xmm0, 0x78(%rsp)
divsd %xmm0, %xmm1
movsd %xmm1, 0x28(%rsp)
movsd 0x88(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x18aa0(%rip), %xmm1    # 0xf2680
mulsd %xmm0, %xmm1
movsd %xmm1, 0x30(%rsp)
movsd 0xa0(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x50(%rsp), %xmm1
movsd 0x10(%rsp), %xmm0
mulsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
callq 0xd6f4c
mulsd 0x5370c(%rip), %xmm0    # 0x12d330
mulsd 0x8(%rsp), %xmm0
addsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0xa8(%rsp), %xmm0
addsd 0x20(%rsp), %xmm0
addsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x48(%rsp)
movsd 0x10(%rsp), %xmm0
callq 0xd6f4c
mulsd 0x536cc(%rip), %xmm0    # 0x12d330
mulsd 0x8(%rsp), %xmm0
movsd 0x20(%rsp), %xmm3
movsd 0x30(%rsp), %xmm2
mulsd %xmm2, %xmm3
movsd %xmm3, 0x70(%rsp)
mulsd 0x28(%rsp), %xmm2
movsd 0x48(%rsp), %xmm1
divsd %xmm1, %xmm2
addsd %xmm0, %xmm2
movapd %xmm3, %xmm0
divsd %xmm1, %xmm0
movsd 0x18(%rsp), %xmm1
subsd %xmm0, %xmm1
divsd %xmm1, %xmm2
movsd %xmm2, 0x30(%rsp)
movsd 0x10(%rsp), %xmm0
callq 0xd6f4c
mulsd 0x5366d(%rip), %xmm0    # 0x12d330
movsd 0x8(%rsp), %xmm1
mulsd %xmm1, %xmm0
mulsd 0x20(%rsp), %xmm0
movsd 0x18(%rsp), %xmm2
divsd %xmm2, %xmm0
addsd 0x28(%rsp), %xmm0
movsd 0x70(%rsp), %xmm3
divsd %xmm2, %xmm3
movsd 0x48(%rsp), %xmm2
subsd %xmm3, %xmm2
divsd %xmm2, %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x50(%rsp), %xmm0
mulsd %xmm1, %xmm0
callq 0xd6f51
movapd %xmm0, %xmm2
mulsd 0x53604(%rip), %xmm2    # 0x12d320
movapd 0x90(%rsp), %xmm1
mulsd %xmm1, %xmm2
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jb 0xd9d3c
xorps %xmm0, %xmm0
sqrtsd %xmm1, %xmm0
jmp 0xd9d5a
movapd %xmm1, %xmm0
movsd %xmm2, 0x8(%rsp)
callq 0x82b0
movsd 0x8(%rsp), %xmm2
movapd 0x90(%rsp), %xmm1
mulsd %xmm2, %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x535e4(%rip), %xmm0    # 0x12d350
divsd %xmm1, %xmm0
callq 0x8670
mulsd 0x8(%rsp), %xmm0
movsd 0x60(%rsp), %xmm3
divsd %xmm3, %xmm0
movsd 0x78(%rsp), %xmm6
mulsd %xmm0, %xmm6
movsd 0x80(%rsp), %xmm4
mulsd 0x58(%rsp), %xmm4
subsd %xmm6, %xmm4
movsd 0x68(%rsp), %xmm2
divsd %xmm2, %xmm3
movsd 0xc0(%rsp), %xmm0
mulsd %xmm4, %xmm0
movsd 0xb0(%rsp), %xmm1
mulsd %xmm6, %xmm1
mulsd 0xc8(%rsp), %xmm4
addsd %xmm0, %xmm1
mulsd 0xb8(%rsp), %xmm6
addsd %xmm4, %xmm6
movsd 0x10(%rsp), %xmm7
mulsd %xmm7, %xmm6
movsd 0x30(%rsp), %xmm5
mulsd %xmm5, %xmm1
addsd %xmm6, %xmm1
movq 0xb8(%r14), %rax
movsd 0x17459(%rip), %xmm4    # 0xf1260
movapd %xmm4, %xmm0
subsd %xmm7, %xmm4
mulsd 0x1bd11(%rip), %xmm4    # 0xf5b28
subsd %xmm5, %xmm0
mulsd 0x1a74d(%rip), %xmm0    # 0xf4570
addsd %xmm4, %xmm0
mulsd 0x68(%rax), %xmm0
addsd 0x60(%rax), %xmm0
mulsd %xmm3, %xmm1
divsd %xmm2, %xmm0
subsd %xmm1, %xmm0
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r14
retq