// File: jkingan[P]ladyheather/heather.cpp
// Function: calc_queue_stats(int)
void calc_queue_stats(int stop)
{
long i;
int k;
struct PLOT_Q q;
struct PLOT_Q q2;
DATA_SIZE sxx, syy, sxy;
DATA_SIZE qi;
DATA_SIZE val;
double jd0;
double t;
int have_deriv;

   // prepare to calculate the statistics values of the plots
   for(k=0; k<NUM_PLOTS+DERIVED_PLOTS; k++) {
      plot[k].sum_x        = (DATA_SIZE) 0.0;
      plot[k].sum_y        = (DATA_SIZE) 0.0;
      plot[k].sum_xx       = (DATA_SIZE) 0.0;
      plot[k].sum_yy       = (DATA_SIZE) 0.0;
      plot[k].sum_xy       = (DATA_SIZE) 0.0;
      plot[k].stat_count   = (DATA_SIZE) 0.0;
      plot[k].sum_change   = (DATA_SIZE) 0.0;
      plot[k].max_disp_val = (DATA_SIZE) (-BIG_NUM);
      plot[k].min_disp_val = (DATA_SIZE) (BIG_NUM);
   }

   qi = (DATA_SIZE) queue_interval;

   if(1 || auto_center) {  // set min/max values in case auto scaling is off
      for(k=0; k<NUM_PLOTS+DERIVED_PLOTS; k++) {
         if(plot[k].float_center == 0) {
            plot[k].min_disp_val = plot[k].max_disp_val = plot[k].plot_center;
            if(k == TEMP) {      // !!!! ref_scale?
               if(plot[k].plot_center == NEED_CENTER) {
                  if(last_temperature) plot[k].min_disp_val = plot[k].max_disp_val = plot[k].plot_center = scale_temp((double) last_temperature);
               }
            }
else if(enviro_mode() && (k == PRESSURE)) {      // !!!! ref_scale?
    if(plot[k].plot_center == NEED_CENTER) {
       if(last_pressure) plot[k].min_disp_val = plot[k].max_disp_val = plot[k].plot_center = scale_temp((double) last_pressure);
    }
 }
            else if(luxor && (k == TC2)) {      // !!!! ref_scale?
               if(plot[k].plot_center == NEED_CENTER) {
                  plot[k].min_disp_val = plot[k].max_disp_val = plot[k].plot_center = scale_temp((double) tc2);
               }
            }
            else if(k == DAC) {  // !!!! ref_scale?
               if(plot[k].plot_center == NEED_CENTER) {
                  plot[k].min_disp_val = plot[k].max_disp_val = plot[k].plot_center = last_dac_voltage;
               }
            }
            else if(luxor && (k == PPS)) {
               // !!!!!! luxor do something?
            }
         }
      }
   }

   plot_column = 0;
   stat_count = 0.0F;
   plot_q_last_col = 0;

   have_deriv = 0;
   for(k=0; k<NUM_PLOTS+DERIVED_PLOTS; k++) {  // see if any derivative plots are enabled
      if(plot[k].show_deriv) {
         have_deriv = 1;
         break;
      }
   }

   i = plot_q_col0;
   jd0 = jd_utc;
   while(i != plot_q_in) {  // scan the data that is in the plot window
      if(filter_count) q = filter_plot_q(i);
      else             q = get_plot_q(i);

      if(have_deriv) {  // showing plot derivative  // get previous queue entry
         if(filter_count) q2 = filter_plot_q(i-1);   // plot filtered data
         else             q2 = get_plot_q(i-1);      // plot raw data
      }

      if(i == plot_q_col0) {
         jd0 = q.q_jd;
         last_q = q;
q2 = q;
      }

      add_stat_point(&q);   // update statistics values
      last_q = q;

      if((queue_interval > 0) && qi) {  // find plot min and max value
         for(k=0; k<NUM_PLOTS+DERIVED_PLOTS; k++) {
            if(k == TEMP) val = scale_temp((double) q.data[TEMP]/(double) qi);
else if(enviro_mode() && (k == PRESSURE)) val = scale_pressure((double) q.data[PRESSURE]/(double) qi);
            else if(luxor && (k == TC2)) val = scale_temp((double)q.data[k]/(double)qi);
            else if(luxor && (k == LUX1)) val = q.data[k]/qi*(DATA_SIZE) lux_scale;
            else if(luxor && (k == LUX2)) val = q.data[k]/qi*(DATA_SIZE) lum_scale;
            else if(k >= NUM_PLOTS) {  // derived plots DERIVED_PLOTS !!!!!
               if(luxor && (k == BATTW)) {        // battery watts
                  val = q.data[BATTI]*q.data[BATTV] / qi;
               }
               else if(luxor && (k == LEDW)) {   // LED watts
                  val = q.data[LEDI]*q.data[LEDV] / qi;
               }
               else if(luxor && (k == EFF)) { // driver efficency
                  val = q.data[BATTI]*q.data[BATTV];
                  if(val) val = q.data[LEDI]*q.data[LEDV] / val;
                  val *= (DATA_SIZE) 100.0;
               }
               else if(luxor && (k == CCT)) { // color temo
                  val = (DATA_SIZE) calc_cct(cct_type, 1, (double)q.data[REDHZ]/(double)qi, (double)q.data[GREENHZ]/(double)qi, (double)q.data[BLUEHZ]/(double)qi);
               }
               else {
//                val = (DATA_SIZE) 0.0;
                  val = q.data[k] / qi;
               }
            }
            else val = q.data[k] / qi;

            if(plot[k].show_deriv) {   // calculate plot derivative value
               val = q.data[k] - q2.data[k];
            }
            else if(tie_plot(k) && plot[k].show_freq) {
               val = (DATA_SIZE) tie_to_freq(k, val);
            }
            else if(phase_plot(k)) {  // calculate TICC_RCVR phase value with trend line removed
               val = remove_trend(k, 1, q.q_jd, val);
            }
            else if(plot[k].drift_rate) {  // calculate value with trend line removed
               t = q.q_jd - jd0;
               t *= (24.0*60.0*60.0);
               val = remove_trend(k, 0, t, val);
            }

            if(val > plot[k].max_disp_val) plot[k].max_disp_val = val;
            if(val < plot[k].min_disp_val) plot[k].min_disp_val = val;
         }
      }

      plot_q_last_col = i;
      i = next_q_point(i, stop);
      if(i < 0) break;      // end of plot data reached
   }

   if(stat_count == (DATA_SIZE) 0.0) return;

   for(k=0; k<NUM_PLOTS+DERIVED_PLOTS; k++) { // calculate linear regression values
      sxy = plot[k].sum_xy - ((plot[k].sum_x*plot[k].sum_y)/stat_count);
      syy = plot[k].sum_yy - ((plot[k].sum_y*plot[k].sum_y)/stat_count);
      sxx = plot[k].sum_xx - ((plot[k].sum_x*plot[k].sum_x)/stat_count);
      plot[k].stat_count = stat_count;
      if(sxx == 0.0F) {
         plot[k].a1 = plot[k].a0 = (DATA_SIZE) 0.0;
      }
      else {
         plot[k].a1 = (sxy / sxx);
         plot[k].a0 = (plot[k].sum_y/stat_count) - (plot[k].a1*(plot[k].sum_x/stat_count));
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x480, %rsp            # imm = 0x480
movl %edi, -0x4(%rbp)
movl $0x0, -0x14(%rbp)
cmpl $0x14, -0x14(%rbp)
jge 0x23fcb
movslq -0x14(%rbp), %rcx
leaq 0x198e76(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x60(%rax)
movslq -0x14(%rbp), %rcx
leaq 0x198e59(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x68(%rax)
movslq -0x14(%rbp), %rcx
leaq 0x198e3c(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x70(%rax)
movslq -0x14(%rbp), %rcx
leaq 0x198e1f(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x78(%rax)
movslq -0x14(%rbp), %rcx
leaq 0x198e02(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x80(%rax)
movslq -0x14(%rbp), %rcx
leaq 0x198de2(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x88(%rax)
movslq -0x14(%rbp), %rcx
leaq 0x198dc2(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0xa8(%rax)
movslq -0x14(%rbp), %rcx
leaq 0x198da2(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0x14b0d0(%rip), %xmm0   # 0x16f060
movsd %xmm0, 0xb8(%rax)
movslq -0x14(%rbp), %rcx
leaq 0x198d7d(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0x14b0a3(%rip), %xmm0   # 0x16f058
movsd %xmm0, 0xb0(%rax)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x23e95
cvtsi2sdq 0x2565a4(%rip), %xmm0 # 0x27a578
movsd %xmm0, -0x198(%rbp)
movl $0x0, -0x14(%rbp)
cmpl $0x14, -0x14(%rbp)
jge 0x24334
movslq -0x14(%rbp), %rcx
leaq 0x198d28(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x1c(%rax)
jne 0x24324
movslq -0x14(%rbp), %rcx
leaq 0x198d09(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0x28(%rax), %xmm0
movslq -0x14(%rbp), %rcx
leaq 0x198cef(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0xb8(%rax)
movslq -0x14(%rbp), %rcx
leaq 0x198cd2(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0xb0(%rax)
cmpl $0x3, -0x14(%rbp)
jne 0x24111
movslq -0x14(%rbp), %rcx
leaq 0x198cab(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0x28(%rax), %xmm0
movsd 0x14b0a4(%rip), %xmm1   # 0x16f130
ucomisd %xmm1, %xmm0
jne 0x2410c
jp 0x2410c
movsd 0x3480bc(%rip), %xmm0   # 0x36c158
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x240a9
jp 0x240a9
jmp 0x2410a
movsd 0x3480a7(%rip), %xmm0   # 0x36c158
callq 0x18060
movslq -0x14(%rbp), %rcx
leaq 0x198c5f(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x28(%rax)
movslq -0x14(%rbp), %rcx
leaq 0x198c45(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0xb8(%rax)
movslq -0x14(%rbp), %rcx
leaq 0x198c28(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0xb0(%rax)
jmp 0x2410c
jmp 0x24322
callq 0x83ad0
cmpl $0x0, %eax
je 0x241d0
cmpl $0x10, -0x14(%rbp)
jne 0x241d0
movslq -0x14(%rbp), %rcx
leaq 0x198bec(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0x28(%rax), %xmm0
movsd 0x14afe5(%rip), %xmm1   # 0x16f130
ucomisd %xmm1, %xmm0
jne 0x241cb
jp 0x241cb
movsd 0x347c4d(%rip), %xmm0   # 0x36bda8
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x24168
jp 0x24168
jmp 0x241c9
movsd 0x347c38(%rip), %xmm0   # 0x36bda8
callq 0x18060
movslq -0x14(%rbp), %rcx
leaq 0x198ba0(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x28(%rax)
movslq -0x14(%rbp), %rcx
leaq 0x198b86(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0xb8(%rax)
movslq -0x14(%rbp), %rcx
leaq 0x198b69(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0xb0(%rax)
jmp 0x241cb
jmp 0x24320
cmpb $0x0, 0x279f47(%rip)    # 0x29e11e
je 0x24277
cmpl $0x8, -0x14(%rbp)
jne 0x24277
movslq -0x14(%rbp), %rcx
leaq 0x198b2e(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0x28(%rax), %xmm0
movsd 0x14af27(%rip), %xmm1   # 0x16f130
ucomisd %xmm1, %xmm0
jne 0x24272
jp 0x24272
movsd 0x347b7f(%rip), %xmm0   # 0x36bd98
callq 0x18060
movslq -0x14(%rbp), %rcx
leaq 0x198af7(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x28(%rax)
movslq -0x14(%rbp), %rcx
leaq 0x198add(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0xb8(%rax)
movslq -0x14(%rbp), %rcx
leaq 0x198ac0(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0xb0(%rax)
jmp 0x2431e
cmpl $0x2, -0x14(%rbp)
jne 0x24309
movslq -0x14(%rbp), %rcx
leaq 0x198a94(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0x28(%rax), %xmm0
movsd 0x14ae8d(%rip), %xmm1   # 0x16f130
ucomisd %xmm1, %xmm0
jne 0x24307
jp 0x24307
movsd 0x347e9d(%rip), %xmm0   # 0x36c150
movslq -0x14(%rbp), %rcx
leaq 0x198a62(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x28(%rax)
movslq -0x14(%rbp), %rcx
leaq 0x198a48(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0xb8(%rax)
movslq -0x14(%rbp), %rcx
leaq 0x198a2b(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0xb0(%rax)
jmp 0x2431c
cmpb $0x0, 0x279e0e(%rip)    # 0x29e11e
je 0x2431a
cmpl $0x0, -0x14(%rbp)
jne 0x2431a
jmp 0x2431a
jmp 0x2431c
jmp 0x2431e
jmp 0x24320
jmp 0x24322
jmp 0x24324
jmp 0x24326
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x23fe3
movl $0x0, 0x25626e(%rip)    # 0x27a5ac
xorps %xmm0, %xmm0
movsd %xmm0, 0x347e27(%rip)   # 0x36c170
movq $0x0, 0x2560fc(%rip) # 0x27a450
movl $0x0, -0x1b4(%rbp)
movl $0x0, -0x14(%rbp)
cmpl $0x14, -0x14(%rbp)
jge 0x243a2
movslq -0x14(%rbp), %rcx
leaq 0x1989aa(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0xcc(%rax)
je 0x24395
movl $0x1, -0x1b4(%rbp)
jmp 0x243a2
jmp 0x24397
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x24365
movq 0x25609f(%rip), %rax    # 0x27a448
movq %rax, -0x10(%rbp)
movsd 0x34835b(%rip), %xmm0   # 0x36c710
movsd %xmm0, -0x1a8(%rbp)
movq -0x10(%rbp), %rax
cmpq 0x256140(%rip), %rax    # 0x27a508
je 0x249df
cmpq $0x0, 0x25627a(%rip)    # 0x27a650
je 0x24402
movq -0x10(%rbp), %rsi
leaq -0x268(%rbp), %rdi
callq 0x16160
leaq -0xc8(%rbp), %rdi
leaq -0x268(%rbp), %rsi
movl $0xb0, %edx
callq 0x92c0
jmp 0x2442a
movq -0x10(%rbp), %rsi
leaq -0x318(%rbp), %rdi
callq 0x133f0
leaq -0xc8(%rbp), %rdi
leaq -0x318(%rbp), %rsi
movl $0xb0, %edx
callq 0x92c0
cmpl $0x0, -0x1b4(%rbp)
je 0x24499
cmpq $0x0, 0x256215(%rip)    # 0x27a650
je 0x2446b
movq -0x10(%rbp), %rsi
subq $0x1, %rsi
leaq -0x3c8(%rbp), %rdi
callq 0x16160
leaq -0x178(%rbp), %rdi
leaq -0x3c8(%rbp), %rsi
movl $0xb0, %edx
callq 0x92c0
jmp 0x24497
movq -0x10(%rbp), %rsi
subq $0x1, %rsi
leaq -0x478(%rbp), %rdi
callq 0x133f0
leaq -0x178(%rbp), %rdi
leaq -0x478(%rbp), %rsi
movl $0xb0, %edx
callq 0x92c0
jmp 0x24499
movq -0x10(%rbp), %rax
cmpq 0x255fa4(%rip), %rax    # 0x27a448
jne 0x244e6
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x1a8(%rbp)
leaq 0x37b28b(%rip), %rdi    # 0x39f748
leaq -0xc8(%rbp), %rsi
movl $0xb0, %edx
callq 0x92c0
leaq -0x178(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
movl $0xb0, %edx
callq 0x92c0
leaq -0xc8(%rbp), %rdi
callq 0x23ac0
leaq 0x37b24f(%rip), %rdi    # 0x39f748
leaq -0xc8(%rbp), %rsi
movl $0xb0, %edx
callq 0x92c0
cmpq $0x0, 0x256066(%rip)    # 0x27a578
jle 0x249b6
movsd -0x198(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x24530
jp 0x24530
jmp 0x249b6
movl $0x0, -0x14(%rbp)
cmpl $0x14, -0x14(%rbp)
jge 0x249b4
cmpl $0x3, -0x14(%rbp)
jne 0x24569
movsd -0xa0(%rbp), %xmm0
divsd -0x198(%rbp), %xmm0
callq 0x18060
movsd %xmm0, -0x1a0(%rbp)
jmp 0x247c5
callq 0x83ad0
cmpl $0x0, %eax
je 0x24598
cmpl $0x10, -0x14(%rbp)
jne 0x24598
movsd -0x38(%rbp), %xmm0
divsd -0x198(%rbp), %xmm0
callq 0x183b0
movsd %xmm0, -0x1a0(%rbp)
jmp 0x247c3
cmpb $0x0, 0x279b7f(%rip)    # 0x29e11e
je 0x245ce
cmpl $0x8, -0x14(%rbp)
jne 0x245ce
movslq -0x14(%rbp), %rax
movsd -0xb8(%rbp,%rax,8), %xmm0
divsd -0x198(%rbp), %xmm0
callq 0x18060
movsd %xmm0, -0x1a0(%rbp)
jmp 0x247c1
cmpb $0x0, 0x279b49(%rip)    # 0x29e11e
je 0x24607
cmpl $0x0, -0x14(%rbp)
jne 0x24607
movslq -0x14(%rbp), %rax
movsd -0xb8(%rbp,%rax,8), %xmm0
divsd -0x198(%rbp), %xmm0
mulsd 0x253496(%rip), %xmm0   # 0x277a90
movsd %xmm0, -0x1a0(%rbp)
jmp 0x247bf
cmpb $0x0, 0x279b10(%rip)    # 0x29e11e
je 0x24640
cmpl $0x4, -0x14(%rbp)
jne 0x24640
movslq -0x14(%rbp), %rax
movsd -0xb8(%rbp,%rax,8), %xmm0
divsd -0x198(%rbp), %xmm0
mulsd 0x253465(%rip), %xmm0   # 0x277a98
movsd %xmm0, -0x1a0(%rbp)
jmp 0x247bd
cmpl $0x10, -0x14(%rbp)
jl 0x2479e
cmpb $0x0, 0x279acd(%rip)    # 0x29e11e
je 0x2467e
cmpl $0xf, -0x14(%rbp)
jne 0x2467e
movsd -0xb0(%rbp), %xmm0
mulsd -0xa8(%rbp), %xmm0
divsd -0x198(%rbp), %xmm0
movsd %xmm0, -0x1a0(%rbp)
jmp 0x2479c
cmpb $0x0, 0x279a99(%rip)    # 0x29e11e
je 0x246b2
cmpl $0x10, -0x14(%rbp)
jne 0x246b2
movsd -0x88(%rbp), %xmm0
mulsd -0x90(%rbp), %xmm0
divsd -0x198(%rbp), %xmm0
movsd %xmm0, -0x1a0(%rbp)
jmp 0x2479a
cmpb $0x0, 0x279a65(%rip)    # 0x29e11e
je 0x24728
cmpl $0x11, -0x14(%rbp)
jne 0x24728
movsd -0xb0(%rbp), %xmm0
mulsd -0xa8(%rbp), %xmm0
movsd %xmm0, -0x1a0(%rbp)
movsd -0x1a0(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x246ee
jp 0x246ee
jmp 0x2470e
movsd -0x88(%rbp), %xmm0
mulsd -0x90(%rbp), %xmm0
divsd -0x1a0(%rbp), %xmm0
movsd %xmm0, -0x1a0(%rbp)
movsd 0x14a93a(%rip), %xmm0   # 0x16f050
mulsd -0x1a0(%rbp), %xmm0
movsd %xmm0, -0x1a0(%rbp)
jmp 0x24798
cmpb $0x0, 0x2799ef(%rip)    # 0x29e11e
je 0x24779
cmpl $0x12, -0x14(%rbp)
jne 0x24779
movzbl 0x347a0a(%rip), %edi    # 0x36c148
movsd -0x60(%rbp), %xmm0
divsd -0x198(%rbp), %xmm0
movsd -0x68(%rbp), %xmm1
divsd -0x198(%rbp), %xmm1
movsd -0x70(%rbp), %xmm2
divsd -0x198(%rbp), %xmm2
movl $0x1, %esi
callq 0xa8d40
movsd %xmm0, -0x1a0(%rbp)
jmp 0x24796
movslq -0x14(%rbp), %rax
movsd -0xb8(%rbp,%rax,8), %xmm0
divsd -0x198(%rbp), %xmm0
movsd %xmm0, -0x1a0(%rbp)
jmp 0x24798
jmp 0x2479a
jmp 0x2479c
jmp 0x247bb
movslq -0x14(%rbp), %rax
movsd -0xb8(%rbp,%rax,8), %xmm0
divsd -0x198(%rbp), %xmm0
movsd %xmm0, -0x1a0(%rbp)
jmp 0x247bd
jmp 0x247bf
jmp 0x247c1
jmp 0x247c3
jmp 0x247c5
movslq -0x14(%rbp), %rcx
leaq 0x198550(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0xcc(%rax)
je 0x2480a
movslq -0x14(%rbp), %rax
movsd -0xb8(%rbp,%rax,8), %xmm0
movslq -0x14(%rbp), %rax
subsd -0x168(%rbp,%rax,8), %xmm0
movsd %xmm0, -0x1a0(%rbp)
jmp 0x24908
movl -0x14(%rbp), %edi
callq 0x19760
cmpl $0x0, %eax
je 0x24852
movslq -0x14(%rbp), %rcx
leaq 0x1984fe(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0xd0(%rax)
je 0x24852
movl -0x14(%rbp), %edi
movsd -0x1a0(%rbp), %xmm0
callq 0xebbe0
movsd %xmm0, -0x1a0(%rbp)
jmp 0x24906
movl -0x14(%rbp), %edi
callq 0x19800
cmpl $0x0, %eax
je 0x24886
movl -0x14(%rbp), %edi
movsd -0xc0(%rbp), %xmm0
movsd -0x1a0(%rbp), %xmm1
movl $0x1, %esi
callq 0x19850
movsd %xmm0, -0x1a0(%rbp)
jmp 0x24904
movslq -0x14(%rbp), %rcx
leaq 0x19848f(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0xa0(%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x248b0
jp 0x248b0
jmp 0x24902
movsd -0xc0(%rbp), %xmm0
subsd -0x1a8(%rbp), %xmm0
movsd %xmm0, -0x1b0(%rbp)
movsd 0x14a738(%rip), %xmm0   # 0x16f008
mulsd -0x1b0(%rbp), %xmm0
movsd %xmm0, -0x1b0(%rbp)
movl -0x14(%rbp), %edi
movsd -0x1b0(%rbp), %xmm0
movsd -0x1a0(%rbp), %xmm1
xorl %esi, %esi
callq 0x19850
movsd %xmm0, -0x1a0(%rbp)
jmp 0x24904
jmp 0x24906
jmp 0x24908
movsd -0x1a0(%rbp), %xmm0
movslq -0x14(%rbp), %rcx
leaq 0x198405(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
ucomisd 0xb8(%rax), %xmm0
jbe 0x24954
movsd -0x1a0(%rbp), %xmm0
movslq -0x14(%rbp), %rcx
leaq 0x1983de(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0xb8(%rax)
movsd -0x1a0(%rbp), %xmm1
movslq -0x14(%rbp), %rcx
leaq 0x1983b9(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0xb0(%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x249a4
movsd -0x1a0(%rbp), %xmm0
movslq -0x14(%rbp), %rcx
leaq 0x19838e(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0xb0(%rax)
jmp 0x249a6
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x24537
jmp 0x249b6
movq -0x10(%rbp), %rax
movq %rax, 0x255a8f(%rip)    # 0x27a450
movq -0x10(%rbp), %rdi
movl -0x4(%rbp), %esi
callq 0x15280
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jge 0x249da
jmp 0x249df
jmp 0x243bd
movsd 0x347789(%rip), %xmm0   # 0x36c170
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x249f7
jp 0x249f7
jmp 0x24c88
movl $0x0, -0x14(%rbp)
cmpl $0x14, -0x14(%rbp)
jge 0x24c88
movslq -0x14(%rbp), %rcx
leaq 0x19830d(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0x80(%rax), %xmm0
movslq -0x14(%rbp), %rcx
leaq 0x1982f0(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0x60(%rax), %xmm1
movslq -0x14(%rbp), %rcx
leaq 0x1982d6(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
mulsd 0x68(%rax), %xmm1
divsd 0x34770f(%rip), %xmm1   # 0x36c170
subsd %xmm1, %xmm0
movsd %xmm0, -0x190(%rbp)
movslq -0x14(%rbp), %rcx
leaq 0x1982a8(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0x78(%rax), %xmm0
movslq -0x14(%rbp), %rcx
leaq 0x19828e(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0x68(%rax), %xmm1
movslq -0x14(%rbp), %rcx
leaq 0x198274(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
mulsd 0x68(%rax), %xmm1
divsd 0x3476ad(%rip), %xmm1   # 0x36c170
subsd %xmm1, %xmm0
movsd %xmm0, -0x188(%rbp)
movslq -0x14(%rbp), %rcx
leaq 0x198246(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0x70(%rax), %xmm0
movslq -0x14(%rbp), %rcx
leaq 0x19822c(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0x60(%rax), %xmm1
movslq -0x14(%rbp), %rcx
leaq 0x198212(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
mulsd 0x60(%rax), %xmm1
divsd 0x34764b(%rip), %xmm1   # 0x36c170
subsd %xmm1, %xmm0
movsd %xmm0, -0x180(%rbp)
movsd 0x347637(%rip), %xmm0   # 0x36c170
movslq -0x14(%rbp), %rcx
leaq 0x1981dc(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x88(%rax)
movsd -0x180(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x24bae
jp 0x24bae
movslq -0x14(%rbp), %rcx
leaq 0x1981ac(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x90(%rax)
movslq -0x14(%rbp), %rcx
leaq 0x19818c(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x98(%rax)
jmp 0x24c78
movsd -0x190(%rbp), %xmm0
divsd -0x180(%rbp), %xmm0
movslq -0x14(%rbp), %rcx
leaq 0x198157(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x98(%rax)
movslq -0x14(%rbp), %rcx
leaq 0x19813a(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0x68(%rax), %xmm1
divsd 0x347573(%rip), %xmm1   # 0x36c170
movslq -0x14(%rbp), %rcx
leaq 0x198118(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0x98(%rax), %xmm0
movslq -0x14(%rbp), %rcx
leaq 0x1980fb(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0x60(%rax), %xmm2
divsd 0x347534(%rip), %xmm2   # 0x36c170
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movslq -0x14(%rbp), %rcx
leaq 0x1980ba(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x90(%rax)
jmp 0x24c7a
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x249fe
addq $0x480, %rsp            # imm = 0x480
popq %rbp
retq
nopw %cs:(%rax,%rax)