// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../source/transfer.c
// Function: transfer_use_limber
int transfer_use_limber(
                        struct precision * ppr,
                        struct perturbations * ppt,
                        struct transfer * ptr,
                        double q_max_bessel,
                        int index_md,
                        int index_tt,
                        double q,
                        double l,
                        short * use_limber) {


  /* criteria for choosing between integration and Limber
     must be implemented here */

  *use_limber = _FALSE_;

  if (q>q_max_bessel) {
    *use_limber = _TRUE_;
  }
  else {

    if (_scalars_) {

      //TBC: in principle the Limber condition should be adapted to account for curvature effects

      if ((ppt->has_cl_cmb_lensing_potential == _TRUE_) && (index_tt == ptr->index_tt_lcmb) && (l>ppr->l_switch_limber)) {
        *use_limber = _TRUE_;
      }
      if (_index_tt_in_range_(ptr->index_tt_density, ppt->selection_num, ppt->has_nc_density) && (l>=ppr->l_switch_limber_for_nc_local_over_z*ppt->selection_mean[index_tt-ptr->index_tt_density])) {
        if (ppt->selection != dirac) *use_limber = _TRUE_;
      }
      if (_index_tt_in_range_(ptr->index_tt_rsd,     ppt->selection_num, ppt->has_nc_rsd) && (l>=ppr->l_switch_limber_for_nc_local_over_z*ppt->selection_mean[index_tt-ptr->index_tt_rsd])) {
        if (ppt->selection != dirac) *use_limber = _TRUE_;
      }
      if (_index_tt_in_range_(ptr->index_tt_d0,      ppt->selection_num, ppt->has_nc_rsd) && (l>=ppr->l_switch_limber_for_nc_local_over_z*ppt->selection_mean[index_tt-ptr->index_tt_d0])) {
        if (ppt->selection != dirac) *use_limber = _TRUE_;
      }
      if (_index_tt_in_range_(ptr->index_tt_d1,      ppt->selection_num, ppt->has_nc_rsd) && (l>=ppr->l_switch_limber_for_nc_local_over_z*ppt->selection_mean[index_tt-ptr->index_tt_d1])) {
        if (ppt->selection != dirac) *use_limber = _TRUE_;
      }
      if (_index_tt_in_range_(ptr->index_tt_nc_lens, ppt->selection_num, ppt->has_nc_lens) && (l>=ppr->l_switch_limber_for_nc_los_over_z*ppt->selection_mean[index_tt-ptr->index_tt_nc_lens])) {
        if (ppt->selection != dirac) *use_limber = _TRUE_;
      }
      if (_index_tt_in_range_(ptr->index_tt_nc_g1, ppt->selection_num, ppt->has_nc_gr) && (l>=ppr->l_switch_limber_for_nc_local_over_z*ppt->selection_mean[index_tt-ptr->index_tt_nc_g1])) {
        if (ppt->selection != dirac) *use_limber = _TRUE_;
      }
      if (_index_tt_in_range_(ptr->index_tt_nc_g2, ppt->selection_num, ppt->has_nc_gr) && (l>=ppr->l_switch_limber_for_nc_local_over_z*ppt->selection_mean[index_tt-ptr->index_tt_nc_g2])) {
        if (ppt->selection != dirac) *use_limber = _TRUE_;
      }
      if (_index_tt_in_range_(ptr->index_tt_nc_g3, ppt->selection_num, ppt->has_nc_gr) && (l>=ppr->l_switch_limber_for_nc_local_over_z*ppt->selection_mean[index_tt-ptr->index_tt_nc_g3])) {
        if (ppt->selection != dirac) *use_limber = _TRUE_;
      }
      if (_index_tt_in_range_(ptr->index_tt_nc_g4, ppt->selection_num, ppt->has_nc_gr) && (l>=ppr->l_switch_limber_for_nc_los_over_z*ppt->selection_mean[index_tt-ptr->index_tt_nc_g4])) {
        if (ppt->selection != dirac) *use_limber = _TRUE_;
      }
      if (_index_tt_in_range_(ptr->index_tt_nc_g5, ppt->selection_num, ppt->has_nc_gr) && (l>=ppr->l_switch_limber_for_nc_local_over_z*ppt->selection_mean[index_tt-ptr->index_tt_nc_g5])) {
        if (ppt->selection != dirac) *use_limber = _TRUE_;
      }
      if (_index_tt_in_range_(ptr->index_tt_lensing, ppt->selection_num, ppt->has_cl_lensing_potential) && (l>=ppr->l_switch_limber_for_nc_los_over_z*ppt->selection_mean[index_tt-ptr->index_tt_lensing])) {
        *use_limber = _TRUE_;
      }
    }
  }

  return _SUCCESS_;
}

// Assembly:
movq %rdi, -0x8(%rsp)
movq %rsi, -0x10(%rsp)
movq %rdx, -0x18(%rsp)
movsd %xmm0, -0x20(%rsp)
movl %ecx, -0x24(%rsp)
movl %r8d, -0x28(%rsp)
movsd %xmm1, -0x30(%rsp)
movsd %xmm2, -0x38(%rsp)
movq %r9, -0x40(%rsp)
movq -0x40(%rsp), %rax
movw $0x0, (%rax)
movsd -0x30(%rsp), %xmm0
ucomisd -0x20(%rsp), %xmm0
jbe 0x142756
movq -0x40(%rsp), %rax
movw $0x1, (%rax)
jmp 0x142d7f
movq -0x10(%rsp), %rax
movswl 0xe(%rax), %eax
cmpl $0x1, %eax
jne 0x142d7d
movl -0x24(%rsp), %eax
movq -0x10(%rsp), %rcx
cmpl 0x848(%rcx), %eax
jne 0x142d7d
movq -0x10(%rsp), %rax
movswl 0x2c(%rax), %eax
cmpl $0x1, %eax
jne 0x1427bb
movl -0x28(%rsp), %eax
movq -0x18(%rsp), %rcx
cmpl 0x8bc(%rcx), %eax
jne 0x1427bb
movsd -0x38(%rsp), %xmm0
movq -0x8(%rsp), %rax
ucomisd 0x7f0(%rax), %xmm0
jbe 0x1427bb
movq -0x40(%rsp), %rax
movw $0x1, (%rax)
movq -0x10(%rsp), %rax
movswl 0x3e(%rax), %eax
cmpl $0x1, %eax
jne 0x142842
movl -0x28(%rsp), %eax
movq -0x18(%rsp), %rcx
cmpl 0x8c0(%rcx), %eax
jl 0x142842
movl -0x28(%rsp), %eax
movq -0x18(%rsp), %rcx
movl 0x8c0(%rcx), %ecx
movq -0x10(%rsp), %rdx
addl 0x64(%rdx), %ecx
cmpl %ecx, %eax
jge 0x142842
movsd -0x38(%rsp), %xmm0
movq -0x8(%rsp), %rax
movsd 0x7f8(%rax), %xmm1
movq -0x10(%rsp), %rax
movl -0x28(%rsp), %ecx
movq -0x18(%rsp), %rdx
subl 0x8c0(%rdx), %ecx
movslq %ecx, %rcx
mulsd 0x70(%rax,%rcx,8), %xmm1
ucomisd %xmm1, %xmm0
jb 0x142842
movq -0x10(%rsp), %rax
cmpl $0x2, 0x68(%rax)
je 0x142840
movq -0x40(%rsp), %rax
movw $0x1, (%rax)
jmp 0x142842
movq -0x10(%rsp), %rax
movswl 0x40(%rax), %eax
cmpl $0x1, %eax
jne 0x1428c9
movl -0x28(%rsp), %eax
movq -0x18(%rsp), %rcx
cmpl 0x8c8(%rcx), %eax
jl 0x1428c9
movl -0x28(%rsp), %eax
movq -0x18(%rsp), %rcx
movl 0x8c8(%rcx), %ecx
movq -0x10(%rsp), %rdx
addl 0x64(%rdx), %ecx
cmpl %ecx, %eax
jge 0x1428c9
movsd -0x38(%rsp), %xmm0
movq -0x8(%rsp), %rax
movsd 0x7f8(%rax), %xmm1
movq -0x10(%rsp), %rax
movl -0x28(%rsp), %ecx
movq -0x18(%rsp), %rdx
subl 0x8c8(%rdx), %ecx
movslq %ecx, %rcx
mulsd 0x70(%rax,%rcx,8), %xmm1
ucomisd %xmm1, %xmm0
jb 0x1428c9
movq -0x10(%rsp), %rax
cmpl $0x2, 0x68(%rax)
je 0x1428c7
movq -0x40(%rsp), %rax
movw $0x1, (%rax)
jmp 0x1428c9
movq -0x10(%rsp), %rax
movswl 0x40(%rax), %eax
cmpl $0x1, %eax
jne 0x142950
movl -0x28(%rsp), %eax
movq -0x18(%rsp), %rcx
cmpl 0x8cc(%rcx), %eax
jl 0x142950
movl -0x28(%rsp), %eax
movq -0x18(%rsp), %rcx
movl 0x8cc(%rcx), %ecx
movq -0x10(%rsp), %rdx
addl 0x64(%rdx), %ecx
cmpl %ecx, %eax
jge 0x142950
movsd -0x38(%rsp), %xmm0
movq -0x8(%rsp), %rax
movsd 0x7f8(%rax), %xmm1
movq -0x10(%rsp), %rax
movl -0x28(%rsp), %ecx
movq -0x18(%rsp), %rdx
subl 0x8cc(%rdx), %ecx
movslq %ecx, %rcx
mulsd 0x70(%rax,%rcx,8), %xmm1
ucomisd %xmm1, %xmm0
jb 0x142950
movq -0x10(%rsp), %rax
cmpl $0x2, 0x68(%rax)
je 0x14294e
movq -0x40(%rsp), %rax
movw $0x1, (%rax)
jmp 0x142950
movq -0x10(%rsp), %rax
movswl 0x40(%rax), %eax
cmpl $0x1, %eax
jne 0x1429d7
movl -0x28(%rsp), %eax
movq -0x18(%rsp), %rcx
cmpl 0x8d0(%rcx), %eax
jl 0x1429d7
movl -0x28(%rsp), %eax
movq -0x18(%rsp), %rcx
movl 0x8d0(%rcx), %ecx
movq -0x10(%rsp), %rdx
addl 0x64(%rdx), %ecx
cmpl %ecx, %eax
jge 0x1429d7
movsd -0x38(%rsp), %xmm0
movq -0x8(%rsp), %rax
movsd 0x7f8(%rax), %xmm1
movq -0x10(%rsp), %rax
movl -0x28(%rsp), %ecx
movq -0x18(%rsp), %rdx
subl 0x8d0(%rdx), %ecx
movslq %ecx, %rcx
mulsd 0x70(%rax,%rcx,8), %xmm1
ucomisd %xmm1, %xmm0
jb 0x1429d7
movq -0x10(%rsp), %rax
cmpl $0x2, 0x68(%rax)
je 0x1429d5
movq -0x40(%rsp), %rax
movw $0x1, (%rax)
jmp 0x1429d7
movq -0x10(%rsp), %rax
movswl 0x42(%rax), %eax
cmpl $0x1, %eax
jne 0x142a5e
movl -0x28(%rsp), %eax
movq -0x18(%rsp), %rcx
cmpl 0x8d4(%rcx), %eax
jl 0x142a5e
movl -0x28(%rsp), %eax
movq -0x18(%rsp), %rcx
movl 0x8d4(%rcx), %ecx
movq -0x10(%rsp), %rdx
addl 0x64(%rdx), %ecx
cmpl %ecx, %eax
jge 0x142a5e
movsd -0x38(%rsp), %xmm0
movq -0x8(%rsp), %rax
movsd 0x800(%rax), %xmm1
movq -0x10(%rsp), %rax
movl -0x28(%rsp), %ecx
movq -0x18(%rsp), %rdx
subl 0x8d4(%rdx), %ecx
movslq %ecx, %rcx
mulsd 0x70(%rax,%rcx,8), %xmm1
ucomisd %xmm1, %xmm0
jb 0x142a5e
movq -0x10(%rsp), %rax
cmpl $0x2, 0x68(%rax)
je 0x142a5c
movq -0x40(%rsp), %rax
movw $0x1, (%rax)
jmp 0x142a5e
movq -0x10(%rsp), %rax
movswl 0x44(%rax), %eax
cmpl $0x1, %eax
jne 0x142ae5
movl -0x28(%rsp), %eax
movq -0x18(%rsp), %rcx
cmpl 0x8d8(%rcx), %eax
jl 0x142ae5
movl -0x28(%rsp), %eax
movq -0x18(%rsp), %rcx
movl 0x8d8(%rcx), %ecx
movq -0x10(%rsp), %rdx
addl 0x64(%rdx), %ecx
cmpl %ecx, %eax
jge 0x142ae5
movsd -0x38(%rsp), %xmm0
movq -0x8(%rsp), %rax
movsd 0x7f8(%rax), %xmm1
movq -0x10(%rsp), %rax
movl -0x28(%rsp), %ecx
movq -0x18(%rsp), %rdx
subl 0x8d8(%rdx), %ecx
movslq %ecx, %rcx
mulsd 0x70(%rax,%rcx,8), %xmm1
ucomisd %xmm1, %xmm0
jb 0x142ae5
movq -0x10(%rsp), %rax
cmpl $0x2, 0x68(%rax)
je 0x142ae3
movq -0x40(%rsp), %rax
movw $0x1, (%rax)
jmp 0x142ae5
movq -0x10(%rsp), %rax
movswl 0x44(%rax), %eax
cmpl $0x1, %eax
jne 0x142b6c
movl -0x28(%rsp), %eax
movq -0x18(%rsp), %rcx
cmpl 0x8dc(%rcx), %eax
jl 0x142b6c
movl -0x28(%rsp), %eax
movq -0x18(%rsp), %rcx
movl 0x8dc(%rcx), %ecx
movq -0x10(%rsp), %rdx
addl 0x64(%rdx), %ecx
cmpl %ecx, %eax
jge 0x142b6c
movsd -0x38(%rsp), %xmm0
movq -0x8(%rsp), %rax
movsd 0x7f8(%rax), %xmm1
movq -0x10(%rsp), %rax
movl -0x28(%rsp), %ecx
movq -0x18(%rsp), %rdx
subl 0x8dc(%rdx), %ecx
movslq %ecx, %rcx
mulsd 0x70(%rax,%rcx,8), %xmm1
ucomisd %xmm1, %xmm0
jb 0x142b6c
movq -0x10(%rsp), %rax
cmpl $0x2, 0x68(%rax)
je 0x142b6a
movq -0x40(%rsp), %rax
movw $0x1, (%rax)
jmp 0x142b6c
movq -0x10(%rsp), %rax
movswl 0x44(%rax), %eax
cmpl $0x1, %eax
jne 0x142bf3
movl -0x28(%rsp), %eax
movq -0x18(%rsp), %rcx
cmpl 0x8e0(%rcx), %eax
jl 0x142bf3
movl -0x28(%rsp), %eax
movq -0x18(%rsp), %rcx
movl 0x8e0(%rcx), %ecx
movq -0x10(%rsp), %rdx
addl 0x64(%rdx), %ecx
cmpl %ecx, %eax
jge 0x142bf3
movsd -0x38(%rsp), %xmm0
movq -0x8(%rsp), %rax
movsd 0x7f8(%rax), %xmm1
movq -0x10(%rsp), %rax
movl -0x28(%rsp), %ecx
movq -0x18(%rsp), %rdx
subl 0x8e0(%rdx), %ecx
movslq %ecx, %rcx
mulsd 0x70(%rax,%rcx,8), %xmm1
ucomisd %xmm1, %xmm0
jb 0x142bf3
movq -0x10(%rsp), %rax
cmpl $0x2, 0x68(%rax)
je 0x142bf1
movq -0x40(%rsp), %rax
movw $0x1, (%rax)
jmp 0x142bf3
movq -0x10(%rsp), %rax
movswl 0x44(%rax), %eax
cmpl $0x1, %eax
jne 0x142c7a
movl -0x28(%rsp), %eax
movq -0x18(%rsp), %rcx
cmpl 0x8e4(%rcx), %eax
jl 0x142c7a
movl -0x28(%rsp), %eax
movq -0x18(%rsp), %rcx
movl 0x8e4(%rcx), %ecx
movq -0x10(%rsp), %rdx
addl 0x64(%rdx), %ecx
cmpl %ecx, %eax
jge 0x142c7a
movsd -0x38(%rsp), %xmm0
movq -0x8(%rsp), %rax
movsd 0x800(%rax), %xmm1
movq -0x10(%rsp), %rax
movl -0x28(%rsp), %ecx
movq -0x18(%rsp), %rdx
subl 0x8e4(%rdx), %ecx
movslq %ecx, %rcx
mulsd 0x70(%rax,%rcx,8), %xmm1
ucomisd %xmm1, %xmm0
jb 0x142c7a
movq -0x10(%rsp), %rax
cmpl $0x2, 0x68(%rax)
je 0x142c78
movq -0x40(%rsp), %rax
movw $0x1, (%rax)
jmp 0x142c7a
movq -0x10(%rsp), %rax
movswl 0x44(%rax), %eax
cmpl $0x1, %eax
jne 0x142d01
movl -0x28(%rsp), %eax
movq -0x18(%rsp), %rcx
cmpl 0x8e8(%rcx), %eax
jl 0x142d01
movl -0x28(%rsp), %eax
movq -0x18(%rsp), %rcx
movl 0x8e8(%rcx), %ecx
movq -0x10(%rsp), %rdx
addl 0x64(%rdx), %ecx
cmpl %ecx, %eax
jge 0x142d01
movsd -0x38(%rsp), %xmm0
movq -0x8(%rsp), %rax
movsd 0x7f8(%rax), %xmm1
movq -0x10(%rsp), %rax
movl -0x28(%rsp), %ecx
movq -0x18(%rsp), %rdx
subl 0x8e8(%rdx), %ecx
movslq %ecx, %rcx
mulsd 0x70(%rax,%rcx,8), %xmm1
ucomisd %xmm1, %xmm0
jb 0x142d01
movq -0x10(%rsp), %rax
cmpl $0x2, 0x68(%rax)
je 0x142cff
movq -0x40(%rsp), %rax
movw $0x1, (%rax)
jmp 0x142d01
movq -0x10(%rsp), %rax
movswl 0x2e(%rax), %eax
cmpl $0x1, %eax
jne 0x142d7b
movl -0x28(%rsp), %eax
movq -0x18(%rsp), %rcx
cmpl 0x8c4(%rcx), %eax
jl 0x142d7b
movl -0x28(%rsp), %eax
movq -0x18(%rsp), %rcx
movl 0x8c4(%rcx), %ecx
movq -0x10(%rsp), %rdx
addl 0x64(%rdx), %ecx
cmpl %ecx, %eax
jge 0x142d7b
movsd -0x38(%rsp), %xmm0
movq -0x8(%rsp), %rax
movsd 0x800(%rax), %xmm1
movq -0x10(%rsp), %rax
movl -0x28(%rsp), %ecx
movq -0x18(%rsp), %rdx
subl 0x8c4(%rdx), %ecx
movslq %ecx, %rcx
mulsd 0x70(%rax,%rcx,8), %xmm1
ucomisd %xmm1, %xmm0
jb 0x142d7b
movq -0x40(%rsp), %rax
movw $0x1, (%rax)
jmp 0x142d7d
jmp 0x142d7f
xorl %eax, %eax
retq
nopw %cs:(%rax,%rax)