// File: jkingan[P]ladyheather/heathmsc.cpp
// Function: process_signal(long, int)
long process_signal(long length, int id)
{
long i;
long last_i;
long j;
int k;
struct PLOT_Q q;
DATA_SIZE show_time;
float a;
float tempflt;
float max_db, min_db;
int color;

   last_i = 0;
   plot_column = 0;

   j = 0;
   i = plot_q_col0;
   fft_queue_0 = i;
   while(i != plot_q_in) {  // copy queue data to FFT buffers
      if(filter_count) q = filter_plot_q(i);
      else             q = get_plot_q(i);

      tsignal[j] = (float) q.data[id];  // * window[j];
      if(queue_interval) tsignal[j] /= queue_interval;
      if(++j >= length) {
         break;  // buffer is full
      }

      i = next_q_point(i, STOP_AT_Q_END);
      if(i < 0) {
         break;
      }
   }

   if(j <= 0) {
      fft_length = 0;
      goto done;
   }

   length = (1 << logg2(j));  // adjust fft length for short data
   if(length > j) length /= 2;
   if(length > max_fft_len) length = max_fft_len;

   fft_scale = 1;
   fft_length = length;
   if(fft_length < 2) goto done;  //fft_scale = 1;
   else               fft_scale = ((view_interval * (long)SCREEN_WIDTH) / (fft_length/2L));
   if(fft_scale < 1)  fft_scale = 1;

   show_time = ((DATA_SIZE) (fft_length)) * ((DATA_SIZE) view_interval);  // seconds per screen
   show_time /= (DATA_SIZE) plot_mag;
   show_time /= nav_rate;
   if(show_time < (DATA_SIZE) (2.0*60.0*60.0)) sprintf(out, "%.1f min", show_time/(DATA_SIZE) 60.0);
   else                                        sprintf(out, "%.1f hrs", show_time/(DATA_SIZE) (60.0*60.0));
   if(title_type != USER) {
      sprintf(plot_title, "%ld point FFT of %s of%s%s data.", 
          fft_length, out, show_live_fft?" live ":" ", plot[id].plot_id);
      title_type = OTHER;
   }

   a = (float) fft_length * (float) fft_length;
   rfft(&tsignal[0], fft_out, logg2(fft_length));

   fft_max = (float) (-BIG_NUM);
   fft_min = (float) (BIG_NUM);
   for(j=1; j<fft_length/2; j++) {
      tempflt  = fft_out[j].real * fft_out[j].real;
      tempflt += fft_out[j].imag * fft_out[j].imag;
      if(tempflt > fft_max) fft_max = tempflt;
      if(tempflt < fft_min) fft_min = tempflt;
   }
   if(fft_max == 0.0F) fft_max = 1.0F;
   max_db = (float) (10.0 * log10(MAX(fft_max/a, 1.e-16))) ;
   min_db = (float) (10.0 * log10(MAX(fft_min/a, 1.e-16))) ;

   if((zoom_screen == 'F') && (fft_col < (SCREEN_WIDTH-TEXT_HEIGHT-2))) {  // FFT waterfall
      for(j=1; j<fft_length/2; j++) {
         tempflt  = fft_out[j].real * fft_out[j].real;
         tempflt += fft_out[j].imag * fft_out[j].imag;

         if(fft_db && (max_db != min_db)) {  // calc FFT in dB
           tempflt /= a;
           tempflt = (float) (10.0 * log10(MAX(tempflt, 1.e-16))) ;
           tempflt -= min_db;
           tempflt /= (max_db-min_db);  // 0..1
         }
         else if(fft_max != fft_min) {
            tempflt -= fft_min;
            tempflt /= (fft_max-fft_min);  // 0..1
         }
         else tempflt = 0.0F;
         tempflt *= 15.0F;    // 15 - number of colors used
         if(tempflt < 0.0F) tempflt = 0.0F-tempflt;
         color = ((int) tempflt) % 15;
         if(color < 0) color = 0;
         else if(color > 14) color = 14;
         dot(fft_col++, fft_row, color+1);
      }

      line(fft_col,fft_row, SCREEN_WIDTH-1, fft_row, BLACK);
      ++fft_row;
      line(0,fft_row, SCREEN_WIDTH-1, fft_row, RED);
      fft_col = 0;
      if(fft_row >= (SCREEN_HEIGHT-TEXT_HEIGHT*2)) fft_row = 0;
   }

   plot_column = 0;
   j = 0;
   i = last_i = plot_q_col0;

   // place fft results into the plot queue FFT plot data
   while(i != plot_q_in) {  
      for(k=0; k<fft_scale; k++) { // expand plot horizontally so that it is easier to read
         q = get_plot_q(i);

         if(j >= fft_length/2) q.data[FFT] = (DATA_SIZE) 0.0;  // fill out queue with 0's
         else if(j == 0)       q.data[FFT] = (DATA_SIZE) 0.0;  // drop the DC value because it messes up scaling
         else {   // insert FFT results into plot queue data
            tempflt  = fft_out[j].real * fft_out[j].real;
            tempflt += fft_out[j].imag * fft_out[j].imag;
            if(fft_db) {  // calc FFT in dB
              tempflt /= a;
              tempflt = (float) (10.0 * log10(MAX(tempflt, 1.e-16))) ;
            }
            else {
               tempflt /= fft_max;
            }
            q.data[FFT] = (DATA_SIZE) tempflt;
            last_i = i;
         }
         if(j == 1) mark_q_entry[1] = i;

         put_plot_q(i, q);
         if(++i == plot_q_in) goto done;
         while(i >= plot_q_size) i -= plot_q_size;
      }
      j++;
      if((j >= fft_length/2) && (j >= SCREEN_WIDTH*2)) break;
   }

   done:
   mark_q_entry[2] = last_i;
   return j;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x4d0, %rsp            # imm = 0x4D0
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq $0x0, -0x20(%rbp)
leaq 0x10dd2b(%rip), %rax    # 0x27a5ac
movl $0x0, (%rax)
movq $0x0, -0x28(%rbp)
leaq 0x10dbb2(%rip), %rax    # 0x27a448
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rcx
leaq 0x2326d0(%rip), %rax    # 0x39ef78
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
leaq 0x10dc52(%rip), %rcx    # 0x27a508
cmpq (%rcx), %rax
je 0x16c9a8
leaq 0x10dd8a(%rip), %rax    # 0x27a650
cmpq $0x0, (%rax)
je 0x16c8f6
movq -0x18(%rbp), %rsi
leaq -0x1b0(%rbp), %rdi
callq 0x16160
leaq -0xe0(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
movl $0xb0, %edx
callq 0x92c0
jmp 0x16c91e
movq -0x18(%rbp), %rsi
leaq -0x260(%rbp), %rdi
callq 0x133f0
leaq -0xe0(%rbp), %rdi
leaq -0x260(%rbp), %rsi
movl $0xb0, %edx
callq 0x92c0
movslq -0xc(%rbp), %rax
movsd -0xd0(%rbp,%rax,8), %xmm0
cvtsd2ss %xmm0, %xmm0
leaq 0x23264a(%rip), %rax    # 0x39ef80
movq (%rax), %rax
movq -0x28(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
leaq 0x10dc2f(%rip), %rax    # 0x27a578
cmpq $0x0, (%rax)
je 0x16c977
leaq 0x10dc22(%rip), %rax    # 0x27a578
cvtsi2ssq (%rax), %xmm1
leaq 0x23261e(%rip), %rax    # 0x39ef80
movq (%rax), %rax
movq -0x28(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
divss %xmm1, %xmm0
movss %xmm0, (%rax,%rcx,4)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
cmpq -0x8(%rbp), %rax
jl 0x16c98b
jmp 0x16c9a8
movq -0x18(%rbp), %rdi
xorl %esi, %esi
callq 0x15280
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jge 0x16c9a3
jmp 0x16c9a8
jmp 0x16c8ab
cmpq $0x0, -0x28(%rbp)
jg 0x16c9c2
leaq 0x2325aa(%rip), %rax    # 0x39ef60
movq $0x0, (%rax)
jmp 0x16d537
movq -0x28(%rbp), %rdi
callq 0x16c7e0
movl %eax, %ecx
movl $0x1, %eax
shll %cl, %eax
cltq
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpq -0x28(%rbp), %rax
jle 0x16c9f6
movq -0x8(%rbp), %rax
movl $0x2, %ecx
cqto
idivq %rcx
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
leaq 0x232557(%rip), %rcx    # 0x39ef58
cmpq (%rcx), %rax
jle 0x16ca14
leaq 0x23254b(%rip), %rax    # 0x39ef58
movq (%rax), %rax
movq %rax, -0x8(%rbp)
leaq 0x23254d(%rip), %rax    # 0x39ef68
movq $0x1, (%rax)
movq -0x8(%rbp), %rcx
leaq 0x232533(%rip), %rax    # 0x39ef60
movq %rcx, (%rax)
leaq 0x232529(%rip), %rax    # 0x39ef60
cmpq $0x2, (%rax)
jge 0x16ca42
jmp 0x16d537
leaq 0x10db37(%rip), %rax    # 0x27a580
movq (%rax), %rax
leaq 0x10af8d(%rip), %rcx    # 0x2779e0
movslq (%rcx), %rcx
imulq %rcx, %rax
movq %rax, -0x3c8(%rbp)
leaq 0x2324f8(%rip), %rax    # 0x39ef60
movq (%rax), %rax
movl $0x2, %ecx
cqto
idivq %rcx
movq %rax, %rcx
movq -0x3c8(%rbp), %rax
cqto
idivq %rcx
movq %rax, %rcx
leaq 0x2324da(%rip), %rax    # 0x39ef68
movq %rcx, (%rax)
leaq 0x2324d0(%rip), %rax    # 0x39ef68
cmpq $0x1, (%rax)
jge 0x16caac
leaq 0x2324c3(%rip), %rax    # 0x39ef68
movq $0x1, (%rax)
leaq 0x2324ad(%rip), %rax    # 0x39ef60
cvtsi2sdq (%rax), %xmm0
leaq 0x10dac1(%rip), %rax    # 0x27a580
cvtsi2sdq (%rax), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0xe8(%rbp)
leaq 0x10dad9(%rip), %rax    # 0x27a5b0
cvtsi2sdl (%rax), %xmm1
movsd -0xe8(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0xe8(%rbp)
leaq 0x10da42(%rip), %rax    # 0x27a538
movsd (%rax), %xmm1
movsd -0xe8(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0xe8(%rbp)
movsd 0x2622(%rip), %xmm0     # 0x16f138
ucomisd -0xe8(%rbp), %xmm0
jbe 0x16cb4b
movsd -0xe8(%rbp), %xmm0
movsd 0x24e8(%rip), %xmm1     # 0x16f018
divsd %xmm1, %xmm0
leaq 0x22e8c5(%rip), %rdi    # 0x39b400
leaq 0x2c17b(%rip), %rsi     # 0x198cbd
movb $0x1, %al
callq 0x9060
jmp 0x16cb74
movsd -0xe8(%rbp), %xmm0
movsd 0x24b5(%rip), %xmm1     # 0x16f010
divsd %xmm1, %xmm0
leaq 0x22e89a(%rip), %rdi    # 0x39b400
leaq 0x2c159(%rip), %rsi     # 0x198cc6
movb $0x1, %al
callq 0x9060
leaq 0x231931(%rip), %rax    # 0x39e4ac
cmpl $0x2, (%rax)
je 0x16cbe9
leaq 0x2323d9(%rip), %rax    # 0x39ef60
movq (%rax), %rdx
leaq 0x10da79(%rip), %rax    # 0x27a60a
movb (%rax), %cl
leaq 0x1924a(%rip), %r8      # 0x185de4
leaq 0x2c14f(%rip), %rax     # 0x198cf0
cmpb $0x0, %cl
cmovneq %rax, %r8
movslq -0xc(%rbp), %rcx
leaq 0x5016d(%rip), %rax     # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %r9
leaq 0x230e69(%rip), %rdi    # 0x39da30
leaq 0x2c101(%rip), %rsi     # 0x198ccf
leaq 0x22e82b(%rip), %rcx    # 0x39b400
movb $0x0, %al
callq 0x9060
leaq 0x2318c9(%rip), %rax    # 0x39e4ac
movl $0x3, (%rax)
leaq 0x232370(%rip), %rax    # 0x39ef60
cvtsi2ssq (%rax), %xmm0
leaq 0x232364(%rip), %rax    # 0x39ef60
cvtsi2ssq (%rax), %xmm1
mulss %xmm1, %xmm0
movss %xmm0, -0xec(%rbp)
leaq 0x23236c(%rip), %rax    # 0x39ef80
movq (%rax), %rax
movq %rax, -0x3d8(%rbp)
leaq 0x232373(%rip), %rax    # 0x39ef98
movq (%rax), %rax
movq %rax, -0x3d0(%rbp)
leaq 0x23232a(%rip), %rax    # 0x39ef60
movq (%rax), %rdi
callq 0x16c7e0
movq -0x3d8(%rbp), %rdi
movq -0x3d0(%rbp), %rsi
movl %eax, %edx
callq 0x16c510
movss 0x2265d(%rip), %xmm0    # 0x18f2b8
movss %xmm0, 0x3498e9(%rip)   # 0x4b654c
movss 0x22651(%rip), %xmm0    # 0x18f2bc
movss %xmm0, 0x3498dd(%rip)   # 0x4b6550
movq $0x1, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x3e0(%rbp)
leaq 0x2322d3(%rip), %rax    # 0x39ef60
movq (%rax), %rax
movl $0x2, %ecx
cqto
idivq %rcx
movq %rax, %rcx
movq -0x3e0(%rbp), %rax
cmpq %rcx, %rax
jge 0x16cd74
leaq 0x2322e4(%rip), %rax    # 0x39ef98
movq (%rax), %rax
movq -0x28(%rbp), %rcx
movss (%rax,%rcx,8), %xmm0
leaq 0x2322d1(%rip), %rax    # 0x39ef98
movq (%rax), %rax
movq -0x28(%rbp), %rcx
mulss (%rax,%rcx,8), %xmm0
movss %xmm0, -0xf0(%rbp)
leaq 0x2322b6(%rip), %rax    # 0x39ef98
movq (%rax), %rax
movq -0x28(%rbp), %rcx
movss 0x4(%rax,%rcx,8), %xmm0
leaq 0x2322a2(%rip), %rax    # 0x39ef98
movq (%rax), %rax
movq -0x28(%rbp), %rcx
movss 0x4(%rax,%rcx,8), %xmm2
movss -0xf0(%rbp), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0xf0(%rbp)
movss -0xf0(%rbp), %xmm0
ucomiss 0x349822(%rip), %xmm0   # 0x4b654c
jbe 0x16cd3c
movss -0xf0(%rbp), %xmm0
movss %xmm0, 0x349810(%rip)   # 0x4b654c
movss -0xf0(%rbp), %xmm1
movss 0x349804(%rip), %xmm0   # 0x4b6550
ucomiss %xmm1, %xmm0
jbe 0x16cd61
movss -0xf0(%rbp), %xmm0
movss %xmm0, 0x3497ef(%rip)   # 0x4b6550
jmp 0x16cd63
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x16cc7b
movss 0x3497d0(%rip), %xmm0   # 0x4b654c
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x16cd96
jp 0x16cd96
movss 0x4bae(%rip), %xmm0     # 0x17193c
movss %xmm0, 0x3497b6(%rip)   # 0x4b654c
movss 0x3497ae(%rip), %xmm0   # 0x4b654c
divss -0xec(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x223ee(%rip), %xmm1    # 0x18f1a0
ucomisd %xmm1, %xmm0
jbe 0x16cdd6
movss 0x34978c(%rip), %xmm0   # 0x4b654c
divss -0xec(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x3e8(%rbp)
jmp 0x16cde8
movsd 0x223c2(%rip), %xmm0    # 0x18f1a0
movsd %xmm0, -0x3e8(%rbp)
jmp 0x16cde8
movsd -0x3e8(%rbp), %xmm0
callq 0x9160
movaps %xmm0, %xmm1
movsd 0x22c0(%rip), %xmm0     # 0x16f0c0
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0xf4(%rbp)
movss 0x349738(%rip), %xmm0   # 0x4b6550
divss -0xec(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x22374(%rip), %xmm1    # 0x18f1a0
ucomisd %xmm1, %xmm0
jbe 0x16ce50
movss 0x349716(%rip), %xmm0   # 0x4b6550
divss -0xec(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x3f0(%rbp)
jmp 0x16ce62
movsd 0x22348(%rip), %xmm0    # 0x18f1a0
movsd %xmm0, -0x3f0(%rbp)
jmp 0x16ce62
movsd -0x3f0(%rbp), %xmm0
callq 0x9160
movaps %xmm0, %xmm1
movsd 0x2246(%rip), %xmm0     # 0x16f0c0
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0xf8(%rbp)
leaq 0x1feaf7(%rip), %rax    # 0x36b988
movzbl (%rax), %eax
cmpl $0x46, %eax
jne 0x16d226
leaq 0x10d7c0(%rip), %rax    # 0x27a664
movl (%rax), %eax
leaq 0x10ab33(%rip), %rcx    # 0x2779e0
movl (%rcx), %ecx
leaq 0x10ab3e(%rip), %rdx    # 0x2779f4
subl (%rdx), %ecx
subl $0x2, %ecx
cmpl %ecx, %eax
jge 0x16d226
movq $0x1, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x3f8(%rbp)
leaq 0x232083(%rip), %rax    # 0x39ef60
movq (%rax), %rax
movl $0x2, %ecx
cqto
idivq %rcx
movq %rax, %rcx
movq -0x3f8(%rbp), %rax
cmpq %rcx, %rax
jge 0x16d178
leaq 0x232094(%rip), %rax    # 0x39ef98
movq (%rax), %rax
movq -0x28(%rbp), %rcx
movss (%rax,%rcx,8), %xmm0
leaq 0x232081(%rip), %rax    # 0x39ef98
movq (%rax), %rax
movq -0x28(%rbp), %rcx
mulss (%rax,%rcx,8), %xmm0
movss %xmm0, -0xf0(%rbp)
leaq 0x232066(%rip), %rax    # 0x39ef98
movq (%rax), %rax
movq -0x28(%rbp), %rcx
movss 0x4(%rax,%rcx,8), %xmm0
leaq 0x232052(%rip), %rax    # 0x39ef98
movq (%rax), %rax
movq -0x28(%rbp), %rcx
movss 0x4(%rax,%rcx,8), %xmm2
movss -0xf0(%rbp), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0xf0(%rbp)
leaq 0x232002(%rip), %rax    # 0x39ef74
cmpb $0x0, (%rax)
je 0x16d05b
movss -0xf4(%rbp), %xmm0
ucomiss -0xf8(%rbp), %xmm0
jne 0x16cf93
jp 0x16cf93
jmp 0x16d05b
movss -0xec(%rbp), %xmm1
movss -0xf0(%rbp), %xmm0
divss %xmm1, %xmm0
movss %xmm0, -0xf0(%rbp)
movss -0xf0(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x221dd(%rip), %xmm1    # 0x18f1a0
ucomisd %xmm1, %xmm0
jbe 0x16cfdf
movss -0xf0(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x400(%rbp)
jmp 0x16cff1
movsd 0x221b9(%rip), %xmm0    # 0x18f1a0
movsd %xmm0, -0x400(%rbp)
jmp 0x16cff1
movsd -0x400(%rbp), %xmm0
callq 0x9160
movaps %xmm0, %xmm1
movsd 0x20b7(%rip), %xmm0     # 0x16f0c0
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0xf0(%rbp)
movss -0xf8(%rbp), %xmm1
movss -0xf0(%rbp), %xmm0
subss %xmm1, %xmm0
movss %xmm0, -0xf0(%rbp)
movss -0xf4(%rbp), %xmm1
subss -0xf8(%rbp), %xmm1
movss -0xf0(%rbp), %xmm0
divss %xmm1, %xmm0
movss %xmm0, -0xf0(%rbp)
jmp 0x16d0bf
movss 0x3494e9(%rip), %xmm0   # 0x4b654c
ucomiss 0x3494e6(%rip), %xmm0   # 0x4b6550
jne 0x16d070
jp 0x16d070
jmp 0x16d0b2
movss 0x3494d8(%rip), %xmm1   # 0x4b6550
movss -0xf0(%rbp), %xmm0
subss %xmm1, %xmm0
movss %xmm0, -0xf0(%rbp)
movss 0x3494b8(%rip), %xmm1   # 0x4b654c
subss 0x3494b4(%rip), %xmm1   # 0x4b6550
movss -0xf0(%rbp), %xmm0
divss %xmm1, %xmm0
movss %xmm0, -0xf0(%rbp)
jmp 0x16d0bd
xorps %xmm0, %xmm0
movss %xmm0, -0xf0(%rbp)
jmp 0x16d0bf
movss 0x22201(%rip), %xmm0    # 0x18f2c8
mulss -0xf0(%rbp), %xmm0
movss %xmm0, -0xf0(%rbp)
xorps %xmm0, %xmm0
ucomiss -0xf0(%rbp), %xmm0
jbe 0x16d0f6
xorps %xmm0, %xmm0
subss -0xf0(%rbp), %xmm0
movss %xmm0, -0xf0(%rbp)
cvttss2si -0xf0(%rbp), %eax
movl $0xf, %ecx
cltd
idivl %ecx
movl %edx, -0xfc(%rbp)
cmpl $0x0, -0xfc(%rbp)
jge 0x16d121
movl $0x0, -0xfc(%rbp)
jmp 0x16d136
cmpl $0xe, -0xfc(%rbp)
jle 0x16d134
movl $0xe, -0xfc(%rbp)
jmp 0x16d136
leaq 0x10d527(%rip), %rax    # 0x27a664
movl (%rax), %edi
movl %edi, %ecx
addl $0x1, %ecx
leaq 0x10d519(%rip), %rax    # 0x27a664
movl %ecx, (%rax)
leaq 0x10d50c(%rip), %rax    # 0x27a660
movl (%rax), %esi
movl -0xfc(%rbp), %eax
addl $0x1, %eax
movzbl %al, %edx
callq 0x10d70
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x16cecb
leaq 0x10d4e5(%rip), %rax    # 0x27a664
movl (%rax), %edi
leaq 0x10d4d8(%rip), %rax    # 0x27a660
movl (%rax), %esi
leaq 0x10a84f(%rip), %rax    # 0x2779e0
movl (%rax), %edx
subl $0x1, %edx
leaq 0x10d4c3(%rip), %rax    # 0x27a660
movl (%rax), %ecx
xorl %r8d, %r8d
callq 0x109c0
leaq 0x10d4b2(%rip), %rax    # 0x27a660
movl (%rax), %ecx
addl $0x1, %ecx
leaq 0x10d4a6(%rip), %rax    # 0x27a660
movl %ecx, (%rax)
leaq 0x10d49d(%rip), %rax    # 0x27a660
movl (%rax), %esi
leaq 0x10a814(%rip), %rax    # 0x2779e0
movl (%rax), %edx
subl $0x1, %edx
leaq 0x10d488(%rip), %rax    # 0x27a660
movl (%rax), %ecx
xorl %edi, %edi
movl $0xc, %r8d
callq 0x109c0
leaq 0x10d476(%rip), %rax    # 0x27a664
movl $0x0, (%rax)
leaq 0x10d465(%rip), %rax    # 0x27a660
movl (%rax), %eax
leaq 0x10a7e0(%rip), %rcx    # 0x2779e4
movl (%rcx), %ecx
leaq 0x10a7e7(%rip), %rdx    # 0x2779f4
movl (%rdx), %edx
shll %edx
subl %edx, %ecx
cmpl %ecx, %eax
jl 0x16d224
leaq 0x10d442(%rip), %rax    # 0x27a660
movl $0x0, (%rax)
jmp 0x16d226
leaq 0x10d37f(%rip), %rax    # 0x27a5ac
movl $0x0, (%rax)
movq $0x0, -0x28(%rbp)
leaq 0x10d206(%rip), %rax    # 0x27a448
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
leaq 0x10d2b0(%rip), %rcx    # 0x27a508
cmpq (%rcx), %rax
je 0x16d535
movl $0x0, -0x2c(%rbp)
movslq -0x2c(%rbp), %rax
leaq 0x231cf5(%rip), %rcx    # 0x39ef68
cmpq (%rcx), %rax
jge 0x16d4dd
movq -0x18(%rbp), %rsi
leaq -0x310(%rbp), %rdi
callq 0x133f0
leaq -0xe0(%rbp), %rdi
leaq -0x310(%rbp), %rsi
movl $0xb0, %edx
callq 0x92c0
movq -0x28(%rbp), %rax
movq %rax, -0x408(%rbp)
leaq 0x231caa(%rip), %rax    # 0x39ef60
movq (%rax), %rax
movl $0x2, %ecx
cqto
idivq %rcx
movq %rax, %rcx
movq -0x408(%rbp), %rax
cmpq %rcx, %rax
jl 0x16d2df
xorps %xmm0, %xmm0
movsd %xmm0, -0x60(%rbp)
jmp 0x16d430
cmpq $0x0, -0x28(%rbp)
jne 0x16d2f3
xorps %xmm0, %xmm0
movsd %xmm0, -0x60(%rbp)
jmp 0x16d42e
leaq 0x231c9e(%rip), %rax    # 0x39ef98
movq (%rax), %rax
movq -0x28(%rbp), %rcx
movss (%rax,%rcx,8), %xmm0
leaq 0x231c8b(%rip), %rax    # 0x39ef98
movq (%rax), %rax
movq -0x28(%rbp), %rcx
mulss (%rax,%rcx,8), %xmm0
movss %xmm0, -0xf0(%rbp)
leaq 0x231c70(%rip), %rax    # 0x39ef98
movq (%rax), %rax
movq -0x28(%rbp), %rcx
movss 0x4(%rax,%rcx,8), %xmm0
leaq 0x231c5c(%rip), %rax    # 0x39ef98
movq (%rax), %rax
movq -0x28(%rbp), %rcx
movss 0x4(%rax,%rcx,8), %xmm2
movss -0xf0(%rbp), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0xf0(%rbp)
leaq 0x231c0c(%rip), %rax    # 0x39ef74
cmpb $0x0, (%rax)
je 0x16d3f9
movss -0xec(%rbp), %xmm1
movss -0xf0(%rbp), %xmm0
divss %xmm1, %xmm0
movss %xmm0, -0xf0(%rbp)
movss -0xf0(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x21dff(%rip), %xmm1    # 0x18f1a0
ucomisd %xmm1, %xmm0
jbe 0x16d3bd
movss -0xf0(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x410(%rbp)
jmp 0x16d3cf
movsd 0x21ddb(%rip), %xmm0    # 0x18f1a0
movsd %xmm0, -0x410(%rbp)
jmp 0x16d3cf
movsd -0x410(%rbp), %xmm0
callq 0x9160
movaps %xmm0, %xmm1
movsd 0x1cd9(%rip), %xmm0     # 0x16f0c0
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0xf0(%rbp)
jmp 0x16d415
movss 0x34914b(%rip), %xmm1   # 0x4b654c
movss -0xf0(%rbp), %xmm0
divss %xmm1, %xmm0
movss %xmm0, -0xf0(%rbp)
movss -0xf0(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x60(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x16d430
cmpq $0x1, -0x28(%rbp)
jne 0x16d446
movq -0x18(%rbp), %rcx
leaq 0x10d04e(%rip), %rax    # 0x27a490
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x418(%rbp)
leaq -0x3c0(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
movl $0xb0, %edx
callq 0x92c0
movq %rsp, %rdi
movl $0x16, %ecx
leaq -0x3c0(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq -0x418(%rbp), %rdi
callq 0x13680
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
leaq 0x10d06e(%rip), %rcx    # 0x27a508
cmpq (%rcx), %rax
jne 0x16d4a4
jmp 0x16d537
jmp 0x16d4a6
movq -0x18(%rbp), %rax
leaq 0x10d04f(%rip), %rcx    # 0x27a500
cmpq (%rcx), %rax
jl 0x16d4cd
leaq 0x10d043(%rip), %rax    # 0x27a500
movq (%rax), %rcx
movq -0x18(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x18(%rbp)
jmp 0x16d4a6
jmp 0x16d4cf
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x16d268
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x420(%rbp)
leaq 0x231a65(%rip), %rax    # 0x39ef60
movq (%rax), %rax
movl $0x2, %ecx
cqto
idivq %rcx
movq %rax, %rcx
movq -0x420(%rbp), %rax
cmpq %rcx, %rax
jl 0x16d530
movq -0x28(%rbp), %rax
leaq 0x10a4be(%rip), %rcx    # 0x2779e0
movl (%rcx), %ecx
shll %ecx
movslq %ecx, %rcx
cmpq %rcx, %rax
jl 0x16d530
jmp 0x16d535
jmp 0x16d24d
jmp 0x16d537
movq -0x20(%rbp), %rcx
leaq 0x10cf4e(%rip), %rax    # 0x27a490
movq %rcx, 0x10(%rax)
movq -0x28(%rbp), %rax
addq $0x4d0, %rsp            # imm = 0x4D0
popq %rbp
retq
nopw %cs:(%rax,%rax)