// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq 0x135d2f(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x108810
leaq 0x556bc(%rip), %rax     # 0x15dd30
cmpl $0x0, 0xcc8(%rax)
je 0x108810
leaq 0x112df5(%rip), %rcx    # 0x21b47d
cmpb $0x0, (%rcx)
jne 0x108810
leaq 0x2376e8(%rip), %r15    # 0x33fd80
cmpq $0x0, (%r15)
je 0x108810
leaq 0x112d81(%rip), %rcx    # 0x21b42a
leaq 0x112dce(%rip), %rdx    # 0x21b47e
movzbl (%rdx), %edx
imulq $0xe8, %rdx, %rdx
cmpb $0x0, (%rcx)
movq (%rax,%rdx), %rdx
leaq 0x2dad3(%rip), %rax     # 0x13619b
leaq 0x2dab8(%rip), %rsi     # 0x136187
cmoveq %rax, %rsi
xorl %eax, %eax
callq 0x9560
movq (%r15), %rax
cmpq $0x4, %rax
jl 0x1087e6
cvtsi2ss %rax, %xmm0
mulss %xmm0, %xmm0
movss %xmm0, -0x2c(%rbp)
movl $0x1, %ebx
leaq 0x23768f(%rip), %r12    # 0x33fd90
leaq 0x2376b0(%rip), %r13    # 0x33fdb8
leaq 0x237685(%rip), %r14    # 0x33fd94
movss (%r12), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm0, %xmm1
xorps %xmm1, %xmm1
cvtsi2ss %ebx, %xmm1
movss 0x4942(%rip), %xmm2     # 0x10d06c
divss %xmm0, %xmm2
divss %xmm1, %xmm2
cvtss2sd %xmm2, %xmm2
jne 0x10873d
jp 0x10873d
xorps %xmm2, %xmm2
movq (%r13), %rax
movss (%rax,%rbx,8), %xmm1
movss 0x4(%rax,%rbx,8), %xmm0
mulss %xmm1, %xmm1
mulss %xmm0, %xmm0
addss %xmm1, %xmm0
cmpb $0x0, (%r14)
je 0x108793
divss -0x2c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
maxsd 0x24059(%rip), %xmm0    # 0x12c7c8
movsd %xmm2, -0x38(%rbp)
callq 0x9160
movsd -0x38(%rbp), %xmm2
mulsd 0x922(%rip), %xmm0      # 0x1090a8
cvtsd2ss %xmm0, %xmm0
leaq 0x2da20(%rip), %rsi     # 0x1361b1
jmp 0x1087ad
ucomiss 0x48f6(%rip), %xmm0     # 0x10d090
jne 0x10879e
jnp 0x1087ca
divss 0x34e7b6(%rip), %xmm0   # 0x456f5c
leaq 0x2da22(%rip), %rsi     # 0x1361cf
leaq 0x135bdc(%rip), %rax    # 0x23e390
movq (%rax), %rdi
xorps %xmm1, %xmm1
cvtss2sd %xmm0, %xmm1
movl %ebx, %edx
movaps %xmm2, %xmm0
movb $0x2, %al
callq 0x9560
incq %rbx
movq (%r15), %rax
movq %rax, %rcx
shrq $0x3f, %rcx
addq %rax, %rcx
sarq %rcx
cmpq %rbx, %rcx
jg 0x10870f
leaq 0x135ba3(%rip), %rbx    # 0x23e390
movq (%rbx), %rsi
movl $0xa, %edi
callq 0x9480
movq (%rbx), %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9420
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq