// File: /workspace/github_c_makefile_star2_O1/PoulinV[P]AxiCLASS/build/../source/transfer.c
// Function: transfer_perturbation_copy_sources_and_nl_corrections
int transfer_perturbation_copy_sources_and_nl_corrections(
                                                          struct perturbations * ppt,
                                                          struct fourier * pfo,
                                                          struct transfer * ptr,
                                                          double *** sources
                                                          ) {
  int index_md;
  int index_ic;
  int index_tp;
  int index_k;
  int index_tau;

  for (index_md = 0; index_md < ptr->md_size; index_md++) {

    class_alloc(sources[index_md],
                ppt->ic_size[index_md]*ppt->tp_size[index_md]*sizeof(double*),
                ptr->error_message);

    for (index_ic = 0; index_ic < ppt->ic_size[index_md]; index_ic++) {

      for (index_tp = 0; index_tp < ppt->tp_size[index_md]; index_tp++) {

        if ((pfo->method != nl_none) && (_scalars_) &&
            (((ppt->has_source_delta_m == _TRUE_) && (index_tp == ppt->index_tp_delta_m)) ||
             ((ppt->has_source_delta_cb == _TRUE_) && (index_tp == ppt->index_tp_delta_cb)) ||
             ((ppt->has_source_theta_m == _TRUE_) && (index_tp == ppt->index_tp_theta_m)) ||
             ((ppt->has_source_theta_cb == _TRUE_) && (index_tp == ppt->index_tp_theta_cb)) ||
             ((ppt->has_source_phi == _TRUE_) && (index_tp == ppt->index_tp_phi)) ||
             ((ppt->has_source_phi_prime == _TRUE_) && (index_tp == ppt->index_tp_phi_prime)) ||
             ((ppt->has_source_phi_plus_psi == _TRUE_) && (index_tp == ppt->index_tp_phi_plus_psi)) ||
             ((ppt->has_source_psi == _TRUE_) && (index_tp == ppt->index_tp_psi)))) {

          class_alloc(sources[index_md][index_ic * ppt->tp_size[index_md] + index_tp],
                      ppt->k_size[index_md]*ppt->tau_size*sizeof(double),
                      ptr->error_message);

          for (index_tau=0; index_tau<ppt->tau_size; index_tau++) {
            for (index_k=0; index_k<ppt->k_size[index_md]; index_k++) {
              if (((ppt->has_source_delta_cb == _TRUE_) && (index_tp == ppt->index_tp_delta_cb)) ||
                  ((ppt->has_source_theta_cb == _TRUE_) && (index_tp == ppt->index_tp_theta_cb))){
                sources[index_md]
                  [index_ic * ppt->tp_size[index_md] + index_tp]
                  [index_tau * ppt->k_size[index_md] + index_k] =
                  ppt->sources[index_md]
                  [index_ic * ppt->tp_size[index_md] + index_tp]
                  [index_tau * ppt->k_size[index_md] + index_k]
                  * pfo->nl_corr_density[pfo->index_pk_cb][index_tau * ppt->k_size[index_md] + index_k];
              }
              else{
                sources[index_md]
                  [index_ic * ppt->tp_size[index_md] + index_tp]
                  [index_tau * ppt->k_size[index_md] + index_k] =
                  ppt->sources[index_md]
                  [index_ic * ppt->tp_size[index_md] + index_tp]
                  [index_tau * ppt->k_size[index_md] + index_k]
                  * pfo->nl_corr_density[pfo->index_pk_m][index_tau * ppt->k_size[index_md] + index_k];
              }
            }
          }
        }
        else {
          sources[index_md][index_ic * ppt->tp_size[index_md] + index_tp] =
            ppt->sources[index_md][index_ic * ppt->tp_size[index_md] + index_tp];
        }
      }
    }
  }

  return _SUCCESS_;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x878, %rsp            # imm = 0x878
movq %rcx, 0x8(%rsp)
movslq 0x8a4(%rdx), %rax
movq %rax, 0x48(%rsp)
testq %rax, %rax
jle 0xa826f
movq %rdi, %r14
movq %rdx, 0x28(%rsp)
leaq 0x54(%rsi), %rax
movq %rax, 0x68(%rsp)
movq %rsi, 0x30(%rsp)
leaq 0x58(%rsi), %rax
movq %rax, 0x60(%rsp)
xorl %ebp, %ebp
movq 0x870(%r14), %rax
movq 0x998(%r14), %rcx
movslq (%rax,%rbp,4), %rax
movslq (%rcx,%rbp,4), %rdi
imulq %rax, %rdi
shlq $0x3, %rdi
callq 0x8460
movq 0x8(%rsp), %rcx
movq %rax, (%rcx,%rbp,8)
movq 0x870(%r14), %rcx
movl (%rcx,%rbp,4), %ecx
testq %rax, %rax
je 0xa82e0
testl %ecx, %ecx
jle 0xa8261
movl $0x0, 0x4(%rsp)
movq 0x998(%r14), %rax
movl (%rax,%rbp,4), %r13d
testl %r13d, %r13d
jle 0xa8247
movq 0x30(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x24(%rsp)
xorl %r12d, %r12d
cmpl $0x0, 0x24(%rsp)
je 0xa8208
cmpw $0x1, 0xe(%r14)
jne 0xa8208
movl 0x848(%r14), %eax
cmpq %rax, %rbp
jne 0xa8208
cmpw $0x1, 0x87c(%r14)
jne 0xa7fd5
cmpl 0x8d8(%r14), %r12d
je 0xa806d
cmpw $0x1, 0x87e(%r14)
jne 0xa7fed
cmpl 0x8dc(%r14), %r12d
je 0xa806d
cmpw $0x1, 0x898(%r14)
jne 0xa8001
cmpl 0x934(%r14), %r12d
je 0xa806d
cmpw $0x1, 0x89a(%r14)
jne 0xa8015
cmpl 0x938(%r14), %r12d
je 0xa806d
cmpw $0x1, 0x8b4(%r14)
jne 0xa8029
cmpl 0x970(%r14), %r12d
je 0xa806d
cmpw $0x1, 0x8b6(%r14)
jne 0xa803d
cmpl 0x974(%r14), %r12d
je 0xa806d
cmpw $0x1, 0x8b8(%r14)
jne 0xa8051
cmpl 0x978(%r14), %r12d
je 0xa806d
cmpw $0x1, 0x8ba(%r14)
jne 0xa8208
cmpl 0x97c(%r14), %r12d
jne 0xa8208
movq 0x9c8(%r14), %rax
movslq (%rax,%rbp,4), %rdi
movslq 0x9f8(%r14), %rbx
imulq %rbx, %rdi
shlq $0x3, %rdi
callq 0x8460
movq 0x8(%rsp), %rsi
movq (%rsi,%rbp,8), %rcx
movl 0x4(%rsp), %edi
imull %edi, %r13d
addl %r12d, %r13d
movslq %r13d, %rdx
movq %rax, (%rcx,%rdx,8)
movq (%rsi,%rbp,8), %rcx
movq 0x998(%r14), %rax
movl (%rax,%rbp,4), %eax
imull %edi, %eax
addl %r12d, %eax
cltq
movq (%rcx,%rax,8), %rcx
testq %rcx, %rcx
je 0xa8273
testl %ebx, %ebx
jle 0xa8230
movq 0x9c8(%r14), %rdx
movl (%rdx,%rbp,4), %edx
leaq (,%rdx,8), %rsi
movq %rsi, 0x50(%rsp)
movq $0x0, 0x18(%rsp)
movq $0x0, 0x38(%rsp)
movq $0x0, 0x10(%rsp)
movq %rbx, 0x58(%rsp)
movq %rdx, 0x40(%rsp)
testl %edx, %edx
jle 0xa81d2
movzwl 0x87e(%r14), %r10d
movq 0x10(%rsp), %r11
movq 0x40(%rsp), %rsi
imulq %rsi, %r11
movq 0x30(%rsp), %rdx
movq 0x150(%rdx), %r13
movq %rsi, %rdx
movq 0x18(%rsp), %rdi
movq 0x38(%rsp), %r15
xorl %ebx, %ebx
cmpw $0x1, %r10w
jne 0xa8157
cmpl 0x8dc(%r14), %r12d
je 0xa816b
cmpw $0x1, 0x89a(%r14)
jne 0xa818d
cmpl 0x938(%r14), %r12d
jne 0xa818d
movq 0xa38(%r14), %rsi
movq (%rsi,%rbp,8), %r9
leaq (%r11,%rbx), %r8
leaq (,%r8,8), %rsi
addq (%r9,%rax,8), %rsi
movq 0x60(%rsp), %r9
jmp 0xa81a7
movq 0xa38(%r14), %rsi
movq (%rsi,%rbp,8), %rsi
movq (%rsi,%rax,8), %rsi
addq %rdi, %rsi
movq 0x68(%rsp), %r9
movq %r15, %r8
movsd (%rsi), %xmm0
movslq (%r9), %rsi
movq (%r13,%rsi,8), %rsi
mulsd (%rsi,%r8,8), %xmm0
movsd %xmm0, (%rcx,%r8,8)
incq %rbx
incq %r15
addq $0x8, %rdi
decq %rdx
jne 0xa8147
movq 0x10(%rsp), %rdi
incq %rdi
movq 0x40(%rsp), %rdx
addq %rdx, 0x38(%rsp)
movq 0x18(%rsp), %rsi
addq 0x50(%rsp), %rsi
movq %rsi, 0x18(%rsp)
movq 0x58(%rsp), %rbx
movq %rdi, 0x10(%rsp)
cmpq %rbx, %rdi
jne 0xa810e
jmp 0xa8230
movq 0xa38(%r14), %rax
movq (%rax,%rbp,8), %rax
imull 0x4(%rsp), %r13d
addl %r12d, %r13d
movslq %r13d, %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rsp), %rdx
movq (%rdx,%rbp,8), %rdx
movq %rax, (%rdx,%rcx,8)
incl %r12d
movq 0x998(%r14), %rax
movl (%rax,%rbp,4), %r13d
cmpl %r13d, %r12d
jl 0xa7f96
movl 0x4(%rsp), %ecx
incl %ecx
movq 0x870(%r14), %rax
movl %ecx, 0x4(%rsp)
cmpl (%rax,%rbp,4), %ecx
jl 0xa7f74
incq %rbp
cmpq 0x48(%rsp), %rbp
jne 0xa7f25
xorl %eax, %eax
jmp 0xa82ce
movq 0x9c8(%r14), %rax
imull (%rax,%rbp,4), %ebx
shll $0x3, %ebx
leaq 0x48d7c(%rip), %rsi     # 0xf1004
leaq 0x79917(%rip), %rdx     # 0x121ba6
leaq 0x70(%rsp), %r14
movq %r14, %rdi
movl %ebx, %ecx
xorl %eax, %eax
callq 0x30c2c
movq 0x28(%rsp), %rdi
addq $0x96a, %rdi            # imm = 0x96A
leaq 0x48d81(%rip), %rsi     # 0xf1034
leaq 0x798b6(%rip), %rdx     # 0x121b70
movl $0x2b0, %ecx            # imm = 0x2B0
movq %r14, %r8
xorl %eax, %eax
callq 0x30c2c
movl $0x1, %eax
addq $0x878, %rsp            # imm = 0x878
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x998(%r14), %rax
imull (%rax,%rbp,4), %ecx
shll $0x3, %ecx
leaq 0x48d0f(%rip), %rsi     # 0xf1004
leaq 0x6f213(%rip), %rdx     # 0x11750f
leaq 0x70(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30c2c
movq 0x28(%rsp), %rdi
addq $0x96a, %rdi            # imm = 0x96A
leaq 0x48d16(%rip), %rsi     # 0xf1034
leaq 0x7984b(%rip), %rdx     # 0x121b70
movl $0x29e, %ecx            # imm = 0x29E
jmp 0xa82bf