// File: jkingan[P]ladyheather/heather.cpp
// Function: get_plot_q(long)
struct PLOT_Q get_plot_q(long i)
{
static struct PLOT_Q q;
DATA_SIZE color_sum;

   // returns entry "i" from the plot queue.  If "i" is out of range, return
   // the last queue entry that we fetched.  This should show up as a duplicate
   // time stamp error...


   if(plot_q == 0) return q;
   if(i >= plot_q_size) return q;
   if(i < 0) return q;

   q = plot_q[i];

   if(luxor) {
      if(show_color_pct) {  // scale color values to percentages
         color_sum = (DATA_SIZE) ((q.data[REDHZ] + q.data[GREENHZ] + q.data[BLUEHZ]) / (DATA_SIZE) 100.0);
         if(color_sum) {
            q.data[REDHZ] /= color_sum;
            q.data[GREENHZ] /= color_sum;
            q.data[BLUEHZ] /= color_sum;
            q.data[WHITEHZ] /= color_sum;
         }
         else {
            q.data[REDHZ] = 0.0;
            q.data[GREENHZ] = 0.0;
            q.data[BLUEHZ] = 0.0;
            q.data[WHITEHZ] = 0.0;
         }
      }
      else if(show_color_uw) {
         q.data[BLUEHZ] /= (DATA_SIZE) BLUE_SENS;     // blue
         q.data[GREENHZ] /= (DATA_SIZE)  GREEN_SENS;  // green
         q.data[REDHZ] /= (DATA_SIZE) RED_SENS;       // red
         q.data[WHITEHZ] /= (DATA_SIZE) WHITE_SENS;   // white
      }
   }
   else if(USES_PLOT_THREE) ;
   else if(graph_lla == 0) {
      q.data[THREE] = q.data[TEMP] - (q.data[DAC] * d_scale);  // !!!!
   }

   return q;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x20(%rbp)
movq %rdi, -0x18(%rbp)
movq %rsi, -0x8(%rbp)
cmpq $0x0, 0x2670e4(%rip)    # 0x27a4f0
jne 0x13428
movq -0x20(%rbp), %rdi
leaq 0x38bf5f(%rip), %rsi    # 0x39f378
movl $0xb0, %edx
callq 0x92c0
jmp 0x13676
movq -0x8(%rbp), %rax
cmpq 0x2670cd(%rip), %rax    # 0x27a500
jl 0x1344f
movq -0x20(%rbp), %rdi
leaq 0x38bf38(%rip), %rsi    # 0x39f378
movl $0xb0, %edx
callq 0x92c0
jmp 0x13676
cmpq $0x0, -0x8(%rbp)
jge 0x13470
movq -0x20(%rbp), %rdi
leaq 0x38bf17(%rip), %rsi    # 0x39f378
movl $0xb0, %edx
callq 0x92c0
jmp 0x13676
movq 0x267079(%rip), %rsi    # 0x27a4f0
imulq $0xb0, -0x8(%rbp), %rax
addq %rax, %rsi
leaq 0x38beef(%rip), %rdi    # 0x39f378
movl $0xb0, %edx
callq 0x92c0
cmpb $0x0, 0x28ac84(%rip)    # 0x29e11e
je 0x135f9
cmpb $0x0, 0x358ca5(%rip)    # 0x36c14c
je 0x1357c
movsd 0x38bf2b(%rip), %xmm0   # 0x39f3e0
addsd 0x38bf1b(%rip), %xmm0   # 0x39f3d8
addsd 0x38bf0b(%rip), %xmm0   # 0x39f3d0
movsd 0x15bb83(%rip), %xmm1   # 0x16f050
divsd %xmm1, %xmm0
movsd %xmm0, -0x10(%rbp)
movsd -0x10(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x134e8
jp 0x134e8
jmp 0x1354e
movsd -0x10(%rbp), %xmm1
movsd 0x38beeb(%rip), %xmm0   # 0x39f3e0
divsd %xmm1, %xmm0
movsd %xmm0, 0x38bedf(%rip)   # 0x39f3e0
movsd -0x10(%rbp), %xmm1
movsd 0x38beca(%rip), %xmm0   # 0x39f3d8
divsd %xmm1, %xmm0
movsd %xmm0, 0x38bebe(%rip)   # 0x39f3d8
movsd -0x10(%rbp), %xmm1
movsd 0x38bea9(%rip), %xmm0   # 0x39f3d0
divsd %xmm1, %xmm0
movsd %xmm0, 0x38be9d(%rip)   # 0x39f3d0
movsd -0x10(%rbp), %xmm1
movsd 0x38bea8(%rip), %xmm0   # 0x39f3e8
divsd %xmm1, %xmm0
movsd %xmm0, 0x38be9c(%rip)   # 0x39f3e8
jmp 0x1357a
xorps %xmm0, %xmm0
movsd %xmm0, 0x38be87(%rip)   # 0x39f3e0
xorps %xmm0, %xmm0
movsd %xmm0, 0x38be74(%rip)   # 0x39f3d8
xorps %xmm0, %xmm0
movsd %xmm0, 0x38be61(%rip)   # 0x39f3d0
xorps %xmm0, %xmm0
movsd %xmm0, 0x38be6e(%rip)   # 0x39f3e8
jmp 0x135f7
cmpb $0x0, 0x358bc8(%rip)    # 0x36c14b
je 0x135f5
movsd 0x358b33(%rip), %xmm1   # 0x36c0c0
movsd 0x38be3b(%rip), %xmm0   # 0x39f3d0
divsd %xmm1, %xmm0
movsd %xmm0, 0x38be2f(%rip)   # 0x39f3d0
movsd 0x358b1f(%rip), %xmm1   # 0x36c0c8
movsd 0x38be27(%rip), %xmm0   # 0x39f3d8
divsd %xmm1, %xmm0
movsd %xmm0, 0x38be1b(%rip)   # 0x39f3d8
movsd 0x358b0b(%rip), %xmm1   # 0x36c0d0
movsd 0x38be13(%rip), %xmm0   # 0x39f3e0
divsd %xmm1, %xmm0
movsd %xmm0, 0x38be07(%rip)   # 0x39f3e0
movsd 0x358af7(%rip), %xmm1   # 0x36c0d8
movsd 0x38bdff(%rip), %xmm0   # 0x39f3e8
divsd %xmm1, %xmm0
movsd %xmm0, 0x38bdf3(%rip)   # 0x39f3e8
jmp 0x135f7
jmp 0x13661
movabsq $0x101b1b0000, %rax     # imm = 0x101B1B0000
andq 0x2644a6(%rip), %rax    # 0x277ab0
cmpq $0x0, %rax
je 0x13612
jmp 0x1365f
movzbl 0x386e8b(%rip), %eax    # 0x39a4a4
cmpl $0x0, %eax
jne 0x1365d
movsd 0x38bd7a(%rip), %xmm1   # 0x39f3a0
movsd 0x38bd6a(%rip), %xmm0   # 0x39f398
movsd 0x38b2ba(%rip), %xmm2   # 0x39e8f0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x38bd5b(%rip)   # 0x39f3b8
jmp 0x1365f
jmp 0x13661
movq -0x20(%rbp), %rdi
leaq 0x38bd0c(%rip), %rsi    # 0x39f378
movl $0xb0, %edx
callq 0x92c0
movq -0x18(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq