// File: /workspace/github_c_makefile_star2_O1/PoulinV[P]AxiCLASS/build/../external/HMcode/hmcode.c
// Function: hmcode_nowiggle
int hmcode_nowiggle(
                    struct fourier *pfo,
                    double * lnpk_l,
                    double * ddlnpk_l,
                    int nw_size,
                    double * ln_k_nw,
                    double * pk_nw,
                    double * pk_w
                    ) {

  // JL: The following parameters define the smoothing algorithm.
  //     In principle, they should be precision parameters rather than hard-coded.
  //     However, the goal is to match exactly other versions of HMcode, so we leave these fixed.
  double wiggle_sigma = 0.25;
  double kmin_wiggle = 5e-3; // Mpc/h
  double logkmin_wiggle = log(kmin_wiggle);
  double kmax_wiggle = 5.; // Mpc/h
  double logkmax_wiggle = log(kmax_wiggle);

  int i;
  int last_index = 0;
  double * lnpk_lin;
  double * lnpk_analytic_nowiggle;
  double * pk_ratio;

  class_alloc(lnpk_lin, nw_size*sizeof(double), pfo->error_message);
  class_alloc(lnpk_analytic_nowiggle, nw_size*sizeof(double), pfo->error_message);
  class_alloc(pk_ratio, nw_size*sizeof(double), pfo->error_message);

  for(i=0; i<nw_size; ++i){

    /* Define a new sampling in k-space, from logkmin_wiggle to
       logkmax_wiggle with nw_size steps */

    ln_k_nw[i] = logkmin_wiggle+i*(logkmax_wiggle-logkmin_wiggle)/(nw_size-1);

    /* Interpolate the linear spectrum to fill lnpk_lin */

    class_call(array_interpolate_spline(pfo->ln_k,
                                        pfo->k_size_extra,
                                        lnpk_l,
                                        ddlnpk_l,
                                        1,
                                        ln_k_nw[i],
                                        &last_index,
                                        &(lnpk_lin[i]),
                                        1,
                                        pfo->error_message),
               pfo->error_message,
               pfo->error_message);

    /* Interpolate the smooth analytic spectrum to populate
       lnpk_analytic_nowiggle. This spectrum is only used to reduce the
       dynamical range before smoothing. */

    class_call(array_interpolate_spline(pfo->ln_k,
                                        pfo->k_size_extra,
                                        pfo->ln_pk_l_an_extra,
                                        pfo->ddln_pk_l_an_extra,
                                        1,
                                        ln_k_nw[i],
                                        &last_index,
                                        &(lnpk_analytic_nowiggle[i]),
                                        1,
                                        pfo->error_message),
               pfo->error_message,
               pfo->error_message);

    /* Compute the ratio P_l / P_analytic_nowiggle */

    pk_ratio[i] = exp(lnpk_lin[i]-lnpk_analytic_nowiggle[i]);

  }

  /* Perform a Gaussian smoothing of this ratio, the result is stored in pk_nw */

  class_call(array_smooth_Gaussian(ln_k_nw,
                                   pk_ratio,
                                   pk_nw,
                                   nw_size,
                                   wiggle_sigma,
                                   pfo->error_message),
             pfo->error_message,
             pfo->error_message);

  /* Multiply the smoothed ratio by the previously used analytic
     approximation to get the actual nowiggle spectrum P_nowiggle, and
     compute the difference P_wiggle = P_l - P_nowiggle */

  for(i=0; i<nw_size; ++i){

    pk_nw[i] = pk_nw[i]*exp(lnpk_analytic_nowiggle[i]);
    pk_w[i] = exp(lnpk_lin[i])-pk_nw[i];
  }

  free(lnpk_lin);
  free(lnpk_analytic_nowiggle);
  free(pk_ratio);

  return _SUCCESS_;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x868, %rsp            # imm = 0x868
movq %r9, 0x30(%rsp)
movq %r8, (%rsp)
movl %ecx, %r14d
movq %rdx, 0x58(%rsp)
movq %rsi, 0x50(%rsp)
movq %rdi, %r15
movl $0x0, 0x14(%rsp)
movslq %ecx, %rbp
shlq $0x3, %rbp
movq %rbp, %rdi
callq 0x8460
movq %rax, 0x28(%rsp)
testq %rax, %rax
je 0xe742d
movq %rbp, %rdi
callq 0x8460
movq %rax, 0x20(%rsp)
testq %rax, %rax
je 0xe746b
movq %rbp, %rdi
callq 0x8460
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0xe74a9
movq %r14, 0x18(%rsp)
testl %r14d, %r14d
jle 0xe73b9
movq 0x18(%rsp), %rcx
leal -0x1(%rcx), %eax
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x48(%rsp)
leaq 0x192(%r15), %r10
movl %ecx, %eax
shlq $0x3, %rax
movq %rax, 0x38(%rsp)
xorl %r12d, %r12d
leaq 0x14(%rsp), %r13
xorl %eax, %eax
movq %r15, 0x40(%rsp)
movl %eax, 0x10(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x47c08(%rip), %xmm0    # 0x12eed0
divsd 0x48(%rsp), %xmm0
addsd 0x47c02(%rip), %xmm0    # 0x12eed8
movq (%rsp), %rax
movsd %xmm0, (%rax,%r12)
movq 0x80(%r15), %rdi
movl 0x104(%r15), %esi
movq 0x28(%rsp), %rax
leaq (%rax,%r12), %rbp
subq $0x8, %rsp
movq 0x58(%rsp), %rdx
movq 0x60(%rsp), %rcx
movl $0x1, %r8d
movq %r13, %r9
movq %r10, %r14
pushq %r10
pushq $0x1
pushq %rbp
callq 0x17ee6
addq $0x20, %rsp
cmpl $0x1, %eax
je 0xe7586
movq 0x80(%r15), %rdi
movl 0x104(%r15), %esi
movq 0x118(%r15), %rdx
movq 0x120(%r15), %rcx
movq (%rsp), %rax
movsd (%rax,%r12), %xmm0
movq 0x20(%rsp), %rax
leaq (%rax,%r12), %r15
subq $0x8, %rsp
movl $0x1, %r8d
movq %r13, %rbx
movq %r13, %r9
pushq %r14
pushq $0x1
pushq %r15
callq 0x17ee6
addq $0x20, %rsp
cmpl $0x1, %eax
je 0xe75be
movsd (%rbp), %xmm0
subsd (%r15), %xmm0
callq 0x8670
movq 0x8(%rsp), %rax
movsd %xmm0, (%rax,%r12)
movl 0x10(%rsp), %eax
incl %eax
addq $0x8, %r12
cmpq %r12, 0x38(%rsp)
movq %r14, %r10
movq 0x40(%rsp), %r15
movq %rbx, %r13
jne 0xe72b5
addq $0x192, %r15            # imm = 0x192
movsd 0xd1a8(%rip), %xmm0     # 0xf4570
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
movq 0x30(%rsp), %rbx
movq %rbx, %rdx
movq 0x18(%rsp), %r14
movl %r14d, %ecx
movq %r15, %r8
callq 0x1ba10
cmpl $0x1, %eax
jne 0xe7506
leaq 0x9ff7(%rip), %rsi      # 0xf13f0
leaq 0x49a77(%rip), %rdx     # 0x130e77
leaq 0x60(%rsp), %r14
movq %r14, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x9c1b(%rip), %rsi      # 0xf1034
leaq 0x498e3(%rip), %rdx     # 0x130d03
movq %r15, %rdi
movl $0x88d, %ecx            # imm = 0x88D
jmp 0xe74e5
leaq 0x9bd0(%rip), %rsi      # 0xf1004
leaq 0x498bf(%rip), %rdx     # 0x130cfa
leaq 0x60(%rsp), %r14
movq %r14, %rdi
movl %ebp, %ecx
xorl %eax, %eax
callq 0x30c2c
addq $0x192, %r15            # imm = 0x192
leaq 0x9bda(%rip), %rsi      # 0xf1034
leaq 0x498a2(%rip), %rdx     # 0x130d03
movq %r15, %rdi
movl $0x853, %ecx            # imm = 0x853
jmp 0xe74e5
leaq 0x9b92(%rip), %rsi      # 0xf1004
leaq 0x4989a(%rip), %rdx     # 0x130d13
leaq 0x60(%rsp), %r14
movq %r14, %rdi
movl %ebp, %ecx
xorl %eax, %eax
callq 0x30c2c
addq $0x192, %r15            # imm = 0x192
leaq 0x9b9c(%rip), %rsi      # 0xf1034
leaq 0x49864(%rip), %rdx     # 0x130d03
movq %r15, %rdi
movl $0x854, %ecx            # imm = 0x854
jmp 0xe74e5
leaq 0x9b54(%rip), %rsi      # 0xf1004
leaq 0x49873(%rip), %rdx     # 0x130d2a
leaq 0x60(%rsp), %r14
movq %r14, %rdi
movl %ebp, %ecx
xorl %eax, %eax
callq 0x30c2c
addq $0x192, %r15            # imm = 0x192
leaq 0x9b5e(%rip), %rsi      # 0xf1034
leaq 0x49826(%rip), %rdx     # 0x130d03
movq %r15, %rdi
movl $0x855, %ecx            # imm = 0x855
movq %r14, %r8
xorl %eax, %eax
callq 0x30c2c
movl $0x1, %eax
addq $0x868, %rsp            # imm = 0x868
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testl %r14d, %r14d
movq 0x28(%rsp), %r13
movq 0x20(%rsp), %rbp
jle 0xe7565
movq 0x8a0(%rsp), %r15
movl %r14d, %r14d
xorl %r12d, %r12d
movsd (%rbx,%r12,8), %xmm0
movsd %xmm0, (%rsp)
movsd (%rbp,%r12,8), %xmm0
callq 0x8670
mulsd (%rsp), %xmm0
movsd %xmm0, (%rbx,%r12,8)
movsd (%r13,%r12,8), %xmm0
callq 0x8670
subsd (%rbx,%r12,8), %xmm0
movsd %xmm0, (%r15,%r12,8)
incq %r12
cmpq %r12, %r14
jne 0xe7523
movq %r13, %rdi
callq 0x8410
movq %rbp, %rdi
callq 0x8410
movq 0x8(%rsp), %rdi
callq 0x8410
xorl %eax, %eax
jmp 0xe74f4
leaq 0x9e63(%rip), %rsi      # 0xf13f0
leaq 0x4979f(%rip), %rdx     # 0x130d33
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x9a87(%rip), %rsi      # 0xf1034
leaq 0x4974f(%rip), %rdx     # 0x130d03
movq %r14, %rdi
movl $0x86b, %ecx            # imm = 0x86B
jmp 0xe75f4
leaq 0x9e2b(%rip), %rsi      # 0xf13f0
leaq 0x497f3(%rip), %rdx     # 0x130dbf
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x9a4f(%rip), %rsi      # 0xf1034
leaq 0x49717(%rip), %rdx     # 0x130d03
movq %r14, %rdi
movl $0x87c, %ecx            # imm = 0x87C
movq %rbx, %r8
jmp 0xe74e8