// File: /workspace/github_c_makefile_star2_O3/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, 0x18(%rsp)
movq %rdi, 0x58(%rsp)
movapd %xmm0, %xmm1
movapd 0x819dc(%rip), %xmm0    # 0xee230
movapd %xmm1, 0x30(%rsp)
xorpd %xmm1, %xmm0
movq (%rdx), %rbx
movq 0x8(%rdx), %rax
movq %rax, 0xd8(%rsp)
movq 0x10(%rdx), %r13
movq 0x20(%rdx), %r8
movq 0x18(%rdx), %r12
movq 0x80(%r12), %rax
movq 0xb8(%rax), %r14
movq 0xc8(%rax), %rcx
movq %rcx, 0x50(%rsp)
movq %rax, 0xe8(%rsp)
movl 0x90(%rax), %eax
movl %eax, 0xac(%rsp)
leaq 0x78(%r12), %rcx
movq %rbx, %rdi
movapd %xmm0, 0x70(%rsp)
movl $0x2, %esi
movl $0x1, %edx
movq %r8, %r15
callq 0x5c3a8
cmpl $0x1, %eax
jne 0x6c913
addq $0xd1c, %rbx            # imm = 0xD1C
leaq 0x81b14(%rip), %rsi     # 0xee3f0
leaq 0xa367c(%rip), %rdx     # 0x10ff5f
leaq 0xf0(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x81735(%rip), %rsi     # 0xee034
leaq 0xa36ae(%rip), %rdx     # 0x10ffb4
movq %rbp, %rdi
movl $0xa1f, %ecx            # imm = 0xA1F
jmp 0x6ca4a
movq %rbp, 0x10(%rsp)
movslq 0x384(%rbx), %rax
movsd 0x81939(%rip), %xmm3    # 0xee260
movapd %xmm3, %xmm1
subsd 0x30(%rsp), %xmm1
movsd 0x38(%r12), %xmm2
mulsd %xmm1, %xmm2
movslq 0xc(%r14), %rsi
cmpw $0x1, 0xe78(%r13)
movapd %xmm3, %xmm4
movapd %xmm3, %xmm0
movq %r12, %rbp
movq %r15, %r12
movq %r13, %r15
jne 0x6c98a
movslq 0x42c(%rbx), %rdi
movsd (%r12,%rdi,8), %xmm3
movslq 0x430(%rbx), %rdi
movsd (%r12,%rdi,8), %xmm4
movapd %xmm3, %xmm0
mulsd %xmm3, %xmm0
divsd %xmm4, %xmm0
divsd %xmm4, %xmm0
divsd %xmm4, %xmm0
movsd %xmm4, 0x98(%rsp)
movsd %xmm3, 0xa0(%rsp)
movsd %xmm0, 0xe0(%rsp)
movsd (%r12,%rax,8), %xmm0
movaps %xmm0, 0x30(%rsp)
movsd 0x30(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x28(%rsp)
movq 0x58(%rsp), %rdi
movsd (%rdi,%rsi,8), %xmm0
addsd %xmm2, %xmm0
movapd %xmm0, 0x60(%rsp)
movapd 0x70(%rsp), %xmm0
movq %rbx, %rsi
movq %r15, %rdx
movq %rbp, %rcx
movl 0xac(%rsp), %r13d
movl %r13d, %r8d
movapd %xmm1, 0xc0(%rsp)
movapd %xmm2, 0xb0(%rsp)
callq 0x6fe5b
testl %eax, %eax
je 0x6ca6b
addq $0x1064, %r15           # imm = 0x1064
leaq 0x819da(%rip), %rsi     # 0xee3f0
leaq 0xa35ad(%rip), %rdx     # 0x10ffca
leaq 0xf0(%rsp), %r14
movq %r14, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x815fb(%rip), %rsi     # 0xee034
leaq 0xa3574(%rip), %rdx     # 0x10ffb4
movq 0x10(%rsp), %rdi
movl $0xa3d, %ecx            # imm = 0xA3D
movq %r14, %r8
xorl %eax, %eax
callq 0x30af0
movl $0x1, %eax
addq $0x10f8, %rsp           # imm = 0x10F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, 0x20(%rsp)
movq %rbx, %r14
cmpw $0x1, 0xb8(%r15)
movq 0xe8(%rsp), %rbx
jne 0x6caf1
movsd 0x18(%rbx), %xmm0
movq %r14, %rdi
movq %r15, %rsi
movapd 0x70(%rsp), %xmm1
movapd 0x60(%rsp), %xmm2
movq %r12, %rdx
callq 0xd0905
cmpl $0x1, %eax
jne 0x6caf1
addq $0x630, %r15            # imm = 0x630
leaq 0x81938(%rip), %rsi     # 0xee3f0
leaq 0xa354b(%rip), %rdx     # 0x11000a
leaq 0xf0(%rsp), %r14
movq %r14, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x81559(%rip), %rsi     # 0xee034
leaq 0xa34d2(%rip), %rdx     # 0x10ffb4
movq 0x10(%rsp), %rdi
movl $0xa4a, %ecx            # imm = 0xA4A
jmp 0x6ca4a
movapd 0x30(%rsp), %xmm7
mulsd 0x860f1(%rip), %xmm7    # 0xf2bf0
movapd 0xc0(%rsp), %xmm6
movsd 0x28(%rsp), %xmm2
mulsd %xmm6, %xmm2
divsd 0x85fce(%rip), %xmm7    # 0xf2ae8
mulsd %xmm6, %xmm2
movsd (%rbx), %xmm3
movsd 0x8(%rbx), %xmm1
movsd 0x10(%rbx), %xmm4
movl 0x10(%r15), %eax
cmpl $0x1, %eax
movsd %xmm2, 0x28(%rsp)
movapd %xmm7, 0x30(%rsp)
je 0x6cc59
testl %eax, %eax
movq 0x18(%rsp), %r8
movq %rbp, %r11
jne 0x6cf10
movq 0x50(%rsp), %rsi
movsd 0xa0(%rsp), %xmm0
movsd %xmm0, 0x120(%rsi)
movsd 0x98(%rsp), %xmm0
movsd %xmm0, 0x128(%rsi)
cmpl $0x1, 0xb0(%rbx)
jne 0x6cd77
movq 0x20(%rsp), %rax
movslq 0x4(%rax), %rax
leaq (%r8,%rax,8), %rdx
movq %r15, %rdi
movapd %xmm3, %xmm0
movsd %xmm1, 0x48(%rsp)
movapd %xmm4, %xmm1
movsd %xmm3, 0x90(%rsp)
movaps 0x70(%rsp), %xmm3
movsd %xmm4, 0x88(%rsp)
movapd %xmm7, %xmm4
movapd 0x60(%rsp), %xmm5
movaps 0xb0(%rsp), %xmm6
callq 0xcdbad
movsd 0x48(%rsp), %xmm1
movsd 0x88(%rsp), %xmm4
movsd 0x90(%rsp), %xmm3
movq 0x50(%rsp), %r9
movapd 0x30(%rsp), %xmm7
movapd 0xc0(%rsp), %xmm6
movq %rbp, %r11
movq 0x18(%rsp), %r8
cmpl $0x1, %eax
jne 0x6cd77
addq $0x134, %r9             # imm = 0x134
leaq 0x817d0(%rip), %rsi     # 0xee3f0
leaq 0xa3417(%rip), %rdx     # 0x11003e
leaq 0xf0(%rsp), %rbx
movq %rbx, %rdi
movq %r9, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x813f1(%rip), %rsi     # 0xee034
leaq 0xa336a(%rip), %rdx     # 0x10ffb4
movq 0x10(%rsp), %rdi
movl $0xa61, %ecx            # imm = 0xA61
jmp 0x6cf08
cmpl $0x1, 0xb0(%rbx)
movq 0x18(%rsp), %r8
movq %rbp, %r11
jne 0x6ce30
movq 0x80(%r11), %rax
movq 0xc0(%rax), %rsi
movq 0x20(%rsp), %rax
movslq 0x4(%rax), %rax
leaq (%r8,%rax,8), %rdx
movsd 0x98(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0xa0(%rsp), %xmm0
movsd %xmm0, (%rsp)
movq %r15, %rdi
movapd %xmm3, %xmm0
movsd %xmm1, 0x48(%rsp)
movsd 0x48(%rsp), %xmm1
movapd %xmm4, %xmm2
movsd %xmm3, 0x90(%rsp)
movsd 0x28(%rsp), %xmm3
movsd %xmm4, 0x88(%rsp)
movaps 0x70(%rsp), %xmm4
movapd %xmm7, %xmm5
movaps 0x60(%rsp), %xmm6
movaps 0xb0(%rsp), %xmm7
callq 0xdc662
movsd 0x48(%rsp), %xmm1
movsd 0x88(%rsp), %xmm4
movsd 0x90(%rsp), %xmm3
movapd 0x30(%rsp), %xmm7
movapd 0xc0(%rsp), %xmm6
movq %rbp, %r11
movq 0x18(%rsp), %r8
cmpl $0x1, %eax
jne 0x6ce30
movq 0x80(%r11), %rax
movq 0xc0(%rax), %rcx
addq $0x20, %rcx
leaq 0x816af(%rip), %rsi     # 0xee3f0
leaq 0xa339b(%rip), %rdx     # 0x1100e3
leaq 0xf0(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x30af0
leaq 0x812d3(%rip), %rsi     # 0xee034
leaq 0xa324c(%rip), %rdx     # 0x10ffb4
movq 0x10(%rsp), %rdi
movl $0xa71, %ecx            # imm = 0xA71
jmp 0x6cf08
cmpl $0x1, 0xb4(%rbx)
jne 0x6cf10
movq 0x20(%rsp), %rax
movslq 0x8(%rax), %rax
leaq (%r8,%rax,8), %rdx
movq %r15, %rdi
movq 0x50(%rsp), %rsi
movapd %xmm1, %xmm0
movapd %xmm4, %xmm1
movapd %xmm3, %xmm2
movsd 0x28(%rsp), %xmm3
movapd 0x70(%rsp), %xmm4
movapd %xmm7, %xmm5
movaps 0x60(%rsp), %xmm6
movaps 0xb0(%rsp), %xmm7
callq 0xce0f3
movapd 0x30(%rsp), %xmm7
movapd 0xc0(%rsp), %xmm6
movq %rbp, %r11
movq 0x18(%rsp), %r8
cmpl $0x1, %eax
jne 0x6cf10
movq 0x50(%rsp), %rcx
addq $0x134, %rcx            # imm = 0x134
leaq 0x815f6(%rip), %rsi     # 0xee3f0
leaq 0xa328c(%rip), %rdx     # 0x11008d
leaq 0xf0(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x30af0
leaq 0x8121a(%rip), %rsi     # 0xee034
leaq 0xa3193(%rip), %rdx     # 0x10ffb4
movq 0x10(%rsp), %rdi
movl $0xa68, %ecx            # imm = 0xA68
jmp 0x6cf08
cmpl $0x1, 0xb4(%rbx)
jne 0x6cf10
movq 0x80(%r11), %rax
movq 0xc0(%rax), %rsi
movq 0x20(%rsp), %rax
movslq 0x8(%rax), %rax
leaq (%r8,%rax,8), %rdx
movsd 0x98(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0xa0(%rsp), %xmm0
movsd %xmm0, (%rsp)
movq %r15, %rdi
movapd %xmm3, %xmm0
movapd %xmm4, %xmm2
movsd 0x28(%rsp), %xmm3
movapd 0x70(%rsp), %xmm4
movapd %xmm7, %xmm5
movaps 0x60(%rsp), %xmm6
movaps 0xb0(%rsp), %xmm7
callq 0xdc83a
movapd 0x30(%rsp), %xmm7
movapd 0xc0(%rsp), %xmm6
movq %rbp, %r11
movq 0x18(%rsp), %r8
cmpl $0x1, %eax
jne 0x6cf10
movq 0x80(%r11), %rax
movq 0xc0(%rax), %rcx
addq $0x20, %rcx
leaq 0x81519(%rip), %rsi     # 0xee3f0
leaq 0xa3269(%rip), %rdx     # 0x110147
leaq 0xf0(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x30af0
leaq 0x8113d(%rip), %rsi     # 0xee034
leaq 0xa30b6(%rip), %rdx     # 0x10ffb4
movq 0x10(%rsp), %rdi
movl $0xa78, %ecx            # imm = 0xA78
movq %rbx, %r8
jmp 0x6ca4d
movsd 0x18(%rbx), %xmm8
movq %r14, %rdi
cmpw $0x1, 0x4b6(%r14)
je 0x6cf2e
cmpw $0x1, 0x4c6(%rdi)
jne 0x6cf6f
movapd 0x70(%rsp), %xmm0
movq 0x58(%rsp), %rsi
movq %r15, %rcx
movq %rbp, %r8
movq %r12, %r9
movsd %xmm8, 0x58(%rsp)
callq 0x705d1
movsd 0x58(%rsp), %xmm8
movapd 0x30(%rsp), %xmm7
movapd 0xc0(%rsp), %xmm6
movq %r14, %rdi
movq %rbp, %r11
movq 0x18(%rsp), %r8
movslq 0x38c(%rdi), %rax
movsd (%r12,%rax,8), %xmm1
mulsd 0x8453c(%rip), %xmm1    # 0xf14c0
mulsd 0xa0774(%rip), %xmm1    # 0x10d700
mulsd 0xa0774(%rip), %xmm1    # 0x10d708
mulsd %xmm8, %xmm1
movsd 0x812bf(%rip), %xmm0    # 0xee260
movapd %xmm8, %xmm2
addsd %xmm0, %xmm2
movsd 0x20(%r11), %xmm3
movapd %xmm2, %xmm4
addsd %xmm3, %xmm4
divsd %xmm4, %xmm1
cmpw $0x1, 0xe78(%r15)
jne 0x6cfd0
mulsd 0xe0(%rsp), %xmm1
movq 0x20(%rsp), %r10
movapd 0x60(%rsp), %xmm5
cmpl 0x74(%rbx), %r13d
jne 0x6d056
movslq 0x388(%rdi), %rax
movsd (%r12,%rax,8), %xmm0
mulsd %xmm6, %xmm0
movslq 0x384(%rdi), %rax
divsd (%r12,%rax,8), %xmm0
mulsd 0x85be9(%rip), %xmm0    # 0xf2bf0
divsd 0x85ad9(%rip), %xmm0    # 0xf2ae8
movapd 0xb0(%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 0x82648(%rip), %xmm0    # 0xef680
mulsd %xmm2, %xmm0
divsd %xmm6, %xmm0
movq 0xb8(%rbx), %rax
movslq 0xc(%rax), %rax
movsd %xmm0, (%r8,%rax,8)
jmp 0x6d1c3
cmpw $0x1, 0x60(%r11)
jne 0x6d068
cmpl 0x70(%rbx), %r13d
je 0x6cfe1
movapd %xmm5, %xmm4
subsd 0xb0(%rsp), %xmm4
mulsd %xmm6, %xmm7
unpcklpd %xmm4, %xmm5            # xmm5 = xmm5[0],xmm4[0]
movapd 0xa074b(%rip), %xmm4    # 0x10d7d0
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(%r11), %xmm1
movslq 0xc(%r10), %rax
movsd %xmm1, (%r8,%rax,8)
cmpw $0x1, 0xb8(%r15)
jne 0x6d101
movsd 0x28(%rsp), %xmm4
mulsd 0xa0642(%rip), %xmm4    # 0x10d710
addsd %xmm0, %xmm3
addsd %xmm8, %xmm3
mulsd %xmm4, %xmm3
movq 0x610(%r15), %r9
movslq 0x5f8(%r15), %rdx
movsd (%r9,%rdx,8), %xmm4
divsd %xmm3, %xmm4
divsd %xmm7, %xmm4
subsd %xmm4, %xmm1
movsd %xmm1, (%r8,%rax,8)
cmpw $0x1, 0x34(%r15)
movapd 0x60(%rsp), %xmm4
jne 0x6d1c3
addsd 0x20(%r11), %xmm2
movsd 0xa05f7(%rip), %xmm3    # 0x10d718
divsd %xmm2, %xmm3
subsd (%r15), %xmm0
movslq 0x398(%rdi), %rdx
movsd (%r12,%rdx,8), %xmm2
addsd %xmm2, %xmm2
movslq 0x390(%rdi), %rdx
movhpd (%r12,%rdx,8), %xmm0    # xmm0 = xmm0[0],mem[0]
unpcklpd %xmm2, %xmm3            # xmm3 = xmm3[0],xmm2[0]
movsd 0x1010(%r15), %xmm2
mulsd 0x85aeb(%rip), %xmm2    # 0xf2c48
divpd %xmm0, %xmm3
movsd 0x85a87(%rip), %xmm0    # 0xf2bf0
divsd %xmm0, %xmm2
divsd %xmm0, %xmm2
movapd %xmm3, %xmm0
unpckhpd %xmm3, %xmm0            # xmm0 = xmm0[1],xmm3[1]
addsd 0xa059f(%rip), %xmm2    # 0x10d720
mulsd %xmm3, %xmm0
divsd %xmm2, %xmm0
mulsd 0x30(%rbx), %xmm0
subsd 0x38(%rbx), %xmm4
mulsd %xmm0, %xmm4
movslq 0x380(%rdi), %rcx
movsd (%r12,%rcx,8), %xmm0
movslq 0x384(%rdi), %rcx
mulsd (%r12,%rcx,8), %xmm0
mulsd %xmm0, %xmm6
divsd %xmm6, %xmm4
addsd %xmm4, %xmm1
movsd %xmm1, (%r8,%rax,8)
cmpw $0x1, 0x4b6(%rdi)
jne 0x6d1f2
cmpw $0x1, 0x60(%r11)
jne 0x6d1db
cmpl 0x70(%rbx), %r13d
je 0x6d1f2
movsd 0x40(%rbx), %xmm0
xorpd 0x81048(%rip), %xmm0    # 0xee230
movslq 0x10(%r10), %rax
movlpd %xmm0, (%r8,%rax,8)
ucomisd 0x81065(%rip), %xmm8    # 0xee260
movq 0x10(%rsp), %rbp
movapd 0x70(%rsp), %xmm0
jbe 0x6d28f
movq 0xd8(%rsp), %rax
movsd 0x1d0(%rax), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x6d28f
movq 0xd8(%rsp), %rax
movsd 0x3e8(%rax), %xmm2
ucomisd %xmm2, %xmm0
jbe 0x6d28f
leaq 0xa2f6e(%rip), %rsi     # 0x1101ad
leaq 0xf0(%rsp), %rbx
movq %rbx, %rdi
movb $0x3, %al
callq 0x30af0
leaq 0x80e2a(%rip), %rsi     # 0xee082
leaq 0xa3017(%rip), %rdx     # 0x110276
leaq 0x8f0(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x80db9(%rip), %rsi     # 0xee034
leaq 0xa2d32(%rip), %rdx     # 0x10ffb4
movq %rbp, %rdi
movl $0xaed, %ecx            # imm = 0xAED
jmp 0x6ca4a
movq 0xb8(%rbx), %rax
movslq (%rax), %rdx
xorl %eax, %eax
testq %rdx, %rdx
jle 0x6ca59
movapd 0x80f84(%rip), %xmm0    # 0xee230
xorl %ecx, %ecx
movsd (%r8,%rcx,8), %xmm1
xorpd %xmm0, %xmm1
movlpd %xmm1, (%r8,%rcx,8)
incq %rcx
cmpq %rcx, %rdx
jne 0x6d2ae
jmp 0x6ca59