// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x138, %rsp            # imm = 0x138
movq %rdi, 0x128(%rsp)
movl %esi, 0x124(%rsp)
movsd %xmm0, 0x118(%rsp)
movsd %xmm1, 0x110(%rsp)
movsd %xmm2, 0x108(%rsp)
movsd %xmm3, 0x100(%rsp)
movsd %xmm4, 0xf8(%rsp)
movsd %xmm5, 0xf0(%rsp)
movl %edx, 0xec(%rsp)
movsd %xmm6, 0xe0(%rsp)
movq 0x128(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0xd8(%rsp)
movq 0x128(%rsp), %rax
movq 0x60(%rax), %rax
movq %rax, 0xd0(%rsp)
movq 0x128(%rsp), %rax
addq $0x38, %rax
movq %rax, 0xc8(%rsp)
movq 0xc8(%rsp), %rax
cmpl $0x1, (%rax)
jne 0x1ad9c6
xorps %xmm0, %xmm0
movsd %xmm0, 0x130(%rsp)
jmp 0x1adec9
cmpl $0x0, 0x124(%rsp)
jne 0x1ada29
movq 0xd8(%rsp), %rdi
movsd 0x118(%rsp), %xmm0
movsd 0x110(%rsp), %xmm1
movsd 0x108(%rsp), %xmm2
movsd 0x100(%rsp), %xmm3
movsd 0xf8(%rsp), %xmm4
movsd 0xf0(%rsp), %xmm5
movsd 0x24832(%rip), %xmm6    # 0x1d2248
callq 0x1a7940
movsd %xmm0, 0xa8(%rsp)
jmp 0x1ade73
cmpl $0x1, 0x124(%rsp)
jne 0x1ada8c
movq 0xd8(%rsp), %rdi
movsd 0x118(%rsp), %xmm0
movsd 0x110(%rsp), %xmm1
movsd 0x108(%rsp), %xmm2
movsd 0x100(%rsp), %xmm3
movsd 0xf8(%rsp), %xmm4
movsd 0xf0(%rsp), %xmm5
movsd 0x28b87(%rip), %xmm6    # 0x1d6600
callq 0x1a7940
movsd %xmm0, 0xa8(%rsp)
jmp 0x1ade71
cmpl $0x2, 0x124(%rsp)
jne 0x1adae7
movq 0x128(%rsp), %rdi
movsd 0x118(%rsp), %xmm0
movsd 0x110(%rsp), %xmm1
movsd 0x108(%rsp), %xmm2
movsd 0x100(%rsp), %xmm3
movsd 0xf8(%rsp), %xmm4
movsd 0xf0(%rsp), %xmm5
callq 0x1a9ba0
movsd %xmm0, 0xa8(%rsp)
jmp 0x1ade6f
cmpl $0x3, 0x124(%rsp)
je 0x1adaff
cmpl $0x4, 0x124(%rsp)
jne 0x1ade21
movsd 0x24741(%rip), %xmm0    # 0x1d2248
movsd %xmm0, 0xc0(%rsp)
movsd 0x60e68(%rip), %xmm0    # 0x20e980
ucomisd 0xe0(%rsp), %xmm0
jbe 0x1adc3f
movsd 0x24719(%rip), %xmm1    # 0x1d2248
movaps %xmm1, %xmm0
callq 0x1a77b0
mulsd 0x100(%rsp), %xmm0
divsd 0x108(%rsp), %xmm0
movsd 0x246f7(%rip), %xmm1    # 0x1d2248
subsd 0x110(%rsp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0xb8(%rsp)
movsd 0x246d9(%rip), %xmm1    # 0x1d2248
movaps %xmm1, %xmm0
callq 0x1a7770
mulsd 0xf0(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0xf0(%rsp), %xmm0
callq 0x82e0
movaps %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x60d59(%rip), %xmm0    # 0x20e908
divsd 0xf0(%rsp), %xmm0
callq 0x8670
movaps %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0xf0(%rsp), %xmm0
movsd 0x24667(%rip), %xmm2    # 0x1d2248
movaps %xmm2, %xmm1
callq 0x1a7880
movaps %xmm0, %xmm1
movsd 0x18(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0xb0(%rsp)
movsd 0xb0(%rsp), %xmm0
movsd 0xb8(%rsp), %xmm1
movsd 0x25a7f(%rip), %xmm2    # 0x1d3698
mulsd %xmm2, %xmm1
movsd 0x60cc3(%rip), %xmm2    # 0x20e8e8
addsd %xmm2, %xmm1
addsd 0xb0(%rsp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0xc0(%rsp)
movsd 0x27389(%rip), %xmm0    # 0x1d4fd0
ucomisd 0xc0(%rsp), %xmm0
jbe 0x1adca3
movq 0x128(%rsp), %rdi
movsd 0x118(%rsp), %xmm0
movsd 0x110(%rsp), %xmm1
movsd 0x108(%rsp), %xmm2
movsd 0x100(%rsp), %xmm3
movsd 0xf8(%rsp), %xmm4
movsd 0xf0(%rsp), %xmm5
callq 0x1a9ba0
movsd %xmm0, 0xa8(%rsp)
jmp 0x1ade1f
cmpl $0x3, 0x124(%rsp)
jne 0x1add0e
movq 0x128(%rsp), %rdi
movsd 0x118(%rsp), %xmm0
movsd 0x110(%rsp), %xmm1
movsd 0x108(%rsp), %xmm2
movsd 0x100(%rsp), %xmm3
movsd 0xf8(%rsp), %xmm4
movsd 0xf0(%rsp), %xmm5
movl 0xec(%rsp), %esi
movsd 0xe0(%rsp), %xmm6
callq 0x1acb00
movsd %xmm0, 0xa8(%rsp)
jmp 0x1ade1d
cmpl $0x4, 0x124(%rsp)
jne 0x1ade1b
movsd 0xf0(%rsp), %xmm1
movsd 0x60bcb(%rip), %xmm0    # 0x20e8f8
divsd %xmm0, %xmm1
movq 0xd8(%rsp), %rax
divsd 0x98(%rax), %xmm1
movq 0xd8(%rsp), %rax
divsd 0x98(%rax), %xmm1
movq 0xd8(%rsp), %rax
divsd 0xa0(%rax), %xmm1
movq 0xd0(%rsp), %rax
movq (%rax), %rax
movsd (%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x1addc4
movq 0x128(%rsp), %rdi
movsd 0x118(%rsp), %xmm0
movsd 0x110(%rsp), %xmm1
movsd 0x108(%rsp), %xmm2
movsd 0x100(%rsp), %xmm3
movsd 0xf8(%rsp), %xmm4
movsd 0xf0(%rsp), %xmm5
callq 0x1a9ba0
movsd %xmm0, 0xa8(%rsp)
jmp 0x1ade19
movq 0x128(%rsp), %rdi
movsd 0x118(%rsp), %xmm0
movsd 0x110(%rsp), %xmm1
movsd 0x108(%rsp), %xmm2
movsd 0x100(%rsp), %xmm3
movsd 0xf8(%rsp), %xmm4
movsd 0xf0(%rsp), %xmm5
movsd 0xe0(%rsp), %xmm6
callq 0x1a92e0
movsd %xmm0, 0xa8(%rsp)
jmp 0x1ade1b
jmp 0x1ade1d
jmp 0x1ade1f
jmp 0x1ade6d
leaq 0x20(%rsp), %rdi
movl 0x124(%rsp), %edx
leaq 0x60dc3(%rip), %rsi     # 0x20ebf7
movb $0x0, %al
callq 0x8090
movq 0x128(%rsp), %rax
movq 0x48(%rax), %rdi
leaq 0x20(%rsp), %rsi
callq 0x8660
movq 0xc8(%rsp), %rax
movl $0x1, (%rax)
xorps %xmm0, %xmm0
movsd %xmm0, 0x130(%rsp)
jmp 0x1adec9
jmp 0x1ade6f
jmp 0x1ade71
jmp 0x1ade73
movq 0xc8(%rsp), %rax
cmpl $0x1, (%rax)
jne 0x1adeb7
leaq 0x20(%rsp), %rdi
leaq 0x60d9b(%rip), %rsi     # 0x20ec27
movb $0x0, %al
callq 0x8090
movq 0x128(%rsp), %rax
movq 0x48(%rax), %rdi
leaq 0x20(%rsp), %rsi
callq 0x8660
xorps %xmm0, %xmm0
movsd %xmm0, 0x130(%rsp)
jmp 0x1adec9
movsd 0xa8(%rsp), %xmm0
movsd %xmm0, 0x130(%rsp)
movsd 0x130(%rsp), %xmm0
addq $0x138, %rsp            # imm = 0x138
retq
nopw (%rax,%rax)