// File: /workspace/github_c_makefile_star2_O1/PoulinV[P]AxiCLASS/build/../source/thermodynamics.c
// Function: thermodynamics_at_z
int thermodynamics_at_z(
                        struct background * pba,
                        struct thermodynamics * pth,
                        double z,
                        enum interpolation_method inter_mode,
                        int * last_index,
                        double * pvecback, //should be filled for z>z_initial!
                        double * pvecthermo
                        ) {

  /** Summary: */

  /** - define local variables */
  double x0;
  /* Dark matter baryon scattering */
  double Vrms_idm_b2, T_diff_idm_b, m_b, FHe;
  /* Varying fundamental constants */
  double sigmaTrescale = 1., alpha = 1., me = 1.;

  /* The fact that z is in the pre-computed range 0 <= z <= z_initial will be checked in the interpolation routines below. Before
     trying to interpolate, allow the routine to deal with the case z > z_initial: then, all relevant quantities can be extrapolated
     using simple analytic approximations */

  if (z >= pth->z_table[pth->tt_size-1]) {

    /* ionization fraction assumed to remain constant at large z */
    x0= pth->thermodynamics_table[(pth->tt_size-1)*pth->th_size+pth->index_th_xe];
    pvecthermo[pth->index_th_xe] = x0;

    /* In the case of varying fundamental constants, compute correction factor (according to 1705.03925) */
    if (pth->has_varconst == _TRUE_) {
      class_call(background_varconst_of_z(pba, z, &alpha, &me),
                 pba->error_message,
                 pth->error_message);
      sigmaTrescale = alpha*alpha/me/me;
    }

    /* Calculate dkappa/dtau (dkappa/dtau = a n_e x_e sigma_T = a^{-2} n_e(today) x_e sigma_T in units of 1/Mpc) */
    pvecthermo[pth->index_th_dkappa] = (1.+z) * (1.+z) * pth->n_e * x0 * sigmaTrescale * _sigma_ * _Mpc_over_m_;

    /* tau_d scales like (1+z)**2 */
    pvecthermo[pth->index_th_tau_d] = pth->thermodynamics_table[(pth->tt_size-1)*pth->th_size+pth->index_th_tau_d]*pow((1+z)/(1.+pth->z_table[pth->tt_size-1]),2);

    if (pth->compute_damping_scale == _TRUE_) {

      /* r_d scales like (1+z)**-3/2 */
      pvecthermo[pth->index_th_r_d] = pth->thermodynamics_table[(pth->tt_size-1)*pth->th_size+pth->index_th_r_d]*pow((1+z)/(1.+pth->z_table[pth->tt_size-1]),-1.5);
    }

    /* Calculate d2kappa/dtau2 = dz/dtau d/dz[dkappa/dtau] given that [dkappa/dtau] proportional to (1+z)^2 and dz/dtau = -H */
    pvecthermo[pth->index_th_ddkappa] = -pvecback[pba->index_bg_H] * 2. / (1.+z) * pvecthermo[pth->index_th_dkappa];

    /* Calculate d3kappa/dtau3 given that [dkappa/dtau] proportional to (1+z)^2 */
    pvecthermo[pth->index_th_dddkappa] = (pvecback[pba->index_bg_H]*pvecback[pba->index_bg_H]/ (1.+z) - pvecback[pba->index_bg_H_prime]) * 2. / (1.+z) * pvecthermo[pth->index_th_dkappa];

    /* \f$ exp^{-\kappa}, g, g', g'' \f$ can be set to zero: they are used only for computing the source functions in the
       perturbation module; but source functions only need to be sampled below z_initial (the condition that
       z_start_sources<z_initial is checked in the perturbation module) */
    pvecthermo[pth->index_th_exp_m_kappa] = 0.;
    pvecthermo[pth->index_th_g]=0.;
    pvecthermo[pth->index_th_dg]=0.;
    pvecthermo[pth->index_th_ddg]=0.;

    /* Calculate Tb assuming Tb ~ T_g at early times */
    pvecthermo[pth->index_th_Tb] = pba->T_cmb*(1.+z);

    /* Tb derivative */
    pvecthermo[pth->index_th_dTb] = pba->T_cmb;

    /* Calculate baryon equation of state parameter wb = (k_B/mu) Tb */
    /* note that m_H / mu = 1 + (m_H/m_He-1) Y_p + x_e (1-Y_p) */
    pvecthermo[pth->index_th_wb] = _k_B_ / ( _c_ * _c_ * _m_H_ ) * (1. + (1./_not4_ - 1.) * pth->YHe + x0 * (1.-pth->YHe)) * pba->T_cmb * (1.+z);

    /* Calculate cb2 (cb2 = (k_B/mu) Tb (1-1/3 dlnTb/dlna) = (k_B/mu) Tb (1+1/3 (1+z) dlnTb/dz)) */
    /* note that m_H / mu = 1 + (m_H/m_He-1) Y_p + x_e (1-Y_p) */
    pvecthermo[pth->index_th_cb2] = pvecthermo[pth->index_th_wb] * 4. / 3.;

    /* derivatives of baryon sound speed (only computed if some non-minimal tight-coupling schemes is requested) */
    if (pth->compute_cb2_derivatives == _TRUE_) {

      /* since cb2 proportional to (1+z) or 1/a, its derivative wrt conformal time is given by dcb2 = - a H cb2 */
      pvecthermo[pth->index_th_dcb2] = - pvecback[pba->index_bg_H] * pvecback[pba->index_bg_a] * pvecthermo[pth->index_th_cb2];

      /* then its second derivative is given by ddcb2 = - a H' cb2 */
      pvecthermo[pth->index_th_ddcb2] = - pvecback[pba->index_bg_H_prime] * pvecback[pba->index_bg_a] * pvecthermo[pth->index_th_cb2];
    }

    /* in this regime, variation rate = dkappa/dtau */
    pvecthermo[pth->index_th_rate] = pvecthermo[pth->index_th_dkappa];

    /* Quantities related to idm */
    if (pba->has_idm == _TRUE_) {

      /* Temperature and sound speed of idm (assuming T_idm ~ T_g at early times) */
      pvecthermo[pth->index_th_T_idm] = pba->T_cmb* (1+z);
      pvecthermo[pth->index_th_c2_idm] = _k_B_ * pba->T_cmb*(1+z)/(pth->m_idm*_eV_)  * (1 - (1.+z)/3./pvecback[pba->index_bg_H]);

      /* For DM-g calculate at early times the optical depth parameters */
      if (pth->has_idm_g == _TRUE_) {
        /* calculate dmu_idm_g and its derivatives */
        pvecthermo[pth->index_th_dmu_idm_g] = 3./8./_PI_/_G_*pow(1.+z, 2+pth->n_index_idm_g)*pba->Omega0_idm*pba->H0*pba->H0*pth->u_idm_g*pow(_c_,4)*_sigma_/1.e11/_eV_/_Mpc_over_m_;
        pvecthermo[pth->index_th_ddmu_idm_g] = -(2.+pth->n_index_idm_g) * pvecback[pba->index_bg_H] * pvecback[pba->index_bg_a] * pvecthermo[pth->index_th_dmu_idm_g];
        pvecthermo[pth->index_th_dddmu_idm_g] = (2.+pth->n_index_idm_g)*pvecthermo[pth->index_th_dmu_idm_g]/(1.+z) *
          (pvecback[pba->index_bg_H]*pvecback[pba->index_bg_H]/(1.+z) * (1.+pth->n_index_idm_g) - pvecback[pba->index_bg_H_prime]);
        /* extrapolate optical depth of idm_g */
        if (pth->n_index_idm_g == -1){
          pvecthermo[pth->index_th_exp_mu_idm_g] = pth->thermodynamics_table[(pth->tt_size-1)*pth->th_size+pth->index_th_exp_mu_idm_g] * exp( - pvecthermo[pth->index_th_dmu_idm_g] *pow(1.+z, -2-pth->n_index_idm_g) * log((1.+z)/(1.+pth->z_table[pth->tt_size-1]))*(1.+z)*(1.+z)/pvecback[pba->index_bg_H]);
        }
        else{
          pvecthermo[pth->index_th_exp_mu_idm_g] = pth->thermodynamics_table[(pth->tt_size-1)*pth->th_size+pth->index_th_exp_mu_idm_g] * exp( - pvecthermo[pth->index_th_dmu_idm_g] *pow(1.+z, -2-pth->n_index_idm_g) /(1.+pth->n_index_idm_g) * (pow(1.+z,pth->n_index_idm_g+1)-pow(1.+pth->z_table[pth->tt_size-1],pth->n_index_idm_g+1))*(1.+z)*(1.+z)/pvecback[pba->index_bg_H] );
        }
      }

      /* For idm_b calculate at early times the interaction rate parameters */
      if (pth->has_idm_b == _TRUE_){

        /* some constants used in the scattering rate and temperatures */
        FHe = 1-pth->YHe;
        m_b = _m_p_*_c_*_c_/_eV_;
        Vrms_idm_b2 = 1.e-8; /* approximation for V_rms at early times */
        T_diff_idm_b = (pvecthermo[pth->index_th_Tb]*_k_B_/_eV_/m_b)+(pvecthermo[pth->index_th_T_idm]*_k_B_/_eV_/pth->m_idm)+(Vrms_idm_b2/3.0); /* T and m are all in eV */

        /* Now compute the coupling coefficients */
        pvecthermo[pth->index_th_R_idm_b] = (pvecback[pba->index_bg_a]*pvecback[pba->index_bg_rho_b]*pth->cross_idm_b*pth->n_coeff_idm_b/(m_b+pth->m_idm))
          *pow(T_diff_idm_b,(pth->n_index_idm_b+1.0)/2.0)*FHe
          *(3.e-4*pow(_c_,4.)/(8.*_PI_*_Mpc_over_m_*_G_*_eV_)); /* conversion coefficient for the units */
        pvecthermo[pth->index_th_dR_idm_b] = pvecthermo[pth->index_th_R_idm_b] * pvecback[pba->index_bg_a] * pvecback[pba->index_bg_H]
          * ( -2. - (1.+z) * (pth->n_index_idm_b+1.0)/2.0 * (pba->T_cmb*_k_B_/_eV_/m_b + pba->T_cmb*_k_B_/_eV_/pth->m_idm)/T_diff_idm_b);
      }

      /* For idm_dr calculate at early times the optical depth parameters */
      if (pth->has_idm_dr == _TRUE_){
        /* calculate dmu_idm_dr and its derivatives */
        pvecthermo[pth->index_th_dmu_idm_dr] = pth->a_idm_dr*pow((1.+z)/1.e7,pth->n_index_idm_dr)*pba->Omega0_idm*pow(pba->h,2);
        pvecthermo[pth->index_th_ddmu_idm_dr] =  -pvecback[pba->index_bg_H] * pth->n_index_idm_dr / (1+z) * pvecthermo[pth->index_th_dmu_idm_dr];
        pvecthermo[pth->index_th_dddmu_idm_dr] = (pvecback[pba->index_bg_H]*pvecback[pba->index_bg_H]/ (1.+z) * (pth->n_index_idm_dr - 1.) - pvecback[pba->index_bg_H_prime])
          * pth->n_index_idm_dr / (1.+z) * pvecthermo[pth->index_th_dmu_idm_dr];

        /* extrapolate optical depth of idm_dr and idr */
        if (pth->n_index_idm_dr == 1 ){
          pvecthermo[pth->index_th_tau_idr] = pth->thermodynamics_table[(pth->tt_size-1)*pth->th_size+pth->index_th_tau_idr]+pvecthermo[pth->index_th_dmu_idm_dr] * pow(1.+z, - pth->n_index_idm_dr) * log((1.+z)/(1.+pth->z_table[pth->tt_size-1]))/(pvecback[pba->index_bg_H]/(1.+z)/(1.+z));
        }
        else{
          pvecthermo[pth->index_th_tau_idr] = pth->thermodynamics_table[(pth->tt_size-1)*pth->th_size+pth->index_th_tau_idr]+pvecthermo[pth->index_th_dmu_idm_dr] * pow(1.+z, - pth->n_index_idm_dr)/(1.-pth->n_index_idm_dr) * (pow(1.+pth->z_table[pth->tt_size-1], pth->n_index_idm_dr -1) - pow(1.+z, pth->n_index_idm_dr -1))/(pvecback[pba->index_bg_H]/(1.+z)/(1.+z));
        }

        if (pth->n_index_idm_dr == 0 ){
          pvecthermo[pth->index_th_tau_idm_dr] = pth->thermodynamics_table[(pth->tt_size-1)*pth->th_size+pth->index_th_tau_idm_dr]+pvecthermo[pth->index_th_dmu_idm_dr] * pow(1.+z, - pth->n_index_idm_dr) * 4./3. * pba->Omega0_idr/pba->Omega0_idm * log((1.+z)/(1.+pth->z_table[pth->tt_size-1]))/(pvecback[pba->index_bg_H]/(1.+z)/(1.+z));
        }
        else{
          pvecthermo[pth->index_th_tau_idm_dr] = pth->thermodynamics_table[(pth->tt_size-1)*pth->th_size+pth->index_th_tau_idm_dr]+pvecthermo[pth->index_th_dmu_idm_dr] * pow(1.+z, - pth->n_index_idm_dr) * 4./3. * pba->Omega0_idr/pba->Omega0_idm /(-pth->n_index_idm_dr) * (pow(1.+pth->z_table[pth->tt_size-1], pth->n_index_idm_dr) - pow(1.+z, pth->n_index_idm_dr))/(pvecback[pba->index_bg_H]/(1.+z)/(1.+z));
        }

        /* extrapolate idm_dr visibility function */
        pvecthermo[pth->index_th_g_idm_dr] = pvecthermo[pth->index_th_dmu_idm_dr] * 4./3. * pba->Omega0_idr/pba->Omega0_idm * (1.+z) * exp(-pvecthermo[pth->index_th_tau_idm_dr]);
      }

    }

    /* Quantities related to idr */
    if (pba->has_idr == _TRUE_) {

      /* Use the temperature scaling assumed throughout */
      pvecthermo[pth->index_th_T_idr] = pba->T_idr* (1+z);

      /* calculate dmu_idr (self interaction) */
      pvecthermo[pth->index_th_dmu_idr] = pth->b_idr*pow((1.+z)/1.e7,pth->n_index_idm_dr)*pba->Omega0_idr*pow(pba->h,2);
    }
  }

  /** - interpolate in table with array_interpolate_spline (normal mode) or array_interpolate_spline_growing_closeby (closeby mode) */

  else {

    /* some very specific cases require linear interpolation because of a break in the derivative of the functions */
    if (((pth->reio_parametrization == reio_half_tanh) && (z < 2*pth->z_reio))
        || ((pth->reio_parametrization == reio_inter) && (z < 50.))) {

      class_call(array_interpolate_linear(pth->z_table,
                                          pth->tt_size,
                                          pth->thermodynamics_table,
                                          pth->th_size,
                                          z,
                                          last_index,
                                          pvecthermo,
                                          pth->th_size,
                                          pth->error_message),
                 pth->error_message,
                 pth->error_message);
    }

    /* in the "normal" case, use spline interpolation */
    else {

      if (inter_mode == inter_normal) {

        class_call(array_interpolate_spline(pth->z_table,
                                            pth->tt_size,
                                            pth->thermodynamics_table,
                                            pth->d2thermodynamics_dz2_table,
                                            pth->th_size,
                                            z,
                                            last_index,
                                            pvecthermo,
                                            pth->th_size,
                                            pth->error_message),
                   pth->error_message,
                   pth->error_message);
      }

      if (inter_mode == inter_closeby) {

        class_call(array_interpolate_spline_growing_closeby(pth->z_table,
                                                            pth->tt_size,
                                                            pth->thermodynamics_table,
                                                            pth->d2thermodynamics_dz2_table,
                                                            pth->th_size,
                                                            z,
                                                            last_index,
                                                            pvecthermo,
                                                            pth->th_size,
                                                            pth->error_message),
                   pth->error_message,
                   pth->error_message);

      }
    }
  }
  return _SUCCESS_;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x858, %rsp            # imm = 0x858
movq %r9, %r14
movapd %xmm0, %xmm3
movq %rsi, %rbx
movq %rdi, %r15
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x38(%rsp)
movq %rax, 0x30(%rsp)
movq 0xf10(%rsi), %rdi
movslq 0xf08(%rsi), %rsi
ucomisd -0x8(%rdi,%rsi,8), %xmm0
jae 0x68cb1
movq %rcx, %r13
movl %edx, %r12d
movl 0x18(%rbx), %eax
cmpl $0x3, %eax
jne 0x68c25
movsd 0x28(%rbx), %xmm0
addsd %xmm0, %xmm0
ucomisd %xmm3, %xmm0
ja 0x68c42
cmpl $0x5, %eax
setne %al
movsd 0xa4e2d(%rip), %xmm0    # 0x10da60
ucomisd %xmm3, %xmm0
setbe %cl
orb %al, %cl
jne 0x68d6e
movq 0xf20(%rbx), %rdx
movl 0xf04(%rbx), %ecx
addq $0x1064, %rbx           # imm = 0x1064
movapd %xmm3, %xmm0
movq %r13, %r8
movq %r14, %r9
pushq %rbx
pushq %rcx
callq 0x18415
addq $0x10, %rsp
xorl %ebp, %ebp
cmpl $0x1, %eax
jne 0x69a81
leaq 0x88773(%rip), %rsi     # 0xf13f0
leaq 0xa7bde(%rip), %rdx     # 0x110862
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x88397(%rip), %rsi     # 0xf1034
leaq 0xa7baa(%rip), %rdx     # 0x11084e
movq %rbx, %rdi
movl $0xf5, %ecx
jmp 0x69a72
movq %r8, %rbp
decq %rsi
movq 0xf20(%rbx), %rax
movslq 0xf04(%rbx), %rcx
movslq %esi, %rdx
imulq %rcx, %rdx
movslq 0xe7c(%rbx), %rcx
addq %rcx, %rdx
movsd (%rax,%rdx,8), %xmm4
movsd %xmm4, (%r14,%rcx,8)
movsd 0x88577(%rip), %xmm2    # 0xf1260
cmpw $0x1, 0xe78(%rbx)
movapd %xmm2, %xmm0
jne 0x68e31
movsd %xmm4, 0x8(%rsp)
leaq 0x38(%rsp), %rsi
leaq 0x30(%rsp), %rdx
movq %r15, %rdi
movsd %xmm3, (%rsp)
movapd %xmm3, %xmm0
callq 0x60fe9
cmpl $0x1, %eax
jne 0x68e06
addq $0xd1c, %r15            # imm = 0xD1C
leaq 0x886bd(%rip), %rsi     # 0xf13f0
leaq 0xa7ae6(%rip), %rdx     # 0x110820
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x30c2c
addq $0x1064, %rbx           # imm = 0x1064
leaq 0x882da(%rip), %rsi     # 0xf1034
leaq 0xa7aed(%rip), %rdx     # 0x11084e
movq %rbx, %rdi
movl $0x5a, %ecx
jmp 0x69a72
xorl %ebp, %ebp
cmpl $0x1, %r12d
je 0x699f5
testl %r12d, %r12d
jne 0x69a81
movq 0xf20(%rbx), %rdx
movq 0xf28(%rbx), %rcx
movl 0xf04(%rbx), %r8d
leaq 0x1064(%rbx), %r15
subq $0x8, %rsp
movsd %xmm3, 0x8(%rsp)
movapd %xmm3, %xmm0
movq %r13, %r9
pushq %r15
pushq %r8
pushq %r14
callq 0x17ee6
addq $0x20, %rsp
cmpl $0x1, %eax
jne 0x699e6
leaq 0x88621(%rip), %rsi     # 0xf13f0
leaq 0xa7b27(%rip), %rdx     # 0x1108fd
leaq 0x50(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x88245(%rip), %rsi     # 0xf1034
leaq 0xa7a58(%rip), %rdx     # 0x11084e
movq %r15, %rdi
movl $0x108, %ecx            # imm = 0x108
movq %rbx, %r8
jmp 0x69a75
movsd 0x38(%rsp), %xmm0
mulsd %xmm0, %xmm0
movsd 0x30(%rsp), %xmm1
divsd %xmm1, %xmm0
divsd %xmm1, %xmm0
movsd (%rsp), %xmm3
movsd 0x8(%rsp), %xmm4
movsd 0x8842f(%rip), %xmm2    # 0xf1260
addsd %xmm2, %xmm3
movapd %xmm3, %xmm1
mulsd %xmm3, %xmm1
mulsd 0x1008(%rbx), %xmm1
mulsd %xmm4, %xmm1
mulsd %xmm0, %xmm1
mulsd 0x8cde3(%rip), %xmm1    # 0xf5c38
mulsd 0x8cc5b(%rip), %xmm1    # 0xf5ab8
movslq 0xe80(%rbx), %rax
movsd %xmm1, (%r14,%rax,8)
movq 0xf10(%rbx), %rax
movq 0xf20(%rbx), %rcx
movslq 0xf08(%rbx), %rdx
leaq -0x1(%rdx), %rsi
movslq 0xf04(%rbx), %rdi
movslq %esi, %rsi
imulq %rdi, %rsi
movslq 0xe84(%rbx), %rdi
leaq (%rsi,%rdi), %r8
addsd -0x8(%rax,%rdx,8), %xmm2
movapd %xmm3, %xmm0
divsd %xmm2, %xmm0
mulsd %xmm0, %xmm0
mulsd (%rcx,%r8,8), %xmm0
movsd %xmm0, (%r14,%rdi,8)
cmpw $0x1, 0x32(%rbx)
movsd %xmm3, (%rsp)
jne 0x68f25
movslq 0xf00(%rbx), %rdi
movslq %esi, %rsi
addq %rdi, %rsi
movsd (%rcx,%rsi,8), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd -0x8(%rax,%rdx,8), %xmm1
addsd 0x88374(%rip), %xmm1    # 0xf1260
movapd %xmm3, %xmm0
divsd %xmm1, %xmm0
movsd 0x8b944(%rip), %xmm1    # 0xf4840
movsd %xmm4, 0x8(%rsp)
callq 0x8620
movsd 0x8(%rsp), %xmm4
movsd (%rsp), %xmm3
mulsd 0x10(%rsp), %xmm0
movslq 0xf00(%rbx), %rax
movsd %xmm0, (%r14,%rax,8)
movslq 0x384(%r15), %rax
movsd (%rbp,%rax,8), %xmm0
mulsd 0x8981e(%rip), %xmm0    # 0xf2758
divsd %xmm3, %xmm0
movslq 0xe80(%rbx), %rcx
mulsd (%r14,%rcx,8), %xmm0
movslq 0xe88(%rbx), %rdx
movsd %xmm0, (%r14,%rdx,8)
movsd (%rbp,%rax,8), %xmm0
mulsd %xmm0, %xmm0
divsd %xmm3, %xmm0
movslq 0x388(%r15), %rdx
subsd (%rbp,%rdx,8), %xmm0
addsd %xmm0, %xmm0
divsd %xmm3, %xmm0
mulsd (%r14,%rcx,8), %xmm0
movslq 0xe8c(%rbx), %rsi
movsd %xmm0, (%r14,%rsi,8)
movslq 0xe90(%rbx), %rsi
xorl %edi, %edi
movq %rdi, (%r14,%rsi,8)
movslq 0xe94(%rbx), %rsi
movq %rdi, (%r14,%rsi,8)
movslq 0xe98(%rbx), %rsi
movq %rdi, (%r14,%rsi,8)
movslq 0xe9c(%rbx), %rsi
movq %rdi, (%r14,%rsi,8)
movsd 0x18(%r15), %xmm0
mulsd %xmm3, %xmm0
movslq 0xee4(%rbx), %rsi
movsd %xmm0, (%r14,%rsi,8)
movsd 0x18(%r15), %xmm0
movslq 0xee8(%rbx), %rsi
movsd %xmm0, (%r14,%rsi,8)
movsd (%rbx), %xmm0
movsd 0xa763e(%rip), %xmm1    # 0x110630
mulsd %xmm0, %xmm1
movsd 0x88262(%rip), %xmm2    # 0xf1260
addsd %xmm2, %xmm1
subsd %xmm0, %xmm2
mulsd %xmm2, %xmm4
addsd %xmm1, %xmm4
mulsd 0xa7622(%rip), %xmm4    # 0x110638
mulsd 0x18(%r15), %xmm4
mulsd %xmm3, %xmm4
movslq 0xeec(%rbx), %rsi
movsd %xmm4, (%r14,%rsi,8)
mulsd 0x8b3f3(%rip), %xmm4    # 0xf4428
divsd 0x89643(%rip), %xmm4    # 0xf2680
movslq 0xef0(%rbx), %rsi
movsd %xmm4, (%r14,%rsi,8)
cmpw $0x1, 0x30(%rbx)
jne 0x690a4
movsd (%rbp,%rax,8), %xmm0
movapd 0x881d1(%rip), %xmm1    # 0xf1230
xorpd %xmm1, %xmm0
movslq 0x380(%r15), %rdi
mulsd (%rbp,%rdi,8), %xmm0
mulsd %xmm0, %xmm4
movslq 0xef4(%rbx), %r8
movsd %xmm4, (%r14,%r8,8)
movsd (%rbp,%rdx,8), %xmm0
xorpd %xmm1, %xmm0
mulsd (%rbp,%rdi,8), %xmm0
mulsd (%r14,%rsi,8), %xmm0
movslq 0xef8(%rbx), %rdx
movsd %xmm0, (%r14,%rdx,8)
movsd (%r14,%rcx,8), %xmm0
movslq 0xefc(%rbx), %rcx
movsd %xmm0, (%r14,%rcx,8)
cmpw $0x1, 0x4b6(%r15)
jne 0x69967
movsd 0x18(%r15), %xmm0
mulsd %xmm3, %xmm0
movslq 0xea0(%rbx), %rcx
movsd %xmm0, (%r14,%rcx,8)
movsd 0x18(%r15), %xmm0
mulsd 0x8cb25(%rip), %xmm0    # 0xf5c10
mulsd %xmm3, %xmm0
movsd 0x1010(%rbx), %xmm1
mulsd 0x8cb19(%rip), %xmm1    # 0xf5c18
movapd %xmm3, %xmm2
divsd 0x8b365(%rip), %xmm2    # 0xf4470
divsd (%rbp,%rax,8), %xmm2
divsd %xmm1, %xmm0
addsd 0x88143(%rip), %xmm2    # 0xf1260
mulsd %xmm0, %xmm2
movslq 0xea4(%rbx), %rax
movsd %xmm2, (%r14,%rax,8)
cmpw $0x1, 0x36(%rbx)
jne 0x693a5
movl 0x1058(%rbx), %eax
addl $0x2, %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
movapd %xmm3, %xmm0
callq 0x8620
mulsd 0xa74e6(%rip), %xmm0    # 0x110640
mulsd 0xf0(%r15), %xmm0
movsd (%r15), %xmm1
mulsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
mulsd 0x1050(%rbx), %xmm0
mulsd 0xa74c8(%rip), %xmm0    # 0x110648
mulsd 0x8cab0(%rip), %xmm0    # 0xf5c38
divsd 0x8cab0(%rip), %xmm0    # 0xf5c40
divsd 0x8ca80(%rip), %xmm0    # 0xf5c18
divsd 0x8c918(%rip), %xmm0    # 0xf5ab8
movslq 0xec8(%rbx), %rcx
movsd %xmm0, (%r14,%rcx,8)
movl 0x1058(%rbx), %eax
xorps %xmm2, %xmm2
cvtsi2sd %eax, %xmm2
movsd 0x88b3e(%rip), %xmm3    # 0xf1d00
addsd %xmm2, %xmm3
movapd 0x88062(%rip), %xmm1    # 0xf1230
movapd %xmm3, %xmm4
xorpd %xmm1, %xmm4
movslq 0x384(%r15), %rdx
mulsd (%rbp,%rdx,8), %xmm4
movslq 0x380(%r15), %rsi
mulsd (%rbp,%rsi,8), %xmm4
mulsd %xmm0, %xmm4
movslq 0xecc(%rbx), %rsi
movsd %xmm4, (%r14,%rsi,8)
movsd (%rsp), %xmm4
mulsd (%r14,%rcx,8), %xmm3
divsd %xmm4, %xmm3
movsd (%rbp,%rdx,8), %xmm0
mulsd %xmm0, %xmm0
divsd %xmm4, %xmm0
addsd 0x8803a(%rip), %xmm2    # 0xf1260
mulsd %xmm0, %xmm2
movslq 0x388(%r15), %rdx
subsd (%rbp,%rdx,8), %xmm2
mulsd %xmm3, %xmm2
movslq 0xed0(%rbx), %rdx
movsd %xmm2, (%r14,%rdx,8)
movslq 0xf08(%rbx), %rdx
leaq -0x1(%rdx), %rsi
movslq 0xf04(%rbx), %rdi
imulq %rsi, %rdi
movslq 0xed4(%rbx), %rsi
addq %rdi, %rsi
movq 0xf20(%rbx), %rdi
movsd (%rdi,%rsi,8), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd (%r14,%rcx,8), %xmm2
xorpd %xmm1, %xmm2
cmpl $-0x1, %eax
je 0x6932c
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
subl %eax, %ecx
xorps %xmm1, %xmm1
cvtsi2sd %ecx, %xmm1
movapd %xmm4, %xmm0
movapd %xmm2, 0x10(%rsp)
callq 0x8620
mulsd 0x10(%rsp), %xmm0
movl 0x1058(%rbx), %eax
xorps %xmm2, %xmm2
cvtsi2sd %eax, %xmm2
movsd 0x87f9b(%rip), %xmm1    # 0xf1260
addsd %xmm1, %xmm2
divsd %xmm2, %xmm0
movsd %xmm0, 0x10(%rsp)
incl %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
movsd (%rsp), %xmm0
callq 0x8620
movsd %xmm0, 0x20(%rsp)
movq 0xf10(%rbx), %rax
movslq 0xf08(%rbx), %rcx
movsd -0x8(%rax,%rcx,8), %xmm0
addsd 0x87f58(%rip), %xmm0    # 0xf1260
movl 0x1058(%rbx), %eax
incl %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
callq 0x8620
movsd 0x20(%rsp), %xmm1
subsd %xmm0, %xmm1
movapd %xmm1, %xmm0
jmp 0x69364
movsd 0x87f2c(%rip), %xmm0    # 0xf1260
movapd %xmm0, %xmm1
divsd %xmm4, %xmm1
mulsd %xmm2, %xmm1
movsd %xmm1, 0x10(%rsp)
movq 0xf10(%rbx), %rax
movsd -0x8(%rax,%rdx,8), %xmm1
addsd %xmm0, %xmm1
movapd %xmm4, %xmm0
divsd %xmm1, %xmm0
callq 0x82c0
mulsd 0x10(%rsp), %xmm0
movsd (%rsp), %xmm1
mulsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
movslq 0x384(%r15), %rax
divsd (%rbp,%rax,8), %xmm0
callq 0x8670
movsd 0x8(%rsp), %xmm1
mulsd %xmm0, %xmm1
movslq 0xed4(%rbx), %rax
movsd %xmm1, (%r14,%rax,8)
movsd (%rsp), %xmm3
cmpw $0x1, 0x34(%rbx)
jne 0x6953e
movsd 0x87ea8(%rip), %xmm0    # 0xf1260
movapd %xmm0, %xmm1
movapd %xmm0, %xmm5
subsd (%rbx), %xmm1
movsd %xmm1, 0x8(%rsp)
movslq 0xee4(%rbx), %rax
movsd 0x8c837(%rip), %xmm2    # 0xf5c10
movsd (%r14,%rax,8), %xmm0
mulsd %xmm2, %xmm0
movsd 0x8c82d(%rip), %xmm4    # 0xf5c18
divsd %xmm4, %xmm0
movsd 0xa7259(%rip), %xmm1    # 0x110650
divsd %xmm1, %xmm0
movapd %xmm1, %xmm6
movslq 0xea0(%rbx), %rax
movsd (%r14,%rax,8), %xmm1
mulsd %xmm2, %xmm1
divsd %xmm4, %xmm1
movsd 0x1010(%rbx), %xmm2
divsd %xmm2, %xmm1
addsd %xmm0, %xmm1
addsd 0xa722c(%rip), %xmm1    # 0x110658
movapd %xmm1, %xmm0
movsd %xmm1, 0x10(%rsp)
movslq 0x380(%r15), %rax
movsd (%rbp,%rax,8), %xmm4
movslq 0x390(%r15), %rax
mulsd (%rbp,%rax,8), %xmm4
mulsd 0x1030(%rbx), %xmm4
mulsd 0x1040(%rbx), %xmm4
addsd %xmm6, %xmm2
xorps %xmm1, %xmm1
cvtsi2sdl 0x1038(%rbx), %xmm1
divsd %xmm2, %xmm4
movsd %xmm4, 0x20(%rsp)
addsd %xmm5, %xmm1
mulsd 0x8884b(%rip), %xmm1    # 0xf1cd0
callq 0x8620
movsd (%rsp), %xmm3
mulsd 0x20(%rsp), %xmm0
mulsd 0x8(%rsp), %xmm0
mulsd 0xa71bd(%rip), %xmm0    # 0x110660
movslq 0xed8(%rbx), %rax
movsd %xmm0, (%r14,%rax,8)
movslq 0x380(%r15), %rax
mulsd (%rbp,%rax,8), %xmm0
movslq 0x384(%r15), %rax
mulsd (%rbp,%rax,8), %xmm0
xorps %xmm1, %xmm1
cvtsi2sdl 0x1038(%rbx), %xmm1
addsd 0x87d83(%rip), %xmm1    # 0xf1260
mulsd %xmm3, %xmm1
mulsd 0x887e7(%rip), %xmm1    # 0xf1cd0
movsd 0x8c71f(%rip), %xmm4    # 0xf5c10
mulsd 0x18(%r15), %xmm4
divsd 0x8c719(%rip), %xmm4    # 0xf5c18
movapd %xmm4, %xmm2
divsd 0xa7145(%rip), %xmm2    # 0x110650
divsd 0x1010(%rbx), %xmm4
addsd %xmm2, %xmm4
mulsd %xmm1, %xmm4
divsd 0x10(%rsp), %xmm4
movsd 0x8922f(%rip), %xmm1    # 0xf2758
subsd %xmm4, %xmm1
mulsd %xmm0, %xmm1
movslq 0xedc(%rbx), %rax
movsd %xmm1, (%r14,%rax,8)
cmpw $0x1, 0x38(%rbx)
jne 0x69967
movapd %xmm3, %xmm0
divsd 0xa7113(%rip), %xmm0    # 0x110668
movsd 0x1018(%rbx), %xmm1
movsd %xmm1, 0x8(%rsp)
movsd 0x1028(%rbx), %xmm1
callq 0x8620
mulsd 0x8(%rsp), %xmm0
mulsd 0xf0(%r15), %xmm0
movsd 0x8(%r15), %xmm2
mulsd %xmm2, %xmm2
mulsd %xmm0, %xmm2
movslq 0xeac(%rbx), %rax
movsd %xmm2, (%r14,%rax,8)
movslq 0x384(%r15), %rcx
movsd (%rbp,%rcx,8), %xmm0
movapd 0x87c81(%rip), %xmm1    # 0xf1230
xorpd %xmm1, %xmm0
mulsd 0x1028(%rbx), %xmm0
movsd (%rsp), %xmm4
divsd %xmm4, %xmm0
mulsd %xmm2, %xmm0
movslq 0xeb0(%rbx), %rdx
movsd %xmm0, (%r14,%rdx,8)
movsd (%rbp,%rcx,8), %xmm0
mulsd %xmm0, %xmm0
divsd %xmm4, %xmm0
movsd 0x1028(%rbx), %xmm2
movsd 0x881f5(%rip), %xmm3    # 0xf17e8
addsd %xmm2, %xmm3
mulsd %xmm0, %xmm3
movslq 0x388(%r15), %rcx
subsd (%rbp,%rcx,8), %xmm3
mulsd %xmm2, %xmm3
divsd %xmm4, %xmm3
mulsd (%r14,%rax,8), %xmm3
movslq 0xeb4(%rbx), %rcx
movsd %xmm3, (%r14,%rcx,8)
movsd 0x1028(%rbx), %xmm2
movapd %xmm2, 0x20(%rsp)
movq 0xf20(%rbx), %rcx
movslq 0xf08(%rbx), %rdx
decq %rdx
movslq 0xf04(%rbx), %rsi
imulq %rdx, %rsi
movslq 0xec0(%rbx), %rdx
addq %rsi, %rdx
movsd (%rcx,%rdx,8), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd (%r14,%rax,8), %xmm0
movsd %xmm0, 0x10(%rsp)
xorpd %xmm2, %xmm1
movapd %xmm4, %xmm0
callq 0x8620
movapd %xmm0, %xmm3
movapd 0x20(%rsp), %xmm0
ucomisd 0x87bd3(%rip), %xmm0    # 0xf1260
mulsd 0x10(%rsp), %xmm3
jne 0x696d3
jp 0x696d3
movq 0xf10(%rbx), %rax
movslq 0xf08(%rbx), %rcx
movsd -0x8(%rax,%rcx,8), %xmm1
addsd 0x87bad(%rip), %xmm1    # 0xf1260
movsd (%rsp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm3, 0x10(%rsp)
callq 0x82c0
movsd 0x10(%rsp), %xmm2
mulsd %xmm0, %xmm2
jmp 0x6974a
movsd 0x1028(%rbx), %xmm1
movsd 0x87b7d(%rip), %xmm0    # 0xf1260
movapd %xmm0, %xmm2
subsd %xmm1, %xmm2
divsd %xmm2, %xmm3
movsd %xmm3, 0x10(%rsp)
movq 0xf10(%rbx), %rax
movslq 0xf08(%rbx), %rcx
addsd -0x8(%rax,%rcx,8), %xmm0
addsd 0x880d7(%rip), %xmm1    # 0xf17e8
callq 0x8620
movsd %xmm0, 0x20(%rsp)
movsd 0x880c4(%rip), %xmm1    # 0xf17e8
addsd 0x1028(%rbx), %xmm1
movsd (%rsp), %xmm0
callq 0x8620
movsd 0x10(%rsp), %xmm2
movsd 0x20(%rsp), %xmm1
subsd %xmm0, %xmm1
mulsd %xmm1, %xmm2
movslq 0x384(%r15), %rax
movsd (%rbp,%rax,8), %xmm1
movsd (%rsp), %xmm0
divsd %xmm0, %xmm1
divsd %xmm0, %xmm1
divsd %xmm1, %xmm2
movsd 0x8(%rsp), %xmm1
addsd %xmm2, %xmm1
movslq 0xec0(%rbx), %rax
movsd %xmm1, (%r14,%rax,8)
movsd 0x1028(%rbx), %xmm2
movaps %xmm2, 0x20(%rsp)
movq 0xf20(%rbx), %rax
movslq 0xf08(%rbx), %rcx
decq %rcx
movslq 0xf04(%rbx), %rdx
imulq %rcx, %rdx
movslq 0xebc(%rbx), %rcx
addq %rdx, %rcx
movsd (%rax,%rcx,8), %xmm1
movsd %xmm1, 0x8(%rsp)
movslq 0xeac(%rbx), %rax
movsd (%r14,%rax,8), %xmm1
movsd %xmm1, 0x10(%rsp)
movaps 0x87a59(%rip), %xmm1    # 0xf1230
xorps %xmm2, %xmm1
movaps %xmm1, 0x40(%rsp)
callq 0x8620
movapd %xmm0, %xmm2
movapd 0x20(%rsp), %xmm0
ucomisd 0x40(%rsp), %xmm0
mulsd 0x10(%rsp), %xmm2
mulsd 0x8ac26(%rip), %xmm2    # 0xf4428
divsd 0x88e76(%rip), %xmm2    # 0xf2680
mulsd 0xf8(%r15), %xmm2
divsd 0xf0(%r15), %xmm2
jne 0x6985c
jp 0x6985c
movq 0xf10(%rbx), %rax
movslq 0xf08(%rbx), %rcx
movsd -0x8(%rax,%rcx,8), %xmm1
addsd 0x87a24(%rip), %xmm1    # 0xf1260
movsd (%rsp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm2, 0x10(%rsp)
callq 0x82c0
movsd 0x10(%rsp), %xmm1
mulsd %xmm0, %xmm1
jmp 0x698c7
movsd 0x1028(%rbx), %xmm1
movapd 0x879c4(%rip), %xmm0    # 0xf1230
xorpd %xmm1, %xmm0
divsd %xmm0, %xmm2
movsd %xmm2, 0x10(%rsp)
movq 0xf10(%rbx), %rax
movslq 0xf08(%rbx), %rcx
movsd -0x8(%rax,%rcx,8), %xmm0
addsd 0x879ca(%rip), %xmm0    # 0xf1260
callq 0x8620
movsd %xmm0, 0x20(%rsp)
movsd 0x1028(%rbx), %xmm1
movsd (%rsp), %xmm0
callq 0x8620
movsd 0x10(%rsp), %xmm1
movsd 0x20(%rsp), %xmm2
subsd %xmm0, %xmm2
mulsd %xmm2, %xmm1
movslq 0x384(%r15), %rax
movsd (%rbp,%rax,8), %xmm0
movsd (%rsp), %xmm2
divsd %xmm2, %xmm0
divsd %xmm2, %xmm0
divsd %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
addsd %xmm1, %xmm0
movslq 0xebc(%rbx), %rax
movsd %xmm0, (%r14,%rax,8)
movslq 0xeac(%rbx), %rax
movsd (%r14,%rax,8), %xmm0
mulsd 0x8ab17(%rip), %xmm0    # 0xf4428
divsd 0x88d67(%rip), %xmm0    # 0xf2680
mulsd 0xf8(%r15), %xmm0
divsd 0xf0(%r15), %xmm0
mulsd %xmm2, %xmm0
movsd %xmm0, 0x8(%rsp)
movslq 0xebc(%rbx), %rax
movsd (%r14,%rax,8), %xmm0
xorpd 0x878e6(%rip), %xmm0    # 0xf1230
callq 0x8670
mulsd 0x8(%rsp), %xmm0
movslq 0xec4(%rbx), %rax
movsd %xmm0, (%r14,%rax,8)
movsd (%rsp), %xmm3
xorl %ebp, %ebp
cmpw $0x1, 0x4c6(%r15)
jne 0x69a81
movsd 0x100(%r15), %xmm0
mulsd %xmm3, %xmm0
movslq 0xea8(%rbx), %rax
movsd %xmm0, (%r14,%rax,8)
divsd 0xa6cce(%rip), %xmm3    # 0x110668
movsd 0x1020(%rbx), %xmm0
movsd %xmm0, (%rsp)
movsd 0x1028(%rbx), %xmm1
movapd %xmm3, %xmm0
callq 0x8620
mulsd (%rsp), %xmm0
mulsd 0xf8(%r15), %xmm0
movsd 0x8(%r15), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm1
movslq 0xeb8(%rbx), %rax
movsd %xmm1, (%r14,%rax,8)
jmp 0x69a81
cmpl $0x1, %r12d
movsd (%rsp), %xmm3
jne 0x69a81
movq 0xf10(%rbx), %rdi
movl 0xf04(%rbx), %r8d
movl 0xf08(%rbx), %esi
movq 0xf20(%rbx), %rdx
movq 0xf28(%rbx), %rcx
addq $0x1064, %rbx           # imm = 0x1064
subq $0x8, %rsp
movapd %xmm3, %xmm0
movq %r13, %r9
pushq %rbx
pushq %r8
pushq %r14
callq 0x19770
addq $0x20, %rsp
cmpl $0x1, %eax
jne 0x69a81
leaq 0x879ad(%rip), %rsi     # 0xf13f0
leaq 0xa6f6f(%rip), %rdx     # 0x1109b9
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x875d1(%rip), %rsi     # 0xf1034
leaq 0xa6de4(%rip), %rdx     # 0x11084e
movq %rbx, %rdi
movl $0x118, %ecx            # imm = 0x118
movq %r14, %r8
xorl %eax, %eax
callq 0x30c2c
movl $0x1, %ebp
movl %ebp, %eax
addq $0x858, %rsp            # imm = 0x858
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq