// File: /workspace/github_c_makefile_star2_O1/PoulinV[P]AxiCLASS/build/../source/transfer.c
// Function: transfer_get_l_list
int transfer_get_l_list(
                        struct precision * ppr,
                        struct perturbations * ppt,
                        struct transfer * ptr
                        ) {

  int index_l;
  int l_max=0;
  int index_md;
  int index_tt;
  int increment,current_l;
  /** Summary: */
  /*
    fprintf(stderr,"rescaling %e logstep %e linstep %e\n",
    ptr->angular_rescaling,
    pow(ppr->l_logstep,ptr->angular_rescaling),
    ppr->l_linstep*ptr->angular_rescaling);
  */

  /* check that largests need value of l_max */

  if (ppt->has_cls == _TRUE_) {

    if (ppt->has_scalars == _TRUE_) {

      if ((ppt->has_cl_cmb_temperature == _TRUE_) ||
          (ppt->has_cl_cmb_polarization == _TRUE_) ||
          (ppt->has_cl_cmb_lensing_potential == _TRUE_))
        l_max=MAX(ppt->l_scalar_max,l_max);

      if ((ppt->has_cl_lensing_potential == _TRUE_) ||
          (ppt->has_cl_number_count == _TRUE_))
        l_max=MAX(ppt->l_lss_max,l_max);
    }

    if (ppt->has_tensors == _TRUE_)
      l_max=MAX(ppt->l_tensor_max,l_max);

  }

  /** - allocate and fill l array */

  /** - start from l = 2 and increase with logarithmic step */

  index_l = 0;
  current_l = 2;
  increment = MAX((int)(current_l * (pow(ppr->l_logstep,ptr->angular_rescaling)-1.)),1);

  while (((current_l+increment) < l_max) &&
         (increment < ppr->l_linstep*ptr->angular_rescaling)) {

    index_l ++;
    current_l += increment;
    increment = MAX((int)(current_l * (pow(ppr->l_logstep,ptr->angular_rescaling)-1.)),1);

  }

  /** - when the logarithmic step becomes larger than some linear step,
      stick to this linear step till l_max */

  increment = ppr->l_linstep*ptr->angular_rescaling;

  while ((current_l+increment) <= l_max) {

    index_l ++;
    current_l += increment;

  }

  /** - last value set to exactly l_max */

  if (current_l != l_max) {

    index_l ++;
    current_l = l_max;

  }

  ptr->l_size_max = index_l+1;

  /** - so far we just counted the number of values. Now repeat the
      whole thing but fill array with values. */

  class_alloc(ptr->l,ptr->l_size_max*sizeof(int),ptr->error_message);

  index_l = 0;
  ptr->l[0] = 2;
  increment = MAX((int)(ptr->l[0] * (pow(ppr->l_logstep,ptr->angular_rescaling)-1.)),1);

  while (((ptr->l[index_l]+increment) < l_max) &&
         (increment < ppr->l_linstep*ptr->angular_rescaling)) {

    index_l ++;
    ptr->l[index_l]=ptr->l[index_l-1]+increment;
    increment = MAX((int)(ptr->l[index_l] * (pow(ppr->l_logstep,ptr->angular_rescaling)-1.)),1);

  }

  increment = ppr->l_linstep*ptr->angular_rescaling;

  while ((ptr->l[index_l]+increment) <= l_max) {

    index_l ++;
    ptr->l[index_l]=ptr->l[index_l-1]+increment;

  }

  if (ptr->l[index_l] != l_max) {

    index_l ++;
    ptr->l[index_l]= l_max;

  }

  /* for each mode and type, find relevant size of l array,
     l_size_tt[index_md][index_tt] (since for some modes and types
     l_max can be smaller). Also, maximize this size for each mode to
     find l_size[index_md]. */

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

    ptr->l_size[index_md] = 0;

    for (index_tt=0;index_tt<ptr->tt_size[index_md];index_tt++) {

      if (_scalars_) {

        if ((ppt->has_cl_cmb_temperature == _TRUE_) &&
            ((index_tt == ptr->index_tt_t0) || (index_tt == ptr->index_tt_t1) || (index_tt == ptr->index_tt_t2)))
          l_max=ppt->l_scalar_max;

        if ((ppt->has_cl_cmb_polarization == _TRUE_) && (index_tt == ptr->index_tt_e))
          l_max=ppt->l_scalar_max;

        if ((ppt->has_cl_cmb_lensing_potential == _TRUE_) && (index_tt == ptr->index_tt_lcmb))
          l_max=ppt->l_scalar_max;

        if ((_index_tt_in_range_(ptr->index_tt_density, ppt->selection_num, ppt->has_nc_density)) ||
            (_index_tt_in_range_(ptr->index_tt_rsd,     ppt->selection_num, ppt->has_nc_rsd)) ||
            (_index_tt_in_range_(ptr->index_tt_d0,      ppt->selection_num, ppt->has_nc_rsd)) ||
            (_index_tt_in_range_(ptr->index_tt_d1,      ppt->selection_num, ppt->has_nc_rsd)) ||
            (_index_tt_in_range_(ptr->index_tt_nc_lens, ppt->selection_num, ppt->has_nc_lens))||
            (_index_tt_in_range_(ptr->index_tt_nc_g1,   ppt->selection_num, ppt->has_nc_gr))  ||
            (_index_tt_in_range_(ptr->index_tt_nc_g2,   ppt->selection_num, ppt->has_nc_gr))  ||
            (_index_tt_in_range_(ptr->index_tt_nc_g3,   ppt->selection_num, ppt->has_nc_gr))  ||
            (_index_tt_in_range_(ptr->index_tt_nc_g4,   ppt->selection_num, ppt->has_nc_gr))  ||
            (_index_tt_in_range_(ptr->index_tt_nc_g5,   ppt->selection_num, ppt->has_nc_gr))
            )
          l_max=ppt->l_lss_max;

        if ((ppt->has_cl_lensing_potential == _TRUE_) && (index_tt >= ptr->index_tt_lensing) && (index_tt < ptr->index_tt_lensing+ppt->selection_num))
          l_max=ppt->l_lss_max;

      }

      if (_tensors_) {
        l_max = ppt->l_tensor_max;
      }

      class_test(l_max > ptr->l[ptr->l_size_max-1],
                 ptr->error_message,
                 "For mode %d, type %d, asked for l_max=%d greater than in Bessel table where l_max=%d",
                 index_md,
                 index_tt,
                 l_max,
                 ptr->l[ptr->l_size_max-1]);

      index_l=0;
      while (ptr->l[index_l] < l_max) index_l++;
      ptr->l_size_tt[index_md][index_tt]=index_l+1;

      if (ptr->l_size_tt[index_md][index_tt] < ptr->l_size_max)
        ptr->l_size_tt[index_md][index_tt]++;
      if (ptr->l_size_tt[index_md][index_tt] < ptr->l_size_max)
        ptr->l_size_tt[index_md][index_tt]++;

      ptr->l_size[index_md] = MAX(ptr->l_size[index_md],ptr->l_size_tt[index_md][index_tt]);

    }
  }

  return _SUCCESS_;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1018, %rsp           # imm = 0x1018
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r12
xorl %r15d, %r15d
cmpw $0x1, 0xc(%rsi)
jne 0xacbd8
xorl %r15d, %r15d
cmpw $0x1, 0xe(%r14)
jne 0xacbc5
cmpw $0x1, 0x28(%r14)
je 0xacb9d
cmpw $0x1, 0x2a(%r14)
je 0xacb9d
xorl %r15d, %r15d
cmpw $0x1, 0x2c(%r14)
jne 0xacbaa
movl 0x48(%r14), %eax
xorl %r15d, %r15d
testl %eax, %eax
cmovgl %eax, %r15d
cmpw $0x1, 0x2e(%r14)
je 0xacbba
cmpw $0x1, 0x30(%r14)
jne 0xacbc5
movl 0x54(%r14), %eax
cmpl %r15d, %eax
cmovgl %eax, %r15d
cmpw $0x1, 0x12(%r14)
jne 0xacbd8
movl 0x50(%r14), %eax
cmpl %r15d, %eax
cmovgl %eax, %r15d
movsd 0x710(%r12), %xmm0
movsd 0x918(%rbx), %xmm1
callq 0x8620
addsd 0x44bf1(%rip), %xmm0    # 0xf17e8
addsd %xmm0, %xmm0
cvttsd2si %xmm0, %eax
testl %eax, %eax
jle 0xacc2c
movsd 0x710(%r12), %xmm0
movsd 0x918(%rbx), %xmm1
callq 0x8620
addsd 0x44bc6(%rip), %xmm0    # 0xf17e8
addsd %xmm0, %xmm0
cvttsd2si %xmm0, %ecx
jmp 0xacc31
movl $0x1, %ecx
leal 0x2(%rcx), %eax
movl $0x2, %ebp
xorl %r13d, %r13d
cmpl %r15d, %eax
jge 0xacd14
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
cvtsi2sdl 0x708(%r12), %xmm2
movsd 0x918(%rbx), %xmm1
mulsd %xmm1, %xmm2
ucomisd %xmm0, %xmm2
jbe 0xacd14
movl $0x1, %ecx
movl %eax, %ebp
movl %ecx, %r13d
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x710(%r12), %xmm0
callq 0x8620
movsd 0x44b4e(%rip), %xmm1    # 0xf17e8
addsd %xmm1, %xmm0
mulsd 0x8(%rsp), %xmm0
cvttsd2si %xmm0, %eax
movl $0x1, %ecx
testl %eax, %eax
jle 0xaccde
movsd 0x710(%r12), %xmm0
movsd 0x918(%rbx), %xmm1
callq 0x8620
movsd 0x44b18(%rip), %xmm1    # 0xf17e8
addsd %xmm1, %xmm0
mulsd 0x8(%rsp), %xmm0
cvttsd2si %xmm0, %ecx
leal (%rcx,%rbp), %eax
cmpl %r15d, %eax
jge 0xacd14
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
xorps %xmm2, %xmm2
cvtsi2sdl 0x708(%r12), %xmm2
movsd 0x918(%rbx), %xmm1
mulsd %xmm1, %xmm2
leal 0x1(%r13), %ecx
ucomisd %xmm0, %xmm2
ja 0xacc71
movsd 0x918(%rbx), %xmm1
xorps %xmm0, %xmm0
cvtsi2sdl 0x708(%r12), %xmm0
movsd %xmm1, 0x8(%rsp)
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %ecx
leal (%rcx,%rbp), %edx
leal 0x1(%r15), %eax
xorl %esi, %esi
cmpl %eax, %edx
cmovgl %edx, %eax
setl %sil
addl %esi, %edx
subl %edx, %eax
cmpl $0x1, %ecx
movl %ecx, %edi
adcl $0x0, %edi
xorl %edx, %edx
divl %edi
leal (%rax,%rsi), %edx
imull %ecx, %edx
addl %esi, %r13d
addl %eax, %r13d
addl %ebp, %edx
xorl %eax, %eax
cmpl %r15d, %edx
setne %al
movl %r13d, %ecx
addl %eax, %ecx
leal (%rax,%r13), %ebp
incl %ebp
movl %ebp, 0x908(%rbx)
leaq 0x4(,%rcx,4), %rdi
callq 0x8460
movq %rax, 0x910(%rbx)
testq %rax, %rax
je 0xace0b
movl $0x2, (%rax)
movsd 0x710(%r12), %xmm0
movsd 0x8(%rsp), %xmm1
callq 0x8620
addsd 0x44a2c(%rip), %xmm0    # 0xf17e8
addsd %xmm0, %xmm0
cvttsd2si %xmm0, %eax
testl %eax, %eax
jle 0xace52
movq 0x910(%rbx), %rax
xorps %xmm0, %xmm0
cvtsi2sdl (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x710(%r12), %xmm0
movsd 0x918(%rbx), %xmm1
callq 0x8620
addsd 0x449e9(%rip), %xmm0    # 0xf17e8
mulsd 0x8(%rsp), %xmm0
cvttsd2si %xmm0, %ecx
jmp 0xace57
shll $0x2, %ebp
leaq 0x441ef(%rip), %rsi     # 0xf1004
leaq 0x74f42(%rip), %rdx     # 0x121d5e
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movl %ebp, %ecx
xorl %eax, %eax
callq 0x30c2c
addq $0x96a, %rbx            # imm = 0x96A
leaq 0x441f9(%rip), %rsi     # 0xf1034
leaq 0x74f23(%rip), %rdx     # 0x121d65
movq %rbx, %rdi
movl $0x395, %ecx            # imm = 0x395
movq %r14, %r8
jmp 0xad2b4
movl $0x1, %ecx
movq 0x910(%rbx), %rax
movl (%rax), %edx
addl %ecx, %edx
xorl %r13d, %r13d
cmpl %r15d, %edx
jge 0xacf3b
xorl %r13d, %r13d
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
xorps %xmm2, %xmm2
cvtsi2sdl 0x708(%r12), %xmm2
movsd 0x918(%rbx), %xmm1
mulsd %xmm1, %xmm2
ucomisd %xmm0, %xmm2
jbe 0xacf3b
movl %edx, 0x4(%rax,%r13,4)
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x710(%r12), %xmm0
callq 0x8620
movsd 0x44924(%rip), %xmm1    # 0xf17e8
addsd %xmm1, %xmm0
mulsd 0x8(%rsp), %xmm0
cvttsd2si %xmm0, %eax
testl %eax, %eax
jle 0xacf1c
movq 0x910(%rbx), %rax
xorps %xmm0, %xmm0
cvtsi2sdl 0x4(%rax,%r13,4), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x710(%r12), %xmm0
movsd 0x918(%rbx), %xmm1
callq 0x8620
movsd 0x448dc(%rip), %xmm1    # 0xf17e8
addsd %xmm1, %xmm0
mulsd 0x8(%rsp), %xmm0
cvttsd2si %xmm0, %ecx
jmp 0xacf21
movl $0x1, %ecx
movq 0x910(%rbx), %rax
movl 0x4(%rax,%r13,4), %edx
addl %ecx, %edx
incq %r13
cmpl %r15d, %edx
jl 0xace71
xorps %xmm0, %xmm0
cvtsi2sdl 0x708(%r12), %xmm0
mulsd 0x918(%rbx), %xmm0
cvttsd2si %xmm0, %esi
movl %r13d, %ecx
movl (%rax,%rcx,4), %edx
leal (%rdx,%rsi), %edi
cmpl %r15d, %edi
jg 0xacf70
addl %esi, %edx
movl %edx, 0x4(%rax,%rcx,4)
incq %rcx
leal (%rsi,%rdx), %edi
jmp 0xacf5d
cmpl %r15d, %edx
je 0xacf7a
movl %r15d, 0x4(%rax,%rcx,4)
cmpl $0x0, 0x854(%r14)
jle 0xad24f
movq 0x8f0(%rbx), %rsi
movq 0x900(%rbx), %rdi
xorl %edx, %edx
movl $0x0, (%rdi,%rdx,4)
cmpl $0x0, (%rsi,%rdx,4)
jle 0xad23c
movzwl 0xe(%r14), %r8d
movzwl 0x12(%r14), %r9d
xorl %ecx, %ecx
cmpw $0x1, %r8w
jne 0xad1b2
movl 0x848(%r14), %r10d
cmpq %r10, %rdx
jne 0xad1b2
cmpw $0x1, 0x28(%r14)
jne 0xad000
movl 0x8a8(%rbx), %r10d
cmpq %r10, %rcx
je 0xacffc
movl 0x8ac(%rbx), %r10d
cmpq %r10, %rcx
je 0xacffc
movl 0x8b0(%rbx), %r10d
cmpq %r10, %rcx
jne 0xad000
movl 0x48(%r14), %r15d
cmpw $0x1, 0x2a(%r14)
jne 0xad018
movl 0x8b4(%rbx), %r10d
cmpq %r10, %rcx
jne 0xad018
movl 0x48(%r14), %r15d
cmpw $0x1, 0x2c(%r14)
jne 0xad030
movl 0x8bc(%rbx), %r10d
cmpq %r10, %rcx
jne 0xad030
movl 0x48(%r14), %r15d
cmpw $0x1, 0x3e(%r14)
jne 0xad054
movslq 0x8c0(%rbx), %r10
cmpq %r10, %rcx
jl 0xad054
movslq 0x64(%r14), %r11
addq %r10, %r11
cmpq %r11, %rcx
jl 0xad18a
movzwl 0x40(%r14), %r10d
cmpw $0x1, %r10w
jne 0xad0c2
movslq 0x8c8(%rbx), %r11
cmpq %r11, %rcx
jl 0xad07c
movslq 0x64(%r14), %r12
addq %r11, %r12
cmpq %r12, %rcx
jl 0xad18a
cmpw $0x1, %r10w
jne 0xad0c2
movslq 0x8cc(%rbx), %r11
cmpq %r11, %rcx
jl 0xad09f
movslq 0x64(%r14), %r12
addq %r11, %r12
cmpq %r12, %rcx
jl 0xad18a
cmpw $0x1, %r10w
jne 0xad0c2
movslq 0x8d0(%rbx), %r10
cmpq %r10, %rcx
jl 0xad0c2
movslq 0x64(%r14), %r11
addq %r10, %r11
cmpq %r11, %rcx
jl 0xad18a
cmpw $0x1, 0x42(%r14)
jne 0xad0e6
movslq 0x8d4(%rbx), %r10
cmpq %r10, %rcx
jl 0xad0e6
movslq 0x64(%r14), %r11
addq %r10, %r11
cmpq %r11, %rcx
jl 0xad18a
movzwl 0x44(%r14), %r10d
cmpw $0x1, %r10w
jne 0xad18e
movslq 0x8d8(%rbx), %r11
cmpq %r11, %rcx
jl 0xad10e
movslq 0x64(%r14), %r12
addq %r11, %r12
cmpq %r12, %rcx
jl 0xad18a
cmpw $0x1, %r10w
jne 0xad18e
movslq 0x8dc(%rbx), %r11
cmpq %r11, %rcx
jl 0xad12d
movslq 0x64(%r14), %r12
addq %r11, %r12
cmpq %r12, %rcx
jl 0xad18a
cmpw $0x1, %r10w
jne 0xad18e
movslq 0x8e0(%rbx), %r11
cmpq %r11, %rcx
jl 0xad14c
movslq 0x64(%r14), %r12
addq %r11, %r12
cmpq %r12, %rcx
jl 0xad18a
cmpw $0x1, %r10w
jne 0xad18e
movslq 0x8e4(%rbx), %r11
cmpq %r11, %rcx
jl 0xad16b
movslq 0x64(%r14), %r12
addq %r11, %r12
cmpq %r12, %rcx
jl 0xad18a
cmpw $0x1, %r10w
jne 0xad18e
movslq 0x8e8(%rbx), %r10
cmpq %r10, %rcx
jl 0xad18e
movslq 0x64(%r14), %r11
addq %r10, %r11
cmpq %r11, %rcx
jge 0xad18e
movl 0x54(%r14), %r15d
cmpw $0x1, 0x2e(%r14)
jne 0xad1b2
movslq 0x8c4(%rbx), %r10
cmpq %r10, %rcx
jl 0xad1b2
movslq 0x64(%r14), %r11
addq %r10, %r11
cmpq %r11, %rcx
jge 0xad1b2
movl 0x54(%r14), %r15d
cmpw $0x1, %r9w
jne 0xad1c9
movl 0x84c(%r14), %r10d
cmpq %r10, %rdx
jne 0xad1c9
movl 0x50(%r14), %r15d
movslq 0x908(%rbx), %r10
cmpl -0x4(%rax,%r10,4), %r15d
jg 0xad253
xorl %r11d, %r11d
movq %r11, %r10
incq %r11
cmpl %r15d, (%rax,%r10,4)
jl 0xad1da
movq 0x8f8(%rbx), %r10
movq (%r10,%rdx,8), %r10
movl %r11d, (%r10,%rcx,4)
cmpl 0x908(%rbx), %r11d
jge 0xad205
incl %r11d
movl %r11d, (%r10,%rcx,4)
movl (%r10,%rcx,4), %r11d
cmpl 0x908(%rbx), %r11d
jge 0xad219
incl %r11d
movl %r11d, (%r10,%rcx,4)
movl (%rdi,%rdx,4), %r11d
movl (%r10,%rcx,4), %r10d
cmpl %r10d, %r11d
cmovgl %r11d, %r10d
movl %r10d, (%rdi,%rdx,4)
incq %rcx
movslq (%rsi,%rdx,4), %r10
cmpq %r10, %rcx
jl 0xacfb5
incq %rdx
movslq 0x854(%r14), %rcx
cmpq %rcx, %rdx
jl 0xacf98
xorl %eax, %eax
jmp 0xad2c0
movl -0x4(%rax,%r10,4), %r9d
leaq 0x74b1a(%rip), %rsi     # 0x121d79
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movl %r15d, %r8d
xorl %eax, %eax
callq 0x30c2c
leaq 0x43e0a(%rip), %rsi     # 0xf1082
leaq 0x74b4f(%rip), %rdx     # 0x121dce
leaq 0x810(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c2c
addq $0x96a, %rbx            # imm = 0x96A
leaq 0x43d92(%rip), %rsi     # 0xf1034
leaq 0x74abc(%rip), %rdx     # 0x121d65
movq %rbx, %rdi
movl $0x3e7, %ecx            # imm = 0x3E7
movq %r15, %r8
xorl %eax, %eax
callq 0x30c2c
movl $0x1, %eax
addq $0x1018, %rsp           # imm = 0x1018
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq