// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x30c8, %rsp           # imm = 0x30C8
movq 0x30d0(%rsp), %rax
movq %rdi, 0x30b8(%rsp)
movq %rsi, 0x30b0(%rsp)
movq %rdx, 0x30a8(%rsp)
movl %ecx, 0x30a4(%rsp)
movq %r8, 0x3098(%rsp)
movq %r9, 0x3090(%rsp)
movsd 0x129da(%rip), %xmm0    # 0x1d2cc0
movsd %xmm0, 0x3088(%rsp)
movsd 0x16249(%rip), %xmm0    # 0x1d6540
movsd %xmm0, 0x3080(%rsp)
movsd 0x3080(%rsp), %xmm0
callq 0x82f0
movsd %xmm0, 0x3078(%rsp)
movsd 0x11f51(%rip), %xmm0    # 0x1d2270
movsd %xmm0, 0x3070(%rsp)
movsd 0x3070(%rsp), %xmm0
callq 0x82f0
movsd %xmm0, 0x3068(%rsp)
movl $0x0, 0x3060(%rsp)
movslq 0x30a4(%rsp), %rdi
shlq $0x3, %rdi
callq 0x8460
movq %rax, 0x3058(%rsp)
cmpq $0x0, 0x3058(%rsp)
jne 0x1c03e6
movslq 0x30a4(%rsp), %rax
shlq $0x3, %rax
movl %eax, 0x3044(%rsp)
leaq 0x2840(%rsp), %rdi
movl 0x3044(%rsp), %ecx
leaq 0x11c6d(%rip), %rsi     # 0x1d2004
leaq 0x51e75(%rip), %rdx     # 0x212213
movb $0x0, %al
callq 0x5b9c0
movq 0x30b8(%rsp), %rdi
addq $0x192, %rdi            # imm = 0x192
leaq 0x2840(%rsp), %r8
leaq 0x11c71(%rip), %rsi     # 0x1d2034
leaq 0x51e52(%rip), %rdx     # 0x21221c
movl $0x853, %ecx            # imm = 0x853
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x30c4(%rsp)
jmp 0x1c099e
movslq 0x30a4(%rsp), %rdi
shlq $0x3, %rdi
callq 0x8460
movq %rax, 0x3050(%rsp)
cmpq $0x0, 0x3050(%rsp)
jne 0x1c0482
movslq 0x30a4(%rsp), %rax
shlq $0x3, %rax
movl %eax, 0x283c(%rsp)
leaq 0x2030(%rsp), %rdi
movl 0x283c(%rsp), %ecx
leaq 0x11bd1(%rip), %rsi     # 0x1d2004
leaq 0x51df2(%rip), %rdx     # 0x21222c
movb $0x0, %al
callq 0x5b9c0
movq 0x30b8(%rsp), %rdi
addq $0x192, %rdi            # imm = 0x192
leaq 0x2030(%rsp), %r8
leaq 0x11bd5(%rip), %rsi     # 0x1d2034
leaq 0x51db6(%rip), %rdx     # 0x21221c
movl $0x854, %ecx            # imm = 0x854
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x30c4(%rsp)
jmp 0x1c099e
movslq 0x30a4(%rsp), %rdi
shlq $0x3, %rdi
callq 0x8460
movq %rax, 0x3048(%rsp)
cmpq $0x0, 0x3048(%rsp)
jne 0x1c051e
movslq 0x30a4(%rsp), %rax
shlq $0x3, %rax
movl %eax, 0x202c(%rsp)
leaq 0x1820(%rsp), %rdi
movl 0x202c(%rsp), %ecx
leaq 0x11b35(%rip), %rsi     # 0x1d2004
leaq 0x51d6d(%rip), %rdx     # 0x212243
movb $0x0, %al
callq 0x5b9c0
movq 0x30b8(%rsp), %rdi
addq $0x192, %rdi            # imm = 0x192
leaq 0x1820(%rsp), %r8
leaq 0x11b39(%rip), %rsi     # 0x1d2034
leaq 0x51d1a(%rip), %rdx     # 0x21221c
movl $0x855, %ecx            # imm = 0x855
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x30c4(%rsp)
jmp 0x1c099e
movl $0x0, 0x3064(%rsp)
movl 0x3064(%rsp), %eax
cmpl 0x30a4(%rsp), %eax
jge 0x1c07f4
movsd 0x3078(%rsp), %xmm0
cvtsi2sdl 0x3064(%rsp), %xmm1
movsd 0x3068(%rsp), %xmm2
subsd 0x3078(%rsp), %xmm2
mulsd %xmm2, %xmm1
movl 0x30a4(%rsp), %eax
subl $0x1, %eax
cvtsi2sd %eax, %xmm2
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movq 0x3098(%rsp), %rax
movslq 0x3064(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq 0x30b8(%rsp), %rax
movq 0x80(%rax), %rdi
movq 0x30b8(%rsp), %rax
movl 0x104(%rax), %esi
movq 0x30b0(%rsp), %rdx
movq 0x30a8(%rsp), %rcx
movq 0x3098(%rsp), %rax
movslq 0x3064(%rsp), %r8
movsd (%rax,%r8,8), %xmm0
movq 0x3058(%rsp), %r10
movslq 0x3064(%rsp), %rax
shlq $0x3, %rax
addq %rax, %r10
movq 0x30b8(%rsp), %rax
addq $0x192, %rax            # imm = 0x192
movl $0x1, %r8d
leaq 0x3060(%rsp), %r9
movq %r10, (%rsp)
movl $0x1, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x24220
cmpl $0x1, %eax
jne 0x1c068e
leaq 0x1020(%rsp), %rdi
movq 0x30b8(%rsp), %rcx
addq $0x192, %rcx            # imm = 0x192
leaq 0x11d99(%rip), %rsi     # 0x1d23d8
leaq 0x51c06(%rip), %rdx     # 0x21224c
movb $0x0, %al
callq 0x5b9c0
movq 0x30b8(%rsp), %rdi
addq $0x192, %rdi            # imm = 0x192
leaq 0x1020(%rsp), %r8
leaq 0x119c9(%rip), %rsi     # 0x1d2034
leaq 0x51baa(%rip), %rdx     # 0x21221c
movl $0x86b, %ecx            # imm = 0x86B
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x30c4(%rsp)
jmp 0x1c099e
movq 0x30b8(%rsp), %rax
movq 0x80(%rax), %rdi
movq 0x30b8(%rsp), %rax
movl 0x104(%rax), %esi
movq 0x30b8(%rsp), %rax
movq 0x118(%rax), %rdx
movq 0x30b8(%rsp), %rax
movq 0x120(%rax), %rcx
movq 0x3098(%rsp), %rax
movslq 0x3064(%rsp), %r8
movsd (%rax,%r8,8), %xmm0
movq 0x3050(%rsp), %r10
movslq 0x3064(%rsp), %rax
shlq $0x3, %rax
addq %rax, %r10
movq 0x30b8(%rsp), %rax
addq $0x192, %rax            # imm = 0x192
movl $0x1, %r8d
leaq 0x3060(%rsp), %r9
movq %r10, (%rsp)
movl $0x1, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x24220
cmpl $0x1, %eax
jne 0x1c079a
leaq 0x820(%rsp), %rdi
movq 0x30b8(%rsp), %rcx
addq $0x192, %rcx            # imm = 0x192
leaq 0x11c8d(%rip), %rsi     # 0x1d23d8
leaq 0x51b86(%rip), %rdx     # 0x2122d8
movb $0x0, %al
callq 0x5b9c0
movq 0x30b8(%rsp), %rdi
addq $0x192, %rdi            # imm = 0x192
leaq 0x820(%rsp), %r8
leaq 0x118bd(%rip), %rsi     # 0x1d2034
leaq 0x51a9e(%rip), %rdx     # 0x21221c
movl $0x87c, %ecx            # imm = 0x87C
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x30c4(%rsp)
jmp 0x1c099e
movq 0x3058(%rsp), %rax
movslq 0x3064(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x3050(%rsp), %rax
movslq 0x3064(%rsp), %rcx
subsd (%rax,%rcx,8), %xmm0
callq 0x8670
movq 0x3048(%rsp), %rax
movslq 0x3064(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x3064(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3064(%rsp)
jmp 0x1c0529
movq 0x3098(%rsp), %rdi
movq 0x3048(%rsp), %rsi
movq 0x3090(%rsp), %rdx
movl 0x30a4(%rsp), %ecx
movsd 0x3088(%rsp), %xmm0
movq 0x30b8(%rsp), %r8
addq $0x192, %r8             # imm = 0x192
callq 0x2b930
cmpl $0x1, %eax
jne 0x1c089c
leaq 0x20(%rsp), %rdi
movq 0x30b8(%rsp), %rcx
addq $0x192, %rcx            # imm = 0x192
leaq 0x11b88(%rip), %rsi     # 0x1d23d8
leaq 0x51b39(%rip), %rdx     # 0x212390
movb $0x0, %al
callq 0x5b9c0
movq 0x30b8(%rsp), %rdi
addq $0x192, %rdi            # imm = 0x192
leaq 0x20(%rsp), %r8
leaq 0x117bb(%rip), %rsi     # 0x1d2034
leaq 0x5199c(%rip), %rdx     # 0x21221c
movl $0x88d, %ecx            # imm = 0x88D
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x30c4(%rsp)
jmp 0x1c099e
movl $0x0, 0x3064(%rsp)
movl 0x3064(%rsp), %eax
cmpl 0x30a4(%rsp), %eax
jge 0x1c096c
movq 0x3090(%rsp), %rax
movslq 0x3064(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x18(%rsp)
movq 0x3050(%rsp), %rax
movslq 0x3064(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
callq 0x8670
movaps %xmm0, %xmm1
movsd 0x18(%rsp), %xmm0
mulsd %xmm1, %xmm0
movq 0x3090(%rsp), %rax
movslq 0x3064(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq 0x3058(%rsp), %rax
movslq 0x3064(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
callq 0x8670
movq 0x3090(%rsp), %rax
movslq 0x3064(%rsp), %rcx
subsd (%rax,%rcx,8), %xmm0
movq 0x30d0(%rsp), %rax
movslq 0x3064(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x3064(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3064(%rsp)
jmp 0x1c08a7
movq 0x3058(%rsp), %rdi
callq 0x8420
movq 0x3050(%rsp), %rdi
callq 0x8420
movq 0x3048(%rsp), %rdi
callq 0x8420
movl $0x0, 0x30c4(%rsp)
movl 0x30c4(%rsp), %eax
addq $0x30c8, %rsp           # imm = 0x30C8
retq
nopl (%rax)