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

  int index_q;
  double q,q_min=0.,q_max=0.,q_step,k_max;
  int nu, nu_min, nu_proposed;
  int q_size_max;
  double q_approximation;
  double last_step=0.;
  int last_index=0;
  double q_logstep_spline;
  double q_logstep_trapzd;
  double q_threshold;
  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_cl[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_cl[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_cl[index_md]-1]);
    }
  }

  /* adjust the parameter governing the log step size to curvature */

  q_logstep_spline = ppr->q_logstep_spline/pow(ptr->angular_rescaling,ppr->q_logstep_open);
  q_logstep_trapzd = ppr->q_logstep_trapzd;

  /* slightly conservative estimate of number of values */

  // One can divide the q range into 3 regions:
  // For q_threshold = q_linstep/q_logstep, we can show explicitly that
  // If q<q_threshold , then delta q > q * (1+q_logstep/2)
  // If q< N * q_threshold, then delta q > q + N/(N+1) * q_linstep
  // It makes sense to combine the first range, with the second range for N=1,10,100,...
  // In practice, we don't need percent level, so N=10 is sufficient
  // The total formula then reads
  // N_steps = ln(MIN(q_max,q_threshold)/q_min)/ln(1+b/2) + 18/q_logstep + 11/10 * (q_max-MIN(10 q_threshold, q_max))/(a)
  // The additional MIN/MAX just catch cases where q_max < q_threshold
  // The contribution from the term 18/q_logstep accounts for the range [q_threshold, 10 q_threshold], and in prinicple can be ignored when q_max < q_threshold, BUT
  // since usually q_logstep is of order unity, we neglect this detail, simplifying our lives
  // The +1 is just to always round up
  if (sgnK == 1) {

    q_approximation = MIN(ppr->hyper_flat_approximation_nu,(q_max/sqrt(K)))*sqrt(K);

    /* max contribution from integer nu values */
    q_threshold = ppr->q_linstep/q_logstep_trapzd;

    q_step = 1.+0.5*q_period*q_logstep_trapzd;
    q_size_max = (int)(log(MIN(q_approximation,q_threshold)/q_min)/log(q_step)+1);

    // Either linear q step OR AT LEAST delta nu = 1 until we reach the approximation/q_max
    q_step = MAX(q_period*ppr->q_linstep, 1*sqrt(K));
    q_size_max += (int)(1.1*(q_approximation-MIN(q_min,10*q_threshold))/q_step+18*q_threshold/q_step+1);

    /* max contribution from non-integer nu values */
    q_threshold = ppr->q_linstep/q_logstep_spline;

    q_step = 1.+0.5*q_period*q_logstep_spline;
    q_size_max += (int)(log(MIN(q_max, q_threshold)/q_approximation)/log(q_step)+1);

    q_step = q_period*ppr->q_linstep;
    q_size_max += (int)(1.1*(q_max-MIN(q_max, 10*q_threshold))/q_step+18*q_threshold/q_step+1);

    /* Make a final maximum with a very large number -- 2^25 (~3*10^7)
       If we have that many points, we have a problem anyways
       BUT maybe the integer steps in nu will 'save' us in this case
       In any case, let's try! */
    q_size_max = MIN(q_size_max, 1<<25);
  }
  else {

    /* max contribution from non-integer nu values */
    q_threshold = ppr->q_linstep/q_logstep_spline;

    q_step = 1.+0.5*q_period*q_logstep_spline;
    q_size_max = (int)(log(MIN(q_max, q_threshold)/q_min)/log(q_step)+1);

    q_step = q_period*ppr->q_linstep;
    q_size_max += (int)(1.1*(q_max-MIN(q_max, 10*q_threshold))/q_step+18*q_threshold/q_step+1);

  }

  /* create array with this conservative size estimate. The exact size
     will be readjusted below, after filling the array. */

  class_alloc(ptr->q,
              q_size_max*sizeof(double),
              ptr->error_message);

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

  index_q = 0;
  ptr->q[index_q] = q_min;
  nu = 3;
  index_q++;

  /* loop over the values */

  while (ptr->q[index_q-1] < q_max) {

    class_test(index_q >= q_size_max,ptr->error_message,"buggy q-list definition (q_size=%i)",q_size_max);

    /* step size formula in flat/open case. Step goes gradually from
       logarithmic to linear:

       - in the small q limit, it is logarithmic with: (delta q / q) =
       q_period * q_logstep_spline

       - in the large q limit, it is linear with: (delta q) = q_period
       * ppr->q_linstep
       */

    if (sgnK<=0) {

      q = ptr->q[index_q-1]
        + q_period * ppr->q_linstep * ptr->q[index_q-1]
        / (ptr->q[index_q-1] + ppr->q_linstep/q_logstep_spline);

    }

    /* step size formula in closed case. Same thing excepted that:

       - in the small q limit, the logarithmic step is reduced, being
       given by q_logstep_trapzd, and values are rounded to integer
       values of nu=q/sqrt(K). This happens as long as
       nu<nu_flat_approximation

       - for nu>nu_flat_approximation, the step gradually catches up
       the same expression as in the flat/open case, and there is no
       need to round up to integer nu's.
    */

    else {

      if (nu < (int)ppr->hyper_flat_approximation_nu) {

        q = ptr->q[index_q-1]
          + q_period * ppr->q_linstep * ptr->q[index_q-1]
          / (ptr->q[index_q-1] + ppr->q_linstep/q_logstep_trapzd);

        nu_proposed = (int)(q/sqrt(K));
        if (nu_proposed <= nu+1)
          nu = nu+1;
        else
          nu = nu_proposed;

        q = nu*sqrt(K);
        last_step = q - ptr->q[index_q-1];
        last_index = index_q+1;
      }
      else {

        q_step = q_period * ppr->q_linstep * ptr->q[index_q-1] / (ptr->q[index_q-1] + ppr->q_linstep/q_logstep_spline);

        if (index_q-last_index < (int)ppr->q_numstep_transition)
          q = ptr->q[index_q-1] + (1-(double)(index_q-last_index)/ppr->q_numstep_transition) * last_step + (double)(index_q-last_index)/ppr->q_numstep_transition * q_step;
        else
          q = ptr->q[index_q-1] + q_step;
      }
    }

    ptr->q[index_q] = q;
    index_q++;
  }

  /* infer total number of values (also checking if we overshot the last point) */

  if (ptr->q[index_q-1] > q_max)
    ptr->q_size=index_q-1;
  else
    ptr->q_size=index_q;

  class_test(ptr->q_size<2,ptr->error_message,"buggy q-list definition");

  /* now, readjust array size */

  class_realloc(ptr->q,
                ptr->q_size*sizeof(double),
                ptr->error_message);

  /* in curved universe, check at which index the flat rescaling
     approximation will start being used */

  if (sgnK != 0) {

    q_approximation = ppr->hyper_flat_approximation_nu * sqrt(sgnK*K);
    /* If q_approximation >= q_max, we can skip any computation and conclude we cannot do an approximation */
    if(q_approximation < ptr->q[ptr->q_size-1]){
      /* Otherwise, just find the first index at which the approximation would break */
      for (ptr->index_q_flat_approximation=0;
           ptr->index_q_flat_approximation < ptr->q_size-1;
           ptr->index_q_flat_approximation++) {
        if (ptr->q[ptr->index_q_flat_approximation] > q_approximation) break;
      }
      if (ptr->transfer_verbose > 1)
        printf("Flat bessel approximation spares hyperspherical bessel computations for %zu wavenumbers over a total of %zu\n",
               ptr->q_size-ptr->index_q_flat_approximation,ptr->q_size);
    }
    else{
      ptr->index_q_flat_approximation = ptr->q_size;
      if (ptr->transfer_verbose > 1)
        printf("Cannot use flat bessel approximation, since q_max = %.5e > q_start_approximation = %.5e\n", ptr->q[ptr->q_size-1], q_approximation);
    }
  }

  return _SUCCESS_;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1098, %rsp           # imm = 0x1098
movl %ecx, %ebp
movsd %xmm0, 0x28(%rsp)
movq %rdx, %r13
movq %rsi, %r15
movq %rdi, %r14
cmpl $-0x1, %ecx
je 0xa85b9
xorpd %xmm2, %xmm2
cmpl $0x1, %ebp
je 0xa85ad
xorpd %xmm3, %xmm3
testl %ebp, %ebp
jne 0xa881a
movsd 0x9e0(%r15), %xmm3
movslq 0x854(%r15), %rax
testq %rax, %rax
jle 0xa870c
movq 0x9b8(%r15), %rcx
movq 0x9d0(%r15), %rdx
xorpd %xmm1, %xmm1
xorl %esi, %esi
movapd %xmm2, %xmm0
movq (%rdx,%rsi,8), %rdi
movslq (%rcx,%rsi,4), %r8
movsd -0x8(%rdi,%r8,8), %xmm2
maxsd %xmm0, %xmm2
incq %rsi
cmpq %rsi, %rax
jne 0xa8589
jmp 0xa881a
ucomisd %xmm2, %xmm1
jb 0xa85e0
sqrtsd %xmm1, %xmm3
jmp 0xa85fd
movsd 0x9e0(%r15), %xmm0
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
xorpd %xmm4, %xmm4
ucomisd %xmm4, %xmm0
movsd %xmm1, 0x8(%rsp)
jb 0xa8649
sqrtsd %xmm0, %xmm3
jmp 0xa865c
movapd %xmm1, %xmm0
movsd %xmm1, 0x8(%rsp)
callq 0x82b0
xorpd %xmm2, %xmm2
movsd 0x8(%rsp), %xmm1
movapd %xmm0, %xmm3
mulsd 0x4707b(%rip), %xmm3    # 0xef680
movslq 0x854(%r15), %rax
testq %rax, %rax
jle 0xa881a
movq 0x9b8(%r15), %rcx
movq 0x9d0(%r15), %rdx
xorl %esi, %esi
movapd %xmm2, %xmm0
movq (%rdx,%rsi,8), %rdi
movslq (%rcx,%rsi,4), %r8
movsd -0x8(%rdi,%r8,8), %xmm2
maxsd %xmm0, %xmm2
incq %rsi
cmpq %rsi, %rax
jne 0xa8625
jmp 0xa881a
callq 0x82b0
xorpd %xmm4, %xmm4
movsd 0x8(%rsp), %xmm1
movapd %xmm0, %xmm3
movslq 0x854(%r15), %rax
testq %rax, %rax
jle 0xa869b
movq 0x9b8(%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 0xa867c
mulsd %xmm4, %xmm4
movapd %xmm4, %xmm0
addsd %xmm1, %xmm0
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm0
movsd %xmm3, 0x10(%rsp)
jb 0xa86c0
xorps %xmm2, %xmm2
sqrtsd %xmm0, %xmm2
jmp 0xa86e1
movsd %xmm4, 0x20(%rsp)
callq 0x82b0
movsd 0x20(%rsp), %xmm4
movsd 0x10(%rsp), %xmm3
movsd 0x8(%rsp), %xmm1
movapd %xmm0, %xmm2
cmpw $0x1, 0x10(%r15)
jne 0xa878c
movapd %xmm1, %xmm5
addsd %xmm1, %xmm5
addsd %xmm4, %xmm5
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm5
jb 0xa8715
xorps %xmm0, %xmm0
sqrtsd %xmm5, %xmm0
jmp 0xa874e
xorpd %xmm1, %xmm1
jmp 0xa881a
movapd %xmm5, %xmm0
movsd %xmm2, 0x18(%rsp)
movsd %xmm4, 0x20(%rsp)
movsd %xmm5, 0x60(%rsp)
callq 0x82b0
movsd 0x60(%rsp), %xmm5
movsd 0x20(%rsp), %xmm4
movsd 0x18(%rsp), %xmm2
movsd 0x10(%rsp), %xmm3
movsd 0x8(%rsp), %xmm1
ucomisd %xmm2, %xmm0
ja 0xa878c
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm5
jb 0xa8767
xorps %xmm2, %xmm2
sqrtsd %xmm5, %xmm2
jmp 0xa878c
movapd %xmm5, %xmm0
movsd %xmm4, 0x20(%rsp)
callq 0x82b0
movsd 0x20(%rsp), %xmm4
movsd 0x10(%rsp), %xmm3
movsd 0x8(%rsp), %xmm1
movapd %xmm0, %xmm2
cmpw $0x1, 0x12(%r15)
jne 0xa881a
movsd 0x46ee0(%rip), %xmm0    # 0xef680
mulsd %xmm1, %xmm0
addsd %xmm0, %xmm4
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm4
jb 0xa87bb
xorps %xmm0, %xmm0
sqrtsd %xmm4, %xmm0
jmp 0xa87e8
movapd %xmm4, %xmm0
movsd %xmm2, 0x18(%rsp)
movsd %xmm4, 0x20(%rsp)
callq 0x82b0
movsd 0x20(%rsp), %xmm4
movsd 0x18(%rsp), %xmm2
movsd 0x10(%rsp), %xmm3
movsd 0x8(%rsp), %xmm1
ucomisd %xmm2, %xmm0
ja 0xa881a
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm4
jb 0xa8801
xorps %xmm2, %xmm2
sqrtsd %xmm4, %xmm2
jmp 0xa881a
movapd %xmm4, %xmm0
callq 0x82b0
movsd 0x10(%rsp), %xmm3
movsd 0x8(%rsp), %xmm1
movapd %xmm0, %xmm2
movsd %xmm2, 0x18(%rsp)
movsd %xmm3, 0x10(%rsp)
movsd %xmm1, 0x8(%rsp)
movsd 0x918(%r13), %xmm0
movsd 0x760(%r14), %xmm1
movsd %xmm1, 0x20(%rsp)
movsd 0x768(%r14), %xmm1
callq 0x8620
movsd 0x20(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd 0x770(%r14), %xmm0
movsd %xmm0, 0x60(%rsp)
cmpl $0x1, %ebp
movsd %xmm1, 0x20(%rsp)
jne 0xa889f
movsd 0x750(%r14), %xmm3
xorpd %xmm0, %xmm0
movsd 0x8(%rsp), %xmm2
ucomisd %xmm0, %xmm2
jb 0xa897c
xorps %xmm0, %xmm0
sqrtsd %xmm2, %xmm0
jmp 0xa8997
movsd 0x758(%r14), %xmm2
movsd 0x46420(%rip), %xmm0    # 0xeecd0
mulsd 0x28(%rsp), %xmm0
mulsd %xmm1, %xmm0
addsd 0x4599e(%rip), %xmm0    # 0xee260
movsd %xmm0, 0x40(%rsp)
divsd %xmm1, %xmm2
movapd %xmm2, 0x30(%rsp)
movsd 0x18(%rsp), %xmm0
minsd %xmm2, %xmm0
divsd 0x10(%rsp), %xmm0
callq 0x82c0
movapd %xmm0, 0x50(%rsp)
movsd 0x40(%rsp), %xmm0
callq 0x82c0
movapd 0x50(%rsp), %xmm4
divsd %xmm0, %xmm4
movsd 0x758(%r14), %xmm0
mulsd 0x28(%rsp), %xmm0
movsd 0x45ed7(%rip), %xmm1    # 0xee7f0
movapd 0x30(%rsp), %xmm3
mulsd %xmm3, %xmm1
movsd 0x18(%rsp), %xmm5
movapd %xmm5, %xmm2
minsd %xmm1, %xmm2
movapd %xmm5, %xmm1
subsd %xmm2, %xmm1
unpcklpd %xmm1, %xmm3            # xmm3 = xmm3[0],xmm1[0]
mulpd 0x75a3b(%rip), %xmm3    # 0x11e380
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
divpd %xmm0, %xmm3
movapd %xmm3, %xmm0
unpckhpd %xmm3, %xmm0            # xmm0 = xmm0[1],xmm3[1]
addpd %xmm3, %xmm0
unpcklpd %xmm4, %xmm0            # xmm0 = xmm0[0],xmm4[0]
addpd 0x48fcb(%rip), %xmm0    # 0xf1930
cvttpd2dq %xmm0, %xmm0
pshufd $0x55, %xmm0, %xmm1     # xmm1 = xmm0[1,1,1,1]
paddd %xmm0, %xmm1
movd %xmm1, %r15d
jmp 0xa8c91
movapd %xmm2, %xmm0
movsd %xmm3, 0x30(%rsp)
callq 0x82b0
movsd 0x30(%rsp), %xmm3
movsd 0x8(%rsp), %xmm2
movsd 0x18(%rsp), %xmm4
movapd %xmm4, %xmm1
divsd %xmm0, %xmm1
ucomisd %xmm3, %xmm1
jbe 0xa89c2
movsd 0x750(%r14), %xmm4
movsd 0x28(%rsp), %xmm1
movsd 0x10(%rsp), %xmm3
jmp 0xa89fa
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm2
jb 0xa89d5
xorps %xmm0, %xmm0
sqrtsd %xmm2, %xmm0
jmp 0xa89ea
movapd %xmm2, %xmm0
callq 0x82b0
movsd 0x18(%rsp), %xmm4
movsd 0x8(%rsp), %xmm2
movsd 0x28(%rsp), %xmm1
movsd 0x10(%rsp), %xmm3
divsd %xmm0, %xmm4
xorps %xmm0, %xmm0
sqrtsd %xmm2, %xmm0
xorpd %xmm5, %xmm5
ucomisd %xmm5, %xmm2
movsd %xmm0, 0x68(%rsp)
jae 0xa8a34
movsd 0x8(%rsp), %xmm0
movsd %xmm4, 0x50(%rsp)
callq 0x82b0
movsd 0x50(%rsp), %xmm4
movsd 0x10(%rsp), %xmm3
movsd 0x28(%rsp), %xmm1
mulsd %xmm0, %xmm4
movsd 0x758(%r14), %xmm5
movsd 0x60(%rsp), %xmm0
divsd %xmm0, %xmm5
movsd 0x4627d(%rip), %xmm2    # 0xeecd0
mulsd %xmm1, %xmm2
movsd %xmm2, 0x30(%rsp)
mulsd %xmm0, %xmm2
addsd 0x457f7(%rip), %xmm2    # 0xee260
movsd %xmm2, 0x88(%rsp)
movsd %xmm4, 0x50(%rsp)
movapd %xmm4, %xmm0
movapd %xmm5, 0x70(%rsp)
minsd %xmm5, %xmm0
divsd %xmm3, %xmm0
callq 0x82c0
movsd %xmm0, 0x40(%rsp)
movsd 0x88(%rsp), %xmm0
callq 0x82c0
movsd 0x28(%rsp), %xmm2
movsd 0x40(%rsp), %xmm1
divsd %xmm0, %xmm1
addsd 0x457a5(%rip), %xmm1    # 0xee260
movsd %xmm1, 0x40(%rsp)
movsd 0x758(%r14), %xmm3
mulsd %xmm2, %xmm3
movsd 0x8(%rsp), %xmm1
ucomisd 0x4577c(%rip), %xmm1    # 0xee258
movsd 0x68(%rsp), %xmm0
jae 0xa8b05
movapd %xmm1, %xmm0
movsd %xmm3, 0x68(%rsp)
callq 0x82b0
movsd 0x68(%rsp), %xmm3
movsd 0x28(%rsp), %xmm2
movsd 0x8(%rsp), %xmm1
cvttsd2si 0x40(%rsp), %ebx
ucomisd %xmm3, %xmm0
movsd 0x18(%rsp), %xmm3
jbe 0xa8b2a
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jb 0xa8b49
xorps %xmm0, %xmm0
sqrtsd %xmm1, %xmm0
jmp 0xa8b58
movsd 0x758(%r14), %xmm7
movapd %xmm7, %xmm0
mulsd %xmm2, %xmm0
movsd 0x10(%rsp), %xmm2
movsd 0x20(%rsp), %xmm4
jmp 0xa8b6d
movapd %xmm1, %xmm0
callq 0x82b0
movsd 0x18(%rsp), %xmm3
movsd 0x10(%rsp), %xmm2
movsd 0x20(%rsp), %xmm4
movsd 0x758(%r14), %xmm7
movapd 0x70(%rsp), %xmm6
movapd %xmm6, %xmm1
mulsd 0x45c71(%rip), %xmm1    # 0xee7f0
minsd %xmm1, %xmm2
movsd 0x50(%rsp), %xmm5
movapd %xmm5, %xmm1
subsd %xmm2, %xmm1
unpcklpd %xmm6, %xmm1            # xmm1 = xmm1[0],xmm6[0]
mulpd 0x757f3(%rip), %xmm1    # 0x11e390
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
divpd %xmm0, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movsd 0x456a7(%rip), %xmm1    # 0xee260
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %r15d
addl %ebx, %r15d
movsd 0x30(%rsp), %xmm0
mulsd %xmm4, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp)
divsd %xmm4, %xmm7
movapd %xmm7, 0x40(%rsp)
movapd %xmm3, %xmm0
minsd %xmm7, %xmm0
divsd %xmm5, %xmm0
callq 0x82c0
movsd %xmm0, 0x50(%rsp)
movsd 0x30(%rsp), %xmm0
callq 0x82c0
movsd 0x50(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd 0x45649(%rip), %xmm3    # 0xee260
addsd %xmm3, %xmm1
cvttsd2si %xmm1, %eax
addl %r15d, %eax
movsd 0x758(%r14), %xmm0
mulsd 0x28(%rsp), %xmm0
movsd 0x45bb7(%rip), %xmm2    # 0xee7f0
movapd 0x40(%rsp), %xmm4
mulsd %xmm4, %xmm2
movsd 0x18(%rsp), %xmm5
movapd %xmm5, %xmm1
minsd %xmm2, %xmm1
movapd %xmm5, %xmm2
subsd %xmm1, %xmm2
unpcklpd %xmm2, %xmm4            # xmm4 = xmm4[0],xmm2[0]
mulpd 0x7571b(%rip), %xmm4    # 0x11e380
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
divpd %xmm0, %xmm4
movapd %xmm4, %xmm0
unpckhpd %xmm4, %xmm0            # xmm0 = xmm0[1],xmm4[1]
addsd %xmm4, %xmm0
addsd %xmm3, %xmm0
cvttsd2si %xmm0, %r15d
addl %eax, %r15d
movl $0x2000000, %eax        # imm = 0x2000000
cmpl %eax, %r15d
cmovgel %eax, %r15d
movslq %r15d, %r12
shlq $0x3, %r12
movq %r12, %rdi
callq 0x8460
movq %rax, 0x928(%r13)
testq %rax, %rax
je 0xa8ecf
movsd 0x10(%rsp), %xmm5
movsd %xmm5, (%rax)
xorl %ecx, %ecx
movsd 0x18(%rsp), %xmm6
ucomisd %xmm5, %xmm6
jbe 0xa8f17
movq %r13, 0x30(%rsp)
cmpl $0x2, %r15d
movl $0x1, %r13d
cmovgel %r15d, %r13d
movl $0x3, %ebx
xorpd %xmm8, %xmm8
movl $0x1, %r12d
movsd 0x8(%rsp), %xmm3
sqrtsd %xmm3, %xmm9
xorpd %xmm0, %xmm0
movsd 0x28(%rsp), %xmm4
movsd 0x20(%rsp), %xmm7
movsd %xmm9, 0x40(%rsp)
cmpq %r12, %r13
je 0xa8feb
testl %ebp, %ebp
jle 0xa8e31
cvttsd2si 0x750(%r14), %edx
movsd 0x758(%r14), %xmm1
movapd %xmm1, %xmm10
mulsd %xmm4, %xmm10
mulsd %xmm5, %xmm10
cmpl %edx, %ebx
jge 0xa8e58
ucomisd %xmm8, %xmm3
movapd %xmm9, %xmm0
jae 0xa8daa
movapd %xmm3, %xmm0
movsd %xmm5, 0x10(%rsp)
movsd %xmm10, 0x50(%rsp)
movsd %xmm1, 0x70(%rsp)
callq 0x82b0
movsd 0x70(%rsp), %xmm1
movsd 0x50(%rsp), %xmm10
movsd 0x40(%rsp), %xmm9
xorpd %xmm8, %xmm8
movsd 0x20(%rsp), %xmm7
movsd 0x18(%rsp), %xmm6
movsd 0x10(%rsp), %xmm5
movsd 0x28(%rsp), %xmm4
movsd 0x8(%rsp), %xmm3
divsd 0x60(%rsp), %xmm1
addsd %xmm5, %xmm1
divsd %xmm1, %xmm10
addsd %xmm5, %xmm10
divsd %xmm0, %xmm10
cvttsd2si %xmm10, %eax
incl %ebx
cmpl %eax, %ebx
cmovlel %eax, %ebx
ucomisd %xmm8, %xmm3
movapd %xmm9, %xmm0
jae 0xa8e08
movapd %xmm3, %xmm0
callq 0x82b0
movsd 0x40(%rsp), %xmm9
xorpd %xmm8, %xmm8
movsd 0x20(%rsp), %xmm7
movsd 0x18(%rsp), %xmm6
movsd 0x28(%rsp), %xmm4
movsd 0x8(%rsp), %xmm3
xorps %xmm5, %xmm5
cvtsi2sd %ebx, %xmm5
mulsd %xmm0, %xmm5
movq 0x30(%rsp), %rax
movq 0x928(%rax), %rax
movapd %xmm5, %xmm0
subsd -0x8(%rax,%r12,8), %xmm0
leal 0x1(%r12), %ecx
jmp 0xa8eb0
movsd 0x758(%r14), %xmm1
movapd %xmm1, %xmm2
mulsd %xmm4, %xmm2
mulsd %xmm5, %xmm2
divsd %xmm7, %xmm1
addsd %xmm5, %xmm1
divsd %xmm1, %xmm2
addsd %xmm2, %xmm5
jmp 0xa8eb0
divsd %xmm7, %xmm1
addsd %xmm5, %xmm1
divsd %xmm1, %xmm10
movl %ecx, %edx
negl %edx
addq %r12, %rdx
movsd 0x778(%r14), %xmm1
cvttsd2si %xmm1, %esi
cmpl %esi, %edx
jge 0xa8eab
xorps %xmm2, %xmm2
cvtsi2sd %edx, %xmm2
divsd %xmm1, %xmm2
movsd 0x453d0(%rip), %xmm1    # 0xee260
subsd %xmm2, %xmm1
mulsd %xmm0, %xmm1
addsd %xmm5, %xmm1
mulsd %xmm10, %xmm2
addsd %xmm1, %xmm2
movapd %xmm2, %xmm5
jmp 0xa8eb0
addsd %xmm10, %xmm5
movsd %xmm5, (%rax,%r12,8)
incq %r12
ucomisd %xmm5, %xmm6
ja 0xa8d11
leaq -0x1(%r12), %rcx
movq 0x30(%rsp), %r13
jmp 0xa8f1d
leaq 0x4512e(%rip), %rsi     # 0xee004
leaq 0x75f53(%rip), %rdx     # 0x11ee30
leaq 0x90(%rsp), %r14
movq %r14, %rdi
movl %r12d, %ecx
xorl %eax, %eax
callq 0x30af0
addq $0x96a, %r13            # imm = 0x96A
leaq 0x45134(%rip), %rsi     # 0xee034
leaq 0x75f30(%rip), %rdx     # 0x11ee37
movq %r13, %rdi
movl $0x48a, %ecx            # imm = 0x48A
movq %r14, %r8
jmp 0xa904c
movl $0x1, %r12d
ucomisd %xmm6, %xmm5
cmovaq %rcx, %r12
movq %r12, 0x920(%r13)
cmpq $0x1, %r12
ja 0xa8f90
leaq 0x75f4c(%rip), %rsi     # 0x11ee85
leaq 0x90(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30af0
leaq 0x45130(%rip), %rsi     # 0xee082
leaq 0x75f44(%rip), %rdx     # 0x11ee9d
leaq 0x890(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30af0
addq $0x96a, %r13            # imm = 0x96A
leaq 0x450b8(%rip), %rsi     # 0xee034
leaq 0x75eb4(%rip), %rdx     # 0x11ee37
movq %r13, %rdi
movl $0x4df, %ecx            # imm = 0x4DF
jmp 0xa9049
shlq $0x3, %r12
movq %rax, %rdi
movq %r12, %rsi
callq 0x8590
movq %rax, 0x928(%r13)
testq %rax, %rax
je 0xa906e
xorl %r15d, %r15d
testl %ebp, %ebp
je 0xa9059
movsd 0x750(%r14), %xmm1
xorps %xmm2, %xmm2
cvtsi2sd %ebp, %xmm2
movsd 0x8(%rsp), %xmm0
mulsd %xmm2, %xmm0
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm0
jb 0xa90ba
sqrtsd %xmm0, %xmm0
jmp 0xa90cb
leaq 0x75e59(%rip), %rsi     # 0x11ee4b
leaq 0x90(%rsp), %r14
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x30af0
leaq 0x45074(%rip), %rsi     # 0xee082
leaq 0x75e5a(%rip), %rdx     # 0x11ee6f
leaq 0x890(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30af0
movq 0x30(%rsp), %rdi
addq $0x96a, %rdi            # imm = 0x96A
leaq 0x44ff7(%rip), %rsi     # 0xee034
leaq 0x75df3(%rip), %rdx     # 0x11ee37
movl $0x497, %ecx            # imm = 0x497
movq %r15, %r8
xorl %eax, %eax
callq 0x30af0
movl $0x1, %r15d
movl %r15d, %eax
addq $0x1098, %rsp           # imm = 0x1098
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x920(%r13), %ecx
shll $0x3, %ecx
leaq 0x44f85(%rip), %rsi     # 0xee004
leaq 0x75daa(%rip), %rdx     # 0x11ee30
leaq 0x90(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30af0
addq $0x96a, %r13            # imm = 0x96A
leaq 0x44f8e(%rip), %rsi     # 0xee034
leaq 0x75d8a(%rip), %rdx     # 0x11ee37
movq %r13, %rdi
movl $0x4e5, %ecx            # imm = 0x4E5
jmp 0xa8f0f
movsd %xmm1, 0x18(%rsp)
callq 0x82b0
movsd 0x18(%rsp), %xmm1
mulsd %xmm0, %xmm1
movq 0x920(%r13), %rdx
movq 0x928(%r13), %rax
movsd -0x8(%rax,%rdx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xa9113
xorl %r15d, %r15d
movq %rdx, %rsi
movl $0x0, %ecx
decq %rsi
je 0xa913e
leal -0x1(%rdx), %ecx
xorl %edi, %edi
movsd (%rax,%rdi,8), %xmm0
ucomisd %xmm1, %xmm0
ja 0xa913c
incq %rdi
cmpq %rdi, %rsi
jne 0xa90fe
jmp 0xa913e
movl %edx, 0x938(%r13)
cmpw $0x2, 0x968(%r13)
jl 0xa9059
leaq 0x75de8(%rip), %rdi     # 0x11ef18
movb $0x2, %al
callq 0x8030
jmp 0xa9059
movl %edi, %ecx
movl %ecx, 0x938(%r13)
cmpw $0x2, 0x968(%r13)
jl 0xa9059
movl %ecx, %eax
movq %rdx, %rsi
subq %rax, %rsi
leaq 0x75d48(%rip), %rdi     # 0x11eeab
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x8030
jmp 0xa9059