// File: /workspace/github_cpp_makefile_star2_O2/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:
leaq 0x13691e(%rip), %rax    # 0x228390
movq (%rax), %rdi
testq %rdi, %rdi
je 0xf1c04
leaq 0x562ab(%rip), %rax     # 0x147d30
cmpl $0x0, 0xcc8(%rax)
je 0xf1c04
leaq 0x1139e4(%rip), %rcx    # 0x20547d
cmpb $0x0, (%rcx)
jne 0xf1c04
leaq 0x2382d7(%rip), %rcx    # 0x329d80
cmpq $0x0, (%rcx)
je 0xf1c04
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq 0x11395f(%rip), %rcx    # 0x20542a
leaq 0x1139ac(%rip), %rdx    # 0x20547e
movzbl (%rdx), %edx
imulq $0xe8, %rdx, %rdx
cmpb $0x0, (%rcx)
movq (%rax,%rdx), %rdx
leaq 0x2e5bd(%rip), %rax     # 0x1200a7
leaq 0x2e5a2(%rip), %rsi     # 0x120093
cmoveq %rax, %rsi
xorl %eax, %eax
callq 0x9560
leaq 0x23827d(%rip), %rcx    # 0x329d80
movq (%rcx), %rax
cvtsi2ss %rax, %xmm0
mulss %xmm0, %xmm0
movss %xmm0, -0x2c(%rbp)
pushq $0x1
popq %rbx
pushq $0x2
popq %r12
leaq 0x23826e(%rip), %r13    # 0x329d90
leaq 0x23828f(%rip), %r14    # 0x329db8
leaq 0x238264(%rip), %r15    # 0x329d94
cqto
idivq %r12
cmpq %rbx, %rax
jle 0xf1c05
movss (%r13), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm0, %xmm1
cvtsi2ss %ebx, %xmm1
movss 0x5596(%rip), %xmm2     # 0xf70ec
divss %xmm0, %xmm2
divss %xmm1, %xmm2
cvtss2sd %xmm2, %xmm2
jne 0xf1b69
jp 0xf1b69
xorps %xmm2, %xmm2
movq (%r14), %rax
movss (%rax,%rbx,8), %xmm1
movss 0x4(%rax,%rbx,8), %xmm0
mulss %xmm1, %xmm1
mulss %xmm0, %xmm0
addss %xmm1, %xmm0
cmpb $0x0, (%r15)
je 0xf1bbe
divss -0x2c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
maxsd 0x24b4e(%rip), %xmm0    # 0x1166e8
movsd %xmm2, -0x38(%rbp)
callq 0x9160
movsd -0x38(%rbp), %xmm2
mulsd 0x14f7(%rip), %xmm0     # 0xf30a8
cvtsd2ss %xmm0, %xmm0
leaq 0x2e501(%rip), %rsi     # 0x1200bd
jmp 0xf1bd8
ucomiss 0x554b(%rip), %xmm0     # 0xf7110
jne 0xf1bc9
jnp 0xf1bf9
divss 0x34f38b(%rip), %xmm0   # 0x440f5c
leaq 0x2e503(%rip), %rsi     # 0x1200db
leaq 0x1367b1(%rip), %rax    # 0x228390
movq (%rax), %rdi
cvtss2sd %xmm0, %xmm1
movl %ebx, %edx
movaps %xmm2, %xmm0
movb $0x2, %al
callq 0x9560
leaq 0x238187(%rip), %rcx    # 0x329d80
incq %rbx
movq (%rcx), %rax
jmp 0xf1b30
retq
leaq 0x136784(%rip), %rbx    # 0x228390
movq (%rbx), %rsi
pushq $0xa
popq %rdi
callq 0x9480
movq (%rbx), %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9420