// File: /workspace/github_c_makefile_star2_O1/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 0xe78f4
movq %rax, %rbp
movq %r15, %rdi
callq 0x8460
testq %rax, %rax
je 0xe793b
movq %rax, 0x48(%rsp)
movslq 0x2c(%rbx), %r14
movq %r14, %r15
shlq $0x3, %r15
movq %r15, %rdi
callq 0x8460
testq %rax, %rax
je 0xe7982
movq %rax, %r13
movq %rbp, 0x40(%rsp)
movq %r15, %rdi
callq 0x8460
testq %rax, %rax
je 0xe79c9
movq %rax, %rbp
movq %r15, %rdi
callq 0x8460
movq %rax, 0x38(%rsp)
testq %rax, %rax
je 0xe7a10
movq %r12, 0x58(%rsp)
movq %r15, %rdi
callq 0x8460
testq %rax, %rax
je 0xe7a57
movq %rax, %r12
movq %r15, %rdi
callq 0x8460
movq %rax, 0x28(%rsp)
testq %rax, %rax
je 0xe7a9b
cmpl $0x0, 0x90(%rbx)
jle 0xe78ad
leaq 0x192(%rbx), %r15
xorl %edx, %edx
movq %r15, 0x20(%rsp)
movq 0x108(%rbx), %rax
movslq 0x104(%rbx), %r15
movl %r15d, %ecx
movq %rdx, 0x50(%rsp)
imull %edx, %ecx
movslq %ecx, %rsi
shlq $0x3, %rsi
movq 0x58(%rsp), %rcx
addq (%rax,%rcx,8), %rsi
movq %r15, %rdx
shlq $0x3, %rdx
movq 0x40(%rsp), %r14
movq %r14, %rdi
callq 0x82d0
movq 0x80(%rbx), %rdi
movq 0x20(%rsp), %rax
movq %rax, (%rsp)
movl %r15d, %esi
movq %r14, %rdx
movl $0x1, %ecx
movq 0x48(%rsp), %r15
movq %r15, %r8
xorl %r9d, %r9d
callq 0x15654
cmpl $0x1, %eax
je 0xe7b39
movl 0x2c(%rbx), %ecx
movq 0x38(%rsp), %rax
movq %rax, (%rsp)
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r13, %r8
movq %rbp, %r9
callq 0xe71f9
testl %eax, %eax
jne 0xe7b76
movl 0x2c(%rbx), %esi
testl %esi, %esi
movq 0x20(%rsp), %r15
jle 0xe77e5
xorl %r14d, %r14d
movsd (%rbp,%r14,8), %xmm0
callq 0x82c0
movsd %xmm0, (%r12,%r14,8)
incq %r14
movslq 0x2c(%rbx), %rsi
cmpq %rsi, %r14
jl 0xe77c7
movq %r15, (%rsp)
movq %r13, %rdi
movq %r12, %rdx
movl $0x1, %ecx
movq 0x28(%rsp), %r8
xorl %r9d, %r9d
callq 0x15654
cmpl $0x1, %eax
je 0xe7bb3
movl 0x104(%rbx), %eax
testl %eax, %eax
jle 0xe789a
xorl %r14d, %r14d
movq 0x80(%rbx), %rcx
movsd (%rcx,%r14,8), %xmm0
ucomisd (%r13), %xmm0
jbe 0xe788b
movslq 0x2c(%rbx), %rsi
movsd -0x8(%r13,%rsi,8), %xmm1
ucomisd %xmm0, %xmm1
jbe 0xe788b
imull 0x50(%rsp), %eax
addl %r14d, %eax
cltq
shlq $0x3, %rax
addq 0x130(%rbx), %rax
movq %r15, 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 0x17ee6
cmpl $0x1, %eax
je 0xe7afe
incq %r14
movslq 0x104(%rbx), %rax
cmpq %rax, %r14
jl 0xe781b
movq 0x50(%rsp), %rdx
incl %edx
cmpl 0x90(%rbx), %edx
jl 0xe771f
movq 0x40(%rsp), %rdi
callq 0x8410
movq 0x48(%rsp), %rdi
callq 0x8410
movq %r13, %rdi
callq 0x8410
movq %rbp, %rdi
callq 0x8410
movq 0x38(%rsp), %rdi
callq 0x8410
movq %r12, %rdi
callq 0x8410
movq 0x28(%rsp), %rdi
callq 0x8410
xorl %eax, %eax
jmp 0xe7aec
leal (,%r14,8), %ecx
leaq 0x9701(%rip), %rsi      # 0xf1004
leaq 0x3855d(%rip), %rdx     # 0x11fe67
leaq 0x60(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30c2c
addq $0x192, %rbx            # imm = 0x192
leaq 0x970d(%rip), %rsi      # 0xf1034
leaq 0x491da(%rip), %rdx     # 0x130b08
movq %rbx, %rdi
movl $0x7c6, %ecx            # imm = 0x7C6
jmp 0xe7add
leal (,%r14,8), %ecx
leaq 0x96ba(%rip), %rsi      # 0xf1004
leaq 0x38514(%rip), %rdx     # 0x11fe65
leaq 0x60(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30c2c
addq $0x192, %rbx            # imm = 0x192
leaq 0x96c6(%rip), %rsi      # 0xf1034
leaq 0x49193(%rip), %rdx     # 0x130b08
movq %rbx, %rdi
movl $0x7c7, %ecx            # imm = 0x7C7
jmp 0xe7add
leal (,%r14,8), %ecx
leaq 0x9673(%rip), %rsi      # 0xf1004
leaq 0x49181(%rip), %rdx     # 0x130b19
leaq 0x60(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30c2c
addq $0x192, %rbx            # imm = 0x192
leaq 0x967f(%rip), %rsi      # 0xf1034
leaq 0x4914c(%rip), %rdx     # 0x130b08
movq %rbx, %rdi
movl $0x7c9, %ecx            # imm = 0x7C9
jmp 0xe7add
leal (,%r14,8), %ecx
leaq 0x962c(%rip), %rsi      # 0xf1004
leaq 0x4914b(%rip), %rdx     # 0x130b2a
leaq 0x60(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30c2c
addq $0x192, %rbx            # imm = 0x192
leaq 0x9638(%rip), %rsi      # 0xf1034
leaq 0x49105(%rip), %rdx     # 0x130b08
movq %rbx, %rdi
movl $0x7ca, %ecx            # imm = 0x7CA
jmp 0xe7add
leal (,%r14,8), %ecx
leaq 0x95e5(%rip), %rsi      # 0xf1004
leaq 0x490fb(%rip), %rdx     # 0x130b21
leaq 0x60(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30c2c
addq $0x192, %rbx            # imm = 0x192
leaq 0x95f1(%rip), %rsi      # 0xf1034
leaq 0x490be(%rip), %rdx     # 0x130b08
movq %rbx, %rdi
movl $0x7cb, %ecx            # imm = 0x7CB
jmp 0xe7add
leal (,%r14,8), %ecx
leaq 0x959e(%rip), %rsi      # 0xf1004
leaq 0x490bb(%rip), %rdx     # 0x130b28
leaq 0x60(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30c2c
addq $0x192, %rbx            # imm = 0x192
leaq 0x95aa(%rip), %rsi      # 0xf1034
leaq 0x49077(%rip), %rdx     # 0x130b08
movq %rbx, %rdi
movl $0x7cd, %ecx            # imm = 0x7CD
jmp 0xe7add
leal (,%r14,8), %ecx
leaq 0x955a(%rip), %rsi      # 0xf1004
leaq 0x49075(%rip), %rdx     # 0x130b26
leaq 0x60(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30c2c
addq $0x192, %rbx            # imm = 0x192
leaq 0x9566(%rip), %rsi      # 0xf1034
leaq 0x49033(%rip), %rdx     # 0x130b08
movq %rbx, %rdi
movl $0x7ce, %ecx            # imm = 0x7CE
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
leaq 0x98eb(%rip), %rsi      # 0xf13f0
leaq 0x49138(%rip), %rdx     # 0x130c44
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x950f(%rip), %rsi      # 0xf1034
leaq 0x48fdc(%rip), %rdx     # 0x130b08
movq %r15, %rdi
movl $0x818, %ecx            # imm = 0x818
jmp 0xe7be9
leaq 0x98b0(%rip), %rsi      # 0xf13f0
leaq 0x48fe9(%rip), %rdx     # 0x130b30
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
movq 0x20(%rsp), %r14
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x94cf(%rip), %rsi      # 0xf1034
leaq 0x48f9c(%rip), %rdx     # 0x130b08
movq %r14, %rdi
movl $0x7e2, %ecx            # imm = 0x7E2
jmp 0xe7be9
leaq 0x9873(%rip), %rsi      # 0xf13f0
leaq 0x49011(%rip), %rdx     # 0x130b95
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
movq 0x20(%rsp), %r14
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x9492(%rip), %rsi      # 0xf1034
leaq 0x48f5f(%rip), %rdx     # 0x130b08
movq %r14, %rdi
movl $0x7f0, %ecx            # imm = 0x7F0
jmp 0xe7be9
leaq 0x9836(%rip), %rsi      # 0xf13f0
leaq 0x49021(%rip), %rdx     # 0x130be2
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x945a(%rip), %rsi      # 0xf1034
leaq 0x48f27(%rip), %rdx     # 0x130b08
movq %r15, %rdi
movl $0x802, %ecx            # imm = 0x802
movq %rbx, %r8
jmp 0xe7ae0