// File: /workspace/github_cpp_makefile_star2_O2/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 0x1110b1(%rip), %r12    # 0x147d30
cmpl $0x0, 0xc8(%r12,%rax)
je 0x36e76
leaq 0x2f2637(%rip), %r15    # 0x3292cc
cmpl $0x2, (%r15)
je 0x36e76
movl %edi, %ebx
addq %rax, %r12
movsd 0x88(%r12), %xmm0
xorpd %xmm2, %xmm2
ucomisd %xmm0, %xmm2
setp %al
setne %cl
orb %al, %cl
leaq 0x1ce6db(%rip), %rax    # 0x2053a0
movq (%rax), %rax
testq %rax, %rax
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x36cec
movsd 0xa8(%r12), %xmm2
divsd %xmm0, %xmm2
cvtsi2sd %rax, %xmm0
divsd %xmm0, %xmm2
cmpl $0x1, %ebx
jne 0x36d0f
leaq 0x1cbbd8(%rip), %rax    # 0x2028d0
movq (%rax), %rax
cmpq $0x8, %rax
je 0x36d07
cmpq $0x10, %rax
jne 0x36d0f
mulsd 0xbc329(%rip), %xmm2    # 0xf3038
movq (%r12), %rcx
movsd 0x98(%r12), %xmm0
movsd 0x90(%r12), %xmm1
leaq 0x2f1b22(%rip), %rdi    # 0x328850
leaq 0xc9f97(%rip), %rsi     # 0x100ccc
movq %rcx, %rdx
movb $0x3, %al
callq 0x9060
leaq 0x2f302a(%rip), %rax    # 0x329d70
movl (%rax), %eax
movsd 0x98(%r12), %xmm0
cmpl $0x1, %eax
je 0x36d7b
cmpl $0x3, %eax
je 0x36d72
cmpl $0x2, %eax
jne 0x36d8c
mulsd 0xbc29f(%rip), %xmm0    # 0xf3008
leaq 0xe92e5(%rip), %r14     # 0x120055
jmp 0x36d9b
leaq 0xe2496(%rip), %r14     # 0x11920f
jmp 0x36d9b
mulsd 0xbc28d(%rip), %xmm0    # 0xf3010
leaq 0xc9f71(%rip), %r14     # 0x100cfb
jmp 0x36d9b
mulsd 0xbc284(%rip), %xmm0    # 0xf3018
leaq 0xc1686(%rip), %r14     # 0xf8421
cmpl $0x1, %ebx
jne 0x36dbe
leaq 0x1cbb29(%rip), %rax    # 0x2028d0
movq (%rax), %rax
cmpq $0x8, %rax
je 0x36db6
cmpq $0x10, %rax
jne 0x36dbe
mulsd 0xbc27a(%rip), %xmm0    # 0xf3038
movsd %xmm0, -0x28(%rbp)
movl %ebx, %edi
callq 0x13376
testl %eax, %eax
je 0x36e10
cmpl $0x0, 0xd0(%r12)
movsd -0x28(%rbp), %xmm0
je 0x36e34
leaq 0x1cbaeb(%rip), %rax    # 0x2028d0
movq (%rax), %r12
movl %ebx, %edi
callq 0x9daff
cmpq $0x2000000, %r12        # imm = 0x2000000
jne 0x36e44
mulsd 0xbc238(%rip), %xmm0    # 0xf3038
leaq 0x2ef419(%rip), %rdi    # 0x326220
leaq 0xc9ef0(%rip), %rsi     # 0x100cfe
jmp 0x36e52
movq 0x8(%r12), %rdx
leaq 0x2ef404(%rip), %rdi    # 0x326220
leaq 0xc9f03(%rip), %rsi     # 0x100d26
movsd -0x28(%rbp), %xmm0
movq %r14, %rcx
movb $0x1, %al
callq 0x9060
jmp 0x36e5c
leaq 0x2ef3e5(%rip), %rdi    # 0x326220
leaq 0xc9ed7(%rip), %rsi     # 0x100d19
jmp 0x36e52
leaq 0x2ef3d5(%rip), %rdi    # 0x326220
leaq 0xc9eba(%rip), %rsi     # 0x100d0c
movq %r14, %rdx
movb $0x1, %al
callq 0x9060
leaq 0x2f19ed(%rip), %rdi    # 0x328850
leaq 0x2ef3b6(%rip), %rsi    # 0x326220
callq 0x96c0
movl $0x3, (%r15)
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq