// File: /workspace/github_c_makefile_star2_O2/PoulinV[P]AxiCLASS/build/../source/thermodynamics.c
// Function: thermodynamics_derivs
int thermodynamics_derivs(
                          double mz,
                          double * y,
                          double * dy,
                          void * parameters_and_workspace,
                          ErrorMsg error_message
                          ) {
  /** Summary: */

  /** Define local variables */
  /* Index for iterating over derivatives */
  int index_ti;

  /* Shorthand notations */
  double z,x,nH,Trad,Tmat,x_H,x_He,Hz,eps,depsdlna,dHdlna,heat_capacity,rate_gamma_b;

  /* Baryon molecular weight */
  double mu_bar;

  /* Shorthand notations for all of the structs */
  struct thermodynamics_parameters_and_workspace * ptpaw;
  struct precision * ppr;
  struct background * pba;
  struct thermodynamics * pth;
  double * pvecback;
  struct thermo_workspace * ptw;
  struct thermo_diffeq_workspace * ptdw;
  struct thermo_vector * ptv;
  struct thermorecfast * precfast;
  struct injection * pin;
  int ap_current;

  /* varying fundamental constants */
  double alpha = 1., me = 1., rescale_rate = 1.;

  /* Redshift */
  z = -mz;

  /** - Rename structure fields (just to avoid heavy notations) */

  /* structures */
  ptpaw = parameters_and_workspace;
  ppr = ptpaw->ppr;
  pba = ptpaw->pba;
  pth = ptpaw->pth;
  pin = &(pth->in);
  /* vector of background quantities */
  pvecback = ptpaw->pvecback;
  /* thermodynamics workspace & vector */
  ptw = ptpaw->ptw;
  ptdw = ptw->ptdw;
  ptv = ptdw->ptv;
  /* pointer to Recfast/HyRec wrappers */
  precfast = ptdw->precfast;
  /* Approximation flag */
  ap_current = ptdw->ap_current;

  /** - Get background/thermo quantities in this point */

  class_call(background_at_z(pba,
                             z,
                             long_info,
                             inter_closeby,
                             &(ptw->last_index_back),
                             pvecback),
             pba->error_message,
             error_message);

  /* Hz is H in inverse seconds (while pvecback returns [H0/c] in inverse Mpcs) */
  Hz = pvecback[pba->index_bg_H] * _c_ / _Mpc_over_m_;

  /* Total number density of Hydrogen nuclei in SI units */
  nH = ptw->SIunit_nH0 * (1.+z) * (1.+z) * (1.+z);

  /* Photon temperature in Kelvins. Modify this for some non-trivial photon temperature changes */
  Trad = ptw->Tcmb * (1.+z);

  /** Set Tmat from the evolver (it is always evolved) and store it in the workspace. */
  Tmat = y[ptv->index_ti_D_Tmat] + ptw->Tcmb*(1.+z);

  /* For varying fundamental constants (according to 1705.03925) */
  if (pth->has_varconst == _TRUE_) {
    alpha = pvecback[pba->index_bg_varc_alpha];
    me = pvecback[pba->index_bg_varc_me];
    rescale_rate = alpha*alpha/me/me/me;
  }

  /** - The input vector y contains thermodynamic variables like
      (Tmat, x_H,x_He).  The goal of this function is: 1) Depending on
      the chosen code and current approximation, to use either
      analytical approximations or the vector y to calculate x_e; 2) To
      compute re-ionization effects on x_e; The output of this function
      is stored in the workspace ptdw */

  class_call(thermodynamics_ionization_fractions(z,y,pba,pth,ptw,ap_current),
             pth->error_message,
             error_message);

  /* Save the output in local variables */
  x = ptdw->x_reio;

  /** - If needed, calculate heating effects (i.e. any possible energy deposition rates
      affecting the evolution equations for x and Tmat) */

  if (pth->has_exotic_injection == _TRUE_) {
    /* In case of energy injection, we currently neglect the contribution to helium ionization for RecFast ! */
    /* Note that we calculate here the energy injection INCLUDING reionization ! */
    class_call(injection_calculate_at_z(pba,pth,x,z,Tmat,pvecback),
               pin->error_message,
               error_message);
  }

  /** - Derivative of the ionization fractions */
  x_H = ptdw->x_H;
  x_He = ptdw->x_He;
  x = ptdw->x_noreio;
  switch (pth->recombination) {

    /** --> use Recfast or HyRec to get the derivatives d(x_H)/dz and
        d(x_He)/dz, and store the result directly in the vector
        dy. This gives the derivative of the ionization fractions from
        recombination only (not from reionization). Of course, the
        full treatment would involve the actual evolution equations
        for x_H and x_He during reionization, but these are not yet
        fully implemented. */
  case recfast:
    precfast->fsR = alpha; /**< Pass value of fsR = relative alpha (fine-structure) */
    precfast->meR = me;    /**< Pass value of meR = relative m_e (effective eletron mass) */
    /* Hydrogen equations */
    if (ptdw->require_H == _TRUE_) {
      class_call(recfast_dx_H_dz(pth,precfast,x_H,x,nH,z,Hz,Tmat,Trad,&(dy[ptv->index_ti_x_H])),
                 precfast->error_message,
                 error_message);
    }

    /* Helium equations */
    if (ptdw->require_He == _TRUE_) {
      class_call(recfast_dx_He_dz(pth,precfast,x_He,x,x_H,nH,z,Hz,Tmat,Trad,&(dy[ptv->index_ti_x_He])),
                 precfast->error_message,
                 error_message);
    }

    break;
  case hyrec:
    /* Hydrogen equations */
    if (ptdw->require_H == _TRUE_) {
      class_call(hyrec_dx_H_dz(pth,ptw->ptdw->phyrec,x_H,x_He,x,nH,z,Hz,Tmat,Trad,alpha,me,&(dy[ptv->index_ti_x_H])),
                 ptw->ptdw->phyrec->error_message,
                 error_message);
    }

    /* Helium equations */
    if (ptdw->require_He == _TRUE_) {
      class_call(hyrec_dx_He_dz(pth,ptw->ptdw->phyrec,x_H,x_He,x,nH,z,Hz,Tmat,Trad,alpha,me,&(dy[ptv->index_ti_x_He])),
                 ptw->ptdw->phyrec->error_message,
                 error_message);
    }
    break;
  }

  /** - Derivative of the matter temperature (relevant for both Recfast and HyRec cases) */

  /* Restore the real x for the temperature equations. */
  x = ptdw->x_reio;

  /** - Calculate quantities for interacting dark matter */
  if (pba->has_idm == _TRUE_ || pba->has_idr == _TRUE_) {
    class_call(thermodynamics_idm_quantities(pba, z, y, dy, pth, ptw, pvecback),
               pth->error_message,
               pth->error_message);
  }

  /* Using the following definitions and equations, we derive a few important quantities
     Using n_e = x * n_H, n_He = f * n_H, rho_He ~ YHe * rho_b, rho_H ~ (1-YHe)*rho_b)
     - Heat capacity of the IGM
     heat_capacity = (3/2)*k_B*(n_H+n_He+n_e) = (3/2)*k_B*(1+f+x)*n_H
     - Mean baryonic molecular mass
     mu_bar = (rho_H + rho_He + rho_e)/(n_H + n_He + n_e) ~ ( (1. + YHe/(1+YHe) + 0.) * rho_H )/( (1. + f + x) * n_H) = m_H / (1+x+f) /(1-YHe)
     - Photon-baryon momentum transfer rate
     R_g = (4/3 * rho_g/rho_b) * (sigma_T * n_e) = (4/3 * rho_g * sigma_T ) * x * (1-YHe)/m_H
     - Photon-Baryon interaction rate:
     rate_gamma_b = 2 * mu_bar / m_e * R_g =  2 * (sigma_T/m_e) * (4/3 * rho_g) * x / (1. + f + x)
  */
  /* Photon-Baryon temperature change rate  */
  rate_gamma_b = ( 2. * _sigma_/_m_e_/_c_ ) * ( 4./3. * pvecback[pba->index_bg_rho_g] * _Jm3_over_Mpc2_ ) * x / (1.+x+ptw->fHe);
  if (pth->has_varconst == _TRUE_) {
    rate_gamma_b *= rescale_rate;
  }

  /* Heat capacity of the IGM */
  heat_capacity = (3./2.)*_k_B_*nH*(1.+ptw->fHe+x);

  /*
   * A note on the temperature definition:
   *
   * All equations work with D_Tmat = Tmat - Trad
   *
   * Thus all derivatives are calculated as dD_Tmat/dz = dTmat/dz - Tcmb
   **/

  /*
   * A note on the 'early' time steady state expansion (activated here before HeIII recombination):
   *
   * Note: dTr/dz = Tr/(1+z) = Tcmb
   *
   * The early system of CMB and matter is very tightly coupled anyway, so we can expand in the following way:
   * The full equation is dTm/dz = (Tm-Tr)/e /(1+z) + 2 Tm/(1+z). Here e = H*(1+x+f)/(cT*Tr^4*x) << 1 at early times
   *
   * Find the first order solution in e, by multiplying in (1+z)*e, and approximate
   *  e*(dTm/dz)*(1+z) ~ e*(dTr/dz)*(1+z) + O(e^2) ~ e * Tr
   *
   * You find e*Tr = (Tm-Tr) + 2 Tm * e
   * Thus Tm = (1+e)/(1+2*e) * Tr = Tr * (1-e) + O(e^2)
   *
   * This is the steady state solution, which is the SAME as e.g. in HyRec
   * In our notation, eps = e*Tr, so we get Tm = Tr - eps
   *
   * So, taking the derivative of the right hand side, we obtain dTm/dz = Tcmb - eps*(dln(eps)/dz)
   *
   * Now use the form of eps = Tr*e = H*(1+x+f)/(cT*Tr^3*x) to derive the remaining terms in the below formula
   * => dln(eps)/dlna = dln(H)/dlna  - (1+f)/(1+x+f)*dln(x)/dlna + 3*dln(Tr)/dlna
   *
   * We also approximate dln(x)/dlna << 1, since we are before HeIII recombination, thus finding
   * => dln(eps)/dlna ~ dln(H)/dlna + 3
   *
   * dD_Tmat/dz = d(-eps)/dz = - eps * dln(eps)/dz = eps *dln(eps)/dlna /(1.+z)
   **/

  if ( ap_current == ptdw->index_ap_brec || (ptw->has_ap_idmtca == _TRUE_ && ap_current == ptdw->index_ap_idmtca)) {
    /* Early time steady state equation */
    dHdlna = (1.+z)*pvecback[pba->index_bg_H_prime]/pvecback[pba->index_bg_H] * _c_ / _Mpc_over_m_;
    eps =  Trad * Hz / rate_gamma_b;
    depsdlna = dHdlna/Hz + 3.;
    /* Recfast v 1.5: add here a smoothing term as suggested by Adam Moss */
    dy[ptdw->ptv->index_ti_D_Tmat] = eps * depsdlna / (1.+z);
  }

  else {
    /* Full equations at later times */
    dy[ptv->index_ti_D_Tmat] =
      + 2.*Tmat/(1.+z)                                                          /* Adiabatic expansion */
      + rate_gamma_b * (Tmat-Trad) / (Hz*(1.+z))                                /* Coupling to photons*/
      - ptw->Tcmb;                                                              /* dTrad/dz */

    /* Add heating from energy injection */
    if (pth->has_exotic_injection == _TRUE_) {
      dy[ptv->index_ti_D_Tmat] -= pin->pvecdeposition[pin->index_dep_heat] / heat_capacity / (Hz*(1.+z));
    }
    /* Add term coming from idm_b */
    if (pth->has_idm_b == _TRUE_){
      mu_bar = _m_H_ / (1. + x + ptw->fHe) / (1. - pth->YHe); //In units of kg
      dy[ptv->index_ti_D_Tmat] += 2.* pvecback[pba->index_bg_rho_idm]/pvecback[pba->index_bg_rho_b]
        * mu_bar/(pth->m_idm*_eV_/_c_/_c_ + _m_p_)
        * ptdw->R_idm_b*(Tmat-ptdw->T_idm) / (pvecback[pba->index_bg_a]*pvecback[pba->index_bg_H]*(1.+z));
    }
  }

  /** - Derivative of the Dark Matter temperature */
  if (pba->has_idm == _TRUE_ && !(ptw->has_ap_idmtca == _TRUE_ && ap_current == ptdw->index_ap_idmtca)) {
    dy[ptv->index_ti_T_idm] = - ptdw->T_idm_prime; // the negative sign will be negated at the end
  }

  /** - If we have extreme heatings, recombination does not fully happen
   * and/or re-ionization happens before a redshift of
   * reionization_z_start_max (default = 50).  We want to catch this
   * unphysical regime, because it would lead to further errors
   * (and/or unphysical calculations) within our recombination codes
   */

  class_test((x>1.0) && (z < ppr->z_end_reco_test) && (z > ppr->reionization_z_start_max),
             error_message,
             "At redshift %.5g : Recombination did not complete by redshift %.5g, or re-ionization happened before %.5g.\nIf this is a desired behavior, please adjust z_end_reco_test and/or reionization_z_start_max.",
             z,ppr->z_end_reco_test,ppr->reionization_z_start_max);

  /** - invert all derivatives (because the evolver evolves with -z, not with +z) */

  for (index_ti=0;index_ti<ptdw->ptv->ti_size;index_ti++) {
    dy[index_ti]=-dy[index_ti];
  }

  return _SUCCESS_;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10f8, %rsp           # imm = 0x10F8
movq %rcx, %rbp
movq %rsi, 0xd0(%rsp)
movq %rdi, 0x10(%rsp)
movapd %xmm0, %xmm1
movapd 0x7cf03(%rip), %xmm0    # 0xe5230
movapd %xmm1, 0x30(%rsp)
xorpd %xmm1, %xmm0
movq (%rdx), %r15
movq 0x8(%rdx), %rax
movq %rax, 0xc8(%rsp)
movq 0x10(%rdx), %r12
movq 0x20(%rdx), %r8
movq 0x18(%rdx), %r13
movq 0x80(%r13), %rax
movq 0xb8(%rax), %r14
movq 0xc8(%rax), %rcx
movq %rcx, 0xe0(%rsp)
movq %rax, 0xe8(%rsp)
movl 0x90(%rax), %ebx
leaq 0x78(%r13), %rcx
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
movq %r15, %rdi
movapd %xmm0, 0x60(%rsp)
movq %r8, 0x48(%rsp)
callq 0x585e8
cmpl $0x1, %eax
jne 0x683e4
addq $0xd1c, %r15            # imm = 0xD1C
leaq 0x7d043(%rip), %rsi     # 0xe53f0
leaq 0x9ea4b(%rip), %rdx     # 0x106dff
leaq 0xf0(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x7cc64(%rip), %rsi     # 0xe5034
leaq 0x9ea7d(%rip), %rdx     # 0x106e54
movq %rbp, %rdi
movl $0xa1f, %ecx            # imm = 0xA1F
jmp 0x68519
movq %rbp, 0x18(%rsp)
movslq 0x384(%r15), %rax
movsd 0x7ce68(%rip), %xmm3    # 0xe5260
movapd %xmm3, %xmm1
subsd 0x30(%rsp), %xmm1
movsd 0x38(%r13), %xmm2
mulsd %xmm1, %xmm2
movslq 0xc(%r14), %rsi
cmpw $0x1, 0xe78(%r12)
movapd %xmm3, %xmm4
movapd %xmm3, %xmm0
movq 0x48(%rsp), %rdi
movq %r12, %rdx
jne 0x6845a
movslq 0x42c(%r15), %r8
movsd (%rdi,%r8,8), %xmm3
movslq 0x430(%r15), %r8
movsd (%rdi,%r8,8), %xmm4
movapd %xmm3, %xmm0
mulsd %xmm3, %xmm0
divsd %xmm4, %xmm0
divsd %xmm4, %xmm0
divsd %xmm4, %xmm0
movsd %xmm4, 0x90(%rsp)
movsd %xmm3, 0x98(%rsp)
movsd %xmm0, 0xd8(%rsp)
movsd (%rdi,%rax,8), %xmm0
movaps %xmm0, 0x30(%rsp)
movsd 0x30(%r13), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x28(%rsp)
movq 0x10(%rsp), %r12
movsd (%r12,%rsi,8), %xmm0
addsd %xmm2, %xmm0
movapd %xmm0, 0x50(%rsp)
movapd 0x60(%rsp), %xmm0
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rcx
movq %r13, %rbp
movq %rdx, %r13
movl %ebx, %r8d
movapd %xmm1, 0xb0(%rsp)
movapd %xmm2, 0xa0(%rsp)
callq 0x6b829
testl %eax, %eax
je 0x68538
addq $0x1064, %r13           # imm = 0x1064
leaq 0x7cf0b(%rip), %rsi     # 0xe53f0
leaq 0x9e97e(%rip), %rdx     # 0x106e6a
leaq 0xf0(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x7cb2c(%rip), %rsi     # 0xe5034
leaq 0x9e945(%rip), %rdx     # 0x106e54
movq 0x18(%rsp), %rdi
movl $0xa3d, %ecx            # imm = 0xA3D
movq %rbx, %r8
xorl %eax, %eax
callq 0x2e014
pushq $0x1
popq %rax
addq $0x10f8, %rsp           # imm = 0x10F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %ebx, 0x24(%rsp)
movq %r15, 0x88(%rsp)
cmpw $0x1, 0xb8(%r13)
movq 0xe8(%rsp), %rbx
movq %r13, %rcx
jne 0x685d4
movsd 0x18(%rbx), %xmm0
movq 0x88(%rsp), %rdi
movq %rcx, %rsi
movapd 0x60(%rsp), %xmm1
movapd 0x50(%rsp), %xmm2
movq 0x48(%rsp), %rdx
movq %rcx, %r12
callq 0xc912c
movq %r12, %rcx
movq 0x10(%rsp), %r12
cmpl $0x1, %eax
jne 0x685d4
addq $0x630, %rcx            # imm = 0x630
leaq 0x7ce52(%rip), %rsi     # 0xe53f0
leaq 0x9e905(%rip), %rdx     # 0x106eaa
leaq 0xf0(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2e014
leaq 0x7ca76(%rip), %rsi     # 0xe5034
leaq 0x9e88f(%rip), %rdx     # 0x106e54
movq 0x18(%rsp), %rdi
movl $0xa4a, %ecx            # imm = 0xA4A
jmp 0x68519
movapd 0x30(%rsp), %xmm7
mulsd 0x814ce(%rip), %xmm7    # 0xe9ab0
movapd 0xb0(%rsp), %xmm6
movsd 0x28(%rsp), %xmm2
mulsd %xmm6, %xmm2
divsd 0x813ab(%rip), %xmm7    # 0xe99a8
mulsd %xmm6, %xmm2
movsd (%rbx), %xmm3
movsd 0x8(%rbx), %xmm1
movsd 0x10(%rbx), %xmm4
movl 0x10(%rcx), %eax
cmpl $0x1, %eax
movsd %xmm2, 0x28(%rsp)
movapd %xmm7, 0x30(%rsp)
je 0x6873c
testl %eax, %eax
movq %rbp, %rsi
movq 0xd0(%rsp), %r15
movq 0xe0(%rsp), %r13
jne 0x689ec
movsd 0x98(%rsp), %xmm0
movsd %xmm0, 0x120(%r13)
movsd 0x90(%rsp), %xmm0
movsd %xmm0, 0x128(%r13)
cmpl $0x1, 0xb0(%rbx)
jne 0x68858
movslq 0x4(%r14), %rax
leaq (%r15,%rax,8), %rdx
movq %rcx, %rdi
movq %r13, %rsi
movapd %xmm3, %xmm0
movsd %xmm1, 0x40(%rsp)
movapd %xmm4, %xmm1
movsd %xmm3, 0x80(%rsp)
movaps 0x60(%rsp), %xmm3
movsd %xmm4, 0x78(%rsp)
movapd %xmm7, %xmm4
movapd 0x50(%rsp), %xmm5
movaps 0xa0(%rsp), %xmm6
movq %rcx, %r12
callq 0xc64ab
movsd 0x40(%rsp), %xmm1
movsd 0x78(%rsp), %xmm4
movsd 0x80(%rsp), %xmm3
movapd 0x30(%rsp), %xmm7
movq %r12, %rcx
movq 0x10(%rsp), %r12
movapd 0xb0(%rsp), %xmm6
movq %rbp, %rsi
cmpl $0x1, %eax
jne 0x68858
addq $0x134, %r13            # imm = 0x134
leaq 0x7cced(%rip), %rsi     # 0xe53f0
leaq 0x9e7d4(%rip), %rdx     # 0x106ede
leaq 0xf0(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x7c90e(%rip), %rsi     # 0xe5034
leaq 0x9e727(%rip), %rdx     # 0x106e54
movq 0x18(%rsp), %rdi
movl $0xa61, %ecx            # imm = 0xA61
jmp 0x68519
cmpl $0x1, 0xb0(%rbx)
movq %rbp, %rsi
movq 0xd0(%rsp), %r15
jne 0x6890e
movq 0x80(%rsi), %rax
movq 0xc0(%rax), %rsi
movslq 0x4(%r14), %rax
leaq (%r15,%rax,8), %rdx
movsd 0x90(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x98(%rsp), %xmm0
movsd %xmm0, (%rsp)
movq %rcx, %rdi
movapd %xmm3, %xmm0
movsd %xmm1, 0x40(%rsp)
movsd 0x40(%rsp), %xmm1
movapd %xmm4, %xmm2
movsd %xmm3, 0x80(%rsp)
movsd 0x28(%rsp), %xmm3
movsd %xmm4, 0x78(%rsp)
movaps 0x60(%rsp), %xmm4
movapd %xmm7, %xmm5
movaps 0x50(%rsp), %xmm6
movaps 0xa0(%rsp), %xmm7
movq %rcx, %r12
callq 0xd4609
movsd 0x40(%rsp), %xmm1
movsd 0x78(%rsp), %xmm4
movsd 0x80(%rsp), %xmm3
movapd 0x30(%rsp), %xmm7
movq %r12, %rcx
movq 0x10(%rsp), %r12
movapd 0xb0(%rsp), %xmm6
movq %rbp, %rsi
cmpl $0x1, %eax
jne 0x6890e
movq 0x80(%rsi), %rax
movq 0xc0(%rax), %rcx
addq $0x20, %rcx
leaq 0x7cbce(%rip), %rsi     # 0xe53f0
leaq 0x9e75a(%rip), %rdx     # 0x106f83
leaq 0xf0(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2e014
leaq 0x7c7f2(%rip), %rsi     # 0xe5034
leaq 0x9e60b(%rip), %rdx     # 0x106e54
movq 0x18(%rsp), %rdi
movl $0xa71, %ecx            # imm = 0xA71
jmp 0x68519
cmpl $0x1, 0xb4(%rbx)
jne 0x689ec
movslq 0x8(%r14), %rax
leaq (%r15,%rax,8), %rdx
movq %rcx, %rdi
movq %r13, %rsi
movapd %xmm1, %xmm0
movapd %xmm4, %xmm1
movapd %xmm3, %xmm2
movsd 0x28(%rsp), %xmm3
movapd 0x60(%rsp), %xmm4
movapd %xmm7, %xmm5
movaps 0x50(%rsp), %xmm6
movaps 0xa0(%rsp), %xmm7
movq %rcx, %r12
callq 0xc69f1
movapd 0x30(%rsp), %xmm7
movq %r12, %rcx
movq 0x10(%rsp), %r12
movapd 0xb0(%rsp), %xmm6
movq %rbp, %rsi
cmpl $0x1, %eax
jne 0x689ec
addq $0x134, %r13            # imm = 0x134
leaq 0x7cb1b(%rip), %rsi     # 0xe53f0
leaq 0x9e651(%rip), %rdx     # 0x106f2d
leaq 0xf0(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x7c73c(%rip), %rsi     # 0xe5034
leaq 0x9e555(%rip), %rdx     # 0x106e54
movq 0x18(%rsp), %rdi
movl $0xa68, %ecx            # imm = 0xA68
jmp 0x68519
cmpl $0x1, 0xb4(%rbx)
jne 0x689ec
movq 0x80(%rsi), %rax
movq 0xc0(%rax), %rsi
movslq 0x8(%r14), %rax
leaq (%r15,%rax,8), %rdx
movsd 0x90(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x98(%rsp), %xmm0
movsd %xmm0, (%rsp)
movq %rcx, %rdi
movapd %xmm3, %xmm0
movapd %xmm4, %xmm2
movsd 0x28(%rsp), %xmm3
movapd 0x60(%rsp), %xmm4
movapd %xmm7, %xmm5
movaps 0x50(%rsp), %xmm6
movaps 0xa0(%rsp), %xmm7
movq %rcx, %r12
callq 0xd47df
movapd 0x30(%rsp), %xmm7
movq %r12, %rcx
movq 0x10(%rsp), %r12
movapd 0xb0(%rsp), %xmm6
movq %rbp, %rsi
cmpl $0x1, %eax
jne 0x689ec
movq 0x80(%rsi), %rax
movq 0xc0(%rax), %rcx
addq $0x20, %rcx
leaq 0x7ca3a(%rip), %rsi     # 0xe53f0
leaq 0x9e62a(%rip), %rdx     # 0x106fe7
leaq 0xf0(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2e014
leaq 0x7c65e(%rip), %rsi     # 0xe5034
leaq 0x9e477(%rip), %rdx     # 0x106e54
movq 0x18(%rsp), %rdi
movl $0xa78, %ecx            # imm = 0xA78
jmp 0x68519
movsd 0x18(%rbx), %xmm8
movq 0x88(%rsp), %rdi
cmpw $0x1, 0x4b6(%rdi)
je 0x68a0e
cmpw $0x1, 0x4c6(%rdi)
jne 0x68a52
movapd 0x60(%rsp), %xmm0
movq %r12, %rsi
movq %rcx, %r12
movq %rbp, %r8
movq 0x48(%rsp), %r9
movsd %xmm8, 0x10(%rsp)
callq 0x6bf8e
movsd 0x10(%rsp), %xmm8
movapd 0x30(%rsp), %xmm7
movq 0x88(%rsp), %rdi
movq %r12, %rcx
movapd 0xb0(%rsp), %xmm6
movq %rbp, %rsi
movslq 0x38c(%rdi), %rax
movq 0x48(%rsp), %r9
movsd (%r9,%rax,8), %xmm1
mulsd 0x7fa14(%rip), %xmm1    # 0xe8480
mulsd 0x9bb4c(%rip), %xmm1    # 0x1045c0
mulsd 0x9bb4c(%rip), %xmm1    # 0x1045c8
mulsd %xmm8, %xmm1
movsd 0x7c7d7(%rip), %xmm0    # 0xe5260
movapd %xmm8, %xmm2
addsd %xmm0, %xmm2
movsd 0x20(%rsi), %xmm3
movapd %xmm2, %xmm4
addsd %xmm3, %xmm4
divsd %xmm4, %xmm1
cmpw $0x1, 0xe78(%rcx)
jne 0x68ab6
mulsd 0xd8(%rsp), %xmm1
movapd 0x50(%rsp), %xmm5
movl 0x24(%rsp), %eax
cmpl 0x74(%rbx), %eax
jne 0x68b3a
movslq 0x388(%rdi), %rax
movsd (%r9,%rax,8), %xmm0
mulsd %xmm6, %xmm0
movslq 0x384(%rdi), %rax
divsd (%r9,%rax,8), %xmm0
mulsd 0x80fc5(%rip), %xmm0    # 0xe9ab0
divsd 0x80eb5(%rip), %xmm0    # 0xe99a8
movapd 0xa0(%rsp), %xmm2
mulsd %xmm7, %xmm2
unpcklpd %xmm0, %xmm2            # xmm2 = xmm2[0],xmm0[0]
unpcklpd %xmm7, %xmm1            # xmm1 = xmm1[0],xmm7[0]
divpd %xmm1, %xmm2
movapd %xmm2, %xmm0
unpckhpd %xmm2, %xmm0            # xmm0 = xmm0[1],xmm2[1]
addsd 0x7dc2c(%rip), %xmm0    # 0xe6748
mulsd %xmm2, %xmm0
divsd %xmm6, %xmm0
movq 0xb8(%rbx), %rax
movslq 0xc(%rax), %rax
movsd %xmm0, (%r15,%rax,8)
jmp 0x68ca3
cmpw $0x1, 0x60(%rsi)
jne 0x68b4e
movl 0x24(%rsp), %eax
cmpl 0x70(%rbx), %eax
je 0x68ac5
movapd %xmm5, %xmm4
subsd 0xa0(%rsp), %xmm4
mulsd %xmm6, %xmm7
unpcklpd %xmm4, %xmm5            # xmm5 = xmm5[0],xmm4[0]
movapd 0x9bb05(%rip), %xmm4    # 0x104670
unpcklpd %xmm1, %xmm4            # xmm4 = xmm4[0],xmm1[0]
mulpd %xmm5, %xmm4
movapd %xmm6, %xmm1
unpcklpd %xmm7, %xmm1            # xmm1 = xmm1[0],xmm7[0]
divpd %xmm1, %xmm4
movapd %xmm4, %xmm1
unpckhpd %xmm4, %xmm1            # xmm1 = xmm1[1],xmm4[1]
addsd %xmm4, %xmm1
subsd 0x38(%rsi), %xmm1
movslq 0xc(%r14), %rax
movsd %xmm1, (%r15,%rax,8)
cmpw $0x1, 0xb8(%rcx)
jne 0x68be5
movsd 0x28(%rsp), %xmm4
mulsd 0x9ba1e(%rip), %xmm4    # 0x1045d0
addsd %xmm0, %xmm3
addsd %xmm8, %xmm3
mulsd %xmm4, %xmm3
movq 0x610(%rcx), %r8
movslq 0x5f8(%rcx), %rdx
movsd (%r8,%rdx,8), %xmm4
divsd %xmm3, %xmm4
divsd %xmm7, %xmm4
subsd %xmm4, %xmm1
movsd %xmm1, (%r15,%rax,8)
cmpw $0x1, 0x34(%rcx)
movapd 0x50(%rsp), %xmm4
jne 0x68ca3
addsd 0x20(%rsi), %xmm2
movsd 0x9b9d5(%rip), %xmm3    # 0x1045d8
divsd %xmm2, %xmm3
subsd (%rcx), %xmm0
movslq 0x398(%rdi), %rdx
movsd (%r9,%rdx,8), %xmm2
addsd %xmm2, %xmm2
movslq 0x390(%rdi), %rdx
movhpd (%r9,%rdx,8), %xmm0     # xmm0 = xmm0[0],mem[0]
unpcklpd %xmm2, %xmm3            # xmm3 = xmm3[0],xmm2[0]
movsd 0x1010(%rcx), %xmm2
mulsd 0x80ecb(%rip), %xmm2    # 0xe9b08
divpd %xmm0, %xmm3
movsd 0x80e67(%rip), %xmm0    # 0xe9ab0
divsd %xmm0, %xmm2
divsd %xmm0, %xmm2
movapd %xmm3, %xmm0
unpckhpd %xmm3, %xmm0            # xmm0 = xmm0[1],xmm3[1]
addsd 0x9b97f(%rip), %xmm2    # 0x1045e0
mulsd %xmm3, %xmm0
divsd %xmm2, %xmm0
mulsd 0x30(%rbx), %xmm0
subsd 0x38(%rbx), %xmm4
mulsd %xmm0, %xmm4
movslq 0x380(%rdi), %rcx
movsd (%r9,%rcx,8), %xmm0
movslq 0x384(%rdi), %rcx
mulsd (%r9,%rcx,8), %xmm0
mulsd %xmm0, %xmm6
divsd %xmm6, %xmm4
addsd %xmm4, %xmm1
movsd %xmm1, (%r15,%rax,8)
cmpw $0x1, 0x4b6(%rdi)
jne 0x68cd4
cmpw $0x1, 0x60(%rsi)
jne 0x68cbd
movl 0x24(%rsp), %eax
cmpl 0x70(%rbx), %eax
je 0x68cd4
movsd 0x40(%rbx), %xmm0
xorpd 0x7c566(%rip), %xmm0    # 0xe5230
movslq 0x10(%r14), %rax
movlpd %xmm0, (%r15,%rax,8)
ucomisd 0x7c583(%rip), %xmm8    # 0xe5260
movq 0x18(%rsp), %r12
movapd 0x60(%rsp), %xmm0
jbe 0x68d74
movq 0xc8(%rsp), %rax
movsd 0x1d0(%rax), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x68d74
movq 0xc8(%rsp), %rax
movsd 0x3e8(%rax), %xmm2
ucomisd %xmm2, %xmm0
jbe 0x68d74
leaq 0x9e32c(%rip), %rsi     # 0x10704d
leaq 0xf0(%rsp), %rbx
movq %rbx, %rdi
movb $0x3, %al
callq 0x2e014
leaq 0x7c348(%rip), %rsi     # 0xe5082
leaq 0x9e3d5(%rip), %rdx     # 0x107116
leaq 0x8f0(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x7c2d7(%rip), %rsi     # 0xe5034
leaq 0x9e0f0(%rip), %rdx     # 0x106e54
movq %r12, %rdi
movl $0xaed, %ecx            # imm = 0xAED
movq %r14, %r8
jmp 0x6851c
movq 0xb8(%rbx), %rax
movl (%rax), %edx
xorl %eax, %eax
testl %edx, %edx
cmovlel %eax, %edx
movapd 0x7c4a4(%rip), %xmm0    # 0xe5230
xorl %ecx, %ecx
cmpq %rcx, %rdx
je 0x68526
movsd (%r15,%rcx,8), %xmm1
xorpd %xmm0, %xmm1
movlpd %xmm1, (%r15,%rcx,8)
incq %rcx
jmp 0x68d8e