// File: /workspace/github_c_makefile_star2_O3/PoulinV[P]AxiCLASS/build/../external/HMcode/hmcode.c
// Function: hmcode_wnw_split
int hmcode_wnw_split(
                      struct precision *ppr,
                      struct background *pba,
                      struct primordial * ppm,
                      struct fourier *pfo
                      ) {

  int index_pk, index_k, index_tau;
  int last_index=0;
  double ln_k;

  double * lnpk_l;
  double * ddlnpk_l;

  double * ln_k_nw;
  double * pk_nw;
  double * pk_w;

  double * lnpk_nw;
  double * ddlnpk_nw;


  /** - single index for which we want to compute and store the dewiggled spectrum (refers to _cb or _m) */

  index_pk = *(pfo->pk_l_nw_index);

  /** - fill the nowiggle array with the original linear spectrum.
      Later, we will overwrite with the de-wiggled values */

  memcpy(pfo->ln_pk_l_nw_extra, pfo->ln_pk_l_extra[index_pk],
         pfo->ln_tau_size * pfo->k_size_extra * sizeof(double));

  /** - allocate temporary arrays */

  class_alloc(lnpk_l,pfo->k_size_extra*sizeof(double),pfo->error_message);
  class_alloc(ddlnpk_l,pfo->k_size_extra*sizeof(double),pfo->error_message);

  class_alloc(ln_k_nw, pfo->nk_wiggle*sizeof(double), pfo->error_message);
  class_alloc(pk_nw, pfo->nk_wiggle*sizeof(double), pfo->error_message);
  class_alloc(pk_w, pfo->nk_wiggle*sizeof(double), pfo->error_message);

  class_alloc(lnpk_nw, pfo->nk_wiggle*sizeof(double), pfo->error_message);
  class_alloc(ddlnpk_nw, pfo->nk_wiggle*sizeof(double), pfo->error_message);

  /** - loop over times at which we are storing the power spectra */

  for (index_tau=0; index_tau<pfo->ln_tau_size; index_tau++){

    /** - create a temporary copy of ln(P_l) at this time */
    memcpy(lnpk_l, &(pfo->ln_pk_l_extra[index_pk][index_tau*pfo->k_size_extra]),
           pfo->k_size_extra * sizeof(double));

    /** - spline it with respect to k, needed for interpolation inside hmcode_nowiggle() */

    class_call(array_spline_table_columns(pfo->ln_k,
                                          pfo->k_size_extra,
                                          lnpk_l,
                                          1,
                                          ddlnpk_l,
                                          _SPLINE_NATURAL_,
                                          pfo->error_message),
               pfo->error_message,
               pfo->error_message);

    /* - compute P_nowiggle and P_wiggle (here the later is not used,
         only the former). These spectra are sampled over an array
         ln_k_nw determined by the function hmcode_nowiggle() */

    class_call(hmcode_nowiggle(pfo,
                               lnpk_l,
                               ddlnpk_l,
                               pfo->nk_wiggle,
                               ln_k_nw,
                               pk_nw,
                               pk_w),
               pfo->error_message,
               pfo->error_message);

    /* - compute ln(P_nowiggle) */

    for (index_k=0; index_k<pfo->nk_wiggle; index_k++) {
      lnpk_nw[index_k] = log(pk_nw[index_k]);
    }

    /** - spline ln(P_nowiggle) with respect to ln(k) */

    class_call(array_spline_table_columns(ln_k_nw,
                                          pfo->nk_wiggle,
                                          lnpk_nw,
                                          1,
                                          ddlnpk_nw,
                                          _SPLINE_NATURAL_,
                                          pfo->error_message),
               pfo->error_message,
               pfo->error_message);

    /** - interpolate ln(P_nowiggle) at the ln(k) values
          used in the fourier structure */

    for (index_k=0; index_k<pfo->k_size_extra; index_k++) {

      ln_k = pfo->ln_k[index_k];

      if ((ln_k>ln_k_nw[0]) && (ln_k<ln_k_nw[pfo->nk_wiggle-1])) {

        class_call(array_interpolate_spline(ln_k_nw,
                                            pfo->nk_wiggle,
                                            lnpk_nw,
                                            ddlnpk_nw,
                                            1,
                                            ln_k,
                                            &last_index,
                                            &(pfo->ln_pk_l_nw_extra[index_tau * pfo->k_size_extra + index_k]),
                                            1,
                                            pfo->error_message),
                   pfo->error_message,
                   pfo->error_message);
      }
    }
  }

  /** - free temporary arrays */

  free(lnpk_l);
  free(ddlnpk_l);

  free(ln_k_nw);
  free(pk_nw);
  free(pk_w);

  free(lnpk_nw);
  free(ddlnpk_nw);

  return _SUCCESS_;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x868, %rsp            # imm = 0x868
movq %rcx, %rbx
movl $0x0, 0x34(%rsp)
movq 0x108(%rcx), %rax
movq 0x128(%rcx), %rcx
movslq (%rcx), %r12
movq 0x130(%rbx), %rdi
movq (%rax,%r12,8), %rsi
movslq 0x90(%rbx), %rax
movslq 0x104(%rbx), %rdx
imulq %rax, %rdx
shlq $0x3, %rdx
callq 0x82d0
movslq 0x104(%rbx), %r14
movq %r14, %r15
shlq $0x3, %r15
movq %r15, %rdi
callq 0x8460
testq %rax, %rax
je 0xe4411
movq %rax, %r13
movq %r15, %rdi
callq 0x8460
testq %rax, %rax
je 0xe4458
movq %rax, 0x48(%rsp)
movq %r13, 0x50(%rsp)
movslq 0x2c(%rbx), %rbp
movq %rbp, %r15
shlq $0x3, %r15
movq %r15, %rdi
callq 0x8460
testq %rax, %rax
je 0xe449f
movq %rax, %r13
movq %r15, %rdi
callq 0x8460
movq %rax, 0x40(%rsp)
testq %rax, %rax
je 0xe44e5
movq %r15, %rdi
callq 0x8460
movq %rax, 0x38(%rsp)
testq %rax, %rax
je 0xe452b
movq %r12, 0x58(%rsp)
movq %r15, %rdi
callq 0x8460
testq %rax, %rax
je 0xe4571
movq %rax, %r12
movq %r15, %rdi
callq 0x8460
movq %rax, 0x28(%rsp)
testq %rax, %rax
je 0xe45b4
cmpl $0x0, 0x90(%rbx)
jle 0xe43c8
leaq 0x192(%rbx), %rax
movq %rax, 0x20(%rsp)
xorl %ecx, %ecx
movq 0x108(%rbx), %rax
movslq %r14d, %r15
movq %rcx, %rbp
imull %ecx, %r14d
movslq %r14d, %rsi
shlq $0x3, %rsi
movq 0x58(%rsp), %rcx
addq (%rax,%rcx,8), %rsi
leaq (,%r15,8), %rdx
movq 0x50(%rsp), %r14
movq %r14, %rdi
callq 0x82d0
movq 0x80(%rbx), %rdi
movq 0x20(%rsp), %rax
movq %rax, (%rsp)
movl %r15d, %esi
movq %r14, %r15
movq %r14, %rdx
movl $0x1, %ecx
movq 0x48(%rsp), %r14
movq %r14, %r8
xorl %r9d, %r9d
callq 0x1577e
cmpl $0x1, %eax
je 0xe4656
movl 0x2c(%rbx), %ecx
movq 0x38(%rsp), %rax
movq %rax, (%rsp)
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %r13, %r8
movq 0x40(%rsp), %r15
movq %r15, %r9
callq 0xe3cbb
testl %eax, %eax
jne 0xe4693
movl 0x2c(%rbx), %esi
testl %esi, %esi
jle 0xe42e7
xorl %r14d, %r14d
movsd (%r15,%r14,8), %xmm0
callq 0x82c0
movsd %xmm0, (%r12,%r14,8)
incq %r14
movslq 0x2c(%rbx), %rsi
cmpq %rsi, %r14
jl 0xe42ca
movq 0x20(%rsp), %rax
movq %rax, (%rsp)
movq %r13, %rdi
movq %r12, %rdx
movl $0x1, %ecx
movq 0x28(%rsp), %r8
xorl %r9d, %r9d
callq 0x1577e
cmpl $0x1, %eax
je 0xe46d0
movl 0x104(%rbx), %r14d
testl %r14d, %r14d
jle 0xe43b7
xorl %r15d, %r15d
movq %rbp, %rcx
movq 0x80(%rbx), %rax
movsd (%rax,%r15,8), %xmm0
ucomisd (%r13), %xmm0
jbe 0xe43a6
movslq 0x2c(%rbx), %rsi
movsd -0x8(%r13,%rsi,8), %xmm1
ucomisd %xmm0, %xmm1
jbe 0xe43a6
imull %ecx, %r14d
addl %r15d, %r14d
movslq %r14d, %rax
shlq $0x3, %rax
addq 0x130(%rbx), %rax
movq 0x20(%rsp), %rcx
movq %rcx, 0x10(%rsp)
movq %rax, (%rsp)
movl $0x1, 0x8(%rsp)
movq %r13, %rdi
movq %r12, %rdx
movq 0x28(%rsp), %rcx
movl $0x1, %r8d
leaq 0x34(%rsp), %r9
callq 0x18071
cmpl $0x1, %eax
je 0xe4616
movl 0x104(%rbx), %r14d
movq %rbp, %rcx
incq %r15
movslq %r14d, %rax
cmpq %rax, %r15
jl 0xe4327
jmp 0xe43ba
movq %rbp, %rcx
incl %ecx
cmpl 0x90(%rbx), %ecx
jl 0xe4226
movq 0x50(%rsp), %rdi
callq 0x8410
movq 0x48(%rsp), %rdi
callq 0x8410
movq %r13, %rdi
callq 0x8410
movq 0x40(%rsp), %rdi
callq 0x8410
movq 0x38(%rsp), %rdi
callq 0x8410
movq %r12, %rdi
callq 0x8410
movq 0x28(%rsp), %rdi
callq 0x8410
xorl %eax, %eax
jmp 0xe4604
leal (,%r14,8), %ecx
leaq 0x9be4(%rip), %rsi      # 0xee004
leaq 0x38a80(%rip), %rdx     # 0x11cea7
leaq 0x60(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30af0
addq $0x192, %rbx            # imm = 0x192
leaq 0x9bf0(%rip), %rsi      # 0xee034
leaq 0x496ed(%rip), %rdx     # 0x12db38
movq %rbx, %rdi
movl $0x7c6, %ecx            # imm = 0x7C6
jmp 0xe45f5
leal (,%r14,8), %ecx
leaq 0x9b9d(%rip), %rsi      # 0xee004
leaq 0x38a37(%rip), %rdx     # 0x11cea5
leaq 0x60(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30af0
addq $0x192, %rbx            # imm = 0x192
leaq 0x9ba9(%rip), %rsi      # 0xee034
leaq 0x496a6(%rip), %rdx     # 0x12db38
movq %rbx, %rdi
movl $0x7c7, %ecx            # imm = 0x7C7
jmp 0xe45f5
leal (,%rbp,8), %ecx
leaq 0x9b57(%rip), %rsi      # 0xee004
leaq 0x49695(%rip), %rdx     # 0x12db49
leaq 0x60(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30af0
addq $0x192, %rbx            # imm = 0x192
leaq 0x9b63(%rip), %rsi      # 0xee034
leaq 0x49660(%rip), %rdx     # 0x12db38
movq %rbx, %rdi
movl $0x7c9, %ecx            # imm = 0x7C9
jmp 0xe45f5
leal (,%rbp,8), %ecx
leaq 0x9b11(%rip), %rsi      # 0xee004
leaq 0x49660(%rip), %rdx     # 0x12db5a
leaq 0x60(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30af0
addq $0x192, %rbx            # imm = 0x192
leaq 0x9b1d(%rip), %rsi      # 0xee034
leaq 0x4961a(%rip), %rdx     # 0x12db38
movq %rbx, %rdi
movl $0x7ca, %ecx            # imm = 0x7CA
jmp 0xe45f5
leal (,%rbp,8), %ecx
leaq 0x9acb(%rip), %rsi      # 0xee004
leaq 0x49611(%rip), %rdx     # 0x12db51
leaq 0x60(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30af0
addq $0x192, %rbx            # imm = 0x192
leaq 0x9ad7(%rip), %rsi      # 0xee034
leaq 0x495d4(%rip), %rdx     # 0x12db38
movq %rbx, %rdi
movl $0x7cb, %ecx            # imm = 0x7CB
jmp 0xe45f5
leal (,%rbp,8), %ecx
leaq 0x9a85(%rip), %rsi      # 0xee004
leaq 0x495d2(%rip), %rdx     # 0x12db58
leaq 0x60(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30af0
addq $0x192, %rbx            # imm = 0x192
leaq 0x9a91(%rip), %rsi      # 0xee034
leaq 0x4958e(%rip), %rdx     # 0x12db38
movq %rbx, %rdi
movl $0x7cd, %ecx            # imm = 0x7CD
jmp 0xe45f5
leal (,%rbp,8), %ecx
leaq 0x9a42(%rip), %rsi      # 0xee004
leaq 0x4958d(%rip), %rdx     # 0x12db56
leaq 0x60(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30af0
addq $0x192, %rbx            # imm = 0x192
leaq 0x9a4e(%rip), %rsi      # 0xee034
leaq 0x4954b(%rip), %rdx     # 0x12db38
movq %rbx, %rdi
movl $0x7ce, %ecx            # imm = 0x7CE
movq %r14, %r8
xorl %eax, %eax
callq 0x30af0
movl $0x1, %eax
addq $0x868, %rsp            # imm = 0x868
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x9dd3(%rip), %rsi      # 0xee3f0
leaq 0x49650(%rip), %rdx     # 0x12dc74
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
movq 0x20(%rsp), %r14
movq %r14, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x99f2(%rip), %rsi      # 0xee034
leaq 0x494ef(%rip), %rdx     # 0x12db38
movq %r14, %rdi
movl $0x818, %ecx            # imm = 0x818
jmp 0xe470b
leaq 0x9d93(%rip), %rsi      # 0xee3f0
leaq 0x494fc(%rip), %rdx     # 0x12db60
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
movq 0x20(%rsp), %r14
movq %r14, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x99b2(%rip), %rsi      # 0xee034
leaq 0x494af(%rip), %rdx     # 0x12db38
movq %r14, %rdi
movl $0x7e2, %ecx            # imm = 0x7E2
jmp 0xe470b
leaq 0x9d56(%rip), %rsi      # 0xee3f0
leaq 0x49524(%rip), %rdx     # 0x12dbc5
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
movq 0x20(%rsp), %r14
movq %r14, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x9975(%rip), %rsi      # 0xee034
leaq 0x49472(%rip), %rdx     # 0x12db38
movq %r14, %rdi
movl $0x7f0, %ecx            # imm = 0x7F0
jmp 0xe470b
leaq 0x9d19(%rip), %rsi      # 0xee3f0
leaq 0x49534(%rip), %rdx     # 0x12dc12
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
movq 0x20(%rsp), %r14
movq %r14, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x9938(%rip), %rsi      # 0xee034
leaq 0x49435(%rip), %rdx     # 0x12db38
movq %r14, %rdi
movl $0x802, %ecx            # imm = 0x802
movq %rbx, %r8
jmp 0xe45f8