// File: /workspace/github_c_makefile_star2_O2/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 0xa3eb7
cmpl $0x1, %ecx
je 0xa3ea7
xorpd %xmm2, %xmm2
xorpd %xmm1, %xmm1
testl %ecx, %ecx
jne 0xa40da
movsd 0x9e0(%r15), %xmm2
movl 0x854(%r15), %eax
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
cmpq %rcx, %rax
je 0xa40da
movq 0x9c8(%r15), %rdx
movq 0x9d0(%r15), %rsi
movq (%rsi,%rcx,8), %rsi
movslq (%rdx,%rcx,4), %rdx
movsd -0x8(%rsi,%rdx,8), %xmm0
maxsd %xmm1, %xmm0
incq %rcx
movapd %xmm0, %xmm1
jmp 0xa3e75
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm3
jb 0xa3ede
sqrtsd %xmm3, %xmm2
jmp 0xa3eef
movsd 0x9e0(%r15), %xmm0
mulsd %xmm0, %xmm0
addsd %xmm3, %xmm0
xorpd %xmm4, %xmm4
ucomisd %xmm4, %xmm0
movsd %xmm3, 0x18(%rsp)
jb 0xa3f38
sqrtsd %xmm0, %xmm2
jmp 0xa3f4b
movapd %xmm3, %xmm0
callq 0x82d0
xorpd %xmm1, %xmm1
movapd %xmm0, %xmm2
movl 0x854(%r15), %eax
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
cmpq %rcx, %rax
je 0xa3f2b
movq 0x9c8(%r15), %rdx
movq 0x9d0(%r15), %rsi
movq (%rsi,%rcx,8), %rsi
movslq (%rdx,%rcx,4), %rdx
movsd -0x8(%rsi,%rdx,8), %xmm0
maxsd %xmm1, %xmm0
incq %rcx
movapd %xmm0, %xmm1
jmp 0xa3efd
mulsd 0x42815(%rip), %xmm2    # 0xe6748
jmp 0xa40da
callq 0x82d0
xorpd %xmm4, %xmm4
movsd 0x18(%rsp), %xmm3
movapd %xmm0, %xmm2
movl 0x854(%r15), %eax
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
cmpq %rcx, %rax
je 0xa3f87
movq 0x9c8(%r15), %rdx
movq 0x9d0(%r15), %rsi
movq (%rsi,%rcx,8), %rsi
movslq (%rdx,%rcx,4), %rdx
movsd -0x8(%rsi,%rdx,8), %xmm0
maxsd %xmm4, %xmm0
incq %rcx
movapd %xmm0, %xmm4
jmp 0xa3f59
mulsd %xmm4, %xmm4
movapd %xmm4, %xmm0
addsd %xmm3, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
movsd %xmm2, 0x10(%rsp)
jb 0xa3fa9
sqrtsd %xmm0, %xmm1
jmp 0xa3fca
movsd %xmm4, 0x8(%rsp)
callq 0x82d0
movsd 0x8(%rsp), %xmm4
movsd 0x18(%rsp), %xmm3
movsd 0x10(%rsp), %xmm2
movapd %xmm0, %xmm1
cmpw $0x1, 0x10(%r15)
jne 0xa4066
movapd %xmm3, %xmm5
addsd %xmm3, %xmm5
addsd %xmm4, %xmm5
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm5
jb 0xa3ff2
sqrtsd %xmm5, %xmm0
jmp 0xa402b
movapd %xmm5, %xmm0
movsd %xmm1, 0x20(%rsp)
movsd %xmm4, 0x8(%rsp)
movsd %xmm5, 0x28(%rsp)
callq 0x82d0
movsd 0x28(%rsp), %xmm5
movsd 0x8(%rsp), %xmm4
movsd 0x18(%rsp), %xmm3
movsd 0x20(%rsp), %xmm1
movsd 0x10(%rsp), %xmm2
ucomisd %xmm1, %xmm0
ja 0xa4066
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm5
jb 0xa4041
sqrtsd %xmm5, %xmm1
jmp 0xa4066
movapd %xmm5, %xmm0
movsd %xmm4, 0x8(%rsp)
callq 0x82d0
movsd 0x8(%rsp), %xmm4
movsd 0x18(%rsp), %xmm3
movsd 0x10(%rsp), %xmm2
movapd %xmm0, %xmm1
cmpw $0x1, 0x12(%r15)
jne 0xa40da
mulsd 0x426d2(%rip), %xmm3    # 0xe6748
addsd %xmm3, %xmm4
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm4
jb 0xa408a
sqrtsd %xmm4, %xmm0
jmp 0xa40b1
movapd %xmm4, %xmm0
movsd %xmm1, 0x20(%rsp)
movsd %xmm4, 0x8(%rsp)
callq 0x82d0
movsd 0x8(%rsp), %xmm4
movsd 0x20(%rsp), %xmm1
movsd 0x10(%rsp), %xmm2
ucomisd %xmm1, %xmm0
ja 0xa40da
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm4
jb 0xa40c7
sqrtsd %xmm4, %xmm1
jmp 0xa40da
movapd %xmm4, %xmm0
callq 0x82d0
movsd 0x10(%rsp), %xmm2
movapd %xmm0, %xmm1
movsd %xmm2, 0x10(%rsp)
divsd %xmm2, %xmm1
movapd %xmm1, %xmm0
callq 0x82e0
movsd %xmm0, 0x18(%rsp)
movsd 0x780(%r14), %xmm0
callq 0x82e0
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 0x8490
movq %rax, 0x948(%rbx)
testq %rax, %rax
je 0xa4169
movsd 0x10(%rsp), %xmm0
movsd %xmm0, (%rax)
movl %ebp, %ecx
pushq $0x1
popq %rdx
cmpq %rcx, %rdx
jae 0xa4165
movsd 0x780(%r14), %xmm0
mulsd -0x8(%rax,%rdx,8), %xmm0
movsd %xmm0, (%rax,%rdx,8)
incq %rdx
jmp 0xa4147
xorl %eax, %eax
jmp 0xa41b5
shll $0x3, %ebp
leaq 0x40e91(%rip), %rsi     # 0xe5004
leaq 0x71c87(%rip), %rdx     # 0x115e01
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movl %ebp, %ecx
xorl %eax, %eax
callq 0x2e014
addq $0x96a, %rbx            # imm = 0x96A
leaq 0x40e9b(%rip), %rsi     # 0xe5034
leaq 0x71c6f(%rip), %rdx     # 0x115e0f
movq %rbx, %rdi
movl $0x54c, %ecx            # imm = 0x54C
movq %r14, %r8
xorl %eax, %eax
callq 0x2e014
pushq $0x1
popq %rax
addq $0x838, %rsp            # imm = 0x838
popq %rbx
popq %r14
popq %r15
popq %rbp
retq