// File: /workspace/github_cpp_makefile_star2_O1/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 0x13644c(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x1080f3
leaq 0x55dd9(%rip), %rax     # 0x15dd30
cmpl $0x0, 0xcc8(%rax)
je 0x1080f3
leaq 0x113512(%rip), %rcx    # 0x21b47d
cmpb $0x0, (%rcx)
jne 0x1080f3
leaq 0x237e05(%rip), %r15    # 0x33fd80
cmpq $0x0, (%r15)
je 0x1080f3
leaq 0x11349e(%rip), %rcx    # 0x21b42a
leaq 0x1134eb(%rip), %rdx    # 0x21b47e
movzbl (%rdx), %edx
imulq $0xe8, %rdx, %rdx
cmpb $0x0, (%rcx)
movq (%rax,%rdx), %rdx
leaq 0x2e0f7(%rip), %rax     # 0x1360a2
leaq 0x2e0dc(%rip), %rsi     # 0x13608e
cmoveq %rax, %rsi
xorl %eax, %eax
callq 0x9560
movq (%r15), %rax
cmpq $0x4, %rax
jl 0x1080c9
cvtsi2ss %rax, %xmm0
mulss %xmm0, %xmm0
movss %xmm0, -0x2c(%rbp)
movl $0x1, %ebx
leaq 0x237dac(%rip), %r12    # 0x33fd90
leaq 0x237dcd(%rip), %r13    # 0x33fdb8
leaq 0x237da2(%rip), %r14    # 0x33fd94
movss (%r12), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm0, %xmm1
xorps %xmm1, %xmm1
cvtsi2ss %ebx, %xmm1
movss 0x4fc7(%rip), %xmm2     # 0x10cfd4
divss %xmm0, %xmm2
divss %xmm1, %xmm2
cvtss2sd %xmm2, %xmm2
jne 0x108020
jp 0x108020
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 0x108076
divss -0x2c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
maxsd 0x2468e(%rip), %xmm0    # 0x12c6e0
movsd %xmm2, -0x38(%rbp)
callq 0x9160
movsd -0x38(%rbp), %xmm2
mulsd 0x103f(%rip), %xmm0     # 0x1090a8
cvtsd2ss %xmm0, %xmm0
leaq 0x2e044(%rip), %rsi     # 0x1360b8
jmp 0x108090
ucomiss 0x4f7f(%rip), %xmm0     # 0x10cffc
jne 0x108081
jnp 0x1080ad
divss 0x34efb3(%rip), %xmm0   # 0x45703c
leaq 0x2e046(%rip), %rsi     # 0x1360d6
leaq 0x1362f9(%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 0x107ff2
leaq 0x1362c0(%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