// File: /workspace/github_c_makefile_star2_O1/lesgourg[P]class_public/build/../source/background.c
// Function: background_functions
int background_functions(
                         struct background * pba,
                         double a,
                         double * pvecback_B, /* vector with argument pvecback[index_bi] */
                         enum vecback_format return_format,
                         double * pvecback /* vector with argument pvecback[index_bg] (must be already allocated with a size compatible with return_format) */
                         ) {

  /** Summary: */

  /** - define local variables */

  /* total density */
  double rho_tot;
  /* critical density */
  double rho_crit;
  /* total pressure */
  double p_tot;
  /* total relativistic density */
  double rho_r;
  /* total non-relativistic density */
  double rho_m;
  /* background ncdm quantities */
  double rho_ncdm,p_ncdm,pseudo_p_ncdm;
  /* index for n_ncdm species */
  int n_ncdm;
  /* fluid's time-dependent equation of state parameter */
  double w_fld, dw_over_da, integral_fld;
  /* scalar field quantities */
  double phi, phi_prime;
  /* Since we only know a_prime_over_a after we have rho_tot,
     it is not possible to simply sum up p_tot_prime directly.
     Instead we sum up dp_dloga = p_prime/a_prime_over_a. The formula is
     p_prime = a_prime_over_a * dp_dloga = a_prime_over_a * Sum [ (w_prime/a_prime_over_a -3(1+w)w)rho].
     Note: The scalar field contribution must be added in the end, as an exception!*/
  double dp_dloga;

  /** - initialize local variables */
  rho_tot = 0.;
  p_tot = 0.;
  dp_dloga = 0.;
  rho_r=0.;
  rho_m=0.;

  class_test(a <= 0.,
             pba->error_message,
             "a = %e instead of strictly positive",a);

  /** - pass value of \f$ a\f$ to output */
  pvecback[pba->index_bg_a] = a;

  /** - compute each component's density and pressure */

  /* photons */
  pvecback[pba->index_bg_rho_g] = pba->Omega0_g * pow(pba->H0,2) / pow(a,4);
  rho_tot += pvecback[pba->index_bg_rho_g];
  p_tot += (1./3.) * pvecback[pba->index_bg_rho_g];
  dp_dloga += -(4./3.) * pvecback[pba->index_bg_rho_g];
  rho_r += pvecback[pba->index_bg_rho_g];

  /* baryons */
  pvecback[pba->index_bg_rho_b] = pba->Omega0_b * pow(pba->H0,2) / pow(a,3);
  rho_tot += pvecback[pba->index_bg_rho_b];
  p_tot += 0;
  rho_m += pvecback[pba->index_bg_rho_b];

  /* cdm */
  if (pba->has_cdm == _TRUE_) {
    pvecback[pba->index_bg_rho_cdm] = pba->Omega0_cdm * pow(pba->H0,2) / pow(a,3);
    rho_tot += pvecback[pba->index_bg_rho_cdm];
    p_tot += 0.;
    rho_m += pvecback[pba->index_bg_rho_cdm];
  }

  /* idm */
  if (pba->has_idm == _TRUE_) {
    pvecback[pba->index_bg_rho_idm] = pba->Omega0_idm * pow(pba->H0,2) / pow(a,3);
    rho_tot += pvecback[pba->index_bg_rho_idm];
    p_tot += 0.;
    rho_m += pvecback[pba->index_bg_rho_idm];
  }

  /* dcdm */
  if (pba->has_dcdm == _TRUE_) {
    /* Pass value of rho_dcdm to output */
    pvecback[pba->index_bg_rho_dcdm] = pvecback_B[pba->index_bi_rho_dcdm];
    rho_tot += pvecback[pba->index_bg_rho_dcdm];
    p_tot += 0.;
    rho_m += pvecback[pba->index_bg_rho_dcdm];
  }

  /* dr */
  if (pba->has_dr == _TRUE_) {
    /* Pass value of rho_dr to output */
    pvecback[pba->index_bg_rho_dr] = pvecback_B[pba->index_bi_rho_dr];
    rho_tot += pvecback[pba->index_bg_rho_dr];
    p_tot += (1./3.)*pvecback[pba->index_bg_rho_dr];
    dp_dloga += -(4./3.) * pvecback[pba->index_bg_rho_dr];
    rho_r += pvecback[pba->index_bg_rho_dr];
  }

  /* Scalar field */
  if (pba->has_scf == _TRUE_) {
    phi = pvecback_B[pba->index_bi_phi_scf];
    phi_prime = pvecback_B[pba->index_bi_phi_prime_scf];
    pvecback[pba->index_bg_phi_scf] = phi; // value of the scalar field phi
    pvecback[pba->index_bg_phi_prime_scf] = phi_prime; // value of the scalar field phi derivative wrt conformal time
    pvecback[pba->index_bg_V_scf] = V_scf(pba,phi); //V_scf(pba,phi); //write here potential as function of phi
    pvecback[pba->index_bg_dV_scf] = dV_scf(pba,phi); // dV_scf(pba,phi); //potential' as function of phi
    pvecback[pba->index_bg_ddV_scf] = ddV_scf(pba,phi); // ddV_scf(pba,phi); //potential'' as function of phi
    pvecback[pba->index_bg_rho_scf] = (phi_prime*phi_prime/(2*a*a) + V_scf(pba,phi))/3.; // energy of the scalar field. The field units are set automatically by setting the initial conditions
    pvecback[pba->index_bg_p_scf] =(phi_prime*phi_prime/(2*a*a) - V_scf(pba,phi))/3.; // pressure of the scalar field
    rho_tot += pvecback[pba->index_bg_rho_scf];
    p_tot += pvecback[pba->index_bg_p_scf];
    dp_dloga += 0.0; /** <-- This depends on a_prime_over_a, so we cannot add it now! */
    //divide relativistic & nonrelativistic (not very meaningful for oscillatory models)
    rho_r += 3.*pvecback[pba->index_bg_p_scf]; //field pressure contributes radiation
    rho_m += pvecback[pba->index_bg_rho_scf] - 3.* pvecback[pba->index_bg_p_scf]; //the rest contributes matter
    //printf(" a= %e, Omega_scf = %f, \n ",a, pvecback[pba->index_bg_rho_scf]/rho_tot );
  }

  /* ncdm */
  if (pba->has_ncdm == _TRUE_) {

    /* Loop over species: */
    for (n_ncdm=0; n_ncdm<pba->N_ncdm; n_ncdm++) {

      /* function returning background ncdm[n_ncdm] quantities (only
         those for which non-NULL pointers are passed) */
      class_call(background_ncdm_momenta(
                                         pba->q_ncdm_bg[n_ncdm],
                                         pba->w_ncdm_bg[n_ncdm],
                                         pba->q_size_ncdm_bg[n_ncdm],
                                         pba->M_ncdm[n_ncdm],
                                         pba->factor_ncdm[n_ncdm],
                                         1./a-1.,
                                         NULL,
                                         &rho_ncdm,
                                         &p_ncdm,
                                         NULL,
                                         &pseudo_p_ncdm),
                 pba->error_message,
                 pba->error_message);

      pvecback[pba->index_bg_rho_ncdm1+n_ncdm] = rho_ncdm;
      rho_tot += rho_ncdm;
      pvecback[pba->index_bg_p_ncdm1+n_ncdm] = p_ncdm;
      p_tot += p_ncdm;
      pvecback[pba->index_bg_pseudo_p_ncdm1+n_ncdm] = pseudo_p_ncdm;
      /** See e.g. Eq. A6 in 1811.00904. */
      dp_dloga += (pseudo_p_ncdm - 5*p_ncdm);

      /* (3 p_ncdm1) is the "relativistic" contribution to rho_ncdm1 */
      rho_r += 3.* p_ncdm;

      /* (rho_ncdm1 - 3 p_ncdm1) is the "non-relativistic" contribution
         to rho_ncdm1 */
      rho_m += rho_ncdm - 3.* p_ncdm;
    }
  }

  /* Lambda */
  if (pba->has_lambda == _TRUE_) {
    pvecback[pba->index_bg_rho_lambda] = pba->Omega0_lambda * pow(pba->H0,2);
    rho_tot += pvecback[pba->index_bg_rho_lambda];
    p_tot -= pvecback[pba->index_bg_rho_lambda];
  }

  /* fluid with w(a) and constant cs2 */
  if (pba->has_fld == _TRUE_) {

    /* get rho_fld from vector of integrated variables */
    pvecback[pba->index_bg_rho_fld] = pvecback_B[pba->index_bi_rho_fld];

    /* get w_fld from dedicated function */
    class_call(background_w_fld(pba,a,&w_fld,&dw_over_da,&integral_fld), pba->error_message, pba->error_message);
    pvecback[pba->index_bg_w_fld] = w_fld;

    // Obsolete: at the beginning, we had here the analytic integral solution corresponding to the case w=w0+w1(1-a/a0):
    // pvecback[pba->index_bg_rho_fld] = pba->Omega0_fld * pow(pba->H0,2) / pow(a,3.*(1.+pba->w0_fld+pba->wa_fld)) * exp(3.*pba->wa_fld*(a-1.));
    // But now everthing is integrated numerically for a given w_fld(a) defined in the function background_w_fld.

    rho_tot += pvecback[pba->index_bg_rho_fld];
    p_tot += w_fld * pvecback[pba->index_bg_rho_fld];
    dp_dloga += (a*dw_over_da-3*(1+w_fld)*w_fld)*pvecback[pba->index_bg_rho_fld];
  }

  /* relativistic neutrinos (and all relativistic relics) */
  if (pba->has_ur == _TRUE_) {
    pvecback[pba->index_bg_rho_ur] = pba->Omega0_ur * pow(pba->H0,2) / pow(a,4);
    rho_tot += pvecback[pba->index_bg_rho_ur];
    p_tot += (1./3.) * pvecback[pba->index_bg_rho_ur];
    dp_dloga += -(4./3.) * pvecback[pba->index_bg_rho_ur];
    rho_r += pvecback[pba->index_bg_rho_ur];
  }

  /* interacting dark radiation */
  if (pba->has_idr == _TRUE_) {
    pvecback[pba->index_bg_rho_idr] = pba->Omega0_idr * pow(pba->H0,2) / pow(a,4);
    rho_tot += pvecback[pba->index_bg_rho_idr];
    p_tot += (1./3.) * pvecback[pba->index_bg_rho_idr];
    rho_r += pvecback[pba->index_bg_rho_idr];
  }

  /** - compute expansion rate H from Friedmann equation: this is the
      only place where the Friedmann equation is assumed. Remember
      that densities are all expressed in units of \f$ [3c^2/8\pi G] \f$, ie
      \f$ \rho_{class} = [8 \pi G \rho_{physical} / 3 c^2]\f$ */
  pvecback[pba->index_bg_H] = sqrt(rho_tot-pba->K/a/a);

  /** - compute derivative of H with respect to conformal time */
  pvecback[pba->index_bg_H_prime] = - (3./2.) * (rho_tot + p_tot) * a + pba->K/a;

  /* Total energy density*/
  pvecback[pba->index_bg_rho_tot] = rho_tot;

  /* Total pressure */
  pvecback[pba->index_bg_p_tot] = p_tot;

  /* Derivative of total pressure w.r.t. conformal time */
  pvecback[pba->index_bg_p_tot_prime] = a*pvecback[pba->index_bg_H]*dp_dloga;
  if (pba->has_scf == _TRUE_) {
    /** The contribution of scf was not added to dp_dloga, add p_scf_prime here: */
    pvecback[pba->index_bg_p_prime_scf] = pvecback[pba->index_bg_phi_prime_scf]*
      (-pvecback[pba->index_bg_phi_prime_scf]*pvecback[pba->index_bg_H]/a-2./3.*pvecback[pba->index_bg_dV_scf]);
    pvecback[pba->index_bg_p_tot_prime] += pvecback[pba->index_bg_p_prime_scf];
  }

  /** - compute critical density */
  rho_crit = rho_tot-pba->K/a/a;
  class_test(rho_crit <= 0.,
             pba->error_message,
             "rho_crit = %e instead of strictly positive",rho_crit);

  /** - compute relativistic density to total density ratio */
  pvecback[pba->index_bg_Omega_r] = rho_r / rho_crit;

  /** - compute other quantities in the exhaustive, redundant format */
  if (return_format == long_info) {

    /** - store critical density */
    pvecback[pba->index_bg_rho_crit] = rho_crit;

    /** - compute Omega_m */
    pvecback[pba->index_bg_Omega_m] = rho_m / rho_crit;

    /** - cosmological time */
    pvecback[pba->index_bg_time] = pvecback_B[pba->index_bi_time];

    /** - comoving sound horizon */
    pvecback[pba->index_bg_rs] = pvecback_B[pba->index_bi_rs];

    /** - growth factor */
    pvecback[pba->index_bg_D] = pvecback_B[pba->index_bi_D];

    /** - velocity growth factor */
    pvecback[pba->index_bg_f] = pvecback_B[pba->index_bi_D_prime]/( pvecback_B[pba->index_bi_D]*a*pvecback[pba->index_bg_H]);

    /**- Varying fundamental constants */
    if (pba->has_varconst == _TRUE_) {
      class_call(background_varconst_of_z(pba,
                                          1./a-1.,
                                          &(pvecback[pba->index_bg_varc_alpha]),
                                          &(pvecback[pba->index_bg_varc_me])
                                          ),
                 pba->error_message,
                 pba->error_message);
    }

    /* one can put other variables here */
    /*  */
    /*  */

  }

  return _SUCCESS_;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10d8, %rsp           # imm = 0x10D8
movq %rdi, %rbx
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jae 0x578fb
movq %rcx, %r14
movq %rsi, %r15
movl %edx, 0x7c(%rsp)
movslq 0x208(%rbx), %rax
movsd %xmm0, (%rcx,%rax,8)
movsd (%rbx), %xmm1
mulsd %xmm1, %xmm1
mulsd 0x10(%rbx), %xmm1
movapd %xmm1, 0x30(%rsp)
movsd 0x8d141(%rip), %xmm1    # 0xe4428
movsd %xmm0, 0x8(%rsp)
callq 0x8620
movapd 0x30(%rsp), %xmm1
divsd %xmm0, %xmm1
movslq 0x214(%rbx), %rax
movsd %xmm1, (%r14,%rax,8)
movapd %xmm1, %xmm0
addsd 0x89f43(%rip), %xmm0    # 0xe1258
movapd %xmm0, 0x20(%rsp)
movsd 0x8d115(%rip), %xmm0    # 0xe4438
movapd %xmm1, 0x30(%rsp)
mulsd %xmm1, %xmm0
movapd %xmm0, 0x40(%rsp)
movsd (%rbx), %xmm0
mulsd %xmm0, %xmm0
mulsd 0x20(%rbx), %xmm0
movapd %xmm0, 0x50(%rsp)
movsd 0x8b332(%rip), %xmm1    # 0xe2680
movsd 0x8(%rsp), %xmm0
callq 0x8620
movsd 0x8(%rsp), %xmm2
movapd 0x50(%rsp), %xmm1
divsd %xmm0, %xmm1
movapd 0x20(%rsp), %xmm0
movslq 0x218(%rbx), %rax
movsd %xmm1, (%r14,%rax,8)
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
xorpd %xmm3, %xmm3
unpcklpd %xmm0, %xmm3            # xmm3 = xmm3[0],xmm0[0]
addpd %xmm1, %xmm3
cmpw $0x1, 0x320(%rbx)
jne 0x573e5
movsd (%rbx), %xmm0
mulsd %xmm0, %xmm0
mulsd 0x30(%rbx), %xmm0
movapd %xmm0, 0x10(%rsp)
movsd 0x8b2cf(%rip), %xmm1    # 0xe2680
movapd %xmm2, %xmm0
movapd %xmm3, 0x50(%rsp)
callq 0x8620
movapd 0x50(%rsp), %xmm3
movapd 0x10(%rsp), %xmm1
divsd %xmm0, %xmm1
movslq 0x21c(%rbx), %rax
movsd %xmm1, (%r14,%rax,8)
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
addpd %xmm1, %xmm3
xorpd %xmm1, %xmm1
movapd 0x40(%rsp), %xmm2
addsd %xmm1, %xmm2
movapd 0x30(%rsp), %xmm4
mulsd 0xa2f9f(%rip), %xmm4    # 0xfa3a0
cmpw $0x1, 0x322(%rbx)
jne 0x57478
movsd (%rbx), %xmm0
mulsd %xmm0, %xmm0
mulsd 0x38(%rbx), %xmm0
movapd %xmm0, 0x10(%rsp)
movsd 0x8b25a(%rip), %xmm1    # 0xe2680
movsd 0x8(%rsp), %xmm0
movapd %xmm3, 0x50(%rsp)
movapd %xmm4, 0x30(%rsp)
movapd %xmm2, 0x40(%rsp)
callq 0x8620
movapd 0x40(%rsp), %xmm2
xorpd %xmm1, %xmm1
movapd 0x30(%rsp), %xmm4
movapd 0x50(%rsp), %xmm3
movapd 0x10(%rsp), %xmm5
divsd %xmm0, %xmm5
movslq 0x220(%rbx), %rax
movsd %xmm5, (%r14,%rax,8)
unpcklpd %xmm5, %xmm5            # xmm5 = xmm5[0,0]
addpd %xmm5, %xmm3
addsd %xmm1, %xmm4
addsd %xmm1, %xmm2
cmpw $0x1, 0x324(%rbx)
jne 0x574ac
movslq 0x2f0(%rbx), %rax
movsd (%r15,%rax,8), %xmm0
movslq 0x238(%rbx), %rax
movsd %xmm0, (%r14,%rax,8)
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
addpd %xmm0, %xmm3
cmpw $0x1, 0x326(%rbx)
unpcklpd %xmm2, %xmm4            # xmm4 = xmm4[0],xmm2[0]
movapd %xmm3, %xmm5
unpckhpd %xmm3, %xmm5            # xmm5 = xmm5[1],xmm3[1]
jne 0x57500
movslq 0x2f4(%rbx), %rax
movsd (%r15,%rax,8), %xmm0
movslq 0x23c(%rbx), %rax
movsd %xmm0, (%r14,%rax,8)
addsd %xmm0, %xmm5
movapd 0x20(%rsp), %xmm1
addsd %xmm0, %xmm1
movapd %xmm1, 0x20(%rsp)
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
mulpd 0xa2f34(%rip), %xmm0    # 0xfa430
addpd %xmm0, %xmm4
cmpw $0x1, 0x328(%rbx)
jne 0x57773
movslq 0x2fc(%rbx), %rax
movsd (%r15,%rax,8), %xmm1
movsd %xmm1, 0x10(%rsp)
movslq 0x300(%rbx), %rax
movsd (%r15,%rax,8), %xmm0
movaps %xmm0, 0x80(%rsp)
movslq 0x240(%rbx), %rax
movsd %xmm1, (%r14,%rax,8)
movslq 0x244(%rbx), %rax
movsd %xmm0, (%r14,%rax,8)
movq 0x148(%rbx), %rax
movsd (%rax), %xmm0
xorpd 0x89ccd(%rip), %xmm0    # 0xe1230
mulsd %xmm1, %xmm0
movapd %xmm3, 0x50(%rsp)
movapd %xmm4, 0x30(%rsp)
movapd %xmm5, 0x40(%rsp)
callq 0x8670
movsd %xmm0, 0x70(%rsp)
movq 0x148(%rbx), %rax
movsd 0x8(%rax), %xmm1
movsd 0x10(%rax), %xmm0
movsd %xmm0, 0x68(%rsp)
movsd 0x10(%rsp), %xmm0
subsd 0x18(%rax), %xmm0
callq 0x8620
addsd 0x68(%rsp), %xmm0
mulsd 0x70(%rsp), %xmm0
movslq 0x248(%rbx), %rax
movsd %xmm0, (%r14,%rax,8)
movq %rbx, %rdi
movsd 0x10(%rsp), %xmm0
callq 0x57f5f
movslq 0x24c(%rbx), %rax
movsd %xmm0, (%r14,%rax,8)
movq %rbx, %rdi
movsd 0x10(%rsp), %xmm0
callq 0x5803e
movslq 0x250(%rbx), %rax
movsd %xmm0, (%r14,%rax,8)
movapd 0x80(%rsp), %xmm2
mulsd %xmm2, %xmm2
movsd 0x8(%rsp), %xmm1
movapd %xmm1, %xmm0
addsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
divsd %xmm0, %xmm2
movapd %xmm2, 0x80(%rsp)
movq 0x148(%rbx), %rax
movsd (%rax), %xmm0
xorpd 0x89bf7(%rip), %xmm0    # 0xe1230
mulsd 0x10(%rsp), %xmm0
callq 0x8670
movsd %xmm0, 0x70(%rsp)
movq 0x148(%rbx), %rax
movsd 0x8(%rax), %xmm1
movsd 0x10(%rax), %xmm0
movsd %xmm0, 0x68(%rsp)
movsd 0x10(%rsp), %xmm0
subsd 0x18(%rax), %xmm0
callq 0x8620
addsd 0x68(%rsp), %xmm0
mulsd 0x70(%rsp), %xmm0
addsd 0x80(%rsp), %xmm0
movsd 0x8aff2(%rip), %xmm1    # 0xe2680
divsd %xmm1, %xmm0
movslq 0x254(%rbx), %rax
movsd %xmm0, (%r14,%rax,8)
movq 0x148(%rbx), %rax
movsd (%rax), %xmm0
xorpd 0x89b7e(%rip), %xmm0    # 0xe1230
mulsd 0x10(%rsp), %xmm0
callq 0x8670
movsd %xmm0, 0x70(%rsp)
movq 0x148(%rbx), %rax
movsd 0x8(%rax), %xmm1
movsd 0x10(%rax), %xmm0
movsd %xmm0, 0x68(%rsp)
movsd 0x10(%rsp), %xmm0
subsd 0x18(%rax), %xmm0
callq 0x8620
movsd 0x8af8e(%rip), %xmm2    # 0xe2680
movapd 0x40(%rsp), %xmm5
movapd 0x30(%rsp), %xmm4
movapd 0x50(%rsp), %xmm3
addsd 0x68(%rsp), %xmm0
mulsd 0x70(%rsp), %xmm0
movapd 0x80(%rsp), %xmm6
subsd %xmm0, %xmm6
divsd %xmm2, %xmm6
movslq 0x258(%rbx), %rax
movsd %xmm6, (%r14,%rax,8)
movslq 0x254(%rbx), %rax
movsd (%r14,%rax,8), %xmm0
addsd %xmm0, %xmm5
xorpd %xmm1, %xmm1
unpcklpd %xmm6, %xmm1            # xmm1 = xmm1[0],xmm6[0]
addpd %xmm1, %xmm4
movapd %xmm6, %xmm1
mulsd %xmm2, %xmm1
movapd 0x20(%rsp), %xmm2
addsd %xmm1, %xmm2
movapd %xmm2, 0x20(%rsp)
mulsd 0x8cd05(%rip), %xmm6    # 0xe4470
addsd %xmm0, %xmm6
addsd %xmm6, %xmm3
cmpw $0x1, 0x32a(%rbx)
movq %r15, 0x98(%rsp)
jne 0x57959
cmpl $0x0, 0x70(%rbx)
movsd 0x8(%rsp), %xmm0
jle 0x57959
movsd 0x89abf(%rip), %xmm1    # 0xe1260
divsd %xmm0, %xmm1
addsd 0x8a03b(%rip), %xmm1    # 0xe17e8
movsd %xmm1, 0x10(%rsp)
xorl %ebp, %ebp
leaq 0xb0(%rsp), %r15
leaq 0xc0(%rsp), %r12
leaq 0xb8(%rsp), %r13
movapd 0x20(%rsp), %xmm2
movapd %xmm2, 0x20(%rsp)
movapd %xmm5, 0x40(%rsp)
movapd %xmm4, 0x30(%rsp)
movapd %xmm3, 0x50(%rsp)
movq 0x340(%rbx), %rax
movq (%rax,%rbp,8), %rdi
movq 0x348(%rbx), %rax
movq (%rax,%rbp,8), %rsi
movq 0x368(%rbx), %rax
movl (%rax,%rbp,4), %edx
movq 0x90(%rbx), %rax
movsd (%rax,%rbp,8), %xmm0
movq 0x378(%rbx), %rax
movsd (%rax,%rbp,8), %xmm1
movsd 0x10(%rsp), %xmm2
xorl %ecx, %ecx
movq %r12, %r8
movq %r13, %r9
pushq %r15
pushq $0x0
callq 0x581af
movapd 0x50(%rsp), %xmm5
movapd 0x40(%rsp), %xmm4
addq $0x10, %rsp
movsd 0xc0(%rsp), %xmm0
movslq 0x260(%rbx), %rax
addq %rbp, %rax
movsd %xmm0, (%r14,%rax,8)
addsd %xmm0, %xmm5
movsd 0xb8(%rsp), %xmm1
movslq 0x264(%rbx), %rax
addq %rbp, %rax
movsd %xmm1, (%r14,%rax,8)
movsd 0xb0(%rsp), %xmm2
movslq 0x268(%rbx), %rax
addq %rbp, %rax
movsd %xmm2, (%r14,%rax,8)
movapd %xmm1, %xmm3
mulsd 0xa2b03(%rip), %xmm3    # 0xfa3a8
addsd %xmm2, %xmm3
unpcklpd %xmm1, %xmm3            # xmm3 = xmm3[0],xmm1[0]
addpd %xmm3, %xmm4
movapd 0x50(%rsp), %xmm3
movapd %xmm1, %xmm2
mulsd 0x8adbd(%rip), %xmm2    # 0xe2680
movapd 0x20(%rsp), %xmm6
addsd %xmm2, %xmm6
movapd %xmm6, 0x20(%rsp)
movapd 0x20(%rsp), %xmm2
mulsd 0x8cb8f(%rip), %xmm1    # 0xe4470
addsd %xmm0, %xmm1
addsd %xmm1, %xmm3
incq %rbp
movslq 0x70(%rbx), %rax
cmpq %rax, %rbp
jl 0x577d3
jmp 0x5795f
leaq 0xa30b1(%rip), %rsi     # 0xfa9b3
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movb $0x1, %al
callq 0x30c2c
leaq 0x89767(%rip), %rsi     # 0xe1082
leaq 0xa30b5(%rip), %rdx     # 0xfa9d7
leaq 0x8d0(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c2c
addq $0xb84, %rbx            # imm = 0xB84
leaq 0x896ef(%rip), %rsi     # 0xe1034
leaq 0xa3093(%rip), %rdx     # 0xfa9df
movq %rbx, %rdi
movl $0x1a1, %ecx            # imm = 0x1A1
jmp 0x57e81
movapd 0x20(%rsp), %xmm2
movapd %xmm2, 0x20(%rsp)
cmpw $0x1, 0x32c(%rbx)
movapd %xmm4, %xmm0
unpckhpd %xmm4, %xmm0            # xmm0 = xmm0[1],xmm4[1]
jne 0x5799c
movsd (%rbx), %xmm1
mulsd %xmm1, %xmm1
mulsd 0xf8(%rbx), %xmm1
movslq 0x224(%rbx), %rax
movsd %xmm1, (%r14,%rax,8)
addsd %xmm1, %xmm5
subsd %xmm1, %xmm0
movq 0x98(%rsp), %r15
cmpw $0x1, 0x32e(%rbx)
unpcklpd %xmm0, %xmm4            # xmm4 = xmm4[0],xmm0[0]
movapd %xmm3, 0x50(%rsp)
jne 0x57ac2
movapd %xmm5, 0x40(%rsp)
movapd %xmm4, 0x30(%rsp)
movslq 0x2f8(%rbx), %rax
movsd (%r15,%rax,8), %xmm0
movslq 0x228(%rbx), %rax
movsd %xmm0, (%r14,%rax,8)
leaq 0xa8(%rsp), %rsi
leaq 0xa0(%rsp), %rdx
leaq 0xc8(%rsp), %rcx
movq %rbx, %rdi
movsd 0x8(%rsp), %xmm0
callq 0x583fc
testl %eax, %eax
je 0x57a54
addq $0xb84, %rbx            # imm = 0xB84
leaq 0x899d6(%rip), %rsi     # 0xe13f0
leaq 0xa2fd3(%rip), %rdx     # 0xfa9f4
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x895f7(%rip), %rsi     # 0xe1034
leaq 0xa2f9b(%rip), %rdx     # 0xfa9df
movq %rbx, %rdi
movl $0x222, %ecx            # imm = 0x222
movq %r14, %r8
jmp 0x57e84
movsd 0xa8(%rsp), %xmm0
movslq 0x22c(%rbx), %rax
movsd %xmm0, (%r14,%rax,8)
movslq 0x228(%rbx), %rax
movsd (%r14,%rax,8), %xmm1
movapd 0x40(%rsp), %xmm5
addsd %xmm1, %xmm5
movsd 0x897d7(%rip), %xmm2    # 0xe1260
addsd %xmm0, %xmm2
mulsd 0x8c9db(%rip), %xmm2    # 0xe4470
mulsd %xmm0, %xmm2
movsd 0xa0(%rsp), %xmm3
mulsd 0x8(%rsp), %xmm3
addsd %xmm2, %xmm3
unpcklpd %xmm0, %xmm3            # xmm3 = xmm3[0],xmm0[0]
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
mulpd %xmm3, %xmm1
movapd 0x30(%rsp), %xmm4
addpd %xmm1, %xmm4
cmpw $0x1, 0x330(%rbx)
jne 0x57b45
movsd (%rbx), %xmm0
mulsd %xmm0, %xmm0
mulsd 0x28(%rbx), %xmm0
movapd %xmm0, 0x10(%rsp)
movsd 0x8c941(%rip), %xmm1    # 0xe4428
movsd 0x8(%rsp), %xmm0
movapd %xmm4, 0x30(%rsp)
movapd %xmm5, 0x40(%rsp)
callq 0x8620
movapd 0x40(%rsp), %xmm5
movapd 0x30(%rsp), %xmm4
movapd 0x10(%rsp), %xmm1
divsd %xmm0, %xmm1
movslq 0x234(%rbx), %rax
movsd %xmm1, (%r14,%rax,8)
addsd %xmm1, %xmm5
movapd 0x20(%rsp), %xmm0
addsd %xmm1, %xmm0
movapd %xmm0, 0x20(%rsp)
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
mulpd 0xa28ef(%rip), %xmm1    # 0xfa430
addpd %xmm1, %xmm4
cmpw $0x1, 0x332(%rbx)
movapd %xmm4, %xmm6
unpckhpd %xmm4, %xmm6            # xmm6 = xmm6[1],xmm4[1]
movapd %xmm4, 0x30(%rsp)
jne 0x57be4
movsd (%rbx), %xmm0
mulsd %xmm0, %xmm0
mulsd 0x40(%rbx), %xmm0
movsd %xmm0, 0x80(%rsp)
movsd 0x8c8a9(%rip), %xmm1    # 0xe4428
movsd 0x8(%rsp), %xmm0
movapd %xmm5, 0x40(%rsp)
movapd %xmm6, 0x10(%rsp)
callq 0x8620
movapd 0x10(%rsp), %xmm6
movapd 0x40(%rsp), %xmm5
movsd 0x8(%rsp), %xmm3
movsd 0x80(%rsp), %xmm1
divsd %xmm0, %xmm1
movslq 0x230(%rbx), %rax
movsd %xmm1, (%r14,%rax,8)
addsd %xmm1, %xmm5
movapd 0x20(%rsp), %xmm0
addsd %xmm1, %xmm0
movapd %xmm0, 0x20(%rsp)
mulsd 0x8c85a(%rip), %xmm1    # 0xe4438
addsd %xmm1, %xmm6
jmp 0x57bea
movsd 0x8(%rsp), %xmm3
movsd 0x1a0(%rbx), %xmm1
divsd %xmm3, %xmm1
divsd %xmm3, %xmm1
movapd %xmm5, %xmm0
subsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x57c12
sqrtsd %xmm0, %xmm0
jmp 0x57c35
movapd %xmm5, 0x40(%rsp)
movapd %xmm6, 0x10(%rsp)
callq 0x82b0
movapd 0x10(%rsp), %xmm6
movapd 0x40(%rsp), %xmm5
movsd 0x8(%rsp), %xmm3
movapd 0x30(%rsp), %xmm2
movslq 0x20c(%rbx), %rcx
movsd %xmm0, (%r14,%rcx,8)
movapd %xmm6, %xmm0
addsd %xmm5, %xmm0
mulsd 0x8cbe8(%rip), %xmm0    # 0xe4840
movsd 0x1a0(%rbx), %xmm1
divsd %xmm3, %xmm1
mulsd %xmm3, %xmm0
addsd %xmm1, %xmm0
movslq 0x210(%rbx), %rax
movsd %xmm0, (%r14,%rax,8)
movslq 0x26c(%rbx), %rax
movsd %xmm5, (%r14,%rax,8)
movslq 0x270(%rbx), %rax
movsd %xmm6, (%r14,%rax,8)
movsd (%r14,%rcx,8), %xmm0
mulsd %xmm3, %xmm0
mulsd %xmm0, %xmm2
movslq 0x274(%rbx), %rax
movsd %xmm2, (%r14,%rax,8)
cmpw $0x1, 0x328(%rbx)
jne 0x57d09
movslq 0x244(%rbx), %rdx
movsd (%r14,%rdx,8), %xmm0
movsd (%r14,%rcx,8), %xmm1
mulsd %xmm0, %xmm1
movslq 0x24c(%rbx), %rdx
movsd (%r14,%rdx,8), %xmm2
mulsd 0x8c80c(%rip), %xmm2    # 0xe44f0
divsd %xmm3, %xmm1
subsd %xmm1, %xmm2
mulsd %xmm0, %xmm2
movslq 0x25c(%rbx), %rdx
movsd %xmm2, (%r14,%rdx,8)
addsd (%r14,%rax,8), %xmm2
movsd %xmm2, (%r14,%rax,8)
movsd 0x1a0(%rbx), %xmm0
divsd %xmm3, %xmm0
divsd %xmm3, %xmm0
subsd %xmm0, %xmm5
xorpd %xmm0, %xmm0
ucomisd %xmm5, %xmm0
jae 0x57e24
movapd 0x20(%rsp), %xmm0
divsd %xmm5, %xmm0
movslq 0x278(%rbx), %rax
movsd %xmm0, (%r14,%rax,8)
xorl %eax, %eax
cmpl $0x2, 0x7c(%rsp)
jne 0x57e90
movslq 0x27c(%rbx), %rdx
movsd %xmm5, (%r14,%rdx,8)
movapd 0x50(%rsp), %xmm0
divsd %xmm5, %xmm0
movslq 0x280(%rbx), %rdx
movsd %xmm0, (%r14,%rdx,8)
movslq 0x304(%rbx), %rdx
movsd (%r15,%rdx,8), %xmm0
movslq 0x290(%rbx), %rdx
movsd %xmm0, (%r14,%rdx,8)
movslq 0x308(%rbx), %rdx
movsd (%r15,%rdx,8), %xmm0
movslq 0x294(%rbx), %rdx
movsd %xmm0, (%r14,%rdx,8)
movslq 0x310(%rbx), %rdx
movsd (%r15,%rdx,8), %xmm0
movslq 0x298(%rbx), %rsi
movsd %xmm0, (%r14,%rsi,8)
movslq 0x314(%rbx), %rsi
movsd (%r15,%rsi,8), %xmm0
movsd (%r15,%rdx,8), %xmm1
mulsd %xmm3, %xmm1
mulsd (%r14,%rcx,8), %xmm1
divsd %xmm1, %xmm0
movslq 0x29c(%rbx), %rcx
movsd %xmm0, (%r14,%rcx,8)
cmpw $0x1, 0x336(%rbx)
jne 0x57e90
movslq 0x2a0(%rbx), %rdx
movslq 0x2a4(%rbx), %rcx
movl 0x180(%rbx), %esi
cmpl $0x1, %esi
je 0x57ea2
testl %esi, %esi
je 0x57ede
jmp 0x57e90
leaq 0xa2c02(%rip), %rsi     # 0xfaa2d
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movapd %xmm5, %xmm0
movb $0x1, %al
callq 0x30c2c
leaq 0x8923a(%rip), %rsi     # 0xe1082
leaq 0xa2c09(%rip), %rdx     # 0xfaa58
leaq 0x8d0(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c2c
addq $0xb84, %rbx            # imm = 0xB84
leaq 0x891c2(%rip), %rsi     # 0xe1034
leaq 0xa2b66(%rip), %rdx     # 0xfa9df
movq %rbx, %rdi
movl $0x25b, %ecx            # imm = 0x25B
movq %r15, %r8
xorl %eax, %eax
callq 0x30c2c
movl $0x1, %eax
addq $0x10d8, %rsp           # imm = 0x10D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movsd 0x893b6(%rip), %xmm0    # 0xe1260
divsd %xmm3, %xmm0
addsd 0x89932(%rip), %xmm0    # 0xe17e8
ucomisd 0x188(%rbx), %xmm0
jbe 0x57ede
movsd 0x170(%rbx), %xmm0
movsd %xmm0, (%r14,%rdx,8)
movsd 0x178(%rbx), %xmm0
movsd %xmm0, (%r14,%rcx,8)
jmp 0x57e90
movabsq $0x3ff0000000000000, %rsi # imm = 0x3FF0000000000000
movq %rsi, (%r14,%rdx,8)
movq %rsi, (%r14,%rcx,8)
jmp 0x57e90