// File: jkingan[P]ladyheather/heather.cpp
// Function: get_stat_val(int)
DATA_SIZE get_stat_val(int id)
{
DATA_SIZE val;

   // get the plot statistic value to show for the plot

   if(stat_count == (DATA_SIZE) 0.0) return (DATA_SIZE) 0.0;

   if(plot[id].show_stat == RMS) {
      strcpy(stat_id, "rms");
      val = sqrt(plot[id].sum_yy/stat_count);
   }
   else if(plot[id].show_stat == AVG) {
      strcpy(stat_id, "avg");
      val = plot[id].sum_y/stat_count;
   }
   else if(plot[id].show_stat == SDEV) {
      strcpy(stat_id, "sdv");
      val = ((plot[id].sum_yy/stat_count) - ((plot[id].sum_y/stat_count)*(plot[id].sum_y/stat_count)) );
//    val = ( plot[id].sum_yy - ((plot[id].sum_y*plot[id].sum_y)/stat_count) ) / stat_count;
      if(val < (DATA_SIZE) 0.0) val = (DATA_SIZE) 0.0 - val;
      val = sqrt(val);
   }
   else if(plot[id].show_stat == VAR) {
      strcpy(stat_id, "var");
      val = ( (plot[id].sum_yy/stat_count) - ((plot[id].sum_y/stat_count)*(plot[id].sum_y/stat_count)) );
//    val = ( plot[id].sum_yy - ((plot[id].sum_y*plot[id].sum_y)/stat_count) ) / stat_count;
   }
   else if(plot[id].show_stat == SHOW_MIN) {
      strcpy(stat_id, "min");
      val = plot[id].min_disp_val;
   }
   else if(plot[id].show_stat == SHOW_MAX) {
      strcpy(stat_id, "max");
      val = plot[id].max_disp_val;
   }
   else if(plot[id].show_stat == SHOW_SPAN) {
      strcpy(stat_id, "span");
      val = plot[id].max_disp_val - plot[id].min_disp_val;
   }
   else {
      strcpy(stat_id, "???");
      val = (DATA_SIZE) 0.0;
   }

   if(plot[id].show_deriv) strcat(stat_id, "*");
   else if(plot[id].show_freq) strcat(stat_id, "#");
   else if(plot[id].drift_rate) strcat(stat_id, "=");
   else strcat(stat_id, ":");

   return val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0xc(%rbp)
movsd 0x35311d(%rip), %xmm0   # 0x36c170
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x1906b
jp 0x1906b
xorps %xmm0, %xmm0
movsd %xmm0, -0x8(%rbp)
jmp 0x194ea
movslq -0xc(%rbp), %rcx
leaq 0x1a3caa(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
cmpl $0x1, 0xd4(%rax)
jne 0x190cd
leaq 0x385890(%rip), %rdi    # 0x39e920
leaq 0x16f0dc(%rip), %rsi    # 0x188173
callq 0x9350
movslq -0xc(%rbp), %rcx
leaq 0x1a3c79(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0x78(%rax), %xmm0
divsd 0x3530b2(%rip), %xmm0   # 0x36c170
callq 0x9280
movsd %xmm0, -0x18(%rbp)
jmp 0x19421
movslq -0xc(%rbp), %rcx
leaq 0x1a3c48(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
cmpl $0x2, 0xd4(%rax)
jne 0x1912a
leaq 0x38582e(%rip), %rdi    # 0x39e920
leaq 0x157334(%rip), %rsi    # 0x17042d
callq 0x9350
movslq -0xc(%rbp), %rcx
leaq 0x1a3c17(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0x68(%rax), %xmm0
divsd 0x353050(%rip), %xmm0   # 0x36c170
movsd %xmm0, -0x18(%rbp)
jmp 0x1941f
movslq -0xc(%rbp), %rcx
leaq 0x1a3beb(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
cmpl $0x4, 0xd4(%rax)
jne 0x19214
leaq 0x3857cd(%rip), %rdi    # 0x39e920
leaq 0x1572d7(%rip), %rsi    # 0x170431
callq 0x9350
movslq -0xc(%rbp), %rcx
leaq 0x1a3bb6(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0x78(%rax), %xmm1
divsd 0x352fef(%rip), %xmm1   # 0x36c170
movslq -0xc(%rbp), %rcx
leaq 0x1a3b94(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0x68(%rax), %xmm0
divsd 0x352fcd(%rip), %xmm0   # 0x36c170
movslq -0xc(%rbp), %rcx
leaq 0x1a3b72(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0x68(%rax), %xmm2
divsd 0x352fab(%rip), %xmm2   # 0x36c170
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x18(%rbp)
xorps %xmm0, %xmm0
ucomisd -0x18(%rbp), %xmm0
jbe 0x19200
xorps %xmm0, %xmm0
subsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x18(%rbp)
movsd -0x18(%rbp), %xmm0
callq 0x9280
movsd %xmm0, -0x18(%rbp)
jmp 0x1941d
movslq -0xc(%rbp), %rcx
leaq 0x1a3b01(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
cmpl $0x8, 0xd4(%rax)
jne 0x192d8
leaq 0x3856e3(%rip), %rdi    # 0x39e920
leaq 0x1571f1(%rip), %rsi    # 0x170435
callq 0x9350
movslq -0xc(%rbp), %rcx
leaq 0x1a3acc(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0x78(%rax), %xmm1
divsd 0x352f05(%rip), %xmm1   # 0x36c170
movslq -0xc(%rbp), %rcx
leaq 0x1a3aaa(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0x68(%rax), %xmm0
divsd 0x352ee3(%rip), %xmm0   # 0x36c170
movslq -0xc(%rbp), %rcx
leaq 0x1a3a88(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0x68(%rax), %xmm2
divsd 0x352ec1(%rip), %xmm2   # 0x36c170
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x18(%rbp)
jmp 0x1941b
movslq -0xc(%rbp), %rcx
leaq 0x1a3a3d(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
cmpl $0x10, 0xd4(%rax)
jne 0x19330
leaq 0x385623(%rip), %rdi    # 0x39e920
leaq 0x17f9be(%rip), %rsi    # 0x198cc2
callq 0x9350
movslq -0xc(%rbp), %rcx
leaq 0x1a3a0c(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0xb0(%rax), %xmm0
movsd %xmm0, -0x18(%rbp)
jmp 0x19419
movslq -0xc(%rbp), %rcx
leaq 0x1a39e5(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
cmpl $0x20, 0xd4(%rax)
jne 0x19388
leaq 0x3855cb(%rip), %rdi    # 0x39e920
leaq 0x1570dd(%rip), %rsi    # 0x170439
callq 0x9350
movslq -0xc(%rbp), %rcx
leaq 0x1a39b4(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0xb8(%rax), %xmm0
movsd %xmm0, -0x18(%rbp)
jmp 0x19417
movslq -0xc(%rbp), %rcx
leaq 0x1a398d(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
cmpl $0x40, 0xd4(%rax)
jne 0x193fa
leaq 0x385573(%rip), %rdi    # 0x39e920
leaq 0x157089(%rip), %rsi    # 0x17043d
callq 0x9350
movslq -0xc(%rbp), %rcx
leaq 0x1a395c(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0xb8(%rax), %xmm0
movslq -0xc(%rbp), %rcx
leaq 0x1a393f(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
subsd 0xb0(%rax), %xmm0
movsd %xmm0, -0x18(%rbp)
jmp 0x19415
leaq 0x38551f(%rip), %rdi    # 0x39e920
leaq 0x171266(%rip), %rsi    # 0x18a66e
callq 0x9350
xorps %xmm0, %xmm0
movsd %xmm0, -0x18(%rbp)
jmp 0x19417
jmp 0x19419
jmp 0x1941b
jmp 0x1941d
jmp 0x1941f
jmp 0x19421
movslq -0xc(%rbp), %rcx
leaq 0x1a38f4(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0xcc(%rax)
je 0x19457
leaq 0x3854da(%rip), %rdi    # 0x39e920
leaq 0x166d5c(%rip), %rsi    # 0x1801a9
callq 0x96a0
jmp 0x194e0
movslq -0xc(%rbp), %rcx
leaq 0x1a38be(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0xd0(%rax)
je 0x1948a
leaq 0x3854a4(%rip), %rdi    # 0x39e920
leaq 0x158919(%rip), %rsi    # 0x171d9c
callq 0x96a0
jmp 0x194de
movslq -0xc(%rbp), %rcx
leaq 0x1a388b(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movsd 0xa0(%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x194b4
jp 0x194b4
jmp 0x194c9
leaq 0x385465(%rip), %rdi    # 0x39e920
leaq 0x158d89(%rip), %rsi    # 0x17224b
callq 0x96a0
jmp 0x194dc
leaq 0x385450(%rip), %rdi    # 0x39e920
leaq 0x16fd70(%rip), %rsi    # 0x189247
callq 0x96a0
jmp 0x194de
jmp 0x194e0
movsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x8(%rbp)
movsd -0x8(%rbp), %xmm0
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)