// File: jkingan[P]ladyheather/heather.cpp
// Function: next_q_point(long, int)
long next_q_point(long i, int stop_flag)
{
long j;
int wrap;

   // locate the next data point in the plot queue based upon the display
   // view interval

   plot_column += plot_mag;
   if((stop_flag == STOP_AT_PLOT_END) && (plot_column >= PLOT_WIDTH)) {  // we are at end of plot area
      plot_column -= plot_mag;
      return (-2L);
   }
   wrap = 0;

   if(slow_q_skips) { //!!! ineffcient way to step over multiple queue entries,  but bug resistant
      j = view_interval;
      while(j--) {
         if(++i == plot_q_in) return (-1L);
         while(i >= plot_q_size) i -= plot_q_size;
      }
   }
   else {  // more efficent way to do it,  but there might be bugs...
      if(i <= plot_q_in) {
         i += view_interval;
         if(i >= plot_q_in) return (-1L);
      }
      else if(i > plot_q_in) {
         i += view_interval;
         if(i <= plot_q_in) return (-1L);
      }
      while(i >= plot_q_size) {
         i -= plot_q_size;
         ++wrap;
      }
   }
   if(1 && wrap && (i >= plot_q_out)) return (-1L);
   if(i == plot_q_out) return (-1L);

   return i;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl 0x26531f(%rip), %eax    # 0x27a5b0
addl 0x265315(%rip), %eax    # 0x27a5ac
movl %eax, 0x26530f(%rip)    # 0x27a5ac
cmpl $0x1, -0x14(%rbp)
jne 0x152d2
movl 0x265303(%rip), %eax    # 0x27a5ac
cmpl 0x2627b5(%rip), %eax    # 0x277a64
jl 0x152d2
movl 0x2652f9(%rip), %ecx    # 0x27a5b0
movl 0x2652ef(%rip), %eax    # 0x27a5ac
subl %ecx, %eax
movl %eax, 0x2652e7(%rip)    # 0x27a5ac
movq $-0x2, -0x8(%rbp)
jmp 0x15427
movl $0x0, -0x24(%rbp)
cmpb $0x0, 0x2652c6(%rip)    # 0x27a5a6
je 0x1534e
movq 0x265297(%rip), %rax    # 0x27a580
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $-0x1, %rcx
movq %rcx, -0x20(%rbp)
cmpq $0x0, %rax
je 0x15349
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
cmpq 0x2651f3(%rip), %rax    # 0x27a508
jne 0x15324
movq $-0x1, -0x8(%rbp)
jmp 0x15427
jmp 0x15326
movq -0x10(%rbp), %rax
cmpq 0x2651cf(%rip), %rax    # 0x27a500
jl 0x15347
movq 0x2651c6(%rip), %rcx    # 0x27a500
movq -0x10(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x15326
jmp 0x152ed
jmp 0x153eb
movq -0x10(%rbp), %rax
cmpq 0x2651af(%rip), %rax    # 0x27a508
jg 0x15386
movq 0x26521e(%rip), %rax    # 0x27a580
addq -0x10(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq 0x265193(%rip), %rax    # 0x27a508
jl 0x15384
movq $-0x1, -0x8(%rbp)
jmp 0x15427
jmp 0x153bd
movq -0x10(%rbp), %rax
cmpq 0x265177(%rip), %rax    # 0x27a508
jle 0x153bb
movq 0x2651e6(%rip), %rax    # 0x27a580
addq -0x10(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq 0x26515b(%rip), %rax    # 0x27a508
jg 0x153b9
movq $-0x1, -0x8(%rbp)
jmp 0x15427
jmp 0x153bb
jmp 0x153bd
jmp 0x153bf
movq -0x10(%rbp), %rax
cmpq 0x265136(%rip), %rax    # 0x27a500
jl 0x153e9
movq 0x26512d(%rip), %rcx    # 0x27a500
movq -0x10(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x10(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x153bf
jmp 0x153eb
cmpl $0x0, -0x24(%rbp)
je 0x15408
movq -0x10(%rbp), %rax
cmpq 0x265114(%rip), %rax    # 0x27a510
jl 0x15408
movq $-0x1, -0x8(%rbp)
jmp 0x15427
movq -0x10(%rbp), %rax
cmpq 0x2650fd(%rip), %rax    # 0x27a510
jne 0x1541f
movq $-0x1, -0x8(%rbp)
jmp 0x15427
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
popq %rbp
retq
nopl (%rax)