// File: /workspace/github_c_makefile_star2_O3/PoulinV[P]AxiCLASS/build/../source/transfer.c
// Function: transfer_get_q_limber_list
int transfer_get_q_limber_list(
                               struct precision * ppr,
                               struct perturbations * ppt,
                               struct transfer * ptr,
                               double K,
                               int sgnK
                               ) {

  int index_q;
  double q_min=0.,q_max=0.,k_max;
  int nu_min;
  int index_md;

  /* first and last value in flat case*/

  if (sgnK == 0) {
    q_min = ppt->k_min;

    q_max = 0.;
    for (index_md=0; index_md<ppt->md_size; index_md++) {
      q_max = MAX(q_max,ppt->k[index_md][ppt->k_size[index_md]-1]);
    }

    K=0;
  }

  /* first and last value in open case*/

  else if (sgnK == -1) {
    q_min = sqrt(ppt->k_min*ppt->k_min+K);

    k_max = 0.;
    for (index_md=0; index_md<ppt->md_size; index_md++) {
      k_max = MAX(k_max,ppt->k[index_md][ppt->k_size[index_md]-1]);
    }

    q_max = sqrt(k_max*k_max+K);
    if (ppt->has_vectors == _TRUE_)
      q_max = MIN(q_max,sqrt(k_max*k_max+2.*K));
    if (ppt->has_tensors == _TRUE_)
      q_max = MIN(q_max,sqrt(k_max*k_max+3.*K));
  }

  /* first and last value in closed case*/

  else if (sgnK == 1) {
    nu_min = 3;
    q_min = nu_min * sqrt(K);

    q_max = 0.;
    for (index_md=0; index_md<ppt->md_size; index_md++) {
      q_max = MAX(q_max,ppt->k[index_md][ppt->k_size[index_md]-1]);
    }
  }

  /* number of values */
  ptr->q_size_limber = (int)(log(q_max/q_min)/log(ppr->q_logstep_limber))+1;

  class_alloc(ptr->q_limber,
              ptr->q_size_limber*sizeof(double),
              ptr->error_message);

  /* assign the first value before starting the loop */

  ptr->q_limber[0] = q_min;
  for (index_q = 1; index_q < ptr->q_size_limber; index_q++) {
    ptr->q_limber[index_q] = ppr->q_logstep_limber *  ptr->q_limber[index_q-1];
  }

  return _SUCCESS_;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x838, %rsp            # imm = 0x838
movapd %xmm0, %xmm3
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
cmpl $-0x1, %ecx
je 0xa91fb
xorpd %xmm1, %xmm1
cmpl $0x1, %ecx
je 0xa91ef
testl %ecx, %ecx
jne 0xa9222
movsd 0x9e0(%r15), %xmm2
movslq 0x854(%r15), %rax
testq %rax, %rax
jle 0xa943c
movq 0x9c8(%r15), %rcx
movq 0x9d0(%r15), %rdx
xorl %esi, %esi
movapd %xmm1, %xmm0
movq (%rdx,%rsi,8), %rdi
movslq (%rcx,%rsi,4), %r8
movsd -0x8(%rdi,%r8,8), %xmm1
maxsd %xmm0, %xmm1
incq %rsi
cmpq %rsi, %rax
jne 0xa91cb
jmp 0xa943c
ucomisd %xmm1, %xmm3
jb 0xa922b
sqrtsd %xmm3, %xmm2
jmp 0xa923c
movsd 0x9e0(%r15), %xmm0
mulsd %xmm0, %xmm0
addsd %xmm3, %xmm0
xorpd %xmm4, %xmm4
ucomisd %xmm4, %xmm0
movsd %xmm3, 0x18(%rsp)
jb 0xa9288
sqrtsd %xmm0, %xmm2
jmp 0xa929b
xorpd %xmm2, %xmm2
jmp 0xa943c
movapd %xmm3, %xmm0
callq 0x82b0
xorpd %xmm1, %xmm1
movapd %xmm0, %xmm2
mulsd 0x4643c(%rip), %xmm2    # 0xef680
movslq 0x854(%r15), %rax
testq %rax, %rax
jle 0xa943c
movq 0x9c8(%r15), %rcx
movq 0x9d0(%r15), %rdx
xorl %esi, %esi
movapd %xmm1, %xmm0
movq (%rdx,%rsi,8), %rdi
movslq (%rcx,%rsi,4), %r8
movsd -0x8(%rdi,%r8,8), %xmm1
maxsd %xmm0, %xmm1
incq %rsi
cmpq %rsi, %rax
jne 0xa9264
jmp 0xa943c
callq 0x82b0
xorpd %xmm4, %xmm4
movsd 0x18(%rsp), %xmm3
movapd %xmm0, %xmm2
movslq 0x854(%r15), %rax
testq %rax, %rax
jle 0xa92da
movq 0x9c8(%r15), %rcx
movq 0x9d0(%r15), %rdx
xorpd %xmm0, %xmm0
xorl %esi, %esi
movq (%rdx,%rsi,8), %rdi
movslq (%rcx,%rsi,4), %r8
movsd -0x8(%rdi,%r8,8), %xmm4
maxsd %xmm0, %xmm4
incq %rsi
movapd %xmm4, %xmm0
cmpq %rsi, %rax
jne 0xa92bb
mulsd %xmm4, %xmm4
movapd %xmm4, %xmm0
addsd %xmm3, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
movsd %xmm2, 0x10(%rsp)
jb 0xa92ff
xorps %xmm1, %xmm1
sqrtsd %xmm0, %xmm1
jmp 0xa9320
movsd %xmm4, 0x8(%rsp)
callq 0x82b0
movsd 0x8(%rsp), %xmm4
movsd 0x18(%rsp), %xmm3
movsd 0x10(%rsp), %xmm2
movapd %xmm0, %xmm1
cmpw $0x1, 0x10(%r15)
jne 0xa93c2
movapd %xmm3, %xmm5
addsd %xmm3, %xmm5
addsd %xmm4, %xmm5
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm5
jb 0xa934b
xorps %xmm0, %xmm0
sqrtsd %xmm5, %xmm0
jmp 0xa9384
movapd %xmm5, %xmm0
movsd %xmm1, 0x20(%rsp)
movsd %xmm4, 0x8(%rsp)
movsd %xmm5, 0x28(%rsp)
callq 0x82b0
movsd 0x28(%rsp), %xmm5
movsd 0x8(%rsp), %xmm4
movsd 0x18(%rsp), %xmm3
movsd 0x20(%rsp), %xmm1
movsd 0x10(%rsp), %xmm2
ucomisd %xmm1, %xmm0
ja 0xa93c2
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm5
jb 0xa939d
xorps %xmm1, %xmm1
sqrtsd %xmm5, %xmm1
jmp 0xa93c2
movapd %xmm5, %xmm0
movsd %xmm4, 0x8(%rsp)
callq 0x82b0
movsd 0x8(%rsp), %xmm4
movsd 0x18(%rsp), %xmm3
movsd 0x10(%rsp), %xmm2
movapd %xmm0, %xmm1
cmpw $0x1, 0x12(%r15)
jne 0xa943c
mulsd 0x462ae(%rip), %xmm3    # 0xef680
addsd %xmm3, %xmm4
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm4
jb 0xa93e9
xorps %xmm0, %xmm0
sqrtsd %xmm4, %xmm0
jmp 0xa9410
movapd %xmm4, %xmm0
movsd %xmm1, 0x20(%rsp)
movsd %xmm4, 0x8(%rsp)
callq 0x82b0
movsd 0x8(%rsp), %xmm4
movsd 0x20(%rsp), %xmm1
movsd 0x10(%rsp), %xmm2
ucomisd %xmm1, %xmm0
ja 0xa943c
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm4
jb 0xa9429
xorps %xmm1, %xmm1
sqrtsd %xmm4, %xmm1
jmp 0xa943c
movapd %xmm4, %xmm0
callq 0x82b0
movsd 0x10(%rsp), %xmm2
movapd %xmm0, %xmm1
movsd %xmm2, 0x10(%rsp)
divsd %xmm2, %xmm1
movapd %xmm1, %xmm0
callq 0x82c0
movsd %xmm0, 0x18(%rsp)
movsd 0x780(%r14), %xmm0
callq 0x82c0
movsd 0x18(%rsp), %xmm1
divsd %xmm0, %xmm1
cvttsd2si %xmm1, %ebp
movslq %ebp, %rax
incl %ebp
leaq 0x1(%rax), %rcx
movq %rcx, 0x940(%rbx)
leaq 0x8(,%rax,8), %rdi
callq 0x8460
movq %rax, 0x948(%rbx)
testq %rax, %rax
je 0xa94d5
movq %rax, %rcx
movsd 0x10(%rsp), %xmm0
movsd %xmm0, (%rax)
xorl %eax, %eax
cmpl $0x2, %ebp
jb 0xa9523
movsd 0x780(%r14), %xmm0
movl %ebp, %edx
movsd (%rcx), %xmm1
movl $0x1, %esi
mulsd %xmm0, %xmm1
movsd %xmm1, (%rcx,%rsi,8)
incq %rsi
cmpq %rsi, %rdx
jne 0xa94c2
jmp 0xa9523
shll $0x3, %ebp
leaq 0x44b25(%rip), %rsi     # 0xee004
leaq 0x75a8b(%rip), %rdx     # 0x11ef71
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movl %ebp, %ecx
xorl %eax, %eax
callq 0x30af0
addq $0x96a, %rbx            # imm = 0x96A
leaq 0x44b2f(%rip), %rsi     # 0xee034
leaq 0x75a73(%rip), %rdx     # 0x11ef7f
movq %rbx, %rdi
movl $0x54c, %ecx            # imm = 0x54C
movq %r14, %r8
xorl %eax, %eax
callq 0x30af0
movl $0x1, %eax
addq $0x838, %rsp            # imm = 0x838
popq %rbx
popq %r14
popq %r15
popq %rbp
retq