// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathmsc.cpp
// Function: plot_adev_curve(ADEV_INFO*, unsigned char, int)
void plot_adev_curve(struct ADEV_INFO *bins, u08 color, int mask)
{
int i;
int x1, x2;
float y1, y2;
float max_scale;
float min_scale;
float adev_range;
int vert_scale;
int vert_ofs;

double n;
float m;
float eb1,eb2;


   if(text_mode) return;  // no room on screen to do this
   if(rcvr_type == NO_RCVR) return;  // no room on screen to do this
   if(rcvr_type == TIDE_RCVR) return;  // ckckck has no adevs to show

   if(first_key) return;
   if(plot_adev_data == 0) return;
   if(bins == 0) return;

   if(zoom_screen == 'P') ;
   else if(zoom_screen) return;

   if(bins->adev_bins[0] == 0.0) return;

if((mask & adev_display_mask) == 0) return;

   max_scale = scale_adev(bins->adev_max);
   if(bottom_adev_decade) min_scale = scale_adev(bottom_adev_decade);
   else                   min_scale = scale_adev(bins->adev_min);
if(ATYPE == A_MTIE) {  // offset plots a little from the top and bottom of the plot area
   min_scale = scale_adev(bins->adev_min);
max_scale = (float) (global_adev_max*MTIE_SCALE);
min_scale = (float) (global_adev_min/MTIE_SCALE);
}

   adev_range = max_scale - min_scale;
   adev_range = (float) ABS(adev_range);
//sprintf(debug_text2, "ascale min:%g  max:%g  range:%g", min_scale, max_scale, adev_range);
   if(adev_range == 0.0) return;


   // adev plots are scaled to major vertical divisions
   vert_scale = (PLOT_HEIGHT / (VERT_MAJOR*2)) * (VERT_MAJOR*2);  // two major divisions per decade
   vert_ofs = (PLOT_HEIGHT - vert_scale) / 2;
   if(((PLOT_HEIGHT / (VERT_MAJOR*2)) & 0x01) == 0x00) {  // align adevs to cyan dotted lines
      vert_ofs += VERT_MAJOR;
   }
//sprintf(plot_title, "bot:%g  max(%g):%g min(%g):%g range:%g", bottom_adev_decade, bins->adev_max,max_scale, bins->adev_min,min_scale, adev_range);

   for(i=first_show_bin; i<bins->bin_count; i++) {
      x1 = (i-first_show_bin-1) * HORIZ_MAJOR;   // make sure line fits in the plot
      x2 = (i-first_show_bin) * HORIZ_MAJOR;
if(x1 > PLOT_WIDTH) continue; // aaaahhhh 
if(x2 > PLOT_WIDTH) continue;
if(x1 < 0) continue;
if(x2 < 0) continue;
      if(x1 < 0) x1 = 0;
      if(x2 > PLOT_WIDTH) x2 = PLOT_WIDTH;

      y1 = (0.0F - scale_adev(bins->adev_bins[i-1]));
      y1 += max_scale;
      y1 /= adev_range;
      y1 *= (float) vert_scale;
      y1 += (float) (PLOT_ROW + vert_ofs);
      if(y1 <= PLOT_ROW) y1 = (float) (PLOT_ROW+2);
      if(y1 >= (PLOT_ROW+PLOT_HEIGHT-1)) y1 = (float) (PLOT_ROW+PLOT_HEIGHT-2);

      y2 = eb1 = eb2 = bins->adev_bins[i];
      y2 = (0.0F - scale_adev(y2));
      y2 += max_scale;
      y2 /= adev_range;
      y2 *= (float) vert_scale;
      y2 += (float) (PLOT_ROW+vert_ofs);
      if(y2 <= PLOT_ROW) y2 = (float) (PLOT_ROW+2);
      if(y2 >= (PLOT_ROW+PLOT_HEIGHT-1)) y2 = (float) (PLOT_ROW+PLOT_HEIGHT-2);

      if(x1 < PLOT_WIDTH) {
         line(PLOT_COL+x1, (int) y1, PLOT_COL+x2, (int) y2, color);
      }
   }

   // draw error bars from last bin to first bin
   if(show_error_bars == 0) return;  // bars disabled
if(ATYPE == A_MTIE) return;

   for(i=bins->bin_count-1; i>=first_show_bin; i--) {
      eb1 = eb2 = bins->adev_bins[i];

      x1 = (i-first_show_bin-1) * HORIZ_MAJOR;   // make sure line fits in the plot
      x2 = (i-first_show_bin) * HORIZ_MAJOR;
if(x1 > PLOT_WIDTH) continue;
if(x2 > PLOT_WIDTH) continue;
if(x1 < 0) continue;
if(x2 < 0) continue;
      if(x1 < 0) x1 = 0;
      if(x2 > PLOT_WIDTH) x2 = PLOT_WIDTH;

      if(1 || (x1 < PLOT_WIDTH)) {
         m = (float) bins->adev_taus[i];
         if(m == 0) continue;

         n = (double) bins->adev_on[i];
         n = sqrt(n/(double) m);
         if(n == 0) continue;

         eb1 -= (eb1 / (float) n);
         eb1 = (0.0F - scale_adev(eb1));
         eb1 += max_scale;
         eb1 /= adev_range;
         eb1 *= vert_scale;
         eb1 += (PLOT_ROW+vert_ofs);
         if(eb1< PLOT_ROW) eb1 = (float) PLOT_ROW;
         if(eb1 >= (PLOT_ROW+PLOT_HEIGHT)) eb1 = (float) (PLOT_ROW+PLOT_HEIGHT);

         eb2 += (eb2 / (float) n);
         eb2 = (0.0F - scale_adev(eb2));
         eb2 += max_scale;
         eb2 /= adev_range;
         eb2 *= vert_scale;
         eb2 += (PLOT_ROW+vert_ofs);
         if(eb2< PLOT_ROW) eb2 = (float) PLOT_ROW;
         if(eb2 >= (PLOT_ROW+PLOT_HEIGHT)) eb2 = (float) (PLOT_ROW+PLOT_HEIGHT);


         if(n < 1.0) {  // error bars are too large to be meaningful - limit size and use arrow endcaps
            eb1 = y2 - (float) (adev_decade_height / 2.0);
            eb2 = y2 + (float) ( adev_decade_height / 2.0);

            if(eb1< PLOT_ROW) eb1 = (float) PLOT_ROW;
            if(eb1 >= (PLOT_ROW+PLOT_HEIGHT)) eb1 = (float) (PLOT_ROW+PLOT_HEIGHT);

            if(eb2< PLOT_ROW) eb2 = (float) PLOT_ROW;
            if(eb2 >= (PLOT_ROW+PLOT_HEIGHT)) eb2 = (float) (PLOT_ROW+PLOT_HEIGHT);

            line(PLOT_COL+x2,(int) eb1, PLOT_COL+x2,(int)eb2, color);

            line(PLOT_COL+x2-HORIZ_MINOR/3,(int) eb1+VERT_MINOR, PLOT_COL+x2,(int)eb1, color);
            line(PLOT_COL+x2+HORIZ_MINOR/3,(int) eb1+VERT_MINOR, PLOT_COL+x2,(int)eb1, color);

            line(PLOT_COL+x2-HORIZ_MINOR/3,(int) eb2-VERT_MINOR, PLOT_COL+x2,(int)eb2, color);
            line(PLOT_COL+x2+HORIZ_MINOR/3,(int) eb2-VERT_MINOR, PLOT_COL+x2,(int)eb2, color);
         }
         else if(0 || (fabs(eb2-eb1) >= (double) (VERT_MINOR*1))) { // good bars, use flat end caps
            if(0) {  // center error bars on the adev line
               y2 = bins->adev_bins[i];
               y2 = (0.0F - scale_adev(y2));
               y2 += max_scale;
               y2 /= adev_range;
               y2 *= (float) vert_scale;
               y2 += (float) (PLOT_ROW+vert_ofs);
               if(y2 < PLOT_ROW) y2 = (float) PLOT_ROW;
               if(y2 >= (PLOT_ROW+PLOT_HEIGHT)) y2 = (float) (PLOT_ROW+PLOT_HEIGHT);

               m = (float) (fabs(eb1-eb2) / 2.0);
               eb1 = y2 - m;
               eb2 = y2 + m;
            }

            line(PLOT_COL+x2,(int) eb1, PLOT_COL+x2,(int)eb2, color);

            line(PLOT_COL+x2-HORIZ_MINOR/3,(int) eb1, PLOT_COL+x2+HORIZ_MINOR/3,(int)eb1, color);
            line(PLOT_COL+x2-HORIZ_MINOR/3,(int) eb2, PLOT_COL+x2+HORIZ_MINOR/3,(int)eb2, color);
         }
         else {  // stop on last non-short error bar
            break;
         }
      }
   }

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
leaq 0x1162f3(%rip), %rax    # 0x2187d8
cmpl $0x0, (%rax)
je 0x1024fc
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1163cd(%rip), %rax    # 0x2188d0
movq (%rax), %rax
cmpq $0x400, %rax            # imm = 0x400
je 0x1024ea
cmpq $0x800000, %rax         # imm = 0x800000
je 0x1024ea
testq %rdi, %rdi
je 0x1024ea
leaq 0x13ca36(%rip), %rax    # 0x23ef58
cmpl $0x0, (%rax)
jne 0x1024ea
leaq 0x118eab(%rip), %rax    # 0x21b3d9
cmpb $0x0, (%rax)
je 0x1024ea
movl %esi, %r14d
leaq 0x20a26b(%rip), %rax    # 0x30c7a8
movzbl (%rax), %eax
cmpl $0x50, %eax
je 0x102549
testl %eax, %eax
jne 0x1024ea
movss 0x194(%rdi), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x10255b
jnp 0x1024ea
leaq 0x1210b6(%rip), %rax    # 0x223618
testl %edx, (%rax)
je 0x1024ea
movq %rdi, -0x38(%rbp)
movss 0x650(%rdi), %xmm0
callq 0xfe758
movss %xmm0, -0x2c(%rbp)
movss 0x278034(%rip), %xmm0   # 0x37a5b8
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x10259a
jp 0x10259a
movq -0x38(%rbp), %rax
movss 0x64c(%rax), %xmm0
callq 0xfe758
leaq 0x12106a(%rip), %r8     # 0x223610
cmpl $0x9, (%r8)
jne 0x1025e3
leaq 0x13a535(%rip), %rax    # 0x23cae8
movsd 0x2a0dd(%rip), %xmm0    # 0x12c698
movsd (%rax), %xmm1
mulsd %xmm0, %xmm1
cvtsd2ss %xmm1, %xmm2
leaq 0x13a522(%rip), %rax    # 0x23caf0
movsd (%rax), %xmm1
divsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
movq -0x38(%rbp), %rdi
jmp 0x1025ec
movq -0x38(%rbp), %rdi
movss -0x2c(%rbp), %xmm2
movss %xmm2, -0x2c(%rbp)
movaps %xmm2, %xmm1
subss %xmm0, %xmm1
xorps %xmm0, %xmm0
xorps %xmm2, %xmm2
subss %xmm1, %xmm2
movaps %xmm1, %xmm3
cmpltss %xmm0, %xmm3
andps %xmm3, %xmm2
andnps %xmm1, %xmm3
orps %xmm2, %xmm3
ucomiss %xmm0, %xmm3
jne 0x10261e
jnp 0x1024ea
leaq 0x116263(%rip), %rax    # 0x218888
movl (%rax), %eax
leaq 0x11623e(%rip), %rcx    # 0x21886c
movl (%rcx), %ecx
leal (%rcx,%rcx), %r9d
cltd
idivl %r9d
imull %eax, %r9d
movl %edx, %esi
shrl $0x1f, %esi
addl %edx, %esi
sarl %esi
xorl %edx, %edx
testb $0x1, %al
cmovel %ecx, %edx
addl %esi, %edx
movq %rdx, -0x98(%rbp)
leaq 0x13a624(%rip), %rsi    # 0x23cc80
movslq (%rsi), %r12
movl 0x648(%rdi), %r15d
cmpl %r15d, %r12d
movaps %xmm3, -0xb0(%rbp)
jge 0x102868
movl %r9d, -0x3c(%rbp)
xorps %xmm3, %xmm3
cvtsi2ss %r9d, %xmm3
leaq 0x1161eb(%rip), %rcx    # 0x218874
leaq 0x1161f4(%rip), %rdx    # 0x218884
movzbl %r14b, %eax
movl %eax, -0x40(%rbp)
movss %xmm3, -0x30(%rbp)
movl (%rsi), %eax
movl %r12d, %r15d
subl %eax, %r15d
leal -0x1(%r15), %r13d
movl (%rcx), %eax
imull %eax, %r13d
movl (%rdx), %ebx
cmpl %ebx, %r13d
jg 0x10284a
imull %eax, %r15d
cmpl %ebx, %r15d
jg 0x10284a
movl %r13d, %eax
orl %r15d, %eax
js 0x10284a
leaq 0x1161a3(%rip), %rax    # 0x21887c
movl (%rax), %eax
movq -0x98(%rbp), %rcx
addl %eax, %ecx
xorps %xmm0, %xmm0
cvtsi2ss %ecx, %xmm0
movss %xmm0, -0x68(%rbp)
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x80(%rbp)
leal 0x2(%rax), %ecx
xorps %xmm0, %xmm0
cvtsi2ss %ecx, %xmm0
movaps %xmm0, -0x90(%rbp)
leaq 0x116174(%rip), %rcx    # 0x218888
movl (%rcx), %ecx
leal -0x1(%rcx,%rax), %edx
xorps %xmm0, %xmm0
cvtsi2ss %edx, %xmm0
movaps %xmm0, -0x50(%rbp)
leal -0x2(%rcx,%rax), %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
movaps %xmm0, -0x60(%rbp)
movss 0x194(%rdi,%r12,4), %xmm0
callq 0xfe758
movss -0x30(%rbp), %xmm3
xorps %xmm1, %xmm1
subss %xmm0, %xmm1
movss -0x2c(%rbp), %xmm4
addss %xmm4, %xmm1
divss -0xb0(%rbp), %xmm1
mulss %xmm3, %xmm1
addss -0x68(%rbp), %xmm1
movaps %xmm1, %xmm0
cmpnless -0x80(%rbp), %xmm0
andps %xmm0, %xmm1
andnps -0x90(%rbp), %xmm0
orps %xmm1, %xmm0
movaps -0x50(%rbp), %xmm2
cmpnless %xmm0, %xmm2
movaps %xmm2, %xmm1
andps %xmm0, %xmm1
andnps -0x60(%rbp), %xmm2
orps %xmm1, %xmm2
cmpl %ebx, %r13d
movaps %xmm2, -0xc0(%rbp)
jge 0x102831
movq -0x38(%rbp), %rbx
movss 0x190(%rbx,%r12,4), %xmm0
callq 0xfe758
xorps %xmm1, %xmm1
subss %xmm0, %xmm1
addss -0x2c(%rbp), %xmm1
divss -0xb0(%rbp), %xmm1
mulss -0x30(%rbp), %xmm1
addss -0x68(%rbp), %xmm1
movaps %xmm1, %xmm0
cmpnless -0x80(%rbp), %xmm0
andps %xmm0, %xmm1
andnps -0x90(%rbp), %xmm0
orps %xmm1, %xmm0
movaps -0x50(%rbp), %xmm2
cmpnless %xmm0, %xmm2
movaps %xmm2, %xmm1
andps %xmm0, %xmm1
andnps -0x60(%rbp), %xmm2
orps %xmm1, %xmm2
leaq 0x116077(%rip), %rax    # 0x218880
movl (%rax), %eax
cvttss2si %xmm2, %esi
addl %eax, %r13d
addl %eax, %r15d
cvttss2si -0xc0(%rbp), %ecx
movl %r13d, %edi
movl %r15d, %edx
movl -0x40(%rbp), %r8d
callq 0xe3c3
movq %rbx, %rdi
jmp 0x102835
movq -0x38(%rbp), %rdi
leaq 0x13a444(%rip), %rsi    # 0x23cc80
leaq 0x116031(%rip), %rcx    # 0x218874
leaq 0x11603a(%rip), %rdx    # 0x218884
incq %r12
movslq 0x648(%rdi), %r15
cmpq %r15, %r12
jl 0x10269c
leaq 0x120dac(%rip), %r8     # 0x223610
movl -0x3c(%rbp), %r9d
leaq 0x13a47d(%rip), %rax    # 0x23ccec
cmpl $0x0, (%rax)
je 0x1024ea
cmpl $0x9, (%r8)
je 0x1024ea
movl (%rsi), %eax
cmpl %eax, %r15d
jle 0x1024ea
xorps %xmm0, %xmm0
cvtsi2ss %r9d, %xmm0
movss %xmm0, -0x3c(%rbp)
movslq %r15d, %r13
addl $-0x2, %r15d
leaq 0x115fcc(%rip), %rbx    # 0x218874
leaq 0x115fd5(%rip), %rcx    # 0x218884
xorps %xmm2, %xmm2
xorps %xmm3, %xmm3
movzbl %r14b, %edx
movl %edx, -0x60(%rbp)
movq %rcx, %r14
movl %r15d, %ecx
subl %eax, %ecx
movl (%rbx), %r12d
movl %r12d, %eax
imull %ecx, %eax
movl (%r14), %edx
cmpl %edx, %eax
jg 0x102d1b
incl %ecx
imull %ecx, %r12d
cmpl %edx, %r12d
jg 0x102d1b
orl %r12d, %eax
js 0x102d1b
movss (%rdi,%r13,4), %xmm1
ucomiss %xmm2, %xmm1
jne 0x102901
jnp 0x102d1b
movss 0x190(%rdi,%r13,4), %xmm4
xorps %xmm0, %xmm0
cvtsi2sdq 0x320(%rdi,%r13,8), %xmm0
cvtss2sd %xmm1, %xmm1
divsd %xmm1, %xmm0
ucomisd %xmm3, %xmm0
jb 0x10292c
sqrtsd %xmm0, %xmm0
jmp 0x10294c
movss %xmm4, -0x50(%rbp)
callq 0x9270
movss -0x50(%rbp), %xmm4
xorps %xmm3, %xmm3
xorps %xmm2, %xmm2
leaq 0x13a338(%rip), %rsi    # 0x23cc80
movq -0x38(%rbp), %rdi
ucomisd %xmm3, %xmm0
jne 0x102958
jnp 0x102d1b
movsd %xmm0, -0x68(%rbp)
cvtsd2ss %xmm0, %xmm0
movaps %xmm4, %xmm1
divss %xmm0, %xmm1
movss %xmm1, -0x30(%rbp)
movaps %xmm4, %xmm0
subss %xmm1, %xmm0
movss %xmm4, -0x50(%rbp)
callq 0xfe758
leaq 0x115ef7(%rip), %rax    # 0x21887c
movl (%rax), %ebx
xorps %xmm1, %xmm1
cvtsi2ss %ebx, %xmm1
movaps %xmm1, -0x90(%rbp)
movss %xmm0, -0x40(%rbp)
leaq 0x115ee7(%rip), %rax    # 0x218888
movl (%rax), %eax
addl %ebx, %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
movaps %xmm0, -0x80(%rbp)
movss -0x30(%rbp), %xmm0
addss -0x50(%rbp), %xmm0
callq 0xfe758
movsd 0x66a9(%rip), %xmm1     # 0x109070
ucomisd -0x68(%rbp), %xmm1
jbe 0x102b98
leaq 0x13a317(%rip), %rax    # 0x23ccf0
movsd (%rax), %xmm0
mulsd 0x6683(%rip), %xmm0     # 0x109068
cvtsd2ss %xmm0, %xmm0
movaps -0xc0(%rbp), %xmm2
movaps %xmm2, %xmm1
subss %xmm0, %xmm1
addss %xmm2, %xmm0
movaps -0x90(%rbp), %xmm4
movaps %xmm4, %xmm2
maxss %xmm1, %xmm2
movaps -0x80(%rbp), %xmm5
movaps %xmm5, %xmm1
cmpless %xmm2, %xmm1
movaps %xmm1, %xmm3
andnps %xmm2, %xmm3
andps %xmm5, %xmm1
orps %xmm3, %xmm1
maxss %xmm0, %xmm4
movaps %xmm5, %xmm0
cmpless %xmm4, %xmm0
movaps %xmm0, %xmm2
andnps %xmm4, %xmm2
andps %xmm5, %xmm0
orps %xmm2, %xmm0
leaq 0x115e40(%rip), %rbx    # 0x218880
movl (%rbx), %edi
addl %r12d, %edi
cvttss2si %xmm1, %r14d
cvttss2si %xmm0, %ecx
movl %ecx, -0x50(%rbp)
movl %r14d, %esi
movl %edi, %edx
movl -0x60(%rbp), %ebx
movl %ebx, %r8d
callq 0xe3c3
leaq 0x115e18(%rip), %rax    # 0x218880
movl (%rax), %edx
addl %r12d, %edx
leaq 0x115e04(%rip), %rax    # 0x218878
movslq (%rax), %rax
imulq $0x55555555, %rax, %rdi # imm = 0x55555555
shrq $0x20, %rdi
subl %eax, %edi
movl %edi, %eax
shrl $0x1f, %eax
sarl %edi
addl %eax, %edi
addl %edx, %edi
leaq 0x115dda(%rip), %rax    # 0x218870
movl (%rax), %esi
addl %r14d, %esi
movl %r14d, %ecx
movl %ebx, %r8d
callq 0xe3c3
leaq 0x115dd3(%rip), %rax    # 0x218880
movl (%rax), %edx
addl %r12d, %edx
leaq 0x115dbf(%rip), %rax    # 0x218878
movslq (%rax), %rax
imulq $0x55555556, %rax, %rdi # imm = 0x55555556
movq %rdi, %rax
shrq $0x3f, %rax
shrq $0x20, %rdi
addl %eax, %edi
addl %edx, %edi
leaq 0x115d97(%rip), %rax    # 0x218870
movl (%rax), %esi
addl %r14d, %esi
movl %r14d, %ecx
leaq 0x115d9c(%rip), %r14    # 0x218884
movl %ebx, %r8d
callq 0xe3c3
leaq 0x115d89(%rip), %rax    # 0x218880
movl (%rax), %edx
addl %r12d, %edx
leaq 0x115d75(%rip), %rax    # 0x218878
movslq (%rax), %rax
imulq $0x55555555, %rax, %rdi # imm = 0x55555555
shrq $0x20, %rdi
subl %eax, %edi
movl %edi, %eax
shrl $0x1f, %eax
sarl %edi
addl %eax, %edi
addl %edx, %edi
movl -0x50(%rbp), %ebx
movl %ebx, %esi
leaq 0x115d46(%rip), %rax    # 0x218870
subl (%rax), %esi
movl %ebx, %ecx
movl -0x60(%rbp), %r8d
callq 0xe3c3
leaq 0x115d42(%rip), %rax    # 0x218880
addl (%rax), %r12d
leaq 0x115d30(%rip), %rax    # 0x218878
movslq (%rax), %rax
imulq $0x55555556, %rax, %rdi # imm = 0x55555556
movq %rdi, %rax
shrq $0x3f, %rax
shrq $0x20, %rdi
addl %eax, %edi
addl %r12d, %edi
movl %ebx, %esi
leaq 0x115d05(%rip), %rax    # 0x218870
subl (%rax), %esi
movl %r12d, %edx
movl %ebx, %ecx
movl -0x60(%rbp), %r8d
callq 0xe3c3
movq -0x38(%rbp), %rdi
leaq 0x13a0fa(%rip), %rsi    # 0x23cc80
leaq 0x115ce7(%rip), %rbx    # 0x218874
xorps %xmm2, %xmm2
xorps %xmm3, %xmm3
jmp 0x102d1b
xorpd %xmm1, %xmm1
subss -0x40(%rbp), %xmm1
movss -0x2c(%rbp), %xmm5
addss %xmm5, %xmm1
addl -0x98(%rbp), %ebx
xorps %xmm2, %xmm2
cvtsi2ss %ebx, %xmm2
movaps -0xb0(%rbp), %xmm6
divss %xmm6, %xmm1
movss -0x3c(%rbp), %xmm7
mulss %xmm7, %xmm1
addss %xmm2, %xmm1
movaps -0x90(%rbp), %xmm8
movaps %xmm8, %xmm3
maxss %xmm1, %xmm3
movaps -0x80(%rbp), %xmm9
movaps %xmm9, %xmm1
cmpless %xmm3, %xmm1
movaps %xmm1, %xmm4
andnps %xmm3, %xmm4
andps %xmm9, %xmm1
orps %xmm4, %xmm1
xorps %xmm3, %xmm3
subss %xmm0, %xmm3
addss %xmm5, %xmm3
divss %xmm6, %xmm3
mulss %xmm7, %xmm3
addss %xmm2, %xmm3
maxss %xmm3, %xmm8
movaps %xmm9, %xmm0
cmpless %xmm8, %xmm0
movaps %xmm0, %xmm2
andnps %xmm8, %xmm2
andps %xmm9, %xmm0
orps %xmm2, %xmm0
movaps %xmm0, %xmm2
subss %xmm1, %xmm2
andps 0x29c34(%rip), %xmm2    # 0x12c870
cvtss2sd %xmm2, %xmm2
leaq 0x115c29(%rip), %rax    # 0x218870
xorps %xmm3, %xmm3
cvtsi2sdl (%rax), %xmm3
ucomisd %xmm3, %xmm2
leaq 0x115c1b(%rip), %rbx    # 0x218874
jb 0x1024ea
leaq 0x115c1a(%rip), %rax    # 0x218880
movl (%rax), %edi
addl %r12d, %edi
cvttss2si %xmm1, %r14d
cvttss2si %xmm0, %ecx
movl %ecx, -0x50(%rbp)
movl %r14d, %esi
movl %edi, %edx
movl -0x60(%rbp), %r8d
callq 0xe3c3
leaq 0x115bf4(%rip), %rax    # 0x218880
movl (%rax), %eax
addl %r12d, %eax
leaq 0x115be0(%rip), %rcx    # 0x218878
movslq (%rcx), %rcx
imulq $0x55555556, %rcx, %rdx # imm = 0x55555556
movq %rdx, %rcx
shrq $0x3f, %rcx
shrq $0x20, %rdx
addl %ecx, %edx
movl %eax, %edi
subl %edx, %edi
addl %eax, %edx
movl %r14d, %esi
movl %r14d, %ecx
leaq 0x115bc2(%rip), %r14    # 0x218884
movl -0x60(%rbp), %r8d
callq 0xe3c3
leaq 0x115bae(%rip), %rax    # 0x218880
addl (%rax), %r12d
leaq 0x115b9c(%rip), %rax    # 0x218878
movslq (%rax), %rax
imulq $0x55555556, %rax, %rdx # imm = 0x55555556
movq %rdx, %rax
shrq $0x3f, %rax
shrq $0x20, %rdx
addl %eax, %edx
movl %r12d, %edi
subl %edx, %edi
addl %r12d, %edx
movl -0x50(%rbp), %ecx
movl %ecx, %esi
movl -0x60(%rbp), %r8d
callq 0xe3c3
xorpd %xmm3, %xmm3
xorps %xmm2, %xmm2
leaq 0x139f69(%rip), %rsi    # 0x23cc80
movq -0x38(%rbp), %rdi
decq %r13
movslq (%rsi), %rax
decl %r15d
cmpq %rax, %r13
jg 0x1028bf
jmp 0x1024ea