// File: jkingan[P]ladyheather/heather.cpp
// Function: scale_plots()
void scale_plots()
{
long i;
struct PLOT_Q q;
int k;
DATA_SIZE scale[NUM_PLOTS+DERIVED_PLOTS];
DATA_SIZE val;

   // Calculate plot scale factors and center line reference points.
   // This routine uses the min and max values collected by calc_plot_statistics()

// if((auto_scale == 0) && (auto_center == 0)) return;
   if(queue_interval <= 0) return;

   // calc_queue_stats() already scanned the queue data to find mins and maxes
   // now we calculate good looking scale factors and center points for the plots

   if(plot_q_last_col) {  // we have data to calculate good graph scale factors from
      i = (PLOT_HEIGHT / VERT_MAJOR) & 0xFFFE;  //even number of major vertical divisions
      //  if(SCREEN_HEIGHT >= MEDIUM_HEIGHT) i -= 1;  // prevents multiple consecutive rescales
      i -= 1;  //!!!!
      if(i <= 0) i = 1;

      // scale graphs to the largest side of the curve above/below
      // the graph center reference line
      for(k=0; k<NUM_PLOTS+DERIVED_PLOTS; k++) {
         if(plot[k].float_center) {
            plot[k].plot_center = (plot[k].max_disp_val+plot[k].min_disp_val) / 2.0F;
         }

         if((plot[k].max_disp_val >= plot[k].plot_center) && (plot[k].min_disp_val < plot[k].plot_center)) {
            if((plot[k].max_disp_val-plot[k].plot_center) >= (plot[k].plot_center-plot[k].min_disp_val)) {
               scale[k] = (plot[k].max_disp_val-plot[k].plot_center);
            }
            else {
               scale[k] = plot[k].plot_center - plot[k].min_disp_val;
            }
         }
         else if(plot[k].max_disp_val >= plot[k].plot_center) {
            scale[k] = (plot[k].max_disp_val - plot[k].plot_center);
         }
         else {
            scale[k] = (plot[k].plot_center - plot[k].min_disp_val);
         }

         if(scale[k] == 0.0) { // force a non-zero scale factor so plot shows correctly
            scale[k] = (DATA_SIZE) 1.0E-9;
         }

         if(i > 1) scale[k] = (scale[k] / (DATA_SIZE) (i/2));
         scale[k] *= plot[k].ref_scale;
//if(k == OSC) sprintf(debug_text, "osc scale: %g ->   %g  min:%g max:%g", scale[k], round_scale(scale[k]), plot[k].min_disp_val, plot[k].max_disp_val);

         // round scale factors to nice values
         scale[k] = round_scale(scale[k]);
      }

      // set the working scale factors to the new values
      if(peak_scale) {  // don't ever let scale factors get smaller
         for(k=0; k<NUM_PLOTS+DERIVED_PLOTS; k++) {
            if(scale[k] > plot[k].scale_factor) {
               if(plot[k].user_scale == 0) {
                  plot[k].scale_factor = scale[k];
               }
            }
         }
      }
      else {  // scale factors can change to whatever they are
         for(k=0; k<NUM_PLOTS+DERIVED_PLOTS; k++) {
            if(plot[k].user_scale == 0) plot[k].scale_factor = scale[k];
         }
      }

      if(1 || auto_center) {  // center the plots
         for(k=0; k<NUM_PLOTS+DERIVED_PLOTS; k++) {
            if(plot[k].float_center) {
               plot[k].plot_center = (plot[k].max_disp_val+plot[k].min_disp_val) / 2.0F;
            }
         }
         last_dac_voltage = plot[DAC].plot_center;
//!!!!   last_temperature = plot[TEMP].plot_center;
      }
   }
   else if(plot_q_last_col >= 1) {  // center these graphs around the last recorded value
      if(filter_count) q = filter_plot_q(plot_q_last_col-1);
      else             q = get_plot_q(plot_q_last_col-1);

      for(k=0; k<NUM_PLOTS+DERIVED_PLOTS; k++) {
         if(plot[k].float_center) {
            if(k == TEMP) plot[k].plot_center = scale_temp((double) q.data[TEMP] / (double) queue_interval);
else if(enviro_mode() && (k == PRESSURE)) plot[k].plot_center = scale_pressure((double) q.data[PRESSURE] / (double) queue_interval);
            else if(luxor && (k == TC2)) plot[k].plot_center = scale_temp((double) q.data[k] / (double) queue_interval);
            else if(luxor && (k == LUX1))  plot[k].plot_center = (q.data[k] / (DATA_SIZE) queue_interval) * (DATA_SIZE) lux_scale;
            else if(luxor && (k == LUX2))  plot[k].plot_center = (q.data[k] / (DATA_SIZE) queue_interval) * (DATA_SIZE) lum_scale;
            else if(k >= NUM_PLOTS) {  // derived plots DERIVED_PLOTS !!!!!
               if(luxor && (k == BATTW)) {        // battery watts
                  plot[k].plot_center = q.data[BATTI]*q.data[BATTV] / (DATA_SIZE) queue_interval;
               }
               else if(luxor && (k == LEDW)) {   // LED watts
                  plot[k].plot_center = q.data[LEDI]*q.data[LEDV] / (DATA_SIZE) queue_interval;
               }
               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 *= 100.0F;
                  plot[k].plot_center = val;
               }
               else if(luxor && (k == CCT)) { // color temo
                  val = calc_cct(cct_type, 1, (double)q.data[REDHZ]/(double)queue_interval, (double)q.data[GREENHZ]/(double)queue_interval, (double)q.data[BLUEHZ]/(double)queue_interval);
                  plot[k].plot_center = val;
               }
               else {
//                plot[k].plot_center = (DATA_SIZE) 0.0;
                  plot[k].plot_center = q.data[k] / (DATA_SIZE) queue_interval;
               }
            }
            else plot[k].plot_center = q.data[k] / (DATA_SIZE) queue_interval;
         }
      }
   }

   // finally we round the center line reference values to multiples of
   // the scale factor (note that this tweak can allow a plot to go slightly
   // off scale)
   if(1 || auto_center) {
      for(k=0; k<NUM_PLOTS+DERIVED_PLOTS; k++) {
         if(plot[k].float_center && plot[k].scale_factor) {
            plot[k].plot_center *= plot[k].ref_scale;
            plot[k].plot_center = (DATA_SIZE) (s64) ((plot[k].plot_center / plot[k].scale_factor)) * plot[k].scale_factor;
            plot[k].plot_center /= plot[k].ref_scale;
         }
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2d0, %rsp            # imm = 0x2D0
cmpq $0x0, 0x2586d5(%rip)    # 0x27a578
jg 0x21eaa
jmp 0x22b21
cmpq $0x0, 0x25859e(%rip)    # 0x27a450
je 0x224e5
movl 0x255baa(%rip), %eax    # 0x277a68
cltd
idivl 0x255b87(%rip)          # 0x277a4c
andl $0xfffe, %eax           # imm = 0xFFFE
cltq
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jg 0x21eeb
movq $0x1, -0x8(%rbp)
movl $0x0, -0xbc(%rbp)
cmpl $0x14, -0xbc(%rbp)
jge 0x222f1
movslq -0xbc(%rbp), %rcx
leaq 0x19ae10(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x1c(%rax)
je 0x21f89
movslq -0xbc(%rbp), %rcx
leaq 0x19adf2(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0xb8(%rax), %xmm0
movslq -0xbc(%rbp), %rcx
leaq 0x19add2(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
addsd 0xb0(%rax), %xmm0
movsd 0x14d1e8(%rip), %xmm1   # 0x16f150
divsd %xmm1, %xmm0
movslq -0xbc(%rbp), %rcx
leaq 0x19ada6(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x28(%rax)
movslq -0xbc(%rbp), %rcx
leaq 0x19ad89(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0xb8(%rax), %xmm0
movslq -0xbc(%rbp), %rcx
leaq 0x19ad69(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
ucomisd 0x28(%rax), %xmm0
jb 0x22134
movslq -0xbc(%rbp), %rcx
leaq 0x19ad46(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0xb0(%rax), %xmm1
movslq -0xbc(%rbp), %rcx
leaq 0x19ad26(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0x28(%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x22134
movslq -0xbc(%rbp), %rcx
leaq 0x19acff(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0xb8(%rax), %xmm0
movslq -0xbc(%rbp), %rcx
leaq 0x19acdf(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
subsd 0x28(%rax), %xmm0
movslq -0xbc(%rbp), %rcx
leaq 0x19acc2(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0x28(%rax), %xmm1
movslq -0xbc(%rbp), %rcx
leaq 0x19aca5(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
subsd 0xb0(%rax), %xmm1
ucomisd %xmm1, %xmm0
jb 0x220e2
movslq -0xbc(%rbp), %rcx
leaq 0x19ac7f(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0xb8(%rax), %xmm0
movslq -0xbc(%rbp), %rcx
leaq 0x19ac5f(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
subsd 0x28(%rax), %xmm0
movslq -0xbc(%rbp), %rax
movsd %xmm0, -0x160(%rbp,%rax,8)
jmp 0x2212f
movslq -0xbc(%rbp), %rcx
leaq 0x19ac30(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0x28(%rax), %xmm0
movslq -0xbc(%rbp), %rcx
leaq 0x19ac13(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
subsd 0xb0(%rax), %xmm0
movslq -0xbc(%rbp), %rax
movsd %xmm0, -0x160(%rbp,%rax,8)
jmp 0x22211
movslq -0xbc(%rbp), %rcx
leaq 0x19abde(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0xb8(%rax), %xmm0
movslq -0xbc(%rbp), %rcx
leaq 0x19abbe(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
ucomisd 0x28(%rax), %xmm0
jb 0x221c2
movslq -0xbc(%rbp), %rcx
leaq 0x19ab9f(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0xb8(%rax), %xmm0
movslq -0xbc(%rbp), %rcx
leaq 0x19ab7f(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
subsd 0x28(%rax), %xmm0
movslq -0xbc(%rbp), %rax
movsd %xmm0, -0x160(%rbp,%rax,8)
jmp 0x2220f
movslq -0xbc(%rbp), %rcx
leaq 0x19ab50(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0x28(%rax), %xmm0
movslq -0xbc(%rbp), %rcx
leaq 0x19ab33(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
subsd 0xb0(%rax), %xmm0
movslq -0xbc(%rbp), %rax
movsd %xmm0, -0x160(%rbp,%rax,8)
jmp 0x22211
movslq -0xbc(%rbp), %rax
movsd -0x160(%rbp,%rax,8), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x22244
jp 0x22244
movslq -0xbc(%rbp), %rax
movsd 0x14cf2d(%rip), %xmm0   # 0x16f168
movsd %xmm0, -0x160(%rbp,%rax,8)
cmpq $0x1, -0x8(%rbp)
jle 0x22282
movslq -0xbc(%rbp), %rax
movsd -0x160(%rbp,%rax,8), %xmm0
movq -0x8(%rbp), %rax
movl $0x2, %ecx
cqto
idivq %rcx
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
movslq -0xbc(%rbp), %rax
movsd %xmm0, -0x160(%rbp,%rax,8)
movslq -0xbc(%rbp), %rcx
leaq 0x19aa90(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0x10(%rax), %xmm0
movslq -0xbc(%rbp), %rax
mulsd -0x160(%rbp,%rax,8), %xmm0
movsd %xmm0, -0x160(%rbp,%rax,8)
movslq -0xbc(%rbp), %rax
movsd -0x160(%rbp,%rax,8), %xmm0
callq 0x21d90
movslq -0xbc(%rbp), %rax
movsd %xmm0, -0x160(%rbp,%rax,8)
movl -0xbc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xbc(%rbp)
jmp 0x21ef5
cmpb $0x0, 0x2582be(%rip)    # 0x27a5b6
je 0x223a9
movl $0x0, -0xbc(%rbp)
cmpl $0x14, -0xbc(%rbp)
jge 0x223a7
movslq -0xbc(%rbp), %rax
movsd -0x160(%rbp,%rax,8), %xmm0
movslq -0xbc(%rbp), %rcx
leaq 0x19a9ed(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
ucomisd 0x38(%rax), %xmm0
jbe 0x22391
movslq -0xbc(%rbp), %rcx
leaq 0x19a9ce(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x30(%rax)
jne 0x2238f
movslq -0xbc(%rbp), %rax
movsd -0x160(%rbp,%rax,8), %xmm0
movslq -0xbc(%rbp), %rcx
leaq 0x19a9a0(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x38(%rax)
jmp 0x22391
jmp 0x22393
movl -0xbc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xbc(%rbp)
jmp 0x22308
jmp 0x2241c
movl $0x0, -0xbc(%rbp)
cmpl $0x14, -0xbc(%rbp)
jge 0x2241a
movslq -0xbc(%rbp), %rcx
leaq 0x19a956(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x30(%rax)
jne 0x22407
movslq -0xbc(%rbp), %rax
movsd -0x160(%rbp,%rax,8), %xmm0
movslq -0xbc(%rbp), %rcx
leaq 0x19a928(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x38(%rax)
jmp 0x22409
movl -0xbc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xbc(%rbp)
jmp 0x223b3
jmp 0x2241c
movl $0x0, -0xbc(%rbp)
cmpl $0x14, -0xbc(%rbp)
jge 0x224d0
movslq -0xbc(%rbp), %rcx
leaq 0x19a8df(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x1c(%rax)
je 0x224ba
movslq -0xbc(%rbp), %rcx
leaq 0x19a8c1(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0xb8(%rax), %xmm0
movslq -0xbc(%rbp), %rcx
leaq 0x19a8a1(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
addsd 0xb0(%rax), %xmm0
movsd 0x14ccb7(%rip), %xmm1   # 0x16f150
divsd %xmm1, %xmm0
movslq -0xbc(%rbp), %rcx
leaq 0x19a875(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x28(%rax)
jmp 0x224bc
movl -0xbc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xbc(%rbp)
jmp 0x22426
movsd 0x19aa40(%rip), %xmm0   # 0x1bcf18
movsd %xmm0, 0x349c70(%rip)   # 0x36c150
jmp 0x229a5
cmpq $0x1, 0x257f63(%rip)    # 0x27a450
jl 0x229a3
cmpq $0x0, 0x258155(%rip)    # 0x27a650
je 0x2252e
movq 0x257f4c(%rip), %rsi    # 0x27a450
subq $0x1, %rsi
leaq -0x218(%rbp), %rdi
callq 0x16160
leaq -0xb8(%rbp), %rdi
leaq -0x218(%rbp), %rsi
movl $0xb0, %edx
callq 0x92c0
jmp 0x2255d
movq 0x257f1b(%rip), %rsi    # 0x27a450
subq $0x1, %rsi
leaq -0x2c8(%rbp), %rdi
callq 0x133f0
leaq -0xb8(%rbp), %rdi
leaq -0x2c8(%rbp), %rsi
movl $0xb0, %edx
callq 0x92c0
movl $0x0, -0xbc(%rbp)
cmpl $0x14, -0xbc(%rbp)
jge 0x229a1
movslq -0xbc(%rbp), %rcx
leaq 0x19a79e(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x1c(%rax)
je 0x2298b
cmpl $0x3, -0xbc(%rbp)
jne 0x225db
movsd -0x90(%rbp), %xmm0
cvtsi2sdq 0x257fc8(%rip), %xmm1 # 0x27a578
divsd %xmm1, %xmm0
callq 0x18060
movslq -0xbc(%rbp), %rcx
leaq 0x19a759(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x28(%rax)
jmp 0x22989
callq 0x83ad0
cmpl $0x0, %eax
je 0x22627
cmpl $0x10, -0xbc(%rbp)
jne 0x22627
movsd -0x28(%rbp), %xmm0
cvtsi2sdq 0x257f7c(%rip), %xmm1 # 0x27a578
divsd %xmm1, %xmm0
callq 0x183b0
movslq -0xbc(%rbp), %rcx
leaq 0x19a70d(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x28(%rax)
jmp 0x22987
cmpb $0x0, 0x27baf0(%rip)    # 0x29e11e
je 0x2267d
cmpl $0x8, -0xbc(%rbp)
jne 0x2267d
movslq -0xbc(%rbp), %rax
movsd -0xa8(%rbp,%rax,8), %xmm0
cvtsi2sdq 0x257f26(%rip), %xmm1 # 0x27a578
divsd %xmm1, %xmm0
callq 0x18060
movslq -0xbc(%rbp), %rcx
leaq 0x19a6b7(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x28(%rax)
jmp 0x22985
cmpb $0x0, 0x27ba9a(%rip)    # 0x29e11e
je 0x226d6
cmpl $0x0, -0xbc(%rbp)
jne 0x226d6
movslq -0xbc(%rbp), %rax
movsd -0xa8(%rbp,%rax,8), %xmm0
cvtsi2sdq 0x257ed0(%rip), %xmm1 # 0x27a578
divsd %xmm1, %xmm0
mulsd 0x2553dc(%rip), %xmm0   # 0x277a90
movslq -0xbc(%rbp), %rcx
leaq 0x19a65e(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x28(%rax)
jmp 0x22983
cmpb $0x0, 0x27ba41(%rip)    # 0x29e11e
je 0x2272f
cmpl $0x4, -0xbc(%rbp)
jne 0x2272f
movslq -0xbc(%rbp), %rax
movsd -0xa8(%rbp,%rax,8), %xmm0
cvtsi2sdq 0x257e77(%rip), %xmm1 # 0x27a578
divsd %xmm1, %xmm0
mulsd 0x25538b(%rip), %xmm0   # 0x277a98
movslq -0xbc(%rbp), %rcx
leaq 0x19a605(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x28(%rax)
jmp 0x22981
cmpl $0x10, -0xbc(%rbp)
jl 0x22945
cmpb $0x0, 0x27b9db(%rip)    # 0x29e11e
je 0x2278d
cmpl $0xf, -0xbc(%rbp)
jne 0x2278d
movsd -0xa0(%rbp), %xmm0
mulsd -0x98(%rbp), %xmm0
cvtsi2sdq 0x257e11(%rip), %xmm1 # 0x27a578
divsd %xmm1, %xmm0
movslq -0xbc(%rbp), %rcx
leaq 0x19a5a7(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x28(%rax)
jmp 0x22943
cmpb $0x0, 0x27b98a(%rip)    # 0x29e11e
je 0x227d8
cmpl $0x10, -0xbc(%rbp)
jne 0x227d8
movsd -0x78(%rbp), %xmm0
mulsd -0x80(%rbp), %xmm0
cvtsi2sdq 0x257dc6(%rip), %xmm1 # 0x27a578
divsd %xmm1, %xmm0
movslq -0xbc(%rbp), %rcx
leaq 0x19a55c(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x28(%rax)
jmp 0x22941
cmpb $0x0, 0x27b93f(%rip)    # 0x29e11e
je 0x2287b
cmpl $0x11, -0xbc(%rbp)
jne 0x2287b
movsd -0xa0(%rbp), %xmm0
mulsd -0x98(%rbp), %xmm0
movsd %xmm0, -0x168(%rbp)
movsd -0x168(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x2281f
jp 0x2281f
jmp 0x22839
movsd -0x78(%rbp), %xmm0
mulsd -0x80(%rbp), %xmm0
divsd -0x168(%rbp), %xmm0
movsd %xmm0, -0x168(%rbp)
movsd 0x14c80f(%rip), %xmm0   # 0x16f050
mulsd -0x168(%rbp), %xmm0
movsd %xmm0, -0x168(%rbp)
movsd -0x168(%rbp), %xmm0
movslq -0xbc(%rbp), %rcx
leaq 0x19a4b9(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x28(%rax)
jmp 0x2293f
cmpb $0x0, 0x27b89c(%rip)    # 0x29e11e
je 0x22903
cmpl $0x12, -0xbc(%rbp)
jne 0x22903
movzbl 0x3498b4(%rip), %edi    # 0x36c148
movsd -0x50(%rbp), %xmm0
cvtsi2sdq 0x257cd6(%rip), %xmm1 # 0x27a578
divsd %xmm1, %xmm0
movsd -0x58(%rbp), %xmm1
cvtsi2sdq 0x257cc4(%rip), %xmm2 # 0x27a578
divsd %xmm2, %xmm1
movsd -0x60(%rbp), %xmm2
cvtsi2sdq 0x257cb2(%rip), %xmm3 # 0x27a578
divsd %xmm3, %xmm2
movl $0x1, %esi
callq 0xa8d40
movsd %xmm0, -0x168(%rbp)
movsd -0x168(%rbp), %xmm0
movslq -0xbc(%rbp), %rcx
leaq 0x19a42e(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x28(%rax)
jmp 0x2293d
movslq -0xbc(%rbp), %rax
movsd -0xa8(%rbp,%rax,8), %xmm0
cvtsi2sdq 0x257c5c(%rip), %xmm1 # 0x27a578
divsd %xmm1, %xmm0
movslq -0xbc(%rbp), %rcx
leaq 0x19a3f2(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x28(%rax)
jmp 0x2293f
jmp 0x22941
jmp 0x22943
jmp 0x2297f
movslq -0xbc(%rbp), %rax
movsd -0xa8(%rbp,%rax,8), %xmm0
cvtsi2sdq 0x257c1a(%rip), %xmm1 # 0x27a578
divsd %xmm1, %xmm0
movslq -0xbc(%rbp), %rcx
leaq 0x19a3b0(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x28(%rax)
jmp 0x22981
jmp 0x22983
jmp 0x22985
jmp 0x22987
jmp 0x22989
jmp 0x2298b
jmp 0x2298d
movl -0xbc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xbc(%rbp)
jmp 0x22567
jmp 0x229a3
jmp 0x229a5
movl $0x0, -0xbc(%rbp)
cmpl $0x14, -0xbc(%rbp)
jge 0x22b21
movslq -0xbc(%rbp), %rcx
leaq 0x19a356(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x1c(%rax)
je 0x22b0b
movslq -0xbc(%rbp), %rcx
leaq 0x19a334(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0x38(%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x22a0b
jp 0x22a0b
jmp 0x22b0b
movslq -0xbc(%rbp), %rcx
leaq 0x19a307(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0x10(%rax), %xmm0
movslq -0xbc(%rbp), %rcx
leaq 0x19a2ea(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
mulsd 0x28(%rax), %xmm0
movsd %xmm0, 0x28(%rax)
movslq -0xbc(%rbp), %rcx
leaq 0x19a2c8(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0x28(%rax), %xmm0
movslq -0xbc(%rbp), %rcx
leaq 0x19a2ab(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
divsd 0x38(%rax), %xmm0
cvttsd2si %xmm0, %rax
cvtsi2sd %rax, %xmm0
movslq -0xbc(%rbp), %rcx
leaq 0x19a284(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
mulsd 0x38(%rax), %xmm0
movslq -0xbc(%rbp), %rcx
leaq 0x19a267(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x28(%rax)
movslq -0xbc(%rbp), %rcx
leaq 0x19a24a(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0x10(%rax), %xmm1
movslq -0xbc(%rbp), %rcx
leaq 0x19a22d(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0x28(%rax), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x28(%rax)
jmp 0x22b0d
movl -0xbc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xbc(%rbp)
jmp 0x229af
addq $0x2d0, %rsp            # imm = 0x2D0
popq %rbp
retq
nopw (%rax,%rax)