// File: /workspace/github_cpp_makefile_star2_O1/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 0x123fa7(%rip), %r12    # 0x15dd30
cmpl $0x0, 0xc8(%r12,%rax)
je 0x39f83
leaq 0x30552d(%rip), %r15    # 0x33f2cc
cmpl $0x2, (%r15)
je 0x39f83
movl %edi, %ebx
addq %rax, %r12
movsd 0x88(%r12), %xmm0
xorpd %xmm2, %xmm2
ucomisd %xmm0, %xmm2
setp %al
setne %cl
orb %al, %cl
leaq 0x1e15d1(%rip), %rax    # 0x21b3a0
movq (%rax), %rax
testq %rax, %rax
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x39df9
movsd 0xa8(%r12), %xmm2
divsd %xmm0, %xmm2
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
divsd %xmm0, %xmm2
cmpl $0x1, %ebx
jne 0x39e1c
leaq 0x1deacb(%rip), %rax    # 0x2188d0
movq (%rax), %rax
cmpq $0x8, %rax
je 0x39e14
cmpq $0x10, %rax
jne 0x39e1c
mulsd 0xcf21c(%rip), %xmm2    # 0x109038
movq (%r12), %rcx
movsd 0x98(%r12), %xmm0
movsd 0x90(%r12), %xmm1
leaq 0x304a15(%rip), %rdi    # 0x33e850
leaq 0xdcd76(%rip), %rsi     # 0x116bb8
movq %rcx, %rdx
movb $0x3, %al
callq 0x9060
leaq 0x305f1d(%rip), %rax    # 0x33fd70
movl (%rax), %eax
movsd 0x98(%r12), %xmm0
cmpl $0x1, %eax
je 0x39e88
cmpl $0x3, %eax
je 0x39e7f
cmpl $0x2, %eax
jne 0x39e99
mulsd 0xcf192(%rip), %xmm0    # 0x109008
leaq 0xfc1d3(%rip), %r14     # 0x136050
jmp 0x39ea8
leaq 0xf5379(%rip), %r14     # 0x12f1ff
jmp 0x39ea8
mulsd 0xcf180(%rip), %xmm0    # 0x109010
leaq 0xdcd50(%rip), %r14     # 0x116be7
jmp 0x39ea8
mulsd 0xcf177(%rip), %xmm0    # 0x109018
leaq 0xd4465(%rip), %r14     # 0x10e30d
cmpl $0x1, %ebx
jne 0x39ecb
leaq 0x1dea1c(%rip), %rax    # 0x2188d0
movq (%rax), %rax
cmpq $0x8, %rax
je 0x39ec3
cmpq $0x10, %rax
jne 0x39ecb
mulsd 0xcf16d(%rip), %xmm0    # 0x109038
movsd %xmm0, -0x28(%rbp)
movl %ebx, %edi
callq 0x13ccd
testl %eax, %eax
je 0x39f1d
cmpl $0x0, 0xd0(%r12)
movsd -0x28(%rbp), %xmm0
je 0x39f41
leaq 0x1de9de(%rip), %rax    # 0x2188d0
movq (%rax), %r12
movl %ebx, %edi
callq 0xad8a2
cmpq $0x2000000, %r12        # imm = 0x2000000
jne 0x39f51
mulsd 0xcf12b(%rip), %xmm0    # 0x109038
leaq 0x30230c(%rip), %rdi    # 0x33c220
leaq 0xdcccf(%rip), %rsi     # 0x116bea
jmp 0x39f5f
movq 0x8(%r12), %rdx
leaq 0x3022f7(%rip), %rdi    # 0x33c220
leaq 0xdcce2(%rip), %rsi     # 0x116c12
movsd -0x28(%rbp), %xmm0
movq %r14, %rcx
movb $0x1, %al
callq 0x9060
jmp 0x39f69
leaq 0x3022d8(%rip), %rdi    # 0x33c220
leaq 0xdccb6(%rip), %rsi     # 0x116c05
jmp 0x39f5f
leaq 0x3022c8(%rip), %rdi    # 0x33c220
leaq 0xdcc99(%rip), %rsi     # 0x116bf8
movq %r14, %rdx
movb $0x1, %al
callq 0x9060
leaq 0x3048e0(%rip), %rdi    # 0x33e850
leaq 0x3022a9(%rip), %rsi    # 0x33c220
callq 0x96c0
movl $0x3, (%r15)
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq