// File: /workspace/github_c_makefile_star2_O2/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
andl $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 0x82f0
movslq 0x104(%rbx), %r14
movq %r14, %r15
shlq $0x3, %r15
movq %r15, %rdi
callq 0x8490
testq %rax, %rax
je 0xdbfd6
movq %rax, %r13
movq %r15, %rdi
callq 0x8490
testq %rax, %rax
je 0xdc01d
movq %rax, %r15
movq %r12, 0x58(%rsp)
movq %r13, 0x48(%rsp)
movslq 0x2c(%rbx), %r12
movq %r12, %rbp
shlq $0x3, %rbp
movq %rbp, %rdi
callq 0x8490
testq %rax, %rax
je 0xdc064
movq %rax, %r13
movq %r12, 0x20(%rsp)
movq %r15, 0x40(%rsp)
movq %rbp, %rdi
callq 0x8490
testq %rax, %rax
je 0xdc0ab
movq %rax, %r15
movq %rbp, %rdi
callq 0x8490
movq %rax, 0x38(%rsp)
testq %rax, %rax
je 0xdc0f6
movq %rbp, %rdi
callq 0x8490
testq %rax, %rax
je 0xdc141
movq %rax, %r12
movq %rbp, %rdi
callq 0x8490
movq %rax, 0x28(%rsp)
testq %rax, %rax
je 0xdc189
leaq 0x192(%rbx), %rax
movq %rax, 0x20(%rsp)
xorl %ecx, %ecx
cmpl 0x90(%rbx), %ecx
jge 0xdc230
movq 0x108(%rbx), %rax
movslq %r14d, %rbp
movq %rcx, 0x50(%rsp)
imull %ecx, %r14d
movslq %r14d, %rsi
shlq $0x3, %rsi
movq 0x58(%rsp), %rcx
addq (%rax,%rcx,8), %rsi
leaq (,%rbp,8), %rdx
movq 0x48(%rsp), %r14
movq %r14, %rdi
callq 0x82f0
movq 0x80(%rbx), %rdi
movq 0x20(%rsp), %rax
movq %rax, (%rsp)
movl %ebp, %esi
movq %r14, %rdx
pushq $0x1
popq %rcx
movq 0x40(%rsp), %rbp
movq %rbp, %r8
xorl %r9d, %r9d
callq 0x139d8
cmpl $0x1, %eax
je 0xdc277
movl 0x2c(%rbx), %ecx
movq 0x38(%rsp), %rax
movq %rax, (%rsp)
movq %rbx, %rdi
movq %r14, %rsi
movq %rbp, %rdx
movq %r13, %r8
movq %r15, %r9
callq 0xdb933
testl %eax, %eax
jne 0xdc2b7
xorl %r14d, %r14d
pushq $0x1
popq %rbp
movslq 0x2c(%rbx), %rsi
cmpq %rsi, %r14
jge 0xdbf18
movsd (%r15,%r14,8), %xmm0
callq 0x82e0
movsd %xmm0, (%r12,%r14,8)
incq %r14
jmp 0xdbef9
movq 0x20(%rsp), %rax
movq %rax, (%rsp)
movq %r13, %rdi
movq %r12, %rdx
movl %ebp, %ecx
movq 0x28(%rsp), %r8
xorl %r9d, %r9d
callq 0x139d8
cmpl $0x1, %eax
je 0xdc2f7
xorl %ebp, %ebp
movslq 0x104(%rbx), %r14
cmpq %r14, %rbp
jge 0xdbfca
movq 0x80(%rbx), %rax
movsd (%rax,%rbp,8), %xmm0
ucomisd (%r13), %xmm0
jbe 0xdbfc2
movslq 0x2c(%rbx), %rsi
movsd -0x8(%r13,%rsi,8), %xmm1
ucomisd %xmm0, %xmm1
jbe 0xdbfc2
movq 0x50(%rsp), %rax
imull %r14d, %eax
addl %ebp, %eax
cltq
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
pushq $0x1
popq %r8
leaq 0x34(%rsp), %r9
callq 0x1604b
cmpl $0x1, %eax
je 0xdc1f0
incq %rbp
jmp 0xdbf41
movq 0x50(%rsp), %rcx
incl %ecx
jmp 0xdbe56
leal (,%r14,8), %ecx
leaq 0x901f(%rip), %rsi      # 0xe5004
leaq 0x37d5b(%rip), %rdx     # 0x113d47
leaq 0x60(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
addq $0x192, %rbx            # imm = 0x192
leaq 0x902b(%rip), %rsi      # 0xe5034
leaq 0x48998(%rip), %rdx     # 0x1249a8
movq %rbx, %rdi
movl $0x7c6, %ecx            # imm = 0x7C6
jmp 0xdc1cf
leal (,%r14,8), %ecx
leaq 0x8fd8(%rip), %rsi      # 0xe5004
leaq 0x37d12(%rip), %rdx     # 0x113d45
leaq 0x60(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
addq $0x192, %rbx            # imm = 0x192
leaq 0x8fe4(%rip), %rsi      # 0xe5034
leaq 0x48951(%rip), %rdx     # 0x1249a8
movq %rbx, %rdi
movl $0x7c7, %ecx            # imm = 0x7C7
jmp 0xdc1cf
leal (,%r12,8), %ecx
leaq 0x8f91(%rip), %rsi      # 0xe5004
leaq 0x4893f(%rip), %rdx     # 0x1249b9
leaq 0x60(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
addq $0x192, %rbx            # imm = 0x192
leaq 0x8f9d(%rip), %rsi      # 0xe5034
leaq 0x4890a(%rip), %rdx     # 0x1249a8
movq %rbx, %rdi
movl $0x7c9, %ecx            # imm = 0x7C9
jmp 0xdc1cf
movq 0x20(%rsp), %rax
leal (,%rax,8), %ecx
leaq 0x8f46(%rip), %rsi      # 0xe5004
leaq 0x48905(%rip), %rdx     # 0x1249ca
leaq 0x60(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
addq $0x192, %rbx            # imm = 0x192
leaq 0x8f52(%rip), %rsi      # 0xe5034
leaq 0x488bf(%rip), %rdx     # 0x1249a8
movq %rbx, %rdi
movl $0x7ca, %ecx            # imm = 0x7CA
jmp 0xdc1cf
movq 0x20(%rsp), %rax
leal (,%rax,8), %ecx
leaq 0x8efb(%rip), %rsi      # 0xe5004
leaq 0x488b1(%rip), %rdx     # 0x1249c1
leaq 0x60(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
addq $0x192, %rbx            # imm = 0x192
leaq 0x8f07(%rip), %rsi      # 0xe5034
leaq 0x48874(%rip), %rdx     # 0x1249a8
movq %rbx, %rdi
movl $0x7cb, %ecx            # imm = 0x7CB
jmp 0xdc1cf
movq 0x20(%rsp), %rax
leal (,%rax,8), %ecx
leaq 0x8eb0(%rip), %rsi      # 0xe5004
leaq 0x4886d(%rip), %rdx     # 0x1249c8
leaq 0x60(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
addq $0x192, %rbx            # imm = 0x192
leaq 0x8ebc(%rip), %rsi      # 0xe5034
leaq 0x48829(%rip), %rdx     # 0x1249a8
movq %rbx, %rdi
movl $0x7cd, %ecx            # imm = 0x7CD
jmp 0xdc1cf
movq 0x20(%rsp), %rax
leal (,%rax,8), %ecx
leaq 0x8e68(%rip), %rsi      # 0xe5004
leaq 0x48823(%rip), %rdx     # 0x1249c6
leaq 0x60(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
addq $0x192, %rbx            # imm = 0x192
leaq 0x8e74(%rip), %rsi      # 0xe5034
leaq 0x487e1(%rip), %rdx     # 0x1249a8
movq %rbx, %rdi
movl $0x7ce, %ecx            # imm = 0x7CE
movq %r14, %r8
xorl %eax, %eax
callq 0x2e014
pushq $0x1
popq %rbp
movl %ebp, %eax
addq $0x868, %rsp            # imm = 0x868
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x91f9(%rip), %rsi      # 0xe53f0
leaq 0x488e6(%rip), %rdx     # 0x124ae4
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
movq 0x20(%rsp), %r14
movq %r14, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x8e18(%rip), %rsi      # 0xe5034
leaq 0x48785(%rip), %rdx     # 0x1249a8
movq %r14, %rdi
movl $0x818, %ecx            # imm = 0x818
movq %rbx, %r8
jmp 0xdc1d2
movq 0x48(%rsp), %rdi
callq 0x8430
movq 0x40(%rsp), %rdi
callq 0x8430
movq %r13, %rdi
callq 0x8430
movq %r15, %rdi
callq 0x8430
movq 0x38(%rsp), %rdi
callq 0x8430
movq %r12, %rdi
callq 0x8430
movq 0x28(%rsp), %rdi
callq 0x8430
xorl %ebp, %ebp
jmp 0xdc1dc
leaq 0x9172(%rip), %rsi      # 0xe53f0
leaq 0x4874b(%rip), %rdx     # 0x1249d0
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
movq 0x20(%rsp), %r14
movq %r14, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x8d91(%rip), %rsi      # 0xe5034
leaq 0x486fe(%rip), %rdx     # 0x1249a8
movq %r14, %rdi
movl $0x7e2, %ecx            # imm = 0x7E2
jmp 0xdc22b
leaq 0x9132(%rip), %rsi      # 0xe53f0
leaq 0x48770(%rip), %rdx     # 0x124a35
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
movq 0x20(%rsp), %r14
movq %r14, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x8d51(%rip), %rsi      # 0xe5034
leaq 0x486be(%rip), %rdx     # 0x1249a8
movq %r14, %rdi
movl $0x7f0, %ecx            # imm = 0x7F0
jmp 0xdc22b
leaq 0x90f2(%rip), %rsi      # 0xe53f0
leaq 0x4877d(%rip), %rdx     # 0x124a82
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
movq 0x20(%rsp), %r14
movq %r14, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x8d11(%rip), %rsi      # 0xe5034
leaq 0x4867e(%rip), %rdx     # 0x1249a8
movq %r14, %rdi
movl $0x802, %ecx            # imm = 0x802
movq %rbx, %r8
xorl %eax, %eax
callq 0x2e014
jmp 0xdc1dc