// File: /workspace/github_c_makefile_star2_O3/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 0xd63e7
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 0xd572b
cmpl $0x1, 0x38(%rbx)
jne 0xd63f0
movaps 0x54320(%rip), %xmm0    # 0x12a6e0
leaq 0xd0(%rsp), %rsi
movaps %xmm0, 0x10(%rsi)
movapd 0x542fc(%rip), %xmm0    # 0x12a6d0
movapd %xmm0, (%rsi)
movw $0xa, 0x20(%rsi)
movq 0x48(%rbx), %rdi
callq 0x8660
xorpd %xmm0, %xmm0
jmp 0xd66a5
movapd 0x30(%rsp), %xmm0
callq 0xd3759
movapd %xmm0, %xmm1
mulsd 0x53f51(%rip), %xmm1    # 0x12a358
mulsd 0x68(%rsp), %xmm1
divsd 0x60(%rsp), %xmm1
movsd 0x17e45(%rip), %xmm0    # 0xee260
subsd 0x58(%rsp), %xmm0
movsd %xmm0, 0x78(%rsp)
divsd %xmm0, %xmm1
movsd %xmm1, 0x28(%rsp)
movsd 0x88(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x19238(%rip), %xmm1    # 0xef680
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 0xd3754
mulsd 0x53ed4(%rip), %xmm0    # 0x12a360
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 0xd3754
mulsd 0x53e94(%rip), %xmm0    # 0x12a360
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 0xd3754
mulsd 0x53e35(%rip), %xmm0    # 0x12a360
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 0xd3759
movapd %xmm0, %xmm2
mulsd 0x53dcc(%rip), %xmm2    # 0x12a350
movapd 0x90(%rsp), %xmm1
mulsd %xmm1, %xmm2
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jb 0xd65a4
xorps %xmm0, %xmm0
sqrtsd %xmm1, %xmm0
jmp 0xd65c2
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 0x53dac(%rip), %xmm0    # 0x12a380
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 0x17bf1(%rip), %xmm4    # 0xee260
movapd %xmm4, %xmm0
subsd %xmm7, %xmm4
mulsd 0x1c4d9(%rip), %xmm4    # 0xf2b58
subsd %xmm5, %xmm0
mulsd 0x1aef5(%rip), %xmm0    # 0xf1580
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