// File: /workspace/github_c_makefile_star2_O2/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 $0x10b8, %rsp           # imm = 0x10B8
movq %rdi, %rbx
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jae 0x517df
movq %rcx, %r14
movl %edx, %ebp
movq %rsi, %r15
movslq 0x208(%rbx), %rax
movsd %xmm0, (%rcx,%rax,8)
movsd (%rbx), %xmm1
mulsd %xmm1, %xmm1
mulsd 0x10(%rbx), %xmm1
movapd %xmm1, 0x20(%rsp)
movsd 0x88137(%rip), %xmm1    # 0xd93f8
movsd %xmm0, 0x8(%rsp)
callq 0x8650
movapd 0x20(%rsp), %xmm1
divsd %xmm0, %xmm1
movslq 0x214(%rbx), %rax
movsd %xmm1, (%r14,%rax,8)
movapd %xmm1, %xmm0
addsd 0x84f69(%rip), %xmm0    # 0xd6258
movapd %xmm0, 0x50(%rsp)
movsd 0x8810b(%rip), %xmm0    # 0xd9408
movapd %xmm1, 0x20(%rsp)
mulsd %xmm1, %xmm0
movapd %xmm0, 0x10(%rsp)
movsd (%rbx), %xmm0
mulsd %xmm0, %xmm0
mulsd 0x20(%rbx), %xmm0
movapd %xmm0, 0x40(%rsp)
movsd 0x86420(%rip), %xmm1    # 0xd7748
movsd 0x8(%rsp), %xmm0
callq 0x8650
movapd 0x40(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
movslq 0x218(%rbx), %rax
movsd %xmm1, (%r14,%rax,8)
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
xorpd %xmm2, %xmm2
unpcklpd 0x50(%rsp), %xmm2       # xmm2 = xmm2[0],mem[0]
addpd %xmm1, %xmm2
cmpw $0x1, 0x320(%rbx)
jne 0x513b7
movsd (%rbx), %xmm1
mulsd %xmm1, %xmm1
mulsd 0x30(%rbx), %xmm1
movapd %xmm1, 0x30(%rsp)
movsd 0x863c1(%rip), %xmm1    # 0xd7748
movapd %xmm2, 0x40(%rsp)
callq 0x8650
movapd 0x40(%rsp), %xmm2
movapd 0x30(%rsp), %xmm1
divsd %xmm0, %xmm1
movslq 0x21c(%rbx), %rax
movsd %xmm1, (%r14,%rax,8)
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
addpd %xmm1, %xmm2
xorpd %xmm1, %xmm1
movapd 0x10(%rsp), %xmm4
addsd %xmm1, %xmm4
movapd 0x20(%rsp), %xmm3
mulsd 0x9debd(%rip), %xmm3    # 0xef290
cmpw $0x1, 0x322(%rbx)
jne 0x5144a
movsd (%rbx), %xmm0
mulsd %xmm0, %xmm0
mulsd 0x38(%rbx), %xmm0
movapd %xmm0, 0x30(%rsp)
movsd 0x86350(%rip), %xmm1    # 0xd7748
movsd 0x8(%rsp), %xmm0
movapd %xmm2, 0x40(%rsp)
movapd %xmm3, 0x20(%rsp)
movapd %xmm4, 0x10(%rsp)
callq 0x8650
movapd 0x10(%rsp), %xmm4
xorpd %xmm1, %xmm1
movapd 0x20(%rsp), %xmm3
movapd 0x40(%rsp), %xmm2
movapd 0x30(%rsp), %xmm5
divsd %xmm0, %xmm5
movslq 0x220(%rbx), %rax
movsd %xmm5, (%r14,%rax,8)
unpcklpd %xmm5, %xmm5            # xmm5 = xmm5[0,0]
addpd %xmm5, %xmm2
addsd %xmm1, %xmm3
addsd %xmm1, %xmm4
cmpw $0x1, 0x324(%rbx)
jne 0x5147e
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, %xmm2
cmpw $0x1, 0x326(%rbx)
unpcklpd %xmm4, %xmm3            # xmm3 = xmm3[0],xmm4[0]
movapd %xmm2, %xmm4
unpckhpd %xmm2, %xmm4            # xmm4 = xmm4[1],xmm2[1]
jne 0x514d2
movslq 0x2f4(%rbx), %rax
movsd (%r15,%rax,8), %xmm0
movslq 0x23c(%rbx), %rax
movsd %xmm0, (%r14,%rax,8)
addsd %xmm0, %xmm4
movapd 0x50(%rsp), %xmm1
addsd %xmm0, %xmm1
movapd %xmm1, 0x50(%rsp)
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
mulpd 0x9de52(%rip), %xmm0    # 0xef320
addpd %xmm0, %xmm3
cmpw $0x1, 0x328(%rbx)
jne 0x51657
movslq 0x2fc(%rbx), %rax
movsd (%r15,%rax,8), %xmm0
movsd %xmm0, 0x30(%rsp)
movslq 0x300(%rbx), %rax
movsd (%r15,%rax,8), %xmm1
movaps %xmm1, 0x60(%rsp)
movslq 0x240(%rbx), %rax
movsd %xmm0, (%r14,%rax,8)
movslq 0x244(%rbx), %rax
movsd %xmm1, (%r14,%rax,8)
movq %rbx, %rdi
movapd %xmm2, 0x40(%rsp)
movapd %xmm3, 0x20(%rsp)
movapd %xmm4, 0x10(%rsp)
callq 0x51d89
movslq 0x248(%rbx), %rax
movsd %xmm0, (%r14,%rax,8)
movq %rbx, %rdi
movsd 0x30(%rsp), %xmm0
callq 0x51ddb
movslq 0x24c(%rbx), %rax
movsd %xmm0, (%r14,%rax,8)
movq %rbx, %rdi
movsd 0x30(%rsp), %xmm0
callq 0x51e8b
movslq 0x250(%rbx), %rax
movsd %xmm0, (%r14,%rax,8)
movapd 0x60(%rsp), %xmm2
mulsd %xmm2, %xmm2
movsd 0x8(%rsp), %xmm1
movapd %xmm1, %xmm0
addsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
divsd %xmm0, %xmm2
movapd %xmm2, 0x60(%rsp)
movq %rbx, %rdi
movsd 0x30(%rsp), %xmm0
callq 0x51d89
addsd 0x60(%rsp), %xmm0
movsd 0x8618a(%rip), %xmm1    # 0xd7748
divsd %xmm1, %xmm0
movslq 0x254(%rbx), %rax
movsd %xmm0, (%r14,%rax,8)
movq %rbx, %rdi
movsd 0x30(%rsp), %xmm0
callq 0x51d89
movapd 0x10(%rsp), %xmm4
movapd 0x20(%rsp), %xmm3
movapd 0x60(%rsp), %xmm5
subsd %xmm0, %xmm5
movsd 0x8614d(%rip), %xmm2    # 0xd7748
divsd %xmm2, %xmm5
movslq 0x258(%rbx), %rax
movsd %xmm5, (%r14,%rax,8)
movslq 0x254(%rbx), %rax
movsd (%r14,%rax,8), %xmm0
addsd %xmm0, %xmm4
xorpd %xmm1, %xmm1
unpcklpd %xmm5, %xmm1            # xmm1 = xmm1[0],xmm5[0]
addpd %xmm1, %xmm3
movapd %xmm5, %xmm1
mulsd %xmm2, %xmm1
movapd 0x50(%rsp), %xmm2
addsd %xmm1, %xmm2
movapd %xmm2, 0x50(%rsp)
movapd 0x40(%rsp), %xmm2
mulsd 0x87df1(%rip), %xmm5    # 0xd9440
addsd %xmm0, %xmm5
addsd %xmm5, %xmm2
cmpw $0x1, 0x32a(%rbx)
movapd %xmm2, 0x40(%rsp)
jne 0x5183d
movapd %xmm4, 0x10(%rsp)
movapd %xmm3, 0x20(%rsp)
movl %ebp, 0x7c(%rsp)
movq %r15, 0x60(%rsp)
movsd 0x84bd8(%rip), %xmm1    # 0xd6260
movsd 0x8(%rsp), %xmm0
divsd %xmm0, %xmm1
addsd 0x8514e(%rip), %xmm1    # 0xd67e8
movsd %xmm1, 0x30(%rsp)
xorl %ebp, %ebp
leaq 0x90(%rsp), %r15
leaq 0xa0(%rsp), %r12
leaq 0x98(%rsp), %r13
movslq 0x70(%rbx), %rax
cmpq %rax, %rbp
jge 0x51845
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 0x30(%rsp), %xmm2
xorl %ecx, %ecx
movq %r12, %r8
movq %r13, %r9
pushq %r15
pushq $0x0
callq 0x51f73
movsd 0x18(%rsp), %xmm0
addq $0x10, %rsp
movsd 0xa0(%rsp), %xmm4
movslq 0x260(%rbx), %rax
addq %rbp, %rax
movsd %xmm4, (%r14,%rax,8)
movapd 0x10(%rsp), %xmm1
addsd %xmm4, %xmm1
movapd %xmm1, 0x10(%rsp)
movsd 0x98(%rsp), %xmm1
movslq 0x264(%rbx), %rax
addq %rbp, %rax
movsd %xmm1, (%r14,%rax,8)
movsd 0x90(%rsp), %xmm2
movslq 0x268(%rbx), %rax
addq %rbp, %rax
movsd %xmm2, (%r14,%rax,8)
movapd %xmm1, %xmm3
mulsd 0x9db11(%rip), %xmm3    # 0xef298
addsd %xmm2, %xmm3
unpcklpd %xmm1, %xmm3            # xmm3 = xmm3[0],xmm1[0]
movapd 0x20(%rsp), %xmm2
addpd %xmm3, %xmm2
movapd %xmm2, 0x20(%rsp)
movapd %xmm1, %xmm2
mulsd 0x85f9d(%rip), %xmm2    # 0xd7748
movapd 0x50(%rsp), %xmm3
addsd %xmm2, %xmm3
movapd %xmm3, 0x50(%rsp)
mulsd 0x87c7d(%rip), %xmm1    # 0xd9440
addsd %xmm4, %xmm1
movapd 0x40(%rsp), %xmm2
addsd %xmm1, %xmm2
movapd %xmm2, 0x40(%rsp)
incq %rbp
jmp 0x516ba
leaq 0x9e0ad(%rip), %rsi     # 0xef893
leaq 0xb0(%rsp), %r14
movq %r14, %rdi
movb $0x1, %al
callq 0x2e014
leaq 0x84883(%rip), %rsi     # 0xd6082
leaq 0x9e0b1(%rip), %rdx     # 0xef8b7
leaq 0x8b0(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x2e014
addq $0xb84, %rbx            # imm = 0xB84
leaq 0x8480b(%rip), %rsi     # 0xd6034
leaq 0x9e08f(%rip), %rdx     # 0xef8bf
movq %rbx, %rdi
movl $0x1a1, %ecx            # imm = 0x1A1
jmp 0x51d66
movsd 0x8(%rsp), %xmm0
jmp 0x5185a
movq 0x60(%rsp), %r15
movl 0x7c(%rsp), %ebp
movapd 0x20(%rsp), %xmm3
movapd 0x10(%rsp), %xmm4
cmpw $0x1, 0x32c(%rbx)
movapd %xmm3, %xmm2
unpckhpd %xmm3, %xmm2            # xmm2 = xmm2[1],xmm3[1]
jne 0x51891
movsd (%rbx), %xmm1
mulsd %xmm1, %xmm1
mulsd 0xf8(%rbx), %xmm1
movslq 0x224(%rbx), %rax
movsd %xmm1, (%r14,%rax,8)
addsd %xmm1, %xmm4
subsd %xmm1, %xmm2
cmpw $0x1, 0x32e(%rbx)
unpcklpd %xmm2, %xmm3            # xmm3 = xmm3[0],xmm2[0]
jne 0x519ab
movapd %xmm4, 0x10(%rsp)
movapd %xmm3, 0x20(%rsp)
movslq 0x2f8(%rbx), %rax
movsd (%r15,%rax,8), %xmm1
movslq 0x228(%rbx), %rax
movsd %xmm1, (%r14,%rax,8)
leaq 0x88(%rsp), %rsi
leaq 0x80(%rsp), %rdx
leaq 0xa8(%rsp), %rcx
movq %rbx, %rdi
callq 0x521cf
testl %eax, %eax
je 0x51935
addq $0xb84, %rbx            # imm = 0xB84
leaq 0x84af5(%rip), %rsi     # 0xd63f0
leaq 0x9dfd2(%rip), %rdx     # 0xef8d4
leaq 0xb0(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x84716(%rip), %rsi     # 0xd6034
leaq 0x9df9a(%rip), %rdx     # 0xef8bf
movq %rbx, %rdi
movl $0x222, %ecx            # imm = 0x222
movq %r14, %r8
jmp 0x51d69
movsd 0x88(%rsp), %xmm0
movslq 0x22c(%rbx), %rax
movsd %xmm0, (%r14,%rax,8)
movslq 0x228(%rbx), %rax
movsd (%r14,%rax,8), %xmm1
movapd 0x10(%rsp), %xmm4
addsd %xmm1, %xmm4
movsd 0x848f6(%rip), %xmm2    # 0xd6260
addsd %xmm0, %xmm2
mulsd 0x87aca(%rip), %xmm2    # 0xd9440
mulsd %xmm0, %xmm2
movsd 0x80(%rsp), %xmm3
movsd 0x8(%rsp), %xmm5
mulsd %xmm5, %xmm3
addsd %xmm2, %xmm3
unpcklpd %xmm0, %xmm3            # xmm3 = xmm3[0],xmm0[0]
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
mulpd %xmm3, %xmm1
movapd 0x20(%rsp), %xmm3
addpd %xmm1, %xmm3
movapd %xmm5, %xmm0
cmpw $0x1, 0x330(%rbx)
jne 0x51a28
movsd (%rbx), %xmm1
mulsd %xmm1, %xmm1
mulsd 0x28(%rbx), %xmm1
movapd %xmm1, 0x30(%rsp)
movsd 0x87a28(%rip), %xmm1    # 0xd93f8
movapd %xmm3, 0x20(%rsp)
movapd %xmm4, 0x10(%rsp)
callq 0x8650
movapd 0x10(%rsp), %xmm4
movapd 0x20(%rsp), %xmm3
movapd 0x30(%rsp), %xmm1
divsd %xmm0, %xmm1
movslq 0x234(%rbx), %rax
movsd %xmm1, (%r14,%rax,8)
addsd %xmm1, %xmm4
movapd 0x50(%rsp), %xmm0
addsd %xmm1, %xmm0
movapd %xmm0, 0x50(%rsp)
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
mulpd 0x9d8fc(%rip), %xmm1    # 0xef320
addpd %xmm1, %xmm3
cmpw $0x1, 0x332(%rbx)
movapd %xmm3, 0x20(%rsp)
movapd %xmm3, %xmm5
unpckhpd %xmm3, %xmm5            # xmm5 = xmm5[1],xmm3[1]
jne 0x51abd
movsd (%rbx), %xmm0
mulsd %xmm0, %xmm0
mulsd 0x40(%rbx), %xmm0
movsd %xmm0, 0x60(%rsp)
movsd 0x8799d(%rip), %xmm1    # 0xd93f8
movsd 0x8(%rsp), %xmm0
movapd %xmm4, 0x10(%rsp)
movapd %xmm5, 0x30(%rsp)
callq 0x8650
movapd 0x30(%rsp), %xmm5
movapd 0x10(%rsp), %xmm4
movsd 0x8(%rsp), %xmm3
movsd 0x60(%rsp), %xmm1
divsd %xmm0, %xmm1
movslq 0x230(%rbx), %rax
movsd %xmm1, (%r14,%rax,8)
addsd %xmm1, %xmm4
movapd 0x50(%rsp), %xmm0
addsd %xmm1, %xmm0
movapd %xmm0, 0x50(%rsp)
mulsd 0x87951(%rip), %xmm1    # 0xd9408
addsd %xmm1, %xmm5
jmp 0x51ac3
movsd 0x8(%rsp), %xmm3
movsd 0x1a0(%rbx), %xmm1
divsd %xmm3, %xmm1
divsd %xmm3, %xmm1
movapd %xmm4, %xmm0
subsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x51aeb
sqrtsd %xmm0, %xmm0
jmp 0x51b0e
movapd %xmm4, 0x10(%rsp)
movapd %xmm5, 0x30(%rsp)
callq 0x82d0
movapd 0x30(%rsp), %xmm5
movapd 0x10(%rsp), %xmm4
movsd 0x8(%rsp), %xmm3
movapd 0x40(%rsp), %xmm2
movslq 0x20c(%rbx), %rax
movsd %xmm0, (%r14,%rax,8)
movapd %xmm5, %xmm0
addsd %xmm4, %xmm0
mulsd 0x87c9f(%rip), %xmm0    # 0xd97d0
movsd 0x1a0(%rbx), %xmm1
divsd %xmm3, %xmm1
mulsd %xmm3, %xmm0
addsd %xmm1, %xmm0
movslq 0x210(%rbx), %rcx
movsd %xmm0, (%r14,%rcx,8)
movslq 0x26c(%rbx), %rcx
movsd %xmm4, (%r14,%rcx,8)
movslq 0x270(%rbx), %rcx
movsd %xmm5, (%r14,%rcx,8)
movsd (%r14,%rax,8), %xmm0
mulsd %xmm3, %xmm0
movapd 0x20(%rsp), %xmm1
mulsd %xmm0, %xmm1
movslq 0x274(%rbx), %rcx
movsd %xmm1, (%r14,%rcx,8)
cmpw $0x1, 0x328(%rbx)
jne 0x51bee
movslq 0x244(%rbx), %rdx
movsd (%r14,%rdx,8), %xmm0
movsd (%r14,%rax,8), %xmm1
mulsd %xmm0, %xmm1
movslq 0x24c(%rbx), %rdx
movsd (%r14,%rdx,8), %xmm2
mulsd 0x878fd(%rip), %xmm2    # 0xd94c0
divsd %xmm3, %xmm1
subsd %xmm1, %xmm2
mulsd %xmm0, %xmm2
movslq 0x25c(%rbx), %rdx
movsd %xmm2, (%r14,%rdx,8)
addsd (%r14,%rcx,8), %xmm2
movsd %xmm2, (%r14,%rcx,8)
movapd 0x40(%rsp), %xmm2
movsd 0x1a0(%rbx), %xmm0
divsd %xmm3, %xmm0
divsd %xmm3, %xmm0
subsd %xmm0, %xmm4
xorpd %xmm0, %xmm0
ucomisd %xmm4, %xmm0
jae 0x51d09
movapd 0x50(%rsp), %xmm0
divsd %xmm4, %xmm0
movslq 0x278(%rbx), %rcx
movsd %xmm0, (%r14,%rcx,8)
xorl %r12d, %r12d
cmpl $0x2, %ebp
jne 0x51d74
movslq 0x27c(%rbx), %rcx
movsd %xmm4, (%r14,%rcx,8)
divsd %xmm4, %xmm2
movslq 0x280(%rbx), %rcx
movsd %xmm2, (%r14,%rcx,8)
movslq 0x304(%rbx), %rcx
movsd (%r15,%rcx,8), %xmm0
movslq 0x290(%rbx), %rcx
movsd %xmm0, (%r14,%rcx,8)
movslq 0x308(%rbx), %rcx
movsd (%r15,%rcx,8), %xmm0
movslq 0x294(%rbx), %rcx
movsd %xmm0, (%r14,%rcx,8)
movslq 0x310(%rbx), %rcx
movsd (%r15,%rcx,8), %xmm0
movslq 0x298(%rbx), %rcx
movsd %xmm0, (%r14,%rcx,8)
movslq 0x314(%rbx), %rcx
movsd (%r15,%rcx,8), %xmm1
mulsd %xmm3, %xmm0
mulsd (%r14,%rax,8), %xmm0
divsd %xmm0, %xmm1
movslq 0x29c(%rbx), %rax
movsd %xmm1, (%r14,%rax,8)
cmpw $0x1, 0x336(%rbx)
jne 0x51d74
movsd 0x84583(%rip), %xmm0    # 0xd6260
divsd %xmm3, %xmm0
addsd 0x84aff(%rip), %xmm0    # 0xd67e8
movslq 0x2a0(%rbx), %rax
leaq (%r14,%rax,8), %rsi
movslq 0x2a4(%rbx), %rax
leaq (%r14,%rax,8), %rdx
movq %rbx, %rdi
callq 0x52822
jmp 0x51d74
leaq 0x9dbfd(%rip), %rsi     # 0xef90d
leaq 0xb0(%rsp), %r14
movq %r14, %rdi
movapd %xmm4, %xmm0
movb $0x1, %al
callq 0x2e014
leaq 0x84355(%rip), %rsi     # 0xd6082
leaq 0x9dc04(%rip), %rdx     # 0xef938
leaq 0x8b0(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x2e014
addq $0xb84, %rbx            # imm = 0xB84
leaq 0x842dd(%rip), %rsi     # 0xd6034
leaq 0x9db61(%rip), %rdx     # 0xef8bf
movq %rbx, %rdi
movl $0x25b, %ecx            # imm = 0x25B
movq %r15, %r8
xorl %eax, %eax
callq 0x2e014
pushq $0x1
popq %r12
movl %r12d, %eax
addq $0x10b8, %rsp           # imm = 0x10B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq