// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../external/HyRec2020/history.c
// Function: rec_get_xe_next2_HTm
void rec_get_xe_next2_HTm(HYREC_DATA *data, int model, double z_in, long iz, double dxedlna_prev[2],
                          double dTmdlna_prev[2], double H, double z_out, double H_next) {

  REC_COSMOPARAMS *cosmo = data->cosmo;
  double xe_in = data->xe_output[iz-1];
  double Tm_in = data->Tm_output[iz-1];
  int *error = &data->error;
  long iz_rad = iz-1-data->rad->iz_rad_0;

  double dxedlna, dTmdlna, nH, TR, dEdtdV, DLNA;
  char sub_message[SIZE_ErrorM];
  DLNA = cosmo->dlna;

  nH = cosmo->nH0 *cube(1.+z_in);
  TR = kBoltz *cosmo->T0 *(1.+z_in);
  dEdtdV = cosmo->inj_params->ion*3*nH*EI / (1-xe_in);
  /*For low redshifts (z < 20 or so) use Peeble's model.
    The precise model does not metter much here as
    1) the free electron fraction is basically zero (~1e-4) in any case and
    2) the universe is going to be reionized around that epoch */

  if (TR/cosmo->fsR/cosmo->fsR/cosmo->meR <= TR_MIN
     || kBoltz*Tm_in/TR <= T_RATIO_MIN) model = PEEBLES;
    dxedlna = rec_dxHIIdlna(data, model, xe_in, xe_in, nH, H, kBoltz*Tm_in, TR, iz_rad, z_in);

  dTmdlna = rec_dTmdlna(z_in, xe_in, Tm_in, cosmo, dEdtdV, H);

  data->Tm_evolve_implicit = 1;
  if (fabs(1-dTmdlna_prev[0]/dTmdlna)<DTM_DIFF_MAX) data->Tm_evolve_implicit = 0;
  if (data->Tm_evolve_implicit == 1){
    dTmdlna_prev[0] = dTmdlna;
    dTmdlna_prev[1] = dTmdlna_prev[0];
    data->xe_output[iz] = xe_in + DLNA *hyrec_integrator(dxedlna, dxedlna_prev, z_in);
    data->Tm_output[iz] = Tm_implicit(z_out, data->xe_output[iz], Tm_in, cosmo, dEdtdV, H_next, DLNA);
  }
  else {
    data->xe_output[iz] = xe_in + DLNA *hyrec_integrator(dxedlna, dxedlna_prev, z_in);
    data->Tm_output[iz] = Tm_in + DLNA *hyrec_integrator(dTmdlna, dTmdlna_prev, z_in);
  }

  if (*error == 1) {
    sprintf(sub_message, "  called from rec_get_xe_next2_HTm at z = %f\n", z_in);
    strcat(data->error_message, sub_message);
    return;
  }
}

// Assembly:
subq $0x8e8, %rsp            # imm = 0x8E8
movq %rdi, 0x8e0(%rsp)
movl %esi, 0x8dc(%rsp)
movsd %xmm0, 0x8d0(%rsp)
movq %rdx, 0x8c8(%rsp)
movq %rcx, 0x8c0(%rsp)
movq %r8, 0x8b8(%rsp)
movsd %xmm1, 0x8b0(%rsp)
movsd %xmm2, 0x8a8(%rsp)
movsd %xmm3, 0x8a0(%rsp)
movq 0x8e0(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x898(%rsp)
movq 0x8e0(%rsp), %rax
movq 0x28(%rax), %rax
movq 0x8c8(%rsp), %rcx
subq $0x1, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x890(%rsp)
movq 0x8e0(%rsp), %rax
movq 0x30(%rax), %rax
movq 0x8c8(%rsp), %rcx
subq $0x1, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x888(%rsp)
movq 0x8e0(%rsp), %rax
addq $0x38, %rax
movq %rax, 0x880(%rsp)
movq 0x8c8(%rsp), %rax
subq $0x1, %rax
movq 0x8e0(%rsp), %rcx
movq 0x58(%rcx), %rcx
subq 0x8(%rcx), %rax
movq %rax, 0x878(%rsp)
movq 0x898(%rsp), %rax
movsd 0xa8(%rax), %xmm0
movsd %xmm0, 0x848(%rsp)
movq 0x898(%rsp), %rax
movsd 0x88(%rax), %xmm0
movsd %xmm0, 0x38(%rsp)
movsd 0x21447(%rip), %xmm0    # 0x1d2248
addsd 0x8d0(%rsp), %xmm0
callq 0x1a5670
movaps %xmm0, %xmm1
movsd 0x38(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x860(%rsp)
movq 0x898(%rsp), %rax
movsd 0x5dac3(%rip), %xmm0    # 0x20e8f8
mulsd 0x8(%rax), %xmm0
movsd 0x21406(%rip), %xmm1    # 0x1d2248
addsd 0x8d0(%rsp), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x858(%rsp)
movq 0x898(%rsp), %rax
movq 0xb8(%rax), %rax
movsd 0x22829(%rip), %xmm0    # 0x1d3698
mulsd 0x60(%rax), %xmm0
mulsd 0x860(%rsp), %xmm0
movsd 0x5de4b(%rip), %xmm1    # 0x20ecd0
mulsd %xmm1, %xmm0
movsd 0x213b7(%rip), %xmm1    # 0x1d2248
subsd 0x890(%rsp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x850(%rsp)
movsd 0x858(%rsp), %xmm1
movq 0x898(%rsp), %rax
divsd 0x98(%rax), %xmm1
movq 0x898(%rsp), %rax
divsd 0x98(%rax), %xmm1
movq 0x898(%rsp), %rax
divsd 0xa0(%rax), %xmm1
movsd 0x5da28(%rip), %xmm0    # 0x20e910
ucomisd %xmm1, %xmm0
jae 0x1b0f16
movsd 0x5da02(%rip), %xmm1    # 0x20e8f8
mulsd 0x888(%rsp), %xmm1
divsd 0x858(%rsp), %xmm1
movsd 0x21350(%rip), %xmm0    # 0x1d2260
ucomisd %xmm1, %xmm0
jb 0x1b0f21
movl $0x0, 0x8dc(%rsp)
movq 0x8e0(%rsp), %rdi
movl 0x8dc(%rsp), %esi
movsd 0x890(%rsp), %xmm0
movsd 0x890(%rsp), %xmm1
movsd 0x860(%rsp), %xmm2
movsd 0x8b0(%rsp), %xmm3
movsd 0x5d99c(%rip), %xmm4    # 0x20e8f8
mulsd 0x888(%rsp), %xmm4
movsd 0x858(%rsp), %xmm5
movq 0x878(%rsp), %rax
movl %eax, %edx
movsd 0x8d0(%rsp), %xmm6
callq 0x1ad910
movsd %xmm0, 0x870(%rsp)
movsd 0x8d0(%rsp), %xmm0
movsd 0x890(%rsp), %xmm1
movsd 0x888(%rsp), %xmm2
movq 0x898(%rsp), %rdi
movsd 0x850(%rsp), %xmm3
movsd 0x8b0(%rsp), %xmm4
callq 0x1af1c0
movsd %xmm0, 0x868(%rsp)
movq 0x8e0(%rsp), %rax
movl $0x1, 0x44(%rax)
movq 0x8b8(%rsp), %rax
movsd (%rax), %xmm0
divsd 0x868(%rsp), %xmm0
movsd 0x2124a(%rip), %xmm1    # 0x1d2248
subsd %xmm0, %xmm1
movaps 0x21227(%rip), %xmm0    # 0x1d2230
pand %xmm0, %xmm1
movsd 0x21c8b(%rip), %xmm0    # 0x1d2ca0
ucomisd %xmm1, %xmm0
jbe 0x1b102a
movq 0x8e0(%rsp), %rax
movl $0x0, 0x44(%rax)
movq 0x8e0(%rsp), %rax
cmpl $0x1, 0x44(%rax)
jne 0x1b1148
movsd 0x868(%rsp), %xmm0
movq 0x8b8(%rsp), %rax
movsd %xmm0, (%rax)
movq 0x8b8(%rsp), %rax
movsd (%rax), %xmm0
movq 0x8b8(%rsp), %rax
movsd %xmm0, 0x8(%rax)
movsd 0x890(%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x848(%rsp), %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x870(%rsp), %xmm0
movq 0x8c0(%rsp), %rdi
movsd 0x8d0(%rsp), %xmm1
callq 0x1af5c0
movsd 0x28(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0x30(%rsp), %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq 0x8e0(%rsp), %rax
movq 0x28(%rax), %rax
movq 0x8c8(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd 0x8a8(%rsp), %xmm0
movq 0x8e0(%rsp), %rax
movq 0x28(%rax), %rax
movq 0x8c8(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
movsd 0x888(%rsp), %xmm2
movq 0x898(%rsp), %rdi
movsd 0x850(%rsp), %xmm3
movsd 0x8a0(%rsp), %xmm4
movsd 0x848(%rsp), %xmm5
callq 0x1af3e0
movq 0x8e0(%rsp), %rax
movq 0x30(%rax), %rax
movq 0x8c8(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0x1b1222
movsd 0x890(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x848(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x870(%rsp), %xmm0
movq 0x8c0(%rsp), %rdi
movsd 0x8d0(%rsp), %xmm1
callq 0x1af5c0
movsd 0x8(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0x10(%rsp), %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq 0x8e0(%rsp), %rax
movq 0x28(%rax), %rax
movq 0x8c8(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd 0x888(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x848(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x868(%rsp), %xmm0
movq 0x8b8(%rsp), %rdi
movsd 0x8d0(%rsp), %xmm1
callq 0x1af5c0
movsd 0x18(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0x20(%rsp), %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq 0x8e0(%rsp), %rax
movq 0x30(%rax), %rax
movq 0x8c8(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq 0x880(%rsp), %rax
cmpl $0x1, (%rax)
jne 0x1b1261
leaq 0x40(%rsp), %rdi
movsd 0x8d0(%rsp), %xmm0
leaq 0x5e503(%rip), %rsi     # 0x20f747
movb $0x1, %al
callq 0x8090
movq 0x8e0(%rsp), %rax
movq 0x48(%rax), %rdi
leaq 0x40(%rsp), %rsi
callq 0x8660
addq $0x8e8, %rsp            # imm = 0x8E8
retq
nopl (%rax)