// File: jkingan[P]ladyheather/heathmsc.cpp
// Function: dump_fft_plot()
void dump_fft_plot()
{
int j;
float tempflt;
float a;
float val;

   // dump the plot FFT data to the debug_file

   if(debug_file == 0) return;
   if(plot[FFT].show_plot == 0) return;
   if(fft_type != FFT_TYPE) return;
   if(fft_length == 0.0) return;

   if(show_live_fft) {
      fprintf(debug_file, "\nLive %s plot FFT:\n", plot[fft_id].plot_id);
   }
   else {
      fprintf(debug_file, "\nSingle %s plot FFT:\n", plot[fft_id].plot_id);
   }

   tempflt = 0.0F;
   a = (float) fft_length * (float) fft_length;

   for(j=1; j<fft_length/2; j++) {
      if(fps) val = (1.0F/ fps) / ((float) j); 
      else val = 0.0;
//sprintf(debug_text2, "fft_scale:%ld  fps:%.9f", fft_scale, fps);

      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))) ;
         fprintf(debug_file, "bin:%d  %.3f s   val:%.9f dB\n", j, val, tempflt);
      }
      else if(tempflt) {
         tempflt /= fft_max;
         fprintf(debug_file, "bin:%d  %.3f s   val:%.9f\n", j, val, tempflt);
      }
   }

   fprintf(debug_file, "\n");
   fflush(debug_file);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
leaq 0x12fe11(%rip), %rax    # 0x29d570
cmpq $0x0, (%rax)
jne 0x16d76a
jmp 0x16da67
leaq 0x4f5af(%rip), %rax     # 0x1bcd20
cmpl $0x0, 0xcc8(%rax)
jne 0x16d77f
jmp 0x16da67
leaq 0x10ced7(%rip), %rax    # 0x27a65d
movzbl (%rax), %eax
cmpl $0x0, %eax
je 0x16d793
jmp 0x16da67
leaq 0x2317c6(%rip), %rax    # 0x39ef60
cvtsi2sdq (%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x16d7af
jp 0x16d7af
jmp 0x16da67
leaq 0x10ce54(%rip), %rax    # 0x27a60a
cmpb $0x0, (%rax)
je 0x16d7f5
leaq 0x12fdae(%rip), %rax    # 0x29d570
movq (%rax), %rdi
leaq 0x10ce92(%rip), %rax    # 0x27a65e
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0x4f548(%rip), %rax     # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rdx
leaq 0x2b514(%rip), %rsi     # 0x198d00
movb $0x0, %al
callq 0x9550
jmp 0x16d82d
leaq 0x12fd74(%rip), %rax    # 0x29d570
movq (%rax), %rdi
leaq 0x10ce58(%rip), %rax    # 0x27a65e
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0x4f50e(%rip), %rax     # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rdx
leaq 0x2b4ee(%rip), %rsi     # 0x198d14
movb $0x0, %al
callq 0x9550
xorps %xmm0, %xmm0
movss %xmm0, -0x8(%rbp)
leaq 0x231724(%rip), %rax    # 0x39ef60
cvtsi2ssq (%rax), %xmm0
leaq 0x231718(%rip), %rax    # 0x39ef60
cvtsi2ssq (%rax), %xmm1
mulss %xmm1, %xmm0
movss %xmm0, -0xc(%rbp)
movl $0x1, -0x4(%rbp)
movslq -0x4(%rbp), %rax
movq %rax, -0x18(%rbp)
leaq 0x2316f4(%rip), %rax    # 0x39ef60
movq (%rax), %rax
movl $0x2, %ecx
cqto
idivq %rcx
movq %rax, %rcx
movq -0x18(%rbp), %rax
cmpq %rcx, %rax
jge 0x16da40
leaq 0x2316e0(%rip), %rax    # 0x39ef70
movss (%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x16d8a0
jp 0x16d8a0
jmp 0x16d8c3
movss 0x4094(%rip), %xmm0     # 0x17193c
leaq 0x2316c1(%rip), %rax    # 0x39ef70
divss (%rax), %xmm0
cvtsi2ssl -0x4(%rbp), %xmm1
divss %xmm1, %xmm0
movss %xmm0, -0x10(%rbp)
jmp 0x16d8cb
xorps %xmm0, %xmm0
movss %xmm0, -0x10(%rbp)
leaq 0x2316c6(%rip), %rax    # 0x39ef98
movq (%rax), %rax
movslq -0x4(%rbp), %rcx
movss (%rax,%rcx,8), %xmm0
leaq 0x2316b3(%rip), %rax    # 0x39ef98
movq (%rax), %rax
movslq -0x4(%rbp), %rcx
mulss (%rax,%rcx,8), %xmm0
movss %xmm0, -0x8(%rbp)
leaq 0x23169b(%rip), %rax    # 0x39ef98
movq (%rax), %rax
movslq -0x4(%rbp), %rcx
movss 0x4(%rax,%rcx,8), %xmm0
leaq 0x231687(%rip), %rax    # 0x39ef98
movq (%rax), %rax
movslq -0x4(%rbp), %rcx
movss 0x4(%rax,%rcx,8), %xmm2
movss -0x8(%rbp), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x8(%rbp)
leaq 0x23163d(%rip), %rax    # 0x39ef74
cmpb $0x0, (%rax)
je 0x16d9da
movss -0xc(%rbp), %xmm1
movss -0x8(%rbp), %xmm0
divss %xmm1, %xmm0
movss %xmm0, -0x8(%rbp)
movss -0x8(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x2183c(%rip), %xmm1    # 0x18f1a0
ucomisd %xmm1, %xmm0
jbe 0x16d97a
movss -0x8(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x20(%rbp)
jmp 0x16d989
movsd 0x2181e(%rip), %xmm0    # 0x18f1a0
movsd %xmm0, -0x20(%rbp)
jmp 0x16d989
movsd -0x20(%rbp), %xmm0
callq 0x9160
movaps %xmm0, %xmm1
movsd 0x1722(%rip), %xmm0     # 0x16f0c0
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x8(%rbp)
leaq 0x12fbbe(%rip), %rax    # 0x29d570
movq (%rax), %rdi
movl -0x4(%rbp), %edx
movss -0x10(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movss -0x8(%rbp), %xmm1
cvtss2sd %xmm1, %xmm1
leaq 0x2b359(%rip), %rsi     # 0x198d2a
movb $0x2, %al
callq 0x9550
jmp 0x16da30
movss -0x8(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x16d9eb
jp 0x16d9eb
jmp 0x16da2e
movss 0x348b59(%rip), %xmm1   # 0x4b654c
movss -0x8(%rbp), %xmm0
divss %xmm1, %xmm0
movss %xmm0, -0x8(%rbp)
leaq 0x12fb68(%rip), %rax    # 0x29d570
movq (%rax), %rdi
movl -0x4(%rbp), %edx
movss -0x10(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movss -0x8(%rbp), %xmm1
cvtss2sd %xmm1, %xmm1
leaq 0x2b321(%rip), %rsi     # 0x198d48
movb $0x2, %al
callq 0x9550
jmp 0x16da30
jmp 0x16da32
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x16d85d
leaq 0x12fb29(%rip), %rax    # 0x29d570
movq (%rax), %rdi
leaq 0x2abd5(%rip), %rsi     # 0x198626
movb $0x0, %al
callq 0x9550
leaq 0x12fb11(%rip), %rax    # 0x29d570
movq (%rax), %rdi
callq 0x9430
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)