// File: /workspace/github_c_makefile_star2_O2/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, 0x20(%rsp)
movq %rdx, %rbp
movq %rsi, %r15
movq %rdi, %r14
cmpl $-0x1, %ecx
movl %ecx, 0x2c(%rsp)
movsd %xmm1, (%rsp)
je 0xa32f9
xorpd %xmm2, %xmm2
cmpl $0x1, %ecx
je 0xa32ed
xorpd %xmm3, %xmm3
testl %ecx, %ecx
jne 0xa3524
movsd 0x9e0(%r15), %xmm3
movl 0x854(%r15), %eax
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
cmpq %rcx, %rax
je 0xa331a
movq 0x9b8(%r15), %rdx
movq 0x9d0(%r15), %rsi
movq (%rsi,%rcx,8), %rsi
movslq (%rdx,%rcx,4), %rdx
movsd -0x8(%rsi,%rdx,8), %xmm0
maxsd %xmm2, %xmm0
incq %rcx
movapd %xmm0, %xmm2
jmp 0xa32bf
ucomisd %xmm2, %xmm1
jb 0xa3328
sqrtsd %xmm1, %xmm3
jmp 0xa3339
movsd 0x9e0(%r15), %xmm0
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
xorpd %xmm4, %xmm4
ucomisd %xmm4, %xmm0
jb 0xa3382
sqrtsd %xmm0, %xmm3
jmp 0xa3394
xorpd %xmm0, %xmm0
movsd %xmm0, (%rsp)
jmp 0xa3524
movapd %xmm1, %xmm0
callq 0x82d0
xorpd %xmm2, %xmm2
movapd %xmm0, %xmm3
movl 0x854(%r15), %eax
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
cmpq %rcx, %rax
je 0xa3375
movq 0x9b8(%r15), %rdx
movq 0x9d0(%r15), %rsi
movq (%rsi,%rcx,8), %rsi
movslq (%rdx,%rcx,4), %rdx
movsd -0x8(%rsi,%rdx,8), %xmm0
maxsd %xmm2, %xmm0
incq %rcx
movapd %xmm0, %xmm2
jmp 0xa3347
mulsd 0x433cb(%rip), %xmm3    # 0xe6748
jmp 0xa3524
callq 0x82d0
xorpd %xmm4, %xmm4
movsd (%rsp), %xmm1
movapd %xmm0, %xmm3
movl 0x854(%r15), %eax
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
cmpq %rcx, %rax
je 0xa33d0
movq 0x9b8(%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 0xa33a2
mulsd %xmm4, %xmm4
movapd %xmm4, %xmm0
addsd %xmm1, %xmm0
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm0
movsd %xmm3, 0x8(%rsp)
jb 0xa33f2
sqrtsd %xmm0, %xmm2
jmp 0xa3412
movsd %xmm4, 0x10(%rsp)
callq 0x82d0
movsd 0x10(%rsp), %xmm4
movsd 0x8(%rsp), %xmm3
movsd (%rsp), %xmm1
movapd %xmm0, %xmm2
cmpw $0x1, 0x10(%r15)
jne 0xa34ac
movapd %xmm1, %xmm5
addsd %xmm1, %xmm5
addsd %xmm4, %xmm5
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm5
jb 0xa343a
sqrtsd %xmm5, %xmm0
jmp 0xa3472
movapd %xmm5, %xmm0
movsd %xmm2, 0x18(%rsp)
movsd %xmm4, 0x10(%rsp)
movsd %xmm5, 0x60(%rsp)
callq 0x82d0
movsd 0x60(%rsp), %xmm5
movsd 0x10(%rsp), %xmm4
movsd 0x18(%rsp), %xmm2
movsd 0x8(%rsp), %xmm3
movsd (%rsp), %xmm1
ucomisd %xmm2, %xmm0
ja 0xa34ac
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm5
jb 0xa3488
sqrtsd %xmm5, %xmm2
jmp 0xa34ac
movapd %xmm5, %xmm0
movsd %xmm4, 0x10(%rsp)
callq 0x82d0
movsd 0x10(%rsp), %xmm4
movsd 0x8(%rsp), %xmm3
movsd (%rsp), %xmm1
movapd %xmm0, %xmm2
cmpw $0x1, 0x12(%r15)
jne 0xa3524
movsd 0x4328c(%rip), %xmm0    # 0xe6748
mulsd %xmm1, %xmm0
addsd %xmm0, %xmm4
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm4
jb 0xa34d4
sqrtsd %xmm4, %xmm0
jmp 0xa34fb
movapd %xmm4, %xmm0
movsd %xmm2, 0x18(%rsp)
movsd %xmm4, 0x10(%rsp)
callq 0x82d0
movsd 0x10(%rsp), %xmm4
movsd 0x18(%rsp), %xmm2
movsd 0x8(%rsp), %xmm3
ucomisd %xmm2, %xmm0
ja 0xa3524
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm4
jb 0xa3511
sqrtsd %xmm4, %xmm2
jmp 0xa3524
movapd %xmm4, %xmm0
callq 0x82d0
movsd 0x8(%rsp), %xmm3
movapd %xmm0, %xmm2
movsd %xmm2, 0x18(%rsp)
movsd %xmm3, 0x8(%rsp)
movsd 0x918(%rbp), %xmm0
movsd 0x760(%r14), %xmm1
movsd %xmm1, 0x10(%rsp)
movsd 0x768(%r14), %xmm1
callq 0x8650
movsd 0x10(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd 0x770(%r14), %xmm0
movsd %xmm0, 0x60(%rsp)
cmpl $0x1, 0x2c(%rsp)
movsd %xmm1, 0x10(%rsp)
jne 0xa35a0
movsd 0x750(%r14), %xmm3
xorpd %xmm0, %xmm0
movsd (%rsp), %xmm2
ucomisd %xmm0, %xmm2
jb 0xa367d
sqrtsd %xmm2, %xmm0
jmp 0xa3697
movsd 0x758(%r14), %xmm2
movsd 0x426ff(%rip), %xmm0    # 0xe5cb0
mulsd 0x20(%rsp), %xmm0
mulsd %xmm1, %xmm0
addsd 0x41c9d(%rip), %xmm0    # 0xe5260
movsd %xmm0, 0x50(%rsp)
divsd %xmm1, %xmm2
movapd %xmm2, 0x40(%rsp)
movsd 0x18(%rsp), %xmm0
minsd %xmm2, %xmm0
divsd 0x8(%rsp), %xmm0
callq 0x82e0
movapd %xmm0, 0x30(%rsp)
movsd 0x50(%rsp), %xmm0
callq 0x82e0
movapd 0x30(%rsp), %xmm4
divsd %xmm0, %xmm4
movsd 0x758(%r14), %xmm0
mulsd 0x20(%rsp), %xmm0
movsd 0x421d6(%rip), %xmm1    # 0xe57f0
movapd 0x40(%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 0x71bda(%rip), %xmm3    # 0x115220
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 0x451ea(%rip), %xmm0    # 0xe8850
cvttpd2dq %xmm0, %xmm0
pshufd $0x55, %xmm0, %xmm1     # xmm1 = xmm0[1,1,1,1]
paddd %xmm0, %xmm1
movd %xmm1, %r15d
jmp 0xa3995
movapd %xmm2, %xmm0
movsd %xmm3, 0x40(%rsp)
callq 0x82d0
movsd 0x40(%rsp), %xmm3
movsd (%rsp), %xmm2
movsd 0x18(%rsp), %xmm4
movapd %xmm4, %xmm1
divsd %xmm0, %xmm1
ucomisd %xmm3, %xmm1
jbe 0xa36c2
movsd 0x750(%r14), %xmm4
movsd 0x20(%rsp), %xmm1
movsd 0x8(%rsp), %xmm3
jmp 0xa36f6
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm2
jb 0xa36d2
sqrtsd %xmm2, %xmm0
jmp 0xa36e6
movapd %xmm2, %xmm0
callq 0x82d0
movsd 0x18(%rsp), %xmm4
movsd (%rsp), %xmm2
movsd 0x20(%rsp), %xmm1
movsd 0x8(%rsp), %xmm3
divsd %xmm0, %xmm4
movsd %xmm2, (%rsp)
sqrtsd %xmm2, %xmm0
xorpd %xmm5, %xmm5
ucomisd %xmm5, %xmm2
movsd %xmm0, 0x68(%rsp)
jae 0xa3731
movsd (%rsp), %xmm0
movsd %xmm4, 0x30(%rsp)
callq 0x82d0
movsd 0x30(%rsp), %xmm4
movsd 0x8(%rsp), %xmm3
movsd 0x20(%rsp), %xmm1
mulsd %xmm0, %xmm4
movsd 0x758(%r14), %xmm5
movsd 0x60(%rsp), %xmm0
divsd %xmm0, %xmm5
movsd 0x42560(%rip), %xmm2    # 0xe5cb0
mulsd %xmm1, %xmm2
movsd %xmm2, 0x40(%rsp)
mulsd %xmm0, %xmm2
addsd 0x41afa(%rip), %xmm2    # 0xe5260
movsd %xmm2, 0x88(%rsp)
movsd %xmm4, 0x30(%rsp)
movapd %xmm4, %xmm0
movapd %xmm5, 0x70(%rsp)
minsd %xmm5, %xmm0
divsd %xmm3, %xmm0
callq 0x82e0
movsd %xmm0, 0x50(%rsp)
movsd 0x88(%rsp), %xmm0
callq 0x82e0
movsd 0x20(%rsp), %xmm2
movsd 0x50(%rsp), %xmm1
divsd %xmm0, %xmm1
addsd 0x41aa8(%rip), %xmm1    # 0xe5260
movsd %xmm1, 0x50(%rsp)
movsd 0x758(%r14), %xmm3
mulsd %xmm2, %xmm3
movsd (%rsp), %xmm1
ucomisd 0x41a80(%rip), %xmm1    # 0xe5258
movsd 0x68(%rsp), %xmm0
jae 0xa3800
movapd %xmm1, %xmm0
movsd %xmm3, 0x68(%rsp)
callq 0x82d0
movsd 0x68(%rsp), %xmm3
movsd 0x20(%rsp), %xmm2
movsd (%rsp), %xmm1
cvttsd2si 0x50(%rsp), %ebx
ucomisd %xmm3, %xmm0
movsd 0x18(%rsp), %xmm3
jbe 0xa3822
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jb 0xa384d
sqrtsd %xmm1, %xmm0
jmp 0xa385c
movsd 0x758(%r14), %xmm7
movapd %xmm7, %xmm0
mulsd %xmm2, %xmm0
movsd 0x8(%rsp), %xmm2
movsd 0x10(%rsp), %xmm4
movsd 0x30(%rsp), %xmm5
movapd 0x70(%rsp), %xmm6
jmp 0xa387d
movapd %xmm1, %xmm0
callq 0x82d0
movsd 0x18(%rsp), %xmm3
movsd 0x8(%rsp), %xmm2
movsd 0x10(%rsp), %xmm4
movsd 0x30(%rsp), %xmm5
movapd 0x70(%rsp), %xmm6
movsd 0x758(%r14), %xmm7
movapd %xmm6, %xmm1
mulsd 0x41f67(%rip), %xmm1    # 0xe57f0
minsd %xmm1, %xmm2
movapd %xmm5, %xmm1
subsd %xmm2, %xmm1
unpcklpd %xmm6, %xmm1            # xmm1 = xmm1[0],xmm6[0]
mulpd 0x7198f(%rip), %xmm1    # 0x115230
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 0x419a3(%rip), %xmm1    # 0xe5260
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %r15d
addl %ebx, %r15d
movsd 0x40(%rsp), %xmm0
mulsd %xmm4, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x40(%rsp)
divsd %xmm4, %xmm7
movapd %xmm7, 0x50(%rsp)
movapd %xmm3, %xmm0
minsd %xmm7, %xmm0
divsd %xmm5, %xmm0
callq 0x82e0
movsd %xmm0, 0x30(%rsp)
movsd 0x40(%rsp), %xmm0
callq 0x82e0
movsd 0x30(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd 0x41945(%rip), %xmm3    # 0xe5260
addsd %xmm3, %xmm1
cvttsd2si %xmm1, %eax
addl %r15d, %eax
movsd 0x758(%r14), %xmm0
mulsd 0x20(%rsp), %xmm0
movsd 0x41eb3(%rip), %xmm2    # 0xe57f0
movapd 0x50(%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 0x718b7(%rip), %xmm4    # 0x115220
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, %r13
leaq (,%r13,8), %r12
movq %r12, %rdi
callq 0x8490
movq %rax, 0x928(%rbp)
testq %rax, %rax
je 0xa3bad
movsd (%rsp), %xmm3
sqrtsd %xmm3, %xmm8
movsd 0x8(%rsp), %xmm5
movsd %xmm5, (%rax)
xorl %ecx, %ecx
xorpd %xmm9, %xmm9
pushq $0x3
popq %rbx
pushq $0x1
popq %r12
xorpd %xmm0, %xmm0
movl 0x2c(%rsp), %edi
movsd 0x20(%rsp), %xmm4
movsd 0x18(%rsp), %xmm6
movsd 0x10(%rsp), %xmm7
movsd %xmm8, 0x40(%rsp)
ucomisd %xmm5, %xmm6
jbe 0xa3bf5
cmpq %r13, %r12
jge 0xa3c6e
testl %edi, %edi
jle 0xa3b23
cvttsd2si 0x750(%r14), %edx
movsd 0x758(%r14), %xmm1
movapd %xmm1, %xmm10
mulsd %xmm4, %xmm10
mulsd %xmm5, %xmm10
cmpl %edx, %ebx
jge 0xa3b4a
ucomisd %xmm9, %xmm3
movapd %xmm8, %xmm0
jae 0xa3aa1
movapd %xmm3, %xmm0
movsd %xmm5, 0x8(%rsp)
movsd %xmm10, 0x50(%rsp)
movsd %xmm1, 0x30(%rsp)
callq 0x82d0
movsd 0x30(%rsp), %xmm1
movsd 0x50(%rsp), %xmm10
xorpd %xmm9, %xmm9
movsd 0x40(%rsp), %xmm8
movsd 0x10(%rsp), %xmm7
movsd 0x18(%rsp), %xmm6
movsd 0x8(%rsp), %xmm5
movsd 0x20(%rsp), %xmm4
movsd (%rsp), %xmm3
movl 0x2c(%rsp), %edi
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 %xmm9, %xmm3
movapd %xmm8, %xmm0
jae 0xa3b02
movapd %xmm3, %xmm0
callq 0x82d0
xorpd %xmm9, %xmm9
movsd 0x40(%rsp), %xmm8
movsd 0x10(%rsp), %xmm7
movsd 0x18(%rsp), %xmm6
movsd 0x20(%rsp), %xmm4
movsd (%rsp), %xmm3
movl 0x2c(%rsp), %edi
cvtsi2sd %ebx, %xmm5
mulsd %xmm0, %xmm5
movq 0x928(%rbp), %rax
movapd %xmm5, %xmm0
subsd -0x8(%rax,%r12,8), %xmm0
leal 0x1(%r12), %ecx
jmp 0xa3b9f
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 0xa3b9f
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 0xa3b9a
cvtsi2sd %edx, %xmm2
divsd %xmm1, %xmm2
movsd 0x416e1(%rip), %xmm1    # 0xe5260
subsd %xmm2, %xmm1
mulsd %xmm0, %xmm1
addsd %xmm5, %xmm1
mulsd %xmm10, %xmm2
addsd %xmm1, %xmm2
movapd %xmm2, %xmm5
jmp 0xa3b9f
addsd %xmm10, %xmm5
movsd %xmm5, (%rax,%r12,8)
incq %r12
jmp 0xa39fb
leaq 0x41450(%rip), %rsi     # 0xe5004
leaq 0x72105(%rip), %rdx     # 0x115cc0
leaq 0x90(%rsp), %r14
movq %r14, %rdi
movl %r12d, %ecx
xorl %eax, %eax
callq 0x2e014
addq $0x96a, %rbp            # imm = 0x96A
leaq 0x41456(%rip), %rsi     # 0xe5034
leaq 0x720e2(%rip), %rdx     # 0x115cc7
movq %rbp, %rdi
movl $0x48a, %ecx            # imm = 0x48A
movq %r14, %r8
jmp 0xa3ccd
ucomisd %xmm6, %xmm5
leaq -0x1(%r12), %rsi
cmovbeq %r12, %rsi
movq %rsi, 0x920(%rbp)
cmpq $0x1, %rsi
ja 0xa3ced
leaq 0x720fb(%rip), %rsi     # 0x115d15
leaq 0x90(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
leaq 0x4144f(%rip), %rsi     # 0xe5082
leaq 0x720f3(%rip), %rdx     # 0x115d2d
leaq 0x890(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x2e014
addq $0x96a, %rbp            # imm = 0x96A
leaq 0x413d7(%rip), %rsi     # 0xe5034
leaq 0x72063(%rip), %rdx     # 0x115cc7
movq %rbp, %rdi
movl $0x4df, %ecx            # imm = 0x4DF
jmp 0xa3cca
leaq 0x72066(%rip), %rsi     # 0x115cdb
leaq 0x90(%rsp), %r14
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x2e014
leaq 0x413f1(%rip), %rsi     # 0xe5082
leaq 0x72067(%rip), %rdx     # 0x115cff
leaq 0x890(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x2e014
addq $0x96a, %rbp            # imm = 0x96A
leaq 0x41379(%rip), %rsi     # 0xe5034
leaq 0x72005(%rip), %rdx     # 0x115cc7
movq %rbp, %rdi
movl $0x497, %ecx            # imm = 0x497
movq %r15, %r8
xorl %eax, %eax
callq 0x2e014
pushq $0x1
popq %r15
movl %r15d, %eax
addq $0x1098, %rsp           # imm = 0x1098
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x85c0
movq %rax, 0x928(%rbp)
testq %rax, %rax
je 0xa3d36
xorl %r15d, %r15d
movl 0x2c(%rsp), %eax
testl %eax, %eax
je 0xa3cd8
movsd 0x750(%r14), %xmm1
cvtsi2sd %eax, %xmm2
movsd (%rsp), %xmm0
mulsd %xmm2, %xmm0
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm0
jb 0xa3d81
sqrtsd %xmm0, %xmm0
jmp 0xa3d90
movl 0x920(%rbp), %ecx
shll $0x3, %ecx
leaq 0x412be(%rip), %rsi     # 0xe5004
leaq 0x71f73(%rip), %rdx     # 0x115cc0
leaq 0x90(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
addq $0x96a, %rbp            # imm = 0x96A
leaq 0x412c7(%rip), %rsi     # 0xe5034
leaq 0x71f53(%rip), %rdx     # 0x115cc7
movq %rbp, %rdi
movl $0x4e5, %ecx            # imm = 0x4E5
jmp 0xa3bed
movsd %xmm1, (%rsp)
callq 0x82d0
movsd (%rsp), %xmm1
mulsd %xmm0, %xmm1
movq 0x920(%rbp), %rdx
movq 0x928(%rbp), %rcx
movsd -0x8(%rcx,%rdx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xa3dcc
leaq -0x1(%rdx), %rsi
leal -0x1(%rdx), %eax
xorl %edi, %edi
cmpq %rdi, %rsi
je 0xa3df5
movsd (%rcx,%rdi,8), %xmm0
ucomisd %xmm1, %xmm0
ja 0xa3df3
incq %rdi
jmp 0xa3db7
movl %edx, 0x938(%rbp)
cmpw $0x2, 0x968(%rbp)
jl 0xa3cd8
leaq 0x71fc1(%rip), %rdi     # 0x115da8
movb $0x2, %al
callq 0x8030
jmp 0xa3cd8
movl %edi, %eax
movl %eax, 0x938(%rbp)
xorl %r15d, %r15d
cmpw $0x2, 0x968(%rbp)
jl 0xa3cd8
movl %eax, %eax
movq %rdx, %rsi
subq %rax, %rsi
leaq 0x71f20(%rip), %rdi     # 0x115d3b
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x8030
jmp 0xa3cd8