// File: /workspace/github_c_makefile_star2_O1/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 0xdc073
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xe0, %rsp
movl %esi, %r14d
movq %rdi, %rbx
cmpl $0x2, %esi
je 0xdc028
movq 0x8(%rbx), %r15
cmpl $0x1, %r14d
je 0xdbdab
testl %r14d, %r14d
jne 0xdbdc5
movsd 0x154b7(%rip), %xmm6    # 0xf1260
jmp 0xdbdb3
movsd 0x51655(%rip), %xmm6    # 0x12d408
movq %r15, %rdi
movapd %xmm8, %xmm0
callq 0xd83f5
jmp 0xdc035
leal -0x3(%r14), %eax
cmpl $0x1, %eax
ja 0xdbe84
movl %edx, %ebp
movq 0x60(%rbx), %r12
movsd 0x51630(%rip), %xmm0    # 0x12d410
ucomisd %xmm6, %xmm0
jbe 0xdbfd7
movsd %xmm8, 0x48(%rsp)
movsd %xmm6, 0x50(%rsp)
movsd %xmm4, 0x58(%rsp)
movsd 0x1545b(%rip), %xmm0    # 0xf1260
movsd %xmm5, 0x10(%rsp)
movsd %xmm3, 0x30(%rsp)
movsd %xmm2, 0x28(%rsp)
movsd %xmm1, 0x20(%rsp)
callq 0xd6f51
mulsd 0x514fe(%rip), %xmm0    # 0x12d328
mulsd 0x30(%rsp), %xmm0
divsd 0x28(%rsp), %xmm0
movsd 0x15422(%rip), %xmm2    # 0xf1260
movapd %xmm2, %xmm1
subsd 0x20(%rsp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x40(%rsp)
movapd %xmm2, %xmm0
callq 0xd6f51
movsd 0x10(%rsp), %xmm1
movapd %xmm0, %xmm2
mulsd 0x514b3(%rip), %xmm2    # 0x12d320
mulsd %xmm1, %xmm2
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jb 0xdbeb5
xorps %xmm0, %xmm0
sqrtsd %xmm1, %xmm0
jmp 0xdbed0
leaq 0x5178d(%rip), %rsi     # 0x12d618
leaq 0x60(%rsp), %r15
movq %r15, %rdi
movl %r14d, %edx
xorl %eax, %eax
callq 0x8090
movq 0x48(%rbx), %rdi
movq %r15, %rsi
callq 0x8660
movl $0x1, 0x38(%rbx)
jmp 0xdc060
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 0x51466(%rip), %xmm0    # 0x12d348
divsd %xmm1, %xmm0
callq 0x8670
mulsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x38(%rsp)
movsd 0x10(%rsp), %xmm0
divsd 0x51433(%rip), %xmm0    # 0x12d338
divsd 0x3479b(%rip), %xmm0    # 0x1106a8
movsd %xmm0, 0x8(%rsp)
movsd 0x15345(%rip), %xmm0    # 0xf1260
callq 0xd6f4c
mulsd 0x51418(%rip), %xmm0    # 0x12d340
movsd %xmm0, 0x18(%rsp)
movsd 0x39552(%rip), %xmm1    # 0x115488
movsd 0x8(%rsp), %xmm0
callq 0x8620
mulsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x39543(%rip), %xmm1    # 0x115498
movsd 0x8(%rsp), %xmm0
callq 0x8620
movsd 0x10(%rsp), %xmm5
mulsd 0x39532(%rip), %xmm0    # 0x1154a0
addsd 0x152ea(%rip), %xmm0    # 0xf1260
movsd 0x18(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd 0x40(%rsp), %xmm0
mulsd 0x166f2(%rip), %xmm0    # 0xf2680
mulsd 0x38(%rsp), %xmm1
addsd 0x51394(%rip), %xmm0    # 0x12d330
addsd %xmm1, %xmm0
divsd %xmm0, %xmm1
movsd 0x18004(%rip), %xmm0    # 0xf3fb0
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 0xdc028
cmpl $0x4, %r14d
je 0xdbff4
cmpl $0x3, %r14d
jne 0xdc035
movq %rbx, %rdi
movapd %xmm8, %xmm0
movl %ebp, %esi
callq 0xdb4da
jmp 0xdc035
movapd %xmm5, %xmm0
divsd 0x51338(%rip), %xmm0    # 0x12d338
movsd 0x98(%r15), %xmm7
divsd %xmm7, %xmm0
divsd %xmm7, %xmm0
divsd 0xa0(%r15), %xmm0
movq (%r12), %rax
movsd (%rax), %xmm7
ucomisd %xmm0, %xmm7
jbe 0xdc074
movq %rbx, %rdi
movapd %xmm8, %xmm0
callq 0xd9a82
cmpl $0x1, 0x38(%rbx)
jne 0xdc064
movups 0x51613(%rip), %xmm0    # 0x12d655
leaq 0x60(%rsp), %rsi
movups %xmm0, 0xd(%rsi)
movupd 0x515f5(%rip), %xmm0    # 0x12d648
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 0xd94da
jmp 0xdc035
nop