// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../external/HMcode/hmcode.c
// Function: hmcode_eisenstein_hu
int hmcode_eisenstein_hu(
                         struct precision *ppr,
                         struct background *pba,
                         struct primordial * ppm,
                         struct fourier *pfo,
                         double * ln_k,
                         int k_size,
                         double * ln_pk_nowiggle
                         ){

  int index_k;
  double h,wm,wb,rb;
  double s, alpha, Gamma, q,L,C,Tk_nw,Pk_nw;
  double k;
  double ns,Om,OL,g,coeff,norm;

  h = pba->h;
  wm = (1.-pba->Omega0_lambda-pba->Omega0_fld)*h*h;
  wb = pba->Omega0_b*h*h;
  rb = wb/wm;

  s = 44.5*log(9.83/wm)/sqrt(1.+10.*pow(wb,0.75));
  alpha = 1.-0.328*log(431.*wm)*rb+0.38*log(22.3*wm)*rb*rb;

  // ns was hard-coded as ns=0.95 in old HMcode implementation (this has no
  // significant impact since the analytic power spectrum is used only to
  // reduce the dynamical range before interpolation!)
  //ns = 0.95;
  ns = ppm->n_s;

  // added by JL for an approximate but realistic normalisation of the spectrum:
  // - factor g(Omega_M) defined and approximated like in Kofman et al. 1993 (valid in a flat Universe)
  // - factor norm refering to eq. (6.34, first line) in Neutrino Cosmology book (CUP 2013)
  //   (the original HMcode was using norm=1, which makes zero difference for the calculation of P_NL)
  Om = (1.-pba->Omega0_lambda-pba->Omega0_fld);
  OL = pba->Omega0_lambda+pba->Omega0_fld;
  g = pow(Om,0.2) / (1.+0.003*pow(OL/Om,4./3.));
  coeff = g/Om/pba->H0/pba->H0;
  // if {\cal P}_R = A_s (k/kp)^(ns-1), then [{\cal P}_R / k^(ns-1)] = A_s / kp^(ns-1)
  norm = pow(coeff,2)*8*_PI_*_PI_/25.*ppm->A_s/pow(ppm->k_pivot,ns-1.);

  for(index_k=0; index_k<k_size; index_k++){
    k = exp(ln_k[index_k]);
    Gamma = (wm/h)*(alpha+(1.-alpha)/(1.+pow(0.43*k*s,4)));
    q = k/h*(pba->T_cmb/2.7)*(pba->T_cmb/2.7)/Gamma;
    L = log(2.*exp(1.)+1.8*q);
    C = 14.2+731./(1.+62.5*q);
    Tk_nw = L/(L+C*q*q);
    // According to eq. (6.34, first line) in Neutrino Cosmology book (CUP 2013),
    // P(k) = norm * k^ns * T(k) where T(k) is noramlised to 1 for small k
    ln_pk_nowiggle[index_k] = log(norm*pow(k,ns)*pow(Tk_nw,2));
  }

  return _SUCCESS_;
}

// Assembly:
subq $0x118, %rsp            # imm = 0x118
movq 0x120(%rsp), %rax
movq %rdi, 0x110(%rsp)
movq %rsi, 0x108(%rsp)
movq %rdx, 0x100(%rsp)
movq %rcx, 0xf8(%rsp)
movq %r8, 0xf0(%rsp)
movl %r9d, 0xec(%rsp)
movq 0x108(%rsp), %rax
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0xe0(%rsp)
movq 0x108(%rsp), %rax
movsd 0x10dc3(%rip), %xmm0    # 0x1d2248
subsd 0x30(%rax), %xmm0
movq 0x108(%rsp), %rax
subsd 0x38(%rax), %xmm0
mulsd 0xe0(%rsp), %xmm0
mulsd 0xe0(%rsp), %xmm0
movsd %xmm0, 0xd8(%rsp)
movq 0x108(%rsp), %rax
movsd 0x20(%rax), %xmm0
mulsd 0xe0(%rsp), %xmm0
mulsd 0xe0(%rsp), %xmm0
movsd %xmm0, 0xd0(%rsp)
movsd 0xd0(%rsp), %xmm0
divsd 0xd8(%rsp), %xmm0
movsd %xmm0, 0xc8(%rsp)
movsd 0x4ef1b(%rip), %xmm0    # 0x210418
divsd 0xd8(%rsp), %xmm0
callq 0x82f0
movaps %xmm0, %xmm1
movsd 0x4eefa(%rip), %xmm0    # 0x210410
mulsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0xd0(%rsp), %xmm0
movsd 0x11797(%rip), %xmm1    # 0x1d2cc8
callq 0x8610
movsd 0x112a2(%rip), %xmm1    # 0x1d27e0
mulsd %xmm1, %xmm0
movsd 0x10cfe(%rip), %xmm1    # 0x1d2248
addsd %xmm1, %xmm0
callq 0x82e0
movaps %xmm0, %xmm1
movsd 0x30(%rsp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0xc0(%rsp)
movsd 0x4ee97(%rip), %xmm0    # 0x210408
mulsd 0xd8(%rsp), %xmm0
callq 0x82f0
movaps %xmm0, %xmm1
movsd 0x4ee76(%rip), %xmm0    # 0x210400
mulsd %xmm1, %xmm0
movsd 0xc8(%rsp), %xmm1
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm1, %xmm0
movsd 0x10c8e(%rip), %xmm1    # 0x1d2248
addsd %xmm1, %xmm0
movsd %xmm0, 0x38(%rsp)
movsd 0x4ee2c(%rip), %xmm0    # 0x2103f8
mulsd 0xd8(%rsp), %xmm0
callq 0x82f0
movsd 0x38(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0x4105d(%rip), %xmm0    # 0x202648
mulsd %xmm2, %xmm0
mulsd 0xc8(%rsp), %xmm0
movsd 0xc8(%rsp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0xb8(%rsp)
movq 0x100(%rsp), %rax
movsd 0x28(%rax), %xmm0
movsd %xmm0, 0x78(%rsp)
movq 0x108(%rsp), %rax
movsd 0x10c13(%rip), %xmm0    # 0x1d2248
subsd 0x30(%rax), %xmm0
movq 0x108(%rsp), %rax
subsd 0x38(%rax), %xmm0
movsd %xmm0, 0x70(%rsp)
movq 0x108(%rsp), %rax
movsd 0x30(%rax), %xmm0
movq 0x108(%rsp), %rax
addsd 0x38(%rax), %xmm0
movsd %xmm0, 0x68(%rsp)
movsd 0x70(%rsp), %xmm0
movsd 0x10c05(%rip), %xmm1    # 0x1d2280
callq 0x8610
movsd %xmm0, 0x40(%rsp)
movsd 0x68(%rsp), %xmm0
divsd 0x70(%rsp), %xmm0
movsd 0x13e76(%rip), %xmm1    # 0x1d5510
callq 0x8610
movaps %xmm0, %xmm1
movsd 0x40(%rsp), %xmm0
movsd 0x4ed40(%rip), %xmm2    # 0x2103f0
mulsd %xmm2, %xmm1
movsd 0x10b8c(%rip), %xmm2    # 0x1d2248
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x60(%rsp)
movsd 0x60(%rsp), %xmm0
divsd 0x70(%rsp), %xmm0
movq 0x108(%rsp), %rax
divsd (%rax), %xmm0
movq 0x108(%rsp), %rax
divsd (%rax), %xmm0
movsd %xmm0, 0x58(%rsp)
movsd 0x58(%rsp), %xmm0
movl $0x2, %edi
callq 0x5b970
movsd 0x13dcc(%rip), %xmm1    # 0x1d54d8
mulsd %xmm1, %xmm0
movsd 0x138c8(%rip), %xmm1    # 0x1d4fe0
mulsd %xmm1, %xmm0
movsd 0x138bc(%rip), %xmm1    # 0x1d4fe0
mulsd %xmm1, %xmm0
movsd 0x11fe0(%rip), %xmm1    # 0x1d3710
divsd %xmm1, %xmm0
movq 0x100(%rsp), %rax
mulsd 0x20(%rax), %xmm0
movsd %xmm0, 0x48(%rsp)
movq 0x100(%rsp), %rax
movsd (%rax), %xmm0
movsd 0x78(%rsp), %xmm1
movsd 0x10ae7(%rip), %xmm2    # 0x1d2248
subsd %xmm2, %xmm1
callq 0x8610
movaps %xmm0, %xmm1
movsd 0x48(%rsp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x50(%rsp)
movl $0x0, 0xe8(%rsp)
movl 0xe8(%rsp), %eax
cmpl 0xec(%rsp), %eax
jge 0x1c19f0
movq 0xf0(%rsp), %rax
movslq 0xe8(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
callq 0x8670
movsd %xmm0, 0x80(%rsp)
movsd 0xd8(%rsp), %xmm0
divsd 0xe0(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0xb8(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x10a5a(%rip), %xmm0    # 0x1d2248
subsd 0xb8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x4ec33(%rip), %xmm0    # 0x210438
mulsd 0x80(%rsp), %xmm0
mulsd 0xc0(%rsp), %xmm0
movl $0x4, %edi
callq 0x5b970
movsd 0x8(%rsp), %xmm2
movsd 0x10(%rsp), %xmm1
movaps %xmm0, %xmm4
movsd 0x18(%rsp), %xmm0
movsd 0x10a0a(%rip), %xmm3    # 0x1d2248
addsd %xmm4, %xmm3
divsd %xmm3, %xmm2
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0xb0(%rsp)
movsd 0x80(%rsp), %xmm0
divsd 0xe0(%rsp), %xmm0
movq 0x108(%rsp), %rax
movsd 0x18(%rax), %xmm1
movsd 0x4eb5a(%rip), %xmm2    # 0x2103d8
divsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movq 0x108(%rsp), %rax
movsd 0x18(%rax), %xmm1
movsd 0x4eb3d(%rip), %xmm2    # 0x2103d8
divsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
divsd 0xb0(%rsp), %xmm0
movsd %xmm0, 0xa8(%rsp)
movsd 0x1098b(%rip), %xmm0    # 0x1d2248
callq 0x8670
movsd 0x136c6(%rip), %xmm1    # 0x1d4f90
mulsd 0xa8(%rsp), %xmm1
addsd %xmm0, %xmm0
addsd %xmm1, %xmm0
callq 0x82f0
movsd %xmm0, 0xa0(%rsp)
movsd 0xa8(%rsp), %xmm0
movsd 0x4eb36(%rip), %xmm1    # 0x210430
mulsd %xmm1, %xmm0
movsd 0x10942(%rip), %xmm1    # 0x1d2248
addsd %xmm1, %xmm0
movsd 0x4eb16(%rip), %xmm1    # 0x210428
divsd %xmm0, %xmm1
movsd 0x4eb02(%rip), %xmm0    # 0x210420
addsd %xmm1, %xmm0
movsd %xmm0, 0x98(%rsp)
movsd 0xa0(%rsp), %xmm0
movsd 0xa0(%rsp), %xmm2
movsd 0x98(%rsp), %xmm1
mulsd 0xa8(%rsp), %xmm1
movsd 0xa8(%rsp), %xmm3
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x90(%rsp)
movsd 0x50(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x80(%rsp), %xmm0
movsd 0x78(%rsp), %xmm1
callq 0x8610
movaps %xmm0, %xmm1
movsd 0x20(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x90(%rsp), %xmm0
movl $0x2, %edi
callq 0x5b970
movaps %xmm0, %xmm1
movsd 0x28(%rsp), %xmm0
mulsd %xmm1, %xmm0
callq 0x82f0
movq 0x120(%rsp), %rax
movslq 0xe8(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0xe8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xe8(%rsp)
jmp 0x1c1788
xorl %eax, %eax
addq $0x118, %rsp            # imm = 0x118
retq
nopw (%rax,%rax)