// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x31b8, %rsp           # imm = 0x31B8
movq %rdi, 0x31a8(%rsp)
movq %rsi, 0x31a0(%rsp)
movq %rdx, 0x3198(%rsp)
movsd %xmm0, 0x3190(%rsp)
movsd %xmm1, 0x3188(%rsp)
movl %ecx, 0x3184(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x3170(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x3168(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x3138(%rsp)
movl $0x0, 0x3134(%rsp)
cmpl $0x0, 0x3184(%rsp)
jne 0x137dd5
movq 0x31a0(%rsp), %rax
movsd 0x9e0(%rax), %xmm0
movsd %xmm0, 0x3170(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x3168(%rsp)
movl $0x0, 0x3114(%rsp)
movl 0x3114(%rsp), %eax
movq 0x31a0(%rsp), %rcx
cmpl 0x854(%rcx), %eax
jge 0x137dc4
movsd 0x3168(%rsp), %xmm1
movq 0x31a0(%rsp), %rax
movq 0x9d0(%rax), %rax
movslq 0x3114(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x31a0(%rsp), %rcx
movq 0x9b8(%rcx), %rcx
movslq 0x3114(%rsp), %rdx
movl (%rcx,%rdx,4), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x137d8a
movq 0x31a0(%rsp), %rax
movq 0x9d0(%rax), %rax
movslq 0x3114(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x31a0(%rsp), %rcx
movq 0x9b8(%rcx), %rcx
movslq 0x3114(%rsp), %rdx
movl (%rcx,%rdx,4), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0xf8(%rsp)
jmp 0x137d9c
movsd 0x3168(%rsp), %xmm0
movsd %xmm0, 0xf8(%rsp)
movsd 0xf8(%rsp), %xmm0
movsd %xmm0, 0x3168(%rsp)
movl 0x3114(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3114(%rsp)
jmp 0x137cd5
xorps %xmm0, %xmm0
movsd %xmm0, 0x3188(%rsp)
jmp 0x138246
cmpl $-0x1, 0x3184(%rsp)
jne 0x1380e8
movq 0x31a0(%rsp), %rax
movsd 0x9e0(%rax), %xmm0
movq 0x31a0(%rsp), %rax
movsd 0x9e0(%rax), %xmm2
movsd 0x3188(%rsp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x82e0
movsd %xmm0, 0x3170(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x3158(%rsp)
movl $0x0, 0x3114(%rsp)
movl 0x3114(%rsp), %eax
movq 0x31a0(%rsp), %rcx
cmpl 0x854(%rcx), %eax
jge 0x137f28
movsd 0x3158(%rsp), %xmm1
movq 0x31a0(%rsp), %rax
movq 0x9d0(%rax), %rax
movslq 0x3114(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x31a0(%rsp), %rcx
movq 0x9b8(%rcx), %rcx
movslq 0x3114(%rsp), %rdx
movl (%rcx,%rdx,4), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x137eee
movq 0x31a0(%rsp), %rax
movq 0x9d0(%rax), %rax
movslq 0x3114(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x31a0(%rsp), %rcx
movq 0x9b8(%rcx), %rcx
movslq 0x3114(%rsp), %rdx
movl (%rcx,%rdx,4), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0xf0(%rsp)
jmp 0x137f00
movsd 0x3158(%rsp), %xmm0
movsd %xmm0, 0xf0(%rsp)
movsd 0xf0(%rsp), %xmm0
movsd %xmm0, 0x3158(%rsp)
movl 0x3114(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3114(%rsp)
jmp 0x137e39
movsd 0x3158(%rsp), %xmm0
movsd 0x3158(%rsp), %xmm2
movsd 0x3188(%rsp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x82e0
movsd %xmm0, 0x3168(%rsp)
movq 0x31a0(%rsp), %rax
movswl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0x13801e
movsd 0x3168(%rsp), %xmm0
movsd %xmm0, 0xe8(%rsp)
movsd 0x3158(%rsp), %xmm0
movsd 0x3158(%rsp), %xmm2
movsd 0x9ace6(%rip), %xmm1    # 0x1d2c80
mulsd 0x3188(%rsp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x82e0
movsd 0xe8(%rsp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x137fd3
movsd 0x3168(%rsp), %xmm0
movsd %xmm0, 0xe0(%rsp)
jmp 0x13800c
movsd 0x3158(%rsp), %xmm0
movsd 0x3158(%rsp), %xmm2
movsd 0x9ac93(%rip), %xmm1    # 0x1d2c80
mulsd 0x3188(%rsp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x82e0
movsd %xmm0, 0xe0(%rsp)
movsd 0xe0(%rsp), %xmm0
movsd %xmm0, 0x3168(%rsp)
movq 0x31a0(%rsp), %rax
movswl 0x12(%rax), %eax
cmpl $0x1, %eax
jne 0x1380e3
movsd 0x3168(%rsp), %xmm0
movsd %xmm0, 0xd8(%rsp)
movsd 0x3158(%rsp), %xmm0
movsd 0x3158(%rsp), %xmm2
movsd 0x9b639(%rip), %xmm1    # 0x1d3698
mulsd 0x3188(%rsp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x82e0
movsd 0xd8(%rsp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x138098
movsd 0x3168(%rsp), %xmm0
movsd %xmm0, 0xd0(%rsp)
jmp 0x1380d1
movsd 0x3158(%rsp), %xmm0
movsd 0x3158(%rsp), %xmm2
movsd 0x9b5e6(%rip), %xmm1    # 0x1d3698
mulsd 0x3188(%rsp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x82e0
movsd %xmm0, 0xd0(%rsp)
movsd 0xd0(%rsp), %xmm0
movsd %xmm0, 0x3168(%rsp)
jmp 0x138244
cmpl $0x1, 0x3184(%rsp)
jne 0x138242
movl $0x3, 0x3150(%rsp)
cvtsi2sdl 0x3150(%rsp), %xmm0
movsd %xmm0, 0xc8(%rsp)
movsd 0x3188(%rsp), %xmm0
callq 0x82e0
movaps %xmm0, %xmm1
movsd 0xc8(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x3170(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x3168(%rsp)
movl $0x0, 0x3114(%rsp)
movl 0x3114(%rsp), %eax
movq 0x31a0(%rsp), %rcx
cmpl 0x854(%rcx), %eax
jge 0x138240
movsd 0x3168(%rsp), %xmm1
movq 0x31a0(%rsp), %rax
movq 0x9d0(%rax), %rax
movslq 0x3114(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x31a0(%rsp), %rcx
movq 0x9b8(%rcx), %rcx
movslq 0x3114(%rsp), %rdx
movl (%rcx,%rdx,4), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x138206
movq 0x31a0(%rsp), %rax
movq 0x9d0(%rax), %rax
movslq 0x3114(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x31a0(%rsp), %rcx
movq 0x9b8(%rcx), %rcx
movslq 0x3114(%rsp), %rdx
movl (%rcx,%rdx,4), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0xc0(%rsp)
jmp 0x138218
movsd 0x3168(%rsp), %xmm0
movsd %xmm0, 0xc0(%rsp)
movsd 0xc0(%rsp), %xmm0
movsd %xmm0, 0x3168(%rsp)
movl 0x3114(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3114(%rsp)
jmp 0x138151
jmp 0x138242
jmp 0x138244
jmp 0x138246
movq 0x31a8(%rsp), %rax
movsd 0x760(%rax), %xmm0
movsd %xmm0, 0xb8(%rsp)
movq 0x3198(%rsp), %rax
movsd 0x918(%rax), %xmm0
movq 0x31a8(%rsp), %rax
movsd 0x768(%rax), %xmm1
callq 0x8610
movaps %xmm0, %xmm1
movsd 0xb8(%rsp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x3128(%rsp)
movq 0x31a8(%rsp), %rax
movsd 0x770(%rax), %xmm0
movsd %xmm0, 0x3120(%rsp)
cmpl $0x1, 0x3184(%rsp)
jne 0x1387d3
movq 0x31a8(%rsp), %rax
movsd 0x750(%rax), %xmm0
movsd %xmm0, 0xa8(%rsp)
movsd 0x3168(%rsp), %xmm0
movsd %xmm0, 0xb0(%rsp)
movsd 0x3188(%rsp), %xmm0
callq 0x82e0
movsd 0xa8(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0xb0(%rsp), %xmm0
divsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x138337
movq 0x31a8(%rsp), %rax
movsd 0x750(%rax), %xmm0
movsd %xmm0, 0xa0(%rsp)
jmp 0x138370
movsd 0x3168(%rsp), %xmm0
movsd %xmm0, 0x98(%rsp)
movsd 0x3188(%rsp), %xmm0
callq 0x82e0
movaps %xmm0, %xmm1
movsd 0x98(%rsp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0xa0(%rsp)
movsd 0xa0(%rsp), %xmm0
movsd %xmm0, 0x90(%rsp)
movsd 0x3188(%rsp), %xmm0
callq 0x82e0
movaps %xmm0, %xmm1
movsd 0x90(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x3140(%rsp)
movq 0x31a8(%rsp), %rax
movsd 0x758(%rax), %xmm0
divsd 0x3120(%rsp), %xmm0
movsd %xmm0, 0x3118(%rsp)
movsd 0x9a8b5(%rip), %xmm0    # 0x1d2c88
mulsd 0x3190(%rsp), %xmm0
movsd 0x3120(%rsp), %xmm1
mulsd %xmm1, %xmm0
movsd 0x99e57(%rip), %xmm1    # 0x1d2248
addsd %xmm1, %xmm0
movsd %xmm0, 0x3160(%rsp)
movsd 0x3140(%rsp), %xmm1
movsd 0x3118(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x13842a
movsd 0x3140(%rsp), %xmm0
movsd %xmm0, 0x88(%rsp)
jmp 0x13843c
movsd 0x3118(%rsp), %xmm0
movsd %xmm0, 0x88(%rsp)
movsd 0x88(%rsp), %xmm0
divsd 0x3170(%rsp), %xmm0
callq 0x82f0
movsd %xmm0, 0x78(%rsp)
movsd 0x3160(%rsp), %xmm0
callq 0x82f0
movaps %xmm0, %xmm1
movsd 0x78(%rsp), %xmm0
divsd %xmm1, %xmm0
movsd 0x99dcc(%rip), %xmm1    # 0x1d2248
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x3148(%rsp)
movsd 0x3190(%rsp), %xmm0
movq 0x31a8(%rsp), %rax
mulsd 0x758(%rax), %xmm0
movsd %xmm0, 0x80(%rsp)
movsd 0x3188(%rsp), %xmm0
callq 0x82e0
movsd 0x80(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0x99d79(%rip), %xmm0    # 0x1d2248
mulsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x1384fe
movsd 0x3188(%rsp), %xmm0
callq 0x82e0
movaps %xmm0, %xmm1
movsd 0x99d56(%rip), %xmm0    # 0x1d2248
mulsd %xmm1, %xmm0
movsd %xmm0, 0x70(%rsp)
jmp 0x13851d
movsd 0x3190(%rsp), %xmm0
movq 0x31a8(%rsp), %rax
mulsd 0x758(%rax), %xmm0
movsd %xmm0, 0x70(%rsp)
movsd 0x70(%rsp), %xmm0
movsd %xmm0, 0x3160(%rsp)
movsd 0x3140(%rsp), %xmm0
movsd %xmm0, 0x68(%rsp)
movsd 0x3170(%rsp), %xmm1
movsd 0x9a294(%rip), %xmm0    # 0x1d27e0
mulsd 0x3118(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x13856c
movsd 0x3170(%rsp), %xmm0
movsd %xmm0, 0x60(%rsp)
jmp 0x138583
movsd 0x9a26c(%rip), %xmm0    # 0x1d27e0
mulsd 0x3118(%rsp), %xmm0
movsd %xmm0, 0x60(%rsp)
movsd 0x68(%rsp), %xmm1
movsd 0x60(%rsp), %xmm0
subsd %xmm0, %xmm1
movsd 0x9a6c5(%rip), %xmm0    # 0x1d2c60
mulsd %xmm1, %xmm0
divsd 0x3160(%rsp), %xmm0
movsd 0x9ca00(%rip), %xmm1    # 0x1d4fb0
mulsd 0x3118(%rsp), %xmm1
divsd 0x3160(%rsp), %xmm1
addsd %xmm1, %xmm0
movsd 0x99c7a(%rip), %xmm1    # 0x1d2248
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
addl 0x3148(%rsp), %eax
movl %eax, 0x3148(%rsp)
movq 0x31a8(%rsp), %rax
movsd 0x758(%rax), %xmm0
divsd 0x3128(%rsp), %xmm0
movsd %xmm0, 0x3118(%rsp)
movsd 0x9a67a(%rip), %xmm0    # 0x1d2c88
mulsd 0x3190(%rsp), %xmm0
movsd 0x3128(%rsp), %xmm1
mulsd %xmm1, %xmm0
movsd 0x99c1c(%rip), %xmm1    # 0x1d2248
addsd %xmm1, %xmm0
movsd %xmm0, 0x3160(%rsp)
movsd 0x3168(%rsp), %xmm1
movsd 0x3118(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x138662
movsd 0x3168(%rsp), %xmm0
movsd %xmm0, 0x58(%rsp)
jmp 0x138671
movsd 0x3118(%rsp), %xmm0
movsd %xmm0, 0x58(%rsp)
movsd 0x58(%rsp), %xmm0
divsd 0x3140(%rsp), %xmm0
callq 0x82f0
movsd %xmm0, 0x48(%rsp)
movsd 0x3160(%rsp), %xmm0
callq 0x82f0
movaps %xmm0, %xmm1
movsd 0x48(%rsp), %xmm0
divsd %xmm1, %xmm0
movsd 0x99b9a(%rip), %xmm1    # 0x1d2248
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
addl 0x3148(%rsp), %eax
movl %eax, 0x3148(%rsp)
movsd 0x3190(%rsp), %xmm0
movq 0x31a8(%rsp), %rax
mulsd 0x758(%rax), %xmm0
movsd %xmm0, 0x3160(%rsp)
movsd 0x3168(%rsp), %xmm0
movsd %xmm0, 0x50(%rsp)
movsd 0x3168(%rsp), %xmm1
movsd 0x9a0da(%rip), %xmm0    # 0x1d27e0
mulsd 0x3118(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x138726
movsd 0x3168(%rsp), %xmm0
movsd %xmm0, 0x40(%rsp)
jmp 0x13873d
movsd 0x9a0b2(%rip), %xmm0    # 0x1d27e0
mulsd 0x3118(%rsp), %xmm0
movsd %xmm0, 0x40(%rsp)
movsd 0x50(%rsp), %xmm1
movsd 0x40(%rsp), %xmm0
subsd %xmm0, %xmm1
movsd 0x9a50b(%rip), %xmm0    # 0x1d2c60
mulsd %xmm1, %xmm0
divsd 0x3160(%rsp), %xmm0
movsd 0x9c846(%rip), %xmm1    # 0x1d4fb0
mulsd 0x3118(%rsp), %xmm1
divsd 0x3160(%rsp), %xmm1
addsd %xmm1, %xmm0
movsd 0x99ac0(%rip), %xmm1    # 0x1d2248
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
addl 0x3148(%rsp), %eax
movl %eax, 0x3148(%rsp)
cmpl $0x2000000, 0x3148(%rsp) # imm = 0x2000000
jge 0x1387b8
movl 0x3148(%rsp), %eax
movl %eax, 0x3c(%rsp)
jmp 0x1387c3
movl $0x2000000, %eax        # imm = 0x2000000
movl %eax, 0x3c(%rsp)
jmp 0x1387c3
movl 0x3c(%rsp), %eax
movl %eax, 0x3148(%rsp)
jmp 0x138986
movq 0x31a8(%rsp), %rax
movsd 0x758(%rax), %xmm0
divsd 0x3128(%rsp), %xmm0
movsd %xmm0, 0x3118(%rsp)
movsd 0x9a48b(%rip), %xmm0    # 0x1d2c88
mulsd 0x3190(%rsp), %xmm0
movsd 0x3128(%rsp), %xmm1
mulsd %xmm1, %xmm0
movsd 0x99a2d(%rip), %xmm1    # 0x1d2248
addsd %xmm1, %xmm0
movsd %xmm0, 0x3160(%rsp)
movsd 0x3168(%rsp), %xmm1
movsd 0x3118(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x138851
movsd 0x3168(%rsp), %xmm0
movsd %xmm0, 0x30(%rsp)
jmp 0x138860
movsd 0x3118(%rsp), %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x30(%rsp), %xmm0
divsd 0x3170(%rsp), %xmm0
callq 0x82f0
movsd %xmm0, 0x20(%rsp)
movsd 0x3160(%rsp), %xmm0
callq 0x82f0
movaps %xmm0, %xmm1
movsd 0x20(%rsp), %xmm0
divsd %xmm1, %xmm0
movsd 0x999ab(%rip), %xmm1    # 0x1d2248
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x3148(%rsp)
movsd 0x3190(%rsp), %xmm0
movq 0x31a8(%rsp), %rax
mulsd 0x758(%rax), %xmm0
movsd %xmm0, 0x3160(%rsp)
movsd 0x3168(%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x3168(%rsp), %xmm1
movsd 0x99ef2(%rip), %xmm0    # 0x1d27e0
mulsd 0x3118(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x13890e
movsd 0x3168(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
jmp 0x138925
movsd 0x99eca(%rip), %xmm0    # 0x1d27e0
mulsd 0x3118(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x28(%rsp), %xmm1
movsd 0x18(%rsp), %xmm0
subsd %xmm0, %xmm1
movsd 0x9a323(%rip), %xmm0    # 0x1d2c60
mulsd %xmm1, %xmm0
divsd 0x3160(%rsp), %xmm0
movsd 0x9c65e(%rip), %xmm1    # 0x1d4fb0
mulsd 0x3118(%rsp), %xmm1
divsd 0x3160(%rsp), %xmm1
addsd %xmm1, %xmm0
movsd 0x998d8(%rip), %xmm1    # 0x1d2248
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
addl 0x3148(%rsp), %eax
movl %eax, 0x3148(%rsp)
movslq 0x3148(%rsp), %rdi
shlq $0x3, %rdi
callq 0x8460
movq %rax, %rcx
movq 0x3198(%rsp), %rax
movq %rcx, 0x928(%rax)
movq 0x3198(%rsp), %rax
cmpq $0x0, 0x928(%rax)
jne 0x138a33
movslq 0x3148(%rsp), %rax
shlq $0x3, %rax
movl %eax, 0x3110(%rsp)
leaq 0x2910(%rsp), %rdi
movl 0x3110(%rsp), %ecx
leaq 0x99620(%rip), %rsi     # 0x1d2004
leaq 0xca7f5(%rip), %rdx     # 0x2031e0
movb $0x0, %al
callq 0x5b9c0
movq 0x3198(%rsp), %rdi
addq $0x96a, %rdi            # imm = 0x96A
leaq 0x2910(%rsp), %r8
leaq 0x99624(%rip), %rsi     # 0x1d2034
leaq 0xca7d0(%rip), %rdx     # 0x2031e7
movl $0x48a, %ecx            # imm = 0x48A
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x31b4(%rsp)
jmp 0x13930c
movl $0x0, 0x3180(%rsp)
movsd 0x3170(%rsp), %xmm0
movq 0x3198(%rsp), %rax
movq 0x928(%rax), %rax
movslq 0x3180(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl $0x3, 0x3154(%rsp)
movl 0x3180(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3180(%rsp)
movq 0x3198(%rsp), %rax
movq 0x928(%rax), %rax
movl 0x3180(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
movsd 0x3168(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x138f72
movl 0x3180(%rsp), %eax
cmpl 0x3148(%rsp), %eax
jl 0x138b4a
leaq 0x2110(%rsp), %rdi
movl 0x3148(%rsp), %edx
leaq 0xca71e(%rip), %rsi     # 0x2031fb
movb $0x0, %al
callq 0x5b9c0
leaq 0x1910(%rsp), %rdi
leaq 0x2110(%rsp), %rcx
leaq 0x99587(%rip), %rsi     # 0x1d2082
leaq 0xca71d(%rip), %rdx     # 0x20321f
movb $0x0, %al
callq 0x5b9c0
movq 0x3198(%rsp), %rdi
addq $0x96a, %rdi            # imm = 0x96A
leaq 0x1910(%rsp), %r8
leaq 0x9950d(%rip), %rsi     # 0x1d2034
leaq 0xca6b9(%rip), %rdx     # 0x2031e7
movl $0x497, %ecx            # imm = 0x497
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x31b4(%rsp)
jmp 0x13930c
cmpl $0x0, 0x3184(%rsp)
jg 0x138c07
movq 0x3198(%rsp), %rax
movq 0x928(%rax), %rax
movl 0x3180(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0x3190(%rsp), %xmm1
movq 0x31a8(%rsp), %rax
mulsd 0x758(%rax), %xmm1
movq 0x3198(%rsp), %rax
movq 0x928(%rax), %rax
movl 0x3180(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
mulsd (%rax,%rcx,8), %xmm1
movq 0x3198(%rsp), %rax
movq 0x928(%rax), %rax
movl 0x3180(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm2
movq 0x31a8(%rsp), %rax
movsd 0x758(%rax), %xmm3
divsd 0x3128(%rsp), %xmm3
addsd %xmm3, %xmm2
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0x3178(%rsp)
jmp 0x138f37
movl 0x3154(%rsp), %eax
movq 0x31a8(%rsp), %rcx
cvttsd2si 0x750(%rcx), %ecx
cmpl %ecx, %eax
jge 0x138db7
movq 0x3198(%rsp), %rax
movq 0x928(%rax), %rax
movl 0x3180(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0x3190(%rsp), %xmm1
movq 0x31a8(%rsp), %rax
mulsd 0x758(%rax), %xmm1
movq 0x3198(%rsp), %rax
movq 0x928(%rax), %rax
movl 0x3180(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
mulsd (%rax,%rcx,8), %xmm1
movq 0x3198(%rsp), %rax
movq 0x928(%rax), %rax
movl 0x3180(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm2
movq 0x31a8(%rsp), %rax
movsd 0x758(%rax), %xmm3
divsd 0x3120(%rsp), %xmm3
addsd %xmm3, %xmm2
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0x3178(%rsp)
movsd 0x3178(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x3188(%rsp), %xmm0
callq 0x82e0
movaps %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x314c(%rsp)
movl 0x314c(%rsp), %eax
movl 0x3154(%rsp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jg 0x138d2d
movl 0x3154(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3154(%rsp)
jmp 0x138d3b
movl 0x314c(%rsp), %eax
movl %eax, 0x3154(%rsp)
cvtsi2sdl 0x3154(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x3188(%rsp), %xmm0
callq 0x82e0
movaps %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x3178(%rsp)
movsd 0x3178(%rsp), %xmm0
movq 0x3198(%rsp), %rax
movq 0x928(%rax), %rax
movl 0x3180(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
subsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x3138(%rsp)
movl 0x3180(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3134(%rsp)
jmp 0x138f35
movsd 0x3190(%rsp), %xmm0
movq 0x31a8(%rsp), %rax
mulsd 0x758(%rax), %xmm0
movq 0x3198(%rsp), %rax
movq 0x928(%rax), %rax
movl 0x3180(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
mulsd (%rax,%rcx,8), %xmm0
movq 0x3198(%rsp), %rax
movq 0x928(%rax), %rax
movl 0x3180(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
movq 0x31a8(%rsp), %rax
movsd 0x758(%rax), %xmm2
divsd 0x3128(%rsp), %xmm2
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x3160(%rsp)
movl 0x3180(%rsp), %eax
subl 0x3134(%rsp), %eax
movq 0x31a8(%rsp), %rcx
cvttsd2si 0x778(%rcx), %ecx
cmpl %ecx, %eax
jge 0x138f00
movq 0x3198(%rsp), %rax
movq 0x928(%rax), %rax
movl 0x3180(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movl 0x3180(%rsp), %eax
subl 0x3134(%rsp), %eax
cvtsi2sd %eax, %xmm2
movq 0x31a8(%rsp), %rax
divsd 0x778(%rax), %xmm2
movsd 0x9939b(%rip), %xmm1    # 0x1d2248
subsd %xmm2, %xmm1
movsd 0x3138(%rsp), %xmm2
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movl 0x3180(%rsp), %eax
subl 0x3134(%rsp), %eax
cvtsi2sd %eax, %xmm0
movq 0x31a8(%rsp), %rax
divsd 0x778(%rax), %xmm0
movsd 0x3160(%rsp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x3178(%rsp)
jmp 0x138f33
movq 0x3198(%rsp), %rax
movq 0x928(%rax), %rax
movl 0x3180(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
addsd 0x3160(%rsp), %xmm0
movsd %xmm0, 0x3178(%rsp)
jmp 0x138f35
jmp 0x138f37
movsd 0x3178(%rsp), %xmm0
movq 0x3198(%rsp), %rax
movq 0x928(%rax), %rax
movslq 0x3180(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x3180(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3180(%rsp)
jmp 0x138a7f
movq 0x3198(%rsp), %rax
movq 0x928(%rax), %rax
movl 0x3180(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd 0x3168(%rsp), %xmm0
jbe 0x138fbc
movl 0x3180(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rcx
movq 0x3198(%rsp), %rax
movq %rcx, 0x920(%rax)
jmp 0x138fd3
movslq 0x3180(%rsp), %rcx
movq 0x3198(%rsp), %rax
movq %rcx, 0x920(%rax)
movq 0x3198(%rsp), %rax
cmpq $0x2, 0x920(%rax)
jae 0x139061
leaq 0x1110(%rsp), %rdi
leaq 0xca241(%rip), %rsi     # 0x203235
movb $0x0, %al
callq 0x5b9c0
leaq 0x910(%rsp), %rdi
leaq 0x1110(%rsp), %rcx
leaq 0x99070(%rip), %rsi     # 0x1d2082
leaq 0xca234(%rip), %rdx     # 0x20324d
movb $0x0, %al
callq 0x5b9c0
movq 0x3198(%rsp), %rdi
addq $0x96a, %rdi            # imm = 0x96A
leaq 0x910(%rsp), %r8
leaq 0x98ff6(%rip), %rsi     # 0x1d2034
leaq 0xca1a2(%rip), %rdx     # 0x2031e7
movl $0x4df, %ecx            # imm = 0x4DF
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x31b4(%rsp)
jmp 0x13930c
movq 0x3198(%rsp), %rax
movq 0x928(%rax), %rdi
movq 0x3198(%rsp), %rax
movq 0x920(%rax), %rsi
shlq $0x3, %rsi
callq 0x8580
movq %rax, %rcx
movq 0x3198(%rsp), %rax
movq %rcx, 0x928(%rax)
movq 0x3198(%rsp), %rax
cmpq $0x0, 0x928(%rax)
jne 0x13912b
movq 0x3198(%rsp), %rax
movq 0x920(%rax), %rax
shlq $0x3, %rax
movl %eax, 0x90c(%rsp)
leaq 0x100(%rsp), %rdi
movl 0x90c(%rsp), %ecx
leaq 0x98f28(%rip), %rsi     # 0x1d2004
leaq 0xca0fd(%rip), %rdx     # 0x2031e0
movb $0x0, %al
callq 0x5b9c0
movq 0x3198(%rsp), %rdi
addq $0x96a, %rdi            # imm = 0x96A
leaq 0x100(%rsp), %r8
leaq 0x98f2c(%rip), %rsi     # 0x1d2034
leaq 0xca0d8(%rip), %rdx     # 0x2031e7
movl $0x4e5, %ecx            # imm = 0x4E5
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x31b4(%rsp)
jmp 0x13930c
cmpl $0x0, 0x3184(%rsp)
je 0x139301
movq 0x31a8(%rsp), %rax
movsd 0x750(%rax), %xmm0
movsd %xmm0, (%rsp)
cvtsi2sdl 0x3184(%rsp), %xmm0
mulsd 0x3188(%rsp), %xmm0
callq 0x82e0
movaps %xmm0, %xmm1
movsd (%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x3140(%rsp)
movsd 0x3140(%rsp), %xmm1
movq 0x3198(%rsp), %rax
movq 0x928(%rax), %rax
movq 0x3198(%rsp), %rcx
movq 0x920(%rcx), %rcx
subq $0x1, %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x13928c
movq 0x3198(%rsp), %rax
movl $0x0, 0x938(%rax)
movq 0x3198(%rsp), %rax
movslq 0x938(%rax), %rax
movq 0x3198(%rsp), %rcx
movq 0x920(%rcx), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jae 0x139238
movq 0x3198(%rsp), %rax
movq 0x928(%rax), %rax
movq 0x3198(%rsp), %rcx
movslq 0x938(%rcx), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd 0x3140(%rsp), %xmm0
jbe 0x13921d
jmp 0x139238
jmp 0x13921f
movq 0x3198(%rsp), %rax
movl 0x938(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x938(%rax)
jmp 0x1391c6
movq 0x3198(%rsp), %rax
movswl 0x968(%rax), %eax
cmpl $0x1, %eax
jle 0x13928a
movq 0x3198(%rsp), %rax
movq 0x920(%rax), %rsi
movq 0x3198(%rsp), %rax
movslq 0x938(%rax), %rax
subq %rax, %rsi
movq 0x3198(%rsp), %rax
movq 0x920(%rax), %rdx
leaq 0xc9fd8(%rip), %rdi     # 0x20325b
movb $0x0, %al
callq 0x8030
jmp 0x1392ff
movq 0x3198(%rsp), %rax
movq 0x920(%rax), %rax
movl %eax, %ecx
movq 0x3198(%rsp), %rax
movl %ecx, 0x938(%rax)
movq 0x3198(%rsp), %rax
movswl 0x968(%rax), %eax
cmpl $0x1, %eax
jle 0x1392fd
movq 0x3198(%rsp), %rax
movq 0x928(%rax), %rax
movq 0x3198(%rsp), %rcx
movq 0x920(%rcx), %rcx
subq $0x1, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0x3140(%rsp), %xmm1
leaq 0xc9fd2(%rip), %rdi     # 0x2032c8
movb $0x2, %al
callq 0x8030
jmp 0x1392ff
jmp 0x139301
movl $0x0, 0x31b4(%rsp)
movl 0x31b4(%rsp), %eax
addq $0x31b8, %rsp           # imm = 0x31B8
retq
nopl (%rax,%rax)