// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathui.cpp
// Function: show_trend_info(int)
void show_trend_info(int plot_id)
{
double val;
char *s;

   if(plot[plot_id].show_trend && (title_type != USER)) {
      if(plot[plot_id].stat_count && view_interval) {
         val = (plot[plot_id].sum_change/plot[plot_id].stat_count)/view_interval;
      }
      else val = 0.0;
      if(plot_id == OSC) {  // scale to microseconds
         if(rcvr_type == SCPI_RCVR) val *= 1000.0;
         else if(rcvr_type == UCCM_RCVR) val *= 1000.0;
      }

      sprintf(plot_title, "%s trend line: %s = (%g*t) + %g   avg_delta=%g",
                          plot[plot_id].plot_id,
                          plot[plot_id].plot_id,
                          plot[plot_id].a1,
                          plot[plot_id].a0,
                          val
      );

      if(trend_rate_display == 3) {  // per second trend
         val = plot[plot_id].a1 * (1.0);
         s = "sec";
      }
      else if(trend_rate_display == 2) {  // per minute trend
         val = plot[plot_id].a1 * (60.0);
         s = "min";
      }
      else if(trend_rate_display == 1) {
         val = plot[plot_id].a1 * (60.0*60.0);  // per hour trend
         s = "hr";
      }
      else { // per day trend
         val = plot[plot_id].a1 * (24.0*60.0*60.0);
         s = "day";
      }

      if(plot_id == OSC) {  // scale to microseconds
         if(rcvr_type == SCPI_RCVR) val *= 1000.0;
         else if(rcvr_type == UCCM_RCVR) val *= 1000.0;
      }

      if(tie_plot(plot_id)) {
         if(plot[plot_id].show_freq) {
            if(rcvr_type == X72_RCVR) {
               sprintf(out, "  (%g mHz/%s)", tie_to_freq(plot_id, val)*1.0E3, s);
            }
            else {
               sprintf(out, "  (%g Hz/%s)", tie_to_freq(plot_id, val), s);
            }
         }
         else {
            sprintf(out, "  (%g ns/%s)", val, s);
         }
      }
      else {
         sprintf(out, "  (%g %s/%s)", val, plot[plot_id].units, s);
      }
      strcat(plot_title, out);

      title_type = OTHER;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movslq %edi, %rax
imulq $0xe8, %rax, %rax
leaq 0x123ef6(%rip), %r12    # 0x15dd30
cmpl $0x0, 0xc8(%r12,%rax)
je 0x3a034
leaq 0x30547c(%rip), %r15    # 0x33f2cc
cmpl $0x2, (%r15)
je 0x3a034
movl %edi, %ebx
addq %rax, %r12
movsd 0x88(%r12), %xmm0
xorpd %xmm2, %xmm2
ucomisd %xmm0, %xmm2
setp %al
setne %cl
orb %al, %cl
leaq 0x1e1520(%rip), %rax    # 0x21b3a0
movq (%rax), %rax
testq %rax, %rax
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x39eaa
movsd 0xa8(%r12), %xmm2
divsd %xmm0, %xmm2
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
divsd %xmm0, %xmm2
cmpl $0x1, %ebx
jne 0x39ecd
leaq 0x1dea1a(%rip), %rax    # 0x2188d0
movq (%rax), %rax
cmpq $0x8, %rax
je 0x39ec5
cmpq $0x10, %rax
jne 0x39ecd
mulsd 0xcf16b(%rip), %xmm2    # 0x109038
movq (%r12), %rcx
movsd 0x98(%r12), %xmm0
movsd 0x90(%r12), %xmm1
leaq 0x304964(%rip), %rdi    # 0x33e850
leaq 0xdcd59(%rip), %rsi     # 0x116c4c
movq %rcx, %rdx
movb $0x3, %al
callq 0x9060
leaq 0x305e6c(%rip), %rax    # 0x33fd70
movl (%rax), %eax
movsd 0x98(%r12), %xmm0
cmpl $0x1, %eax
je 0x39f39
cmpl $0x3, %eax
je 0x39f30
cmpl $0x2, %eax
jne 0x39f4a
mulsd 0xcf0e1(%rip), %xmm0    # 0x109008
leaq 0xfc21b(%rip), %r14     # 0x136149
jmp 0x39f59
leaq 0xf53b8(%rip), %r14     # 0x12f2ef
jmp 0x39f59
mulsd 0xcf0cf(%rip), %xmm0    # 0x109010
leaq 0xdcd33(%rip), %r14     # 0x116c7b
jmp 0x39f59
mulsd 0xcf0c6(%rip), %xmm0    # 0x109018
leaq 0xd4448(%rip), %r14     # 0x10e3a1
cmpl $0x1, %ebx
jne 0x39f7c
leaq 0x1de96b(%rip), %rax    # 0x2188d0
movq (%rax), %rax
cmpq $0x8, %rax
je 0x39f74
cmpq $0x10, %rax
jne 0x39f7c
mulsd 0xcf0bc(%rip), %xmm0    # 0x109038
movsd %xmm0, -0x28(%rbp)
movl %ebx, %edi
callq 0x13c3e
testl %eax, %eax
je 0x39fce
cmpl $0x0, 0xd0(%r12)
movsd -0x28(%rbp), %xmm0
je 0x39ff2
leaq 0x1de92d(%rip), %rax    # 0x2188d0
movq (%rax), %r12
movl %ebx, %edi
callq 0xadb42
cmpq $0x2000000, %r12        # imm = 0x2000000
jne 0x3a002
mulsd 0xcf07a(%rip), %xmm0    # 0x109038
leaq 0x30225b(%rip), %rdi    # 0x33c220
leaq 0xdccb2(%rip), %rsi     # 0x116c7e
jmp 0x3a010
movq 0x8(%r12), %rdx
leaq 0x302246(%rip), %rdi    # 0x33c220
leaq 0xdccc5(%rip), %rsi     # 0x116ca6
movsd -0x28(%rbp), %xmm0
movq %r14, %rcx
movb $0x1, %al
callq 0x9060
jmp 0x3a01a
leaq 0x302227(%rip), %rdi    # 0x33c220
leaq 0xdcc99(%rip), %rsi     # 0x116c99
jmp 0x3a010
leaq 0x302217(%rip), %rdi    # 0x33c220
leaq 0xdcc7c(%rip), %rsi     # 0x116c8c
movq %r14, %rdx
movb $0x1, %al
callq 0x9060
leaq 0x30482f(%rip), %rdi    # 0x33e850
leaq 0x3021f8(%rip), %rsi    # 0x33c220
callq 0x96c0
movl $0x3, (%r15)
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq