// File: /workspace/github_c_makefile_star2_O2/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 $0x148, %rsp            # imm = 0x148
cmpl $0x1, 0x38(%rdi)
je 0xce7a2
movq %rdi, %rbx
movsd %xmm1, 0x48(%rsp)
movsd %xmm0, 0x70(%rsp)
movsd %xmm2, 0x50(%rsp)
movsd %xmm3, 0x58(%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
mulsd %xmm3, %xmm0
unpcklpd %xmm5, %xmm4            # xmm4 = xmm4[0],xmm5[0]
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 0xb0(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
leaq 0x90(%rsp), %rdx
leaq 0x78(%rsp), %rcx
movapd %xmm0, 0x80(%rsp)
movapd %xmm4, %xmm1
movsd %xmm2, 0x10(%rsp)
movsd %xmm3, 0x20(%rsp)
callq 0xcdbf0
cmpl $0x1, 0x38(%rbx)
jne 0xce7ab
movaps 0x52dd5(%rip), %xmm0    # 0x121550
leaq 0xc0(%rsp), %rsi
movaps %xmm0, 0x10(%rsi)
movapd 0x52db1(%rip), %xmm0    # 0x121540
movapd %xmm0, (%rsi)
movw $0xa, 0x20(%rsi)
movq 0x48(%rbx), %rdi
callq 0x8690
xorpd %xmm0, %xmm0
jmp 0xcea1b
movsd 0x10(%rsp), %xmm0
movsd 0x20(%rsp), %xmm1
callq 0xcd110
movapd %xmm0, %xmm1
mulsd 0x58(%rsp), %xmm1
divsd 0x50(%rsp), %xmm1
movsd 0x16a8c(%rip), %xmm0    # 0xe5260
subsd 0x48(%rsp), %xmm0
movsd %xmm0, 0x68(%rsp)
divsd %xmm0, %xmm1
movsd %xmm1, 0x18(%rsp)
movsd 0x78(%rsp), %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x17f4a(%rip), %xmm1    # 0xe6748
mulsd %xmm0, %xmm1
movsd %xmm1, 0x38(%rsp)
movsd 0x90(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x10(%rsp), %xmm0
movsd 0x20(%rsp), %xmm1
callq 0xcd128
addsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x98(%rsp), %xmm0
addsd 0x30(%rsp), %xmm0
addsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x40(%rsp)
movsd 0x10(%rsp), %xmm0
movsd 0x20(%rsp), %xmm1
callq 0xcd128
movsd 0x30(%rsp), %xmm3
movsd 0x38(%rsp), %xmm2
mulsd %xmm2, %xmm3
movsd %xmm3, 0x60(%rsp)
mulsd 0x18(%rsp), %xmm2
movsd 0x40(%rsp), %xmm1
divsd %xmm1, %xmm2
addsd %xmm0, %xmm2
movapd %xmm3, %xmm0
divsd %xmm1, %xmm0
movsd 0x28(%rsp), %xmm1
subsd %xmm0, %xmm1
divsd %xmm1, %xmm2
movsd %xmm2, 0x38(%rsp)
movsd 0x10(%rsp), %xmm0
movsd 0x20(%rsp), %xmm1
callq 0xcd128
mulsd 0x30(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
divsd %xmm1, %xmm0
addsd 0x18(%rsp), %xmm0
movsd 0x60(%rsp), %xmm2
divsd %xmm1, %xmm2
movsd 0x40(%rsp), %xmm1
subsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x10(%rsp), %xmm0
movsd 0x20(%rsp), %xmm1
callq 0xcd0fc
movapd 0x80(%rsp), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jb 0xce923
sqrtsd %xmm1, %xmm0
jmp 0xce935
movapd %xmm1, %xmm0
callq 0x82d0
movapd 0x80(%rsp), %xmm1
movsd 0x10(%rsp), %xmm2
mulsd %xmm0, %xmm2
movsd %xmm2, 0x10(%rsp)
movsd 0x528d3(%rip), %xmm0    # 0x121220
divsd %xmm1, %xmm0
callq 0x86a0
mulsd 0x10(%rsp), %xmm0
movsd 0x50(%rsp), %xmm3
divsd %xmm3, %xmm0
movsd 0x68(%rsp), %xmm6
mulsd %xmm0, %xmm6
movsd 0x70(%rsp), %xmm4
mulsd 0x48(%rsp), %xmm4
subsd %xmm6, %xmm4
movsd 0x58(%rsp), %xmm2
divsd %xmm2, %xmm3
movsd 0xb0(%rsp), %xmm0
mulsd %xmm4, %xmm0
movsd 0xa0(%rsp), %xmm1
mulsd %xmm6, %xmm1
mulsd 0xb8(%rsp), %xmm4
addsd %xmm0, %xmm1
mulsd 0xa8(%rsp), %xmm6
addsd %xmm4, %xmm6
movsd 0x18(%rsp), %xmm7
mulsd %xmm7, %xmm6
movsd 0x38(%rsp), %xmm5
mulsd %xmm5, %xmm1
addsd %xmm6, %xmm1
movq 0xb8(%r14), %rax
movsd 0x1687b(%rip), %xmm4    # 0xe5260
movapd %xmm4, %xmm0
subsd %xmm7, %xmm4
mulsd 0x1b023(%rip), %xmm4    # 0xe9a18
subsd %xmm5, %xmm0
mulsd 0x19aff(%rip), %xmm0    # 0xe8500
addsd %xmm4, %xmm0
mulsd 0x68(%rax), %xmm0
addsd 0x60(%rax), %xmm0
mulsd %xmm3, %xmm1
divsd %xmm2, %xmm0
subsd %xmm1, %xmm0
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r14
retq