// File: /workspace/github_c_makefile_star2_O3/PoulinV[P]AxiCLASS/build/../source/transfer.c
// Function: transfer_compute_for_each_l
int transfer_compute_for_each_l(
                                struct transfer_workspace * ptw,
                                struct precision * ppr,
                                struct perturbations * ppt,
                                struct transfer * ptr,
                                int index_q,
                                int index_md,
                                int index_ic,
                                int index_tt,
                                int index_l,
                                double l,
                                double q_max_bessel,
                                radial_function_type radial_type,
                                short use_full_limber
                                ){

  /** Summary: */

  /** - define local variables */

  /* current wavenumber value */
  double q,k;

  /* value of transfer function */
  double transfer_function;

  /* whether to use the Limber approximation */
  short use_limber;

  /** - return zero transfer function if l is above l_max */
  if (index_l >= ptr->l_size_tt[index_md][index_tt]) {
     transfer_function = 0.;
  }
  else {

    if (ptr->transfer_verbose > 3)
      printf("Compute transfer for l=%d type=%d\n",(int)l,index_tt);

    if (use_full_limber == _FALSE_) {

      q = ptr->q[index_q];
      k = ptr->k[index_md][index_q];

      class_call(transfer_use_limber(ppr,
                                     ppt,
                                     ptr,
                                     q_max_bessel,
                                     index_md,
                                     index_tt,
                                     q,
                                     l,
                                     &use_limber),
                 ptr->error_message,
                 ptr->error_message);
    }
    else {
      q = ptr->q_limber[index_q];
      k = ptr->k_limber[index_md][index_q];
      use_limber = _TRUE_;
    }

    if (use_limber == _TRUE_) {

      class_call(transfer_limber(ptr,
                                 ptw,
                                 index_md,
                                 index_q,
                                 l,
                                 q,
                                 radial_type,
                                 &transfer_function),
                 ptr->error_message,
                 ptr->error_message);

    }
    else {
      class_call(transfer_integrate(
                                    ppt,
                                    ptr,
                                    ptw,
                                    index_q,
                                    index_md,
                                    index_tt,
                                    l,
                                    index_l,
                                    k,
                                    radial_type,
                                    &transfer_function
                                    ),
                 ptr->error_message,
                 ptr->error_message);
    }
  }

  /** - store transfer function in transfer structure */
  if (use_full_limber == _FALSE_) {
    ptr->transfer[index_md][((index_ic * ptr->tt_size[index_md] + index_tt)
                             * ptr->l_size[index_md] + index_l)
                            * ptr->q_size + index_q]
      = transfer_function;
  }
  else {
    ptr->transfer_limber[index_md][((index_ic * ptr->tt_size[index_md] + index_tt)
                                   * ptr->l_size[index_md] + index_l)
                                  * ptr->q_size_limber + index_q]
      = transfer_function;
  }

  return _SUCCESS_;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x848, %rsp            # imm = 0x848
movapd %xmm0, %xmm2
movl %r8d, %ebp
movq %rcx, %rbx
movq %rsi, %r11
movslq 0x888(%rsp), %r15
movzwl 0x8a0(%rsp), %ecx
movl 0x890(%rsp), %esi
movl 0x880(%rsp), %r12d
movq 0x8f8(%rbx), %rax
movslq %r9d, %r14
movq (%rax,%r14,8), %rax
xorpd %xmm0, %xmm0
cmpl %esi, (%rax,%r15,4)
jle 0xacbd5
movq %rdx, %r10
movq %rdi, %rdx
cmpw $0x4, 0x968(%rbx)
jl 0xacaac
cvttsd2si %xmm2, %esi
leaq 0x731ca(%rip), %rdi     # 0x11fc32
movq %rdx, 0x10(%rsp)
movl %r15d, %edx
xorl %eax, %eax
movsd %xmm2, 0x18(%rsp)
movq %r10, %r13
movsd %xmm1, 0x28(%rsp)
movq %r11, 0x20(%rsp)
callq 0x8030
movq 0x20(%rsp), %r11
movsd 0x28(%rsp), %xmm1
movq %r13, %r10
movq 0x10(%rsp), %rdx
movzwl 0x8a0(%rsp), %ecx
movsd 0x18(%rsp), %xmm2
movl 0x898(%rsp), %r8d
movl %ebp, 0x10(%rsp)
movslq %ebp, %rbp
testw %cx, %cx
je 0xacad1
movq 0x948(%rbx), %rax
movsd (%rax,%rbp,8), %xmm1
jmp 0xacb53
movq 0x928(%rbx), %rax
movq 0x930(%rbx), %rcx
movsd (%rax,%rbp,8), %xmm3
movsd %xmm3, 0x28(%rsp)
movq (%rcx,%r14,8), %rax
movsd (%rax,%rbp,8), %xmm0
movsd %xmm0, 0x20(%rsp)
leaq 0xe(%rsp), %r9
movq %r11, %rdi
movq %r10, %rsi
movq %rdx, %r13
movq %rbx, %rdx
movapd %xmm1, %xmm0
movl %r14d, %ecx
movq %r10, 0x38(%rsp)
movl %r15d, %r8d
movaps %xmm3, %xmm1
movsd %xmm2, 0x18(%rsp)
movsd 0x18(%rsp), %xmm2
callq 0xad818
movsd 0x28(%rsp), %xmm1
movl 0x898(%rsp), %r8d
movq %r13, %rdx
movsd 0x18(%rsp), %xmm2
leaq 0xe(%rsp), %rax
cmpw $0x1, (%rax)
jne 0xacc70
leaq 0x30(%rsp), %r9
movq %rbx, %rdi
movq %rdx, %rsi
movapd %xmm2, %xmm0
callq 0xadb1b
testl %eax, %eax
je 0xacbbc
addq $0x96a, %rbx            # imm = 0x96A
leaq 0x41877(%rip), %rsi     # 0xee3f0
leaq 0x730f1(%rip), %rdx     # 0x11fc71
leaq 0x40(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x4149b(%rip), %rsi     # 0xee034
leaq 0x730b5(%rip), %rdx     # 0x11fc55
movq %rbx, %rdi
movl $0xce0, %ecx            # imm = 0xCE0
movq %r14, %r8
xorl %eax, %eax
callq 0x30af0
movl $0x1, %eax
jmp 0xacc5e
movsd 0x30(%rsp), %xmm0
movl 0x890(%rsp), %esi
movl 0x10(%rsp), %ebp
movzwl 0x8a0(%rsp), %ecx
testw %cx, %cx
je 0xacc1c
movq 0x960(%rbx), %rax
movq 0x8f0(%rbx), %rcx
movq 0x900(%rbx), %rdx
imull (%rcx,%r14,4), %r12d
addl %r15d, %r12d
imull (%rdx,%r14,4), %r12d
addl %esi, %r12d
movslq %r12d, %rcx
imulq 0x940(%rbx), %rcx
movslq %ebp, %rdx
shlq $0x3, %rcx
addq (%rax,%r14,8), %rcx
movsd %xmm0, (%rcx,%rdx,8)
jmp 0xacc5c
movslq %ebp, %rbp
movq 0x958(%rbx), %rax
movq 0x8f0(%rbx), %rcx
movq 0x900(%rbx), %rdx
imull (%rcx,%r14,4), %r12d
addl %r15d, %r12d
imull (%rdx,%r14,4), %r12d
addl %esi, %r12d
movslq %r12d, %rcx
imulq 0x920(%rbx), %rcx
shlq $0x3, %rcx
addq (%rax,%r14,8), %rcx
movsd %xmm0, (%rcx,%rbp,8)
xorl %eax, %eax
addq $0x848, %rsp            # imm = 0x848
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
subq $0x8, %rsp
leaq 0x38(%rsp), %rax
movq 0x40(%rsp), %rdi
movq %rbx, %rsi
movl 0x18(%rsp), %ecx
movapd %xmm2, %xmm0
movsd 0x28(%rsp), %xmm1
pushq %rax
pushq %r8
movl 0x8a8(%rsp), %r13d
pushq %r13
callq 0xae4ce
addq $0x20, %rsp
testl %eax, %eax
je 0xacceb
addq $0x96a, %rbx            # imm = 0x96A
leaq 0x41739(%rip), %rsi     # 0xee3f0
leaq 0x73007(%rip), %rdx     # 0x11fcc5
leaq 0x40(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x4135d(%rip), %rsi     # 0xee034
leaq 0x72f77(%rip), %rdx     # 0x11fc55
movq %rbx, %rdi
movl $0xcf2, %ecx            # imm = 0xCF2
jmp 0xacba8
movsd 0x30(%rsp), %xmm0
movq %r13, %rsi
jmp 0xacc1f