// File: /workspace/github_c_makefile_star2_O1/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 0xac1f5
xorpd %xmm1, %xmm1
cmpl $0x1, %ecx
je 0xac1e9
testl %ecx, %ecx
jne 0xac21c
movsd 0x9e0(%r15), %xmm2
movslq 0x854(%r15), %rax
testq %rax, %rax
jle 0xac436
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 0xac1c5
jmp 0xac436
ucomisd %xmm1, %xmm3
jb 0xac225
sqrtsd %xmm3, %xmm2
jmp 0xac236
movsd 0x9e0(%r15), %xmm0
mulsd %xmm0, %xmm0
addsd %xmm3, %xmm0
xorpd %xmm4, %xmm4
ucomisd %xmm4, %xmm0
movsd %xmm3, 0x18(%rsp)
jb 0xac282
sqrtsd %xmm0, %xmm2
jmp 0xac295
xorpd %xmm2, %xmm2
jmp 0xac436
movapd %xmm3, %xmm0
callq 0x82b0
xorpd %xmm1, %xmm1
movapd %xmm0, %xmm2
mulsd 0x46442(%rip), %xmm2    # 0xf2680
movslq 0x854(%r15), %rax
testq %rax, %rax
jle 0xac436
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 0xac25e
jmp 0xac436
callq 0x82b0
xorpd %xmm4, %xmm4
movsd 0x18(%rsp), %xmm3
movapd %xmm0, %xmm2
movslq 0x854(%r15), %rax
testq %rax, %rax
jle 0xac2d4
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 0xac2b5
mulsd %xmm4, %xmm4
movapd %xmm4, %xmm0
addsd %xmm3, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
movsd %xmm2, 0x10(%rsp)
jb 0xac2f9
xorps %xmm1, %xmm1
sqrtsd %xmm0, %xmm1
jmp 0xac31a
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 0xac3bc
movapd %xmm3, %xmm5
addsd %xmm3, %xmm5
addsd %xmm4, %xmm5
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm5
jb 0xac345
xorps %xmm0, %xmm0
sqrtsd %xmm5, %xmm0
jmp 0xac37e
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 0xac3bc
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm5
jb 0xac397
xorps %xmm1, %xmm1
sqrtsd %xmm5, %xmm1
jmp 0xac3bc
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 0xac436
mulsd 0x462b4(%rip), %xmm3    # 0xf2680
addsd %xmm3, %xmm4
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm4
jb 0xac3e3
xorps %xmm0, %xmm0
sqrtsd %xmm4, %xmm0
jmp 0xac40a
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 0xac436
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm4
jb 0xac423
xorps %xmm1, %xmm1
sqrtsd %xmm4, %xmm1
jmp 0xac436
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 0xac4cf
movq %rax, %rcx
movsd 0x10(%rsp), %xmm0
movsd %xmm0, (%rax)
xorl %eax, %eax
cmpl $0x2, %ebp
jb 0xac51d
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 0xac4bc
jmp 0xac51d
shll $0x3, %ebp
leaq 0x44b2b(%rip), %rsi     # 0xf1004
leaq 0x75a51(%rip), %rdx     # 0x121f31
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movl %ebp, %ecx
xorl %eax, %eax
callq 0x30c2c
addq $0x96a, %rbx            # imm = 0x96A
leaq 0x44b35(%rip), %rsi     # 0xf1034
leaq 0x75a39(%rip), %rdx     # 0x121f3f
movq %rbx, %rdi
movl $0x54c, %ecx            # imm = 0x54C
movq %r14, %r8
xorl %eax, %eax
callq 0x30c2c
movl $0x1, %eax
addq $0x838, %rsp            # imm = 0x838
popq %rbx
popq %r14
popq %r15
popq %rbp
retq