// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../external/HyRec2020/history.c
// Function: get_rec_next2_HHe
void get_rec_next2_HHe(HYREC_DATA *data, int model, double z_in, long iz, double *xH1, double *xHeII,
                       double dxHIIdlna_prev[2], double dxHeIIdlna_prev[2], double H) {

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

  double dxHeIIdlna, dxHIIdlna=0., z_out, xe;
  double nH, TR, DLNA;
  char sub_message[SIZE_ErrorM];
  DLNA = cosmo->dlna;
  xe = *xHeII + 1.- (*xH1);
  nH = cosmo->nH0 *cube(1.+z_in);
  TR = kBoltz * cosmo->T0 *(1.+z_in);
  /* Evolve HeII by solving ODE */
  dxHeIIdlna  = rec_helium_dxHeIIdlna(data, z_in, *xH1, *xHeII, H);
  *xHeII     += DLNA * hyrec_integrator(dxHeIIdlna, dxHeIIdlna_prev, z_in);

  /* Compute dxHII/dlna. This also correctly updates the radiation field at z_in,
     which is required even when using the stiff approximation */

  /* If system is stiff use the quasi-equilibrium solution */
  if(data->quasi_eq == 1){
    z_out = (1.+z_in)*exp(-DLNA)-1.;
    rec_xH1_stiff(data, model, z_out, *xHeII, xH1, iz_rad+1, H);
    hyrec_integrator(dxHIIdlna, dxHIIdlna_prev, z_in);
  }

    /* Otherwise use second-order explicit solver */
  else {
    dxHIIdlna = rec_dxHIIdlna(data, model, xe, 1.-(*xH1), nH, H, kBoltz*Tm, TR, iz_rad, z_in);
    *xH1 -= DLNA * hyrec_integrator(dxHIIdlna, dxHIIdlna_prev, z_in);
  }

    /* Checking for errors */
  if (*xH1 < 0. || *xH1 > 1. || *xH1 != *xH1) {
    sprintf(sub_message, "xH1 < 0 or xH1 > 1 in get_rec_next2_HHe: at z = %f, xH1 = %E\n", z_out, *xH1);
    strcat(data->error_message, sub_message);
    *error = 1;
  }
  if (*error == 1) {
    sprintf(sub_message, "  called from get_rec_next2_HHe at z = %f\n", z_out);
    strcat(data->error_message, sub_message);
    return;
  }
}

// Assembly:
subq $0x8b8, %rsp            # imm = 0x8B8
movq 0x8c0(%rsp), %rax
movq %rdi, 0x8b0(%rsp)
movl %esi, 0x8ac(%rsp)
movsd %xmm0, 0x8a0(%rsp)
movq %rdx, 0x898(%rsp)
movq %rcx, 0x890(%rsp)
movq %r8, 0x888(%rsp)
movq %r9, 0x880(%rsp)
movsd %xmm1, 0x878(%rsp)
movq 0x8b0(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x870(%rsp)
movq 0x8b0(%rsp), %rax
addq $0x38, %rax
movq %rax, 0x868(%rsp)
movq 0x8b0(%rsp), %rax
movq 0x30(%rax), %rax
movq 0x898(%rsp), %rcx
subq $0x1, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x860(%rsp)
movq 0x898(%rsp), %rax
subq $0x1, %rax
movq 0x8b0(%rsp), %rcx
movq 0x58(%rcx), %rcx
subq 0x8(%rcx), %rax
movq %rax, 0x858(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x848(%rsp)
movq 0x870(%rsp), %rax
movsd 0xa8(%rax), %xmm0
movsd %xmm0, 0x820(%rsp)
movq 0x888(%rsp), %rax
movsd 0x21e01(%rip), %xmm0    # 0x1d2248
addsd (%rax), %xmm0
movq 0x890(%rsp), %rax
subsd (%rax), %xmm0
movsd %xmm0, 0x838(%rsp)
movq 0x870(%rsp), %rax
movsd 0x88(%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x21dca(%rip), %xmm0    # 0x1d2248
addsd 0x8a0(%rsp), %xmm0
callq 0x1a5670
movaps %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x830(%rsp)
movq 0x870(%rsp), %rax
movsd 0x5e446(%rip), %xmm0    # 0x20e8f8
mulsd 0x8(%rax), %xmm0
movsd 0x21d89(%rip), %xmm1    # 0x1d2248
addsd 0x8a0(%rsp), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x828(%rsp)
movq 0x8b0(%rsp), %rdi
movsd 0x8a0(%rsp), %xmm0
movq 0x890(%rsp), %rax
movsd (%rax), %xmm1
movq 0x888(%rsp), %rax
movsd (%rax), %xmm2
movsd 0x878(%rsp), %xmm3
callq 0x1a6e90
movsd %xmm0, 0x850(%rsp)
movsd 0x820(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x850(%rsp), %xmm0
movq 0x8c0(%rsp), %rdi
movsd 0x8a0(%rsp), %xmm1
callq 0x1af5c0
movaps %xmm0, %xmm2
movsd 0x18(%rsp), %xmm0
movq 0x888(%rsp), %rax
movsd (%rax), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movq 0x8b0(%rsp), %rax
cmpl $0x1, 0x3c(%rax)
jne 0x1b0640
movsd 0x21cca(%rip), %xmm0    # 0x1d2248
addsd 0x8a0(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x820(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
callq 0x8670
movaps %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd 0x22209(%rip), %xmm1    # 0x1d27d0
addsd %xmm1, %xmm0
movsd %xmm0, 0x840(%rsp)
movq 0x8b0(%rsp), %rdi
movl 0x8ac(%rsp), %esi
movsd 0x840(%rsp), %xmm0
movq 0x888(%rsp), %rax
movsd (%rax), %xmm1
movq 0x890(%rsp), %rdx
movq 0x858(%rsp), %rax
addq $0x1, %rax
movl %eax, %ecx
movsd 0x878(%rsp), %xmm2
callq 0x1afbe0
movsd 0x848(%rsp), %xmm0
movq 0x880(%rsp), %rdi
movsd 0x8a0(%rsp), %xmm1
callq 0x1af5c0
jmp 0x1b071d
movq 0x8b0(%rsp), %rdi
movl 0x8ac(%rsp), %esi
movsd 0x838(%rsp), %xmm0
movq 0x890(%rsp), %rax
movsd 0x21be0(%rip), %xmm1    # 0x1d2248
subsd (%rax), %xmm1
movsd 0x830(%rsp), %xmm2
movsd 0x878(%rsp), %xmm3
movsd 0x5e272(%rip), %xmm4    # 0x20e8f8
mulsd 0x860(%rsp), %xmm4
movsd 0x828(%rsp), %xmm5
movq 0x858(%rsp), %rax
movl %eax, %edx
movsd 0x8a0(%rsp), %xmm6
callq 0x1ad910
movsd %xmm0, 0x848(%rsp)
movsd 0x820(%rsp), %xmm0
movsd %xmm0, (%rsp)
movsd 0x848(%rsp), %xmm0
movq 0x880(%rsp), %rdi
movsd 0x8a0(%rsp), %xmm1
callq 0x1af5c0
movaps %xmm0, %xmm2
movsd (%rsp), %xmm0
movq 0x890(%rsp), %rax
movsd (%rax), %xmm1
movq %xmm0, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
movq %rcx, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movq 0x890(%rsp), %rax
xorps %xmm0, %xmm0
ucomisd (%rax), %xmm0
ja 0x1b0766
movq 0x890(%rsp), %rax
movsd (%rax), %xmm0
movsd 0x21b06(%rip), %xmm1    # 0x1d2248
ucomisd %xmm1, %xmm0
ja 0x1b0766
movq 0x890(%rsp), %rax
movsd (%rax), %xmm0
movq 0x890(%rsp), %rax
ucomisd (%rax), %xmm0
jne 0x1b0766
jp 0x1b0766
jmp 0x1b07b2
leaq 0x20(%rsp), %rdi
movsd 0x840(%rsp), %xmm0
movq 0x890(%rsp), %rax
movsd (%rax), %xmm1
leaq 0x5eef6(%rip), %rsi     # 0x20f67d
movb $0x2, %al
callq 0x8090
movq 0x8b0(%rsp), %rax
movq 0x48(%rax), %rdi
leaq 0x20(%rsp), %rsi
callq 0x8660
movq 0x868(%rsp), %rax
movl $0x1, (%rax)
movq 0x868(%rsp), %rax
cmpl $0x1, (%rax)
jne 0x1b07f1
leaq 0x20(%rsp), %rdi
movsd 0x840(%rsp), %xmm0
leaq 0x5eee7(%rip), %rsi     # 0x20f6bb
movb $0x1, %al
callq 0x8090
movq 0x8b0(%rsp), %rax
movq 0x48(%rax), %rdi
leaq 0x20(%rsp), %rsi
callq 0x8660
addq $0x8b8, %rsp            # imm = 0x8B8
retq
nopl (%rax)