// File: /workspace/github_c_makefile_star2_O1/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
movsd %xmm0, 0x18(%rsp)
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
cmpl $-0x1, %ecx
movl %ecx, 0x2c(%rsp)
je 0xab5f2
xorpd %xmm2, %xmm2
cmpl $0x1, %ecx
je 0xab5e3
xorpd %xmm0, %xmm0
movsd %xmm0, 0x20(%rsp)
testl %ecx, %ecx
jne 0xab826
movsd 0x9e0(%r15), %xmm0
movsd %xmm0, 0x20(%rsp)
movslq 0x854(%r15), %rax
testq %rax, %rax
jle 0xab738
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 0xab5bf
jmp 0xab826
ucomisd %xmm2, %xmm1
jb 0xab618
xorps %xmm0, %xmm0
sqrtsd %xmm1, %xmm0
jmp 0xab62f
movsd 0x9e0(%r15), %xmm0
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
xorpd %xmm3, %xmm3
ucomisd %xmm3, %xmm0
movsd %xmm1, (%rsp)
jb 0xab681
sqrtsd %xmm0, %xmm0
jmp 0xab68f
movapd %xmm1, %xmm0
movsd %xmm1, (%rsp)
callq 0x82b0
xorpd %xmm2, %xmm2
movsd (%rsp), %xmm1
mulsd 0x47049(%rip), %xmm0    # 0xf2680
movsd %xmm0, 0x20(%rsp)
movslq 0x854(%r15), %rax
testq %rax, %rax
jle 0xab826
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 0xab65d
jmp 0xab826
callq 0x82b0
xorpd %xmm3, %xmm3
movsd (%rsp), %xmm1
movsd %xmm0, 0x20(%rsp)
movslq 0x854(%r15), %rax
testq %rax, %rax
jle 0xab6d4
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), %xmm3
maxsd %xmm0, %xmm3
incq %rsi
movapd %xmm3, %xmm0
cmpq %rsi, %rax
jne 0xab6b5
mulsd %xmm3, %xmm3
movapd %xmm3, %xmm0
addsd %xmm1, %xmm0
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm0
jb 0xab6f3
xorps %xmm2, %xmm2
sqrtsd %xmm0, %xmm2
jmp 0xab70d
movsd %xmm3, 0x10(%rsp)
callq 0x82b0
movsd 0x10(%rsp), %xmm3
movsd (%rsp), %xmm1
movapd %xmm0, %xmm2
cmpw $0x1, 0x10(%r15)
jne 0xab7aa
movapd %xmm1, %xmm4
addsd %xmm1, %xmm4
addsd %xmm3, %xmm4
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm4
jb 0xab741
xorps %xmm0, %xmm0
sqrtsd %xmm4, %xmm0
jmp 0xab773
xorpd %xmm1, %xmm1
jmp 0xab826
movapd %xmm4, %xmm0
movsd %xmm2, 0x8(%rsp)
movsd %xmm3, 0x10(%rsp)
movsd %xmm4, 0x58(%rsp)
callq 0x82b0
movsd 0x58(%rsp), %xmm4
movsd 0x10(%rsp), %xmm3
movsd 0x8(%rsp), %xmm2
movsd (%rsp), %xmm1
ucomisd %xmm2, %xmm0
ja 0xab7aa
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm4
jb 0xab78c
xorps %xmm2, %xmm2
sqrtsd %xmm4, %xmm2
jmp 0xab7aa
movapd %xmm4, %xmm0
movsd %xmm3, 0x10(%rsp)
callq 0x82b0
movsd 0x10(%rsp), %xmm3
movsd (%rsp), %xmm1
movapd %xmm0, %xmm2
cmpw $0x1, 0x12(%r15)
jne 0xab826
movsd 0x46ec6(%rip), %xmm0    # 0xf2680
mulsd %xmm1, %xmm0
addsd %xmm0, %xmm3
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm3
jb 0xab7d5
xorps %xmm0, %xmm0
sqrtsd %xmm3, %xmm0
jmp 0xab7fb
movapd %xmm3, %xmm0
movsd %xmm2, 0x8(%rsp)
movsd %xmm3, 0x10(%rsp)
callq 0x82b0
movsd 0x10(%rsp), %xmm3
movsd 0x8(%rsp), %xmm2
movsd (%rsp), %xmm1
ucomisd %xmm2, %xmm0
ja 0xab826
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm3
jb 0xab814
xorps %xmm2, %xmm2
sqrtsd %xmm3, %xmm2
jmp 0xab826
movapd %xmm3, %xmm0
callq 0x82b0
movsd (%rsp), %xmm1
movapd %xmm0, %xmm2
movsd %xmm2, 0x8(%rsp)
movsd %xmm1, (%rsp)
movsd 0x918(%rbx), %xmm0
movsd 0x760(%r14), %xmm1
movsd %xmm1, 0x10(%rsp)
movsd 0x768(%r14), %xmm1
callq 0x8620
movsd 0x10(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd 0x770(%r14), %xmm0
movsd %xmm0, 0x58(%rsp)
cmpl $0x1, 0x2c(%rsp)
movsd %xmm1, 0x10(%rsp)
jne 0xab8a4
movsd 0x750(%r14), %xmm4
xorpd %xmm0, %xmm0
movsd (%rsp), %xmm2
ucomisd %xmm0, %xmm2
jb 0xab981
xorps %xmm0, %xmm0
sqrtsd %xmm2, %xmm0
jmp 0xab99b
movsd 0x758(%r14), %xmm2
movsd 0x4641b(%rip), %xmm0    # 0xf1cd0
mulsd 0x18(%rsp), %xmm0
mulsd %xmm1, %xmm0
addsd 0x45999(%rip), %xmm0    # 0xf1260
movsd %xmm0, 0x30(%rsp)
divsd %xmm1, %xmm2
movapd %xmm2, 0x40(%rsp)
movsd 0x8(%rsp), %xmm0
minsd %xmm2, %xmm0
divsd 0x20(%rsp), %xmm0
callq 0x82c0
movapd %xmm0, 0x60(%rsp)
movsd 0x30(%rsp), %xmm0
callq 0x82c0
movapd 0x60(%rsp), %xmm4
divsd %xmm0, %xmm4
movsd 0x758(%r14), %xmm0
mulsd 0x18(%rsp), %xmm0
movsd 0x45ed2(%rip), %xmm1    # 0xf17f0
movapd 0x40(%rsp), %xmm3
mulsd %xmm3, %xmm1
movsd 0x8(%rsp), %xmm5
movapd %xmm5, %xmm2
minsd %xmm1, %xmm2
movapd %xmm5, %xmm1
subsd %xmm2, %xmm1
unpcklpd %xmm1, %xmm3            # xmm3 = xmm3[0],xmm1[0]
mulpd 0x759f6(%rip), %xmm3    # 0x121340
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 0x48fb6(%rip), %xmm0    # 0xf4920
cvttpd2dq %xmm0, %xmm0
pshufd $0x55, %xmm0, %xmm1     # xmm1 = xmm0[1,1,1,1]
paddd %xmm0, %xmm1
movd %xmm1, %r15d
jmp 0xabc71
movapd %xmm2, %xmm0
movsd %xmm4, 0x40(%rsp)
callq 0x82b0
movsd 0x40(%rsp), %xmm4
movsd (%rsp), %xmm2
movsd 0x8(%rsp), %xmm3
movapd %xmm3, %xmm1
divsd %xmm0, %xmm1
ucomisd %xmm4, %xmm1
jbe 0xab9c0
movsd 0x750(%r14), %xmm3
movsd 0x18(%rsp), %xmm1
jmp 0xab9f1
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm2
jb 0xab9d3
xorps %xmm0, %xmm0
sqrtsd %xmm2, %xmm0
jmp 0xab9e7
movapd %xmm2, %xmm0
callq 0x82b0
movsd 0x8(%rsp), %xmm3
movsd (%rsp), %xmm2
movsd 0x18(%rsp), %xmm1
divsd %xmm0, %xmm3
xorps %xmm0, %xmm0
sqrtsd %xmm2, %xmm0
xorpd %xmm4, %xmm4
ucomisd %xmm4, %xmm2
movsd %xmm0, 0x70(%rsp)
jae 0xaba24
movsd (%rsp), %xmm0
movsd %xmm3, 0x60(%rsp)
callq 0x82b0
movsd 0x60(%rsp), %xmm3
movsd 0x18(%rsp), %xmm1
mulsd %xmm0, %xmm3
movsd 0x758(%r14), %xmm4
movsd 0x58(%rsp), %xmm0
divsd %xmm0, %xmm4
movsd 0x4628d(%rip), %xmm2    # 0xf1cd0
mulsd %xmm1, %xmm2
movsd %xmm2, 0x40(%rsp)
mulsd %xmm0, %xmm2
addsd 0x45807(%rip), %xmm2    # 0xf1260
movsd %xmm2, 0x78(%rsp)
movsd %xmm3, 0x60(%rsp)
movapd %xmm3, %xmm0
movapd %xmm4, 0x80(%rsp)
minsd %xmm4, %xmm0
divsd 0x20(%rsp), %xmm0
callq 0x82c0
movsd %xmm0, 0x30(%rsp)
movsd 0x78(%rsp), %xmm0
callq 0x82c0
movsd 0x18(%rsp), %xmm2
movsd 0x30(%rsp), %xmm1
divsd %xmm0, %xmm1
addsd 0x457b6(%rip), %xmm1    # 0xf1260
movsd %xmm1, 0x30(%rsp)
movsd 0x758(%r14), %xmm3
mulsd %xmm2, %xmm3
movsd (%rsp), %xmm1
ucomisd 0x4578e(%rip), %xmm1    # 0xf1258
movsd 0x70(%rsp), %xmm0
jae 0xabaf2
movapd %xmm1, %xmm0
movsd %xmm3, 0x70(%rsp)
callq 0x82b0
movsd 0x70(%rsp), %xmm3
movsd 0x18(%rsp), %xmm2
movsd (%rsp), %xmm1
cvttsd2si 0x30(%rsp), %ebp
ucomisd %xmm3, %xmm0
movsd 0x8(%rsp), %xmm3
jbe 0xabb17
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jb 0xabb26
xorps %xmm0, %xmm0
sqrtsd %xmm1, %xmm0
jmp 0xabb35
movsd 0x758(%r14), %xmm0
mulsd %xmm2, %xmm0
jmp 0xabb35
movapd %xmm1, %xmm0
callq 0x82b0
movsd 0x8(%rsp), %xmm3
movsd 0x10(%rsp), %xmm4
movapd 0x80(%rsp), %xmm6
movapd %xmm6, %xmm1
mulsd 0x45ca0(%rip), %xmm1    # 0xf17f0
movsd 0x20(%rsp), %xmm2
minsd %xmm1, %xmm2
movsd 0x60(%rsp), %xmm5
movapd %xmm5, %xmm1
subsd %xmm2, %xmm1
unpcklpd %xmm6, %xmm1            # xmm1 = xmm1[0],xmm6[0]
mulpd 0x757dc(%rip), %xmm1    # 0x121350
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 0x456d0(%rip), %xmm1    # 0xf1260
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %r15d
addl %ebp, %r15d
movsd 0x758(%r14), %xmm2
movsd 0x40(%rsp), %xmm0
mulsd %xmm4, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x40(%rsp)
divsd %xmm4, %xmm2
movapd %xmm2, 0x30(%rsp)
movapd %xmm3, %xmm0
minsd %xmm2, %xmm0
divsd %xmm5, %xmm0
callq 0x82c0
movsd %xmm0, 0x60(%rsp)
movsd 0x40(%rsp), %xmm0
callq 0x82c0
movsd 0x60(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd 0x45669(%rip), %xmm4    # 0xf1260
addsd %xmm4, %xmm1
cvttsd2si %xmm1, %eax
addl %r15d, %eax
movsd 0x758(%r14), %xmm0
mulsd 0x18(%rsp), %xmm0
movsd 0x45bd7(%rip), %xmm2    # 0xf17f0
movapd 0x30(%rsp), %xmm3
mulsd %xmm3, %xmm2
movsd 0x8(%rsp), %xmm5
movapd %xmm5, %xmm1
minsd %xmm2, %xmm1
movapd %xmm5, %xmm2
subsd %xmm1, %xmm2
unpcklpd %xmm2, %xmm3            # xmm3 = xmm3[0],xmm2[0]
mulpd 0x756fb(%rip), %xmm3    # 0x121340
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
divpd %xmm0, %xmm3
movapd %xmm3, %xmm0
unpckhpd %xmm3, %xmm0            # xmm0 = xmm0[1],xmm3[1]
addsd %xmm3, %xmm0
addsd %xmm4, %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(%rbx)
testq %rax, %rax
je 0xabecf
movsd 0x20(%rsp), %xmm0
movsd %xmm0, (%rax)
movq 0x928(%rbx), %rdi
movsd (%rdi), %xmm9
xorl %eax, %eax
movsd 0x8(%rsp), %xmm6
ucomisd %xmm9, %xmm6
jbe 0xabf17
cmpl $0x2, %r15d
movl $0x1, %r13d
cmovgel %r15d, %r13d
movl $0x3, %ebp
xorpd %xmm8, %xmm8
movl $0x1, %r12d
movsd (%rsp), %xmm4
sqrtsd %xmm4, %xmm10
xorpd %xmm0, %xmm0
movl 0x2c(%rsp), %esi
movsd 0x18(%rsp), %xmm5
movsd 0x10(%rsp), %xmm7
movsd %xmm10, 0x20(%rsp)
cmpq %r12, %r13
je 0xabfec
testl %esi, %esi
jle 0xabe14
cvttsd2si 0x750(%r14), %ecx
cmpl %ecx, %ebp
jge 0xabe3e
movsd 0x758(%r14), %xmm2
ucomisd %xmm8, %xmm4
movapd %xmm10, %xmm0
jae 0xabd7d
movapd %xmm4, %xmm0
movsd %xmm9, 0x40(%rsp)
movsd %xmm2, 0x30(%rsp)
callq 0x82b0
movsd 0x30(%rsp), %xmm2
movsd 0x20(%rsp), %xmm10
movsd 0x40(%rsp), %xmm9
xorpd %xmm8, %xmm8
movsd 0x10(%rsp), %xmm7
movsd 0x8(%rsp), %xmm6
movsd 0x18(%rsp), %xmm5
movsd (%rsp), %xmm4
movl 0x2c(%rsp), %esi
movapd %xmm2, %xmm1
mulsd %xmm5, %xmm1
mulsd %xmm9, %xmm1
divsd 0x58(%rsp), %xmm2
addsd %xmm9, %xmm2
divsd %xmm2, %xmm1
addsd %xmm9, %xmm1
divsd %xmm0, %xmm1
cvttsd2si %xmm1, %eax
incl %ebp
cmpl %eax, %ebp
cmovlel %eax, %ebp
ucomisd %xmm8, %xmm4
movapd %xmm10, %xmm0
jae 0xabde9
movapd %xmm4, %xmm0
callq 0x82b0
movsd 0x20(%rsp), %xmm10
xorpd %xmm8, %xmm8
movsd 0x10(%rsp), %xmm7
movsd 0x8(%rsp), %xmm6
movsd 0x18(%rsp), %xmm5
movsd (%rsp), %xmm4
movl 0x2c(%rsp), %esi
xorps %xmm9, %xmm9
cvtsi2sd %ebp, %xmm9
mulsd %xmm0, %xmm9
movq 0x928(%rbx), %rax
movapd %xmm9, %xmm0
subsd -0x8(%rax,%r12,8), %xmm0
leal 0x1(%r12), %eax
jmp 0xabead
movsd 0x758(%r14), %xmm1
movapd %xmm1, %xmm2
mulsd %xmm5, %xmm2
mulsd %xmm9, %xmm2
divsd %xmm7, %xmm1
addsd %xmm9, %xmm1
divsd %xmm1, %xmm2
addsd %xmm2, %xmm9
jmp 0xabead
movsd 0x758(%r14), %xmm3
movsd 0x778(%r14), %xmm2
movapd %xmm3, %xmm1
mulsd %xmm5, %xmm1
mulsd %xmm9, %xmm1
divsd %xmm7, %xmm3
addsd %xmm9, %xmm3
divsd %xmm3, %xmm1
movl %eax, %ecx
negl %ecx
addq %r12, %rcx
cvttsd2si %xmm2, %edx
cmpl %edx, %ecx
jge 0xabea8
xorps %xmm3, %xmm3
cvtsi2sd %ecx, %xmm3
divsd %xmm2, %xmm3
movsd 0x453d4(%rip), %xmm2    # 0xf1260
subsd %xmm3, %xmm2
mulsd %xmm0, %xmm2
addsd %xmm9, %xmm2
mulsd %xmm1, %xmm3
addsd %xmm2, %xmm3
movapd %xmm3, %xmm9
jmp 0xabead
addsd %xmm1, %xmm9
movq 0x928(%rbx), %rdi
movsd %xmm9, (%rdi,%r12,8)
incq %r12
ucomisd %xmm9, %xmm6
ja 0xabcfc
leaq -0x1(%r12), %rax
jmp 0xabf1d
leaq 0x4512e(%rip), %rsi     # 0xf1004
leaq 0x75f13(%rip), %rdx     # 0x121df0
leaq 0x90(%rsp), %r14
movq %r14, %rdi
movl %r12d, %ecx
xorl %eax, %eax
callq 0x30c2c
addq $0x96a, %rbx            # imm = 0x96A
leaq 0x45134(%rip), %rsi     # 0xf1034
leaq 0x75ef0(%rip), %rdx     # 0x121df7
movq %rbx, %rdi
movl $0x48a, %ecx            # imm = 0x48A
movq %r14, %r8
jmp 0xac04b
movl $0x1, %r12d
ucomisd %xmm6, %xmm9
cmovaq %rax, %r12
movq %r12, 0x920(%rbx)
cmpq $0x1, %r12
ja 0xabf91
leaq 0x75f0b(%rip), %rsi     # 0x121e45
leaq 0x90(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30c2c
leaq 0x4512f(%rip), %rsi     # 0xf1082
leaq 0x75f03(%rip), %rdx     # 0x121e5d
leaq 0x890(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c2c
addq $0x96a, %rbx            # imm = 0x96A
leaq 0x450b7(%rip), %rsi     # 0xf1034
leaq 0x75e73(%rip), %rdx     # 0x121df7
movq %rbx, %rdi
movl $0x4df, %ecx            # imm = 0x4DF
jmp 0xac048
shlq $0x3, %r12
movq %r12, %rsi
callq 0x8590
movq %rax, 0x928(%rbx)
testq %rax, %rax
je 0xac06d
xorl %r15d, %r15d
movl 0x2c(%rsp), %eax
testl %eax, %eax
je 0xac058
movsd 0x750(%r14), %xmm1
xorps %xmm2, %xmm2
cvtsi2sd %eax, %xmm2
movsd (%rsp), %xmm0
mulsd %xmm2, %xmm0
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm0
jb 0xac0b8
sqrtsd %xmm0, %xmm0
jmp 0xac0c9
leaq 0x75e18(%rip), %rsi     # 0x121e0b
leaq 0x90(%rsp), %r14
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x30c2c
leaq 0x45073(%rip), %rsi     # 0xf1082
leaq 0x75e19(%rip), %rdx     # 0x121e2f
leaq 0x890(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c2c
addq $0x96a, %rbx            # imm = 0x96A
leaq 0x44ffb(%rip), %rsi     # 0xf1034
leaq 0x75db7(%rip), %rdx     # 0x121df7
movq %rbx, %rdi
movl $0x497, %ecx            # imm = 0x497
movq %r15, %r8
xorl %eax, %eax
callq 0x30c2c
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(%rbx), %ecx
shll $0x3, %ecx
leaq 0x44f87(%rip), %rsi     # 0xf1004
leaq 0x75d6c(%rip), %rdx     # 0x121df0
leaq 0x90(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30c2c
addq $0x96a, %rbx            # imm = 0x96A
leaq 0x44f90(%rip), %rsi     # 0xf1034
leaq 0x75d4c(%rip), %rdx     # 0x121df7
movq %rbx, %rdi
movl $0x4e5, %ecx            # imm = 0x4E5
jmp 0xabf0f
movsd %xmm1, 0x8(%rsp)
callq 0x82b0
movsd 0x8(%rsp), %xmm1
mulsd %xmm0, %xmm1
movq 0x920(%rbx), %rdx
movq 0x928(%rbx), %rax
movsd -0x8(%rax,%rdx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xac111
xorl %r15d, %r15d
movq %rdx, %rsi
movl $0x0, %ecx
decq %rsi
je 0xac13a
leal -0x1(%rdx), %ecx
xorl %edi, %edi
movsd (%rax,%rdi,8), %xmm0
ucomisd %xmm1, %xmm0
ja 0xac138
incq %rdi
cmpq %rdi, %rsi
jne 0xac0fc
jmp 0xac13a
movl %edx, 0x938(%rbx)
cmpw $0x2, 0x968(%rbx)
jl 0xac058
leaq 0x75dac(%rip), %rdi     # 0x121ed8
movb $0x2, %al
callq 0x8030
jmp 0xac058
movl %edi, %ecx
movl %ecx, 0x938(%rbx)
cmpw $0x2, 0x968(%rbx)
jl 0xac058
movl %ecx, %eax
movq %rdx, %rsi
subq %rax, %rsi
leaq 0x75d0e(%rip), %rdi     # 0x121e6b
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x8030
jmp 0xac058