// File: /workspace/github_c_makefile_star2_O3/PoulinV[P]AxiCLASS/build/../external/HyRec2020/hydrogen.c
// Function: rec_dxHIIdlna
double rec_dxHIIdlna(HYREC_DATA *data, int model, double xe, double xHII, double nH, double H, double TM, double TR,
                     unsigned iz, double z){

  REC_COSMOPARAMS * cosmo = data->cosmo;
  FIT_FUNC *fit = data->fit;
  int *error = &data->error;
  double Pion, RLya, four_betaB, result;
  char sub_message[128];

  if (*error == 1) return 0.;
  if      (model == PEEBLES)  result = rec_TLA_dxHIIdlna(cosmo, xe, xHII, nH, H, TM, TR, 1.00);
  else if (model == RECFAST)  result = rec_TLA_dxHIIdlna(cosmo, xe, xHII, nH, H, TM, TR, 1.14);
  else if (model == EMLA2s2p) result = rec_HMLA_dxHIIdlna(data, xe, xHII, nH, H, TM, TR);
  else if (model == FULL || model == SWIFT) {

    /*  When the full two-photon rate is required for z < 900, makes a simple estimate of the probability of
        photoionization from n = 2. If less than PION_MAX, just use the effective 4-level atom.*/
    Pion = 1.;
    if (z < 900.) {
      RLya       = LYA_FACT(1.,1.) *H/nH/(1.-xHII);
      four_betaB = SAHA_FACT(1.,1.) *TR*sqrt(TR) *exp(-0.25*EI/TR) *alphaB_PPB(TR, 1.,1.);
      Pion       = four_betaB/(3.*RLya + L2s1s + four_betaB);
    }
    if (Pion < PION_MAX) result = rec_HMLA_dxHIIdlna(data, xe, xHII, nH, H, TM, TR);
    else {
      if (model == FULL) result = rec_HMLA_2photon_dxHIIdlna(data, xe, xHII, nH, H, TM, TR, iz, z);
      else if (model == SWIFT) {
        if (TR/kBoltz/cosmo->fsR/cosmo->fsR/cosmo->meR < fit->swift_func[0][0]) result = rec_HMLA_dxHIIdlna(data, xe, xHII, nH, H, TM, TR);
        else result = rec_swift_hyrec_dxHIIdlna(data, xe, xHII, nH, H, TM, TR, z);
      }
    }
  }

  else {
    sprintf(sub_message, "Error in rec_dxedlna: model = %i is undefined.\n", model);
    strcat(data->error_message, sub_message);
    *error = 1;
    return 0.;
  }

  if (*error == 1) {
    sprintf(sub_message, "  called from rec_dxHIIdlna\n");
    strcat(data->error_message, sub_message);
    return 0.;
  }
  return result;
}

// Assembly:
movapd %xmm0, %xmm8
xorpd %xmm0, %xmm0
cmpl $0x1, 0x38(%rdi)
je 0xd88e3
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xe0, %rsp
movl %esi, %r15d
movq %rdi, %rbx
cmpl $0x2, %esi
je 0xd8898
movq 0x8(%rbx), %r14
cmpl $0x1, %r15d
je 0xd8621
testl %r15d, %r15d
jne 0xd863b
movsd 0x15c41(%rip), %xmm6    # 0xee260
jmp 0xd8629
movsd 0x51e0f(%rip), %xmm6    # 0x12a438
movq %r14, %rdi
movapd %xmm8, %xmm0
callq 0xd4bf9
jmp 0xd88a5
leal -0x3(%r15), %eax
cmpl $0x1, %eax
ja 0xd86fa
movl %edx, %ebp
movq 0x60(%rbx), %r12
movsd 0x51dea(%rip), %xmm0    # 0x12a440
ucomisd %xmm6, %xmm0
jbe 0xd884d
movsd %xmm8, 0x48(%rsp)
movsd %xmm6, 0x50(%rsp)
movsd %xmm4, 0x58(%rsp)
movsd 0x15be5(%rip), %xmm0    # 0xee260
movsd %xmm5, 0x10(%rsp)
movsd %xmm3, 0x30(%rsp)
movsd %xmm2, 0x28(%rsp)
movsd %xmm1, 0x20(%rsp)
callq 0xd3759
mulsd 0x51cb8(%rip), %xmm0    # 0x12a358
mulsd 0x30(%rsp), %xmm0
divsd 0x28(%rsp), %xmm0
movsd 0x15bac(%rip), %xmm2    # 0xee260
movapd %xmm2, %xmm1
subsd 0x20(%rsp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x40(%rsp)
movapd %xmm2, %xmm0
callq 0xd3759
movsd 0x10(%rsp), %xmm1
movapd %xmm0, %xmm2
mulsd 0x51c6d(%rip), %xmm2    # 0x12a350
mulsd %xmm1, %xmm2
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jb 0xd872b
xorps %xmm0, %xmm0
sqrtsd %xmm1, %xmm0
jmp 0xd8746
leaq 0x51f47(%rip), %rsi     # 0x12a648
leaq 0x60(%rsp), %r14
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x8090
movq 0x48(%rbx), %rdi
movq %r14, %rsi
callq 0x8660
movl $0x1, 0x38(%rbx)
jmp 0xd88d0
movapd %xmm1, %xmm0
movsd %xmm2, 0x8(%rsp)
callq 0x82b0
movsd 0x8(%rsp), %xmm2
movsd 0x10(%rsp), %xmm1
mulsd %xmm2, %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x51c20(%rip), %xmm0    # 0x12a378
divsd %xmm1, %xmm0
callq 0x8670
mulsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x38(%rsp)
movsd 0x10(%rsp), %xmm0
divsd 0x51bed(%rip), %xmm0    # 0x12a368
divsd 0x34f45(%rip), %xmm0    # 0x10d6c8
movsd %xmm0, 0x8(%rsp)
movsd 0x15acf(%rip), %xmm0    # 0xee260
callq 0xd3754
mulsd 0x51bd2(%rip), %xmm0    # 0x12a370
movsd %xmm0, 0x18(%rsp)
movsd 0x39d1c(%rip), %xmm1    # 0x1124c8
movsd 0x8(%rsp), %xmm0
callq 0x8620
mulsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x39d0d(%rip), %xmm1    # 0x1124d8
movsd 0x8(%rsp), %xmm0
callq 0x8620
movsd 0x10(%rsp), %xmm5
mulsd 0x39cfc(%rip), %xmm0    # 0x1124e0
addsd 0x15a74(%rip), %xmm0    # 0xee260
movsd 0x18(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd 0x40(%rsp), %xmm0
mulsd 0x16e7c(%rip), %xmm0    # 0xef680
mulsd 0x38(%rsp), %xmm1
addsd 0x51b4e(%rip), %xmm0    # 0x12a360
addsd %xmm1, %xmm0
divsd %xmm0, %xmm1
movsd 0x1879e(%rip), %xmm0    # 0xf0fc0
ucomisd %xmm1, %xmm0
movsd 0x58(%rsp), %xmm4
movsd 0x30(%rsp), %xmm3
movsd 0x28(%rsp), %xmm2
movsd 0x20(%rsp), %xmm1
movsd 0x50(%rsp), %xmm6
movsd 0x48(%rsp), %xmm8
ja 0xd8898
cmpl $0x3, %r15d
jne 0xd8864
movq %rbx, %rdi
movapd %xmm8, %xmm0
movl %ebp, %esi
callq 0xd7d30
jmp 0xd88a5
movapd %xmm5, %xmm0
divsd 0x51af8(%rip), %xmm0    # 0x12a368
movsd 0x98(%r14), %xmm7
divsd %xmm7, %xmm0
divsd %xmm7, %xmm0
divsd 0xa0(%r14), %xmm0
movq (%r12), %rax
movsd (%rax), %xmm7
ucomisd %xmm0, %xmm7
jbe 0xd88e4
movq %rbx, %rdi
movapd %xmm8, %xmm0
callq 0xd62ea
cmpl $0x1, 0x38(%rbx)
jne 0xd88d4
movups 0x51dd3(%rip), %xmm0    # 0x12a685
leaq 0x60(%rsp), %rsi
movups %xmm0, 0xd(%rsi)
movupd 0x51db5(%rip), %xmm0    # 0x12a678
movapd %xmm0, (%rsi)
movq 0x48(%rbx), %rdi
callq 0x8660
xorpd %xmm0, %xmm0
addq $0xe0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
movapd %xmm8, %xmm0
callq 0xd5d42
jmp 0xd88a5
nop