// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heather.cpp
// Function: show_plot_grid()
void show_plot_grid()
{
int x, y;
int color;
int col;
int j;
int top_adev_row;
int adev_decade_width;  // HORIZ_MAJOR divisions per decade

   if(bin_scale == 8) adev_decade_width = 4;  // 1-2-4-8 decades
   else if(bin_scale == 1) adev_decade_width = 1;  // 1 per decade
//   else if(bin_scale == 2) adev_decade_width = 4;  // 1 per octave
   else adev_decade_width = 3;  // 1-2-5 decades

   if(rcvr_type == NO_RCVR) return;
   top_adev_row = SCREEN_HEIGHT;


   for(x=0; x<PLOT_WIDTH; x++) {  // draw vertical features
      col = PLOT_COL + x;
      if((x % HORIZ_MAJOR) == 0) {  // major tick marks
         dot(col, PLOT_ROW+1, WHITE);               // along top horizontal axis
         dot(col, PLOT_ROW+2, WHITE);
         dot(col, PLOT_ROW+3, WHITE);

         dot(col, PLOT_ROW+PLOT_HEIGHT-2, WHITE);   // along bottom horizontal axis
         dot(col, PLOT_ROW+PLOT_HEIGHT-3, WHITE);
         dot(col, PLOT_ROW+PLOT_HEIGHT-4, WHITE);

         for(j=0; j<=PLOT_CENTER; j+=VERT_MAJOR) {
            dot(col,   PLOT_ROW+PLOT_CENTER+j-1, WHITE);  // + at intersections
            dot(col,   PLOT_ROW+PLOT_CENTER+j,   WHITE);
            dot(col,   PLOT_ROW+PLOT_CENTER+j+1, WHITE);
            if(col > PLOT_COL) dot(col-1, PLOT_ROW+PLOT_CENTER+j,WHITE);
            dot(col+1, PLOT_ROW+PLOT_CENTER+j,   WHITE);

            dot(col,  PLOT_ROW+PLOT_CENTER-j-1, WHITE);  // + at intersections
            dot(col,  PLOT_ROW+PLOT_CENTER-j,   WHITE);
            dot(col,  PLOT_ROW+PLOT_CENTER-j+1, WHITE);
            if(col > PLOT_COL) dot(col-1,PLOT_ROW+PLOT_CENTER-j, WHITE);
            dot(col+1,PLOT_ROW+PLOT_CENTER-j,    WHITE);
         }

         color = GREY;  // WHITE;
         if(plot_adev_data) {
            if((x % (HORIZ_MAJOR*adev_decade_width)) == 0) color = CYAN;  // ADEV 1-2-5 bins
         }

         for(j=VERT_MINOR; j<=PLOT_CENTER; j+=VERT_MINOR) {
            dot(col, PLOT_ROW+PLOT_CENTER+j, color);
            dot(col, PLOT_ROW+PLOT_CENTER-j, color);
         }
      }
      else if((x % HORIZ_MINOR) == 0) {  // minor tick marks
         dot(col, PLOT_ROW+1, WHITE);
         dot(col, PLOT_ROW+PLOT_CENTER, GREY);  // center line tick marks
         dot(col, PLOT_ROW+PLOT_HEIGHT-2, WHITE);

         if(plot_adev_data) color = CYAN;  // subtly highlight ADEV decades
         else               color = GREY;

         for(j=VERT_MAJOR; j<=PLOT_CENTER; j+=VERT_MAJOR) {
            dot(col, PLOT_ROW+PLOT_CENTER+j, color);
            dot(col, PLOT_ROW+PLOT_CENTER-j, color);
            if((PLOT_ROW+PLOT_CENTER-j) < top_adev_row) {
               if(color == CYAN) top_adev_row = (PLOT_ROW+PLOT_CENTER-j);
            }
            if(SCREEN_HEIGHT > SHORT_SCREEN) {
               if(plot_adev_data && (color != CYAN)) color = CYAN;
               else color = GREY;  // WHITE;
            }
            else if(zoom_screen == 'P') {
               if(plot_adev_data && (color != CYAN)) color = CYAN;
               else color = GREY;  // WHITE;
            }
            else {
               dot(col, PLOT_ROW+PLOT_CENTER, color);
            }
         }
      }
   }

   for(y=0; y<=PLOT_CENTER; y++) {  // draw horizontal features
      if((y % VERT_MAJOR) == 0) {
         if((HIGHLIGHT_REF == 0) || (y != 0)) {
            dot(PLOT_COL+1,              PLOT_ROW+PLOT_CENTER+y, WHITE);
            dot(PLOT_COL+1,              PLOT_ROW+PLOT_CENTER-y, WHITE);
            dot(PLOT_COL+PLOT_WIDTH-1-1, PLOT_ROW+PLOT_CENTER+y, WHITE);
            dot(PLOT_COL+PLOT_WIDTH-1-1, PLOT_ROW+PLOT_CENTER-y, WHITE);
            dot(PLOT_COL+2,              PLOT_ROW+PLOT_CENTER+y, WHITE);
            dot(PLOT_COL+2,              PLOT_ROW+PLOT_CENTER-y, WHITE);
            dot(PLOT_COL+PLOT_WIDTH-1-2, PLOT_ROW+PLOT_CENTER+y, WHITE);
            dot(PLOT_COL+PLOT_WIDTH-1-2, PLOT_ROW+PLOT_CENTER-y, WHITE);
            dot(PLOT_COL+3,              PLOT_ROW+PLOT_CENTER+y, WHITE);
            dot(PLOT_COL+3,              PLOT_ROW+PLOT_CENTER-y, WHITE);
            dot(PLOT_COL+PLOT_WIDTH-1-3, PLOT_ROW+PLOT_CENTER+y, WHITE);
            dot(PLOT_COL+PLOT_WIDTH-1-3, PLOT_ROW+PLOT_CENTER-y, WHITE);
         }
      }
      else if((y % VERT_MINOR) == 0) {
         dot(PLOT_COL+1,             PLOT_ROW+PLOT_CENTER+y,  WHITE);
         dot(PLOT_COL+1,             PLOT_ROW+PLOT_CENTER-y,  WHITE);
         dot(PLOT_COL+PLOT_WIDTH-1-1,PLOT_ROW+PLOT_CENTER+y,  WHITE);
         dot(PLOT_COL+PLOT_WIDTH-1-1,PLOT_ROW+PLOT_CENTER-y,  WHITE);
      }
   }

   // draw plot border
   draw_rectangle(PLOT_COL,PLOT_ROW+1, PLOT_WIDTH-1,PLOT_HEIGHT-1-1, WHITE);

   if(HIGHLIGHT_REF) {   // highlight plot center reference line with > ,,, < markers
      mark_row(PLOT_CENTER);
   }

   label_adev_grid(top_adev_row);  // label the ADEV grid lines if adevs being shown
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl 0x225685(%rip), %eax    # 0x23cc7c
xorl %ecx, %ecx
cmpl $0x1, %eax
setne %cl
leal 0x1(,%rcx,2), %ecx
cmpl $0x8, %eax
movl $0x4, %eax
cmovnel %ecx, %eax
movl %eax, -0x34(%rbp)
cmpq $0x400, 0x2012b1(%rip) # imm = 0x400
jne 0x17630
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x2011ce(%rip), %ecx    # 0x218804
cmpl $0x0, 0x201247(%rip)    # 0x218884
jle 0x17a46
xorl %esi, %esi
movl 0x201234(%rip), %r15d   # 0x218880
addl %esi, %r15d
movl %esi, %eax
cltd
idivl 0x20121c(%rip)          # 0x218874
testl %edx, %edx
movl %esi, -0x2c(%rbp)
je 0x1779f
movl %esi, %eax
cltd
idivl 0x20120c(%rip)          # 0x218878
testl %edx, %edx
jne 0x17a35
movl %ecx, %ebx
movl 0x201200(%rip), %esi    # 0x21887c
incl %esi
movl %r15d, %edi
movl $0xf, %edx
callq 0xe6a0
movl 0x201203(%rip), %esi    # 0x218894
addl 0x2011e5(%rip), %esi    # 0x21887c
movl %r15d, %edi
movl $0x8, %edx
callq 0xe6a0
movl 0x2011d2(%rip), %eax    # 0x21887c
movl 0x2011d8(%rip), %ecx    # 0x218888
leal (%rax,%rcx), %esi
addl $-0x2, %esi
movl %r15d, %edi
movl $0xf, %edx
callq 0xe6a0
movl 0x2011a2(%rip), %r12d   # 0x21886c
movl 0x2011c4(%rip), %esi    # 0x218894
cmpl %esi, %r12d
jg 0x17a33
xorl %eax, %eax
cmpb $0x0, 0x203cf7(%rip)    # 0x21b3d9
setne %al
leal (%rax,%rax,2), %r13d
addl $0x8, %r13d
movl %ebx, %ecx
movl %ecx, %ebx
addl %r12d, %esi
addl 0x201182(%rip), %esi    # 0x21887c
movzbl %r13b, %r14d
movl %r15d, %edi
movl %r14d, %edx
callq 0xe6a0
movl 0x20116d(%rip), %esi    # 0x21887c
subl %r12d, %esi
addl 0x20117c(%rip), %esi    # 0x218894
movl %r15d, %edi
movl %r14d, %edx
callq 0xe6a0
movl 0x20116b(%rip), %esi    # 0x218894
addl 0x20114d(%rip), %esi    # 0x21887c
movl %esi, %ecx
subl %r12d, %ecx
cmpl %ebx, %ecx
cmovgel %ebx, %ecx
cmpl $0xb, %r13d
cmovnel %ebx, %ecx
cmpl $0x259, 0x2010ba(%rip)  # imm = 0x259
jge 0x17755
cmpb $0x50, 0x2f5055(%rip)   # 0x30c7a8
jne 0x17775
xorl %eax, %eax
cmpl $0xb, %r13d
setne %al
cmpb $0x0, 0x203c74(%rip)    # 0x21b3d9
leal 0x8(%rax,%rax,2), %r13d
movl $0x8, %eax
cmovel %eax, %r13d
jmp 0x17784
movl %ecx, %ebx
movl %r15d, %edi
movl %r14d, %edx
callq 0xe6a0
movl %ebx, %ecx
addl 0x2010e1(%rip), %r12d   # 0x21886c
movl 0x201103(%rip), %esi    # 0x218894
cmpl %esi, %r12d
jle 0x176ef
jmp 0x17a35
movl %ecx, %ebx
movl 0x2010d5(%rip), %esi    # 0x21887c
incl %esi
movl %r15d, %edi
movl $0xf, %edx
callq 0xe6a0
movl 0x2010c0(%rip), %esi    # 0x21887c
addl $0x2, %esi
movl %r15d, %edi
movl $0xf, %edx
callq 0xe6a0
movl 0x2010aa(%rip), %esi    # 0x21887c
addl $0x3, %esi
movl %r15d, %edi
movl $0xf, %edx
callq 0xe6a0
movl 0x201094(%rip), %eax    # 0x21887c
movl 0x20109a(%rip), %ecx    # 0x218888
leal (%rax,%rcx), %esi
addl $-0x2, %esi
movl %r15d, %edi
movl $0xf, %edx
callq 0xe6a0
movl 0x201075(%rip), %eax    # 0x21887c
movl 0x20107b(%rip), %ecx    # 0x218888
leal (%rax,%rcx), %esi
addl $-0x3, %esi
movl %r15d, %edi
movl $0xf, %edx
callq 0xe6a0
movl 0x201056(%rip), %eax    # 0x21887c
movl 0x20105c(%rip), %ecx    # 0x218888
leal (%rax,%rcx), %esi
addl $-0x4, %esi
movl %r15d, %edi
movl $0xf, %edx
callq 0xe6a0
movl 0x20104f(%rip), %eax    # 0x218894
testl %eax, %eax
js 0x179b1
leal -0x1(%r15), %ecx
movl %ecx, -0x30(%rbp)
leal 0x1(%r15), %r13d
xorl %r14d, %r14d
xorl %r12d, %r12d
movl 0x201018(%rip), %ecx    # 0x21887c
addl %r12d, %eax
leal (%rcx,%rax), %esi
decl %esi
movl %r15d, %edi
movl $0xf, %edx
callq 0xe6a0
movl 0x200ffd(%rip), %esi    # 0x21887c
addl %r12d, %esi
addl 0x20100c(%rip), %esi    # 0x218894
movl %r15d, %edi
movl $0xf, %edx
callq 0xe6a0
movl 0x200ff9(%rip), %eax    # 0x218894
movl 0x200fdb(%rip), %ecx    # 0x21887c
addl %r12d, %ecx
leal (%rax,%rcx), %esi
incl %esi
movl %r15d, %edi
movl $0xf, %edx
callq 0xe6a0
cmpl 0x200fc3(%rip), %r15d   # 0x218880
jle 0x178db
movl 0x200fb7(%rip), %esi    # 0x21887c
addl %r12d, %esi
addl 0x200fc6(%rip), %esi    # 0x218894
movl -0x30(%rbp), %edi
movl $0xf, %edx
callq 0xe6a0
movl 0x200f9b(%rip), %esi    # 0x21887c
addl %r12d, %esi
addl 0x200faa(%rip), %esi    # 0x218894
movl %r13d, %edi
movl $0xf, %edx
callq 0xe6a0
movl %r12d, %esi
notl %esi
addl 0x200f7a(%rip), %esi    # 0x21887c
addl 0x200f8c(%rip), %esi    # 0x218894
movl %r15d, %edi
movl $0xf, %edx
callq 0xe6a0
movl 0x200f61(%rip), %esi    # 0x21887c
addl %r14d, %esi
addl 0x200f70(%rip), %esi    # 0x218894
movl %r15d, %edi
movl $0xf, %edx
callq 0xe6a0
movl 0x200f5d(%rip), %eax    # 0x218894
movl 0x200f3f(%rip), %ecx    # 0x21887c
addl %r14d, %ecx
leal (%rax,%rcx), %esi
incl %esi
movl %r15d, %edi
movl $0xf, %edx
callq 0xe6a0
cmpl 0x200f27(%rip), %r15d   # 0x218880
jle 0x17977
movl 0x200f1b(%rip), %esi    # 0x21887c
addl %r14d, %esi
addl 0x200f2a(%rip), %esi    # 0x218894
movl -0x30(%rbp), %edi
movl $0xf, %edx
callq 0xe6a0
addl 0x200efe(%rip), %r14d   # 0x21887c
addl 0x200f0f(%rip), %r14d   # 0x218894
movl %r13d, %edi
movl %r14d, %esi
movl $0xf, %edx
callq 0xe6a0
addl 0x200ed0(%rip), %r12d   # 0x21886c
movl %r12d, %r14d
negl %r14d
movl 0x200eec(%rip), %eax    # 0x218894
cmpl %eax, %r12d
jle 0x1785e
cmpb $0x0, 0x203a21(%rip)    # 0x21b3d9
je 0x179d9
movl 0x200eb4(%rip), %ecx    # 0x218874
imull -0x34(%rbp), %ecx
movl -0x2c(%rbp), %eax
cltd
idivl %ecx
xorl %eax, %eax
testl %edx, %edx
sete %al
leal (%rax,%rax,2), %eax
addl $0x8, %eax
jmp 0x179db
movb $0x8, %al
movl %ebx, %ecx
movl 0x200e8c(%rip), %r12d   # 0x218870
movl 0x200eaa(%rip), %esi    # 0x218894
cmpl %esi, %r12d
jg 0x17a35
movzbl %al, %r14d
addl %r12d, %esi
addl 0x200e80(%rip), %esi    # 0x21887c
movl %r15d, %edi
movl %r14d, %edx
callq 0xe6a0
movl 0x200e6f(%rip), %esi    # 0x21887c
subl %r12d, %esi
addl 0x200e7e(%rip), %esi    # 0x218894
movl %r15d, %edi
movl %r14d, %edx
callq 0xe6a0
addl 0x200e48(%rip), %r12d   # 0x218870
movl 0x200e66(%rip), %esi    # 0x218894
cmpl %esi, %r12d
jle 0x179f3
movl %ebx, %ecx
movl -0x2c(%rbp), %esi
incl %esi
cmpl 0x200e44(%rip), %esi    # 0x218884
jl 0x17645
movl %ecx, %ebx
movl 0x200e46(%rip), %esi    # 0x218894
testl %esi, %esi
js 0x17c90
xorl %r13d, %r13d
xorl %r14d, %r14d
movl %r14d, %eax
cltd
idivl 0x200e06(%rip)          # 0x21886c
testl %edx, %edx
je 0x17a9c
movl %r14d, %eax
cltd
idivl 0x200dfc(%rip)          # 0x218870
testl %edx, %edx
jne 0x17c77
movl 0x200dfe(%rip), %edi    # 0x218880
incl %edi
movl $0xfffffffe, %r15d      # imm = 0xFFFFFFFE
movl $0x1, %r12d
leaq 0x200de5(%rip), %rax    # 0x21887c
jmp 0x17bf3
testl %r13d, %r13d
je 0x17c77
movl 0x200dd5(%rip), %edi    # 0x218880
incl %edi
addl 0x200dc9(%rip), %esi    # 0x21887c
addl %r14d, %esi
movl $0xf, %edx
callq 0xe6a0
movl 0x200dba(%rip), %edi    # 0x218880
incl %edi
movl 0x200dae(%rip), %esi    # 0x21887c
addl 0x200dc0(%rip), %esi    # 0x218894
addl %r13d, %esi
movl $0xf, %edx
callq 0xe6a0
movl 0x200d99(%rip), %eax    # 0x218880
movl 0x200d97(%rip), %ecx    # 0x218884
leal (%rax,%rcx), %edi
addl $-0x2, %edi
movl 0x200d83(%rip), %esi    # 0x21887c
addl 0x200d95(%rip), %esi    # 0x218894
addl %r14d, %esi
movl $0xf, %edx
callq 0xe6a0
movl 0x200d6e(%rip), %eax    # 0x218880
movl 0x200d6c(%rip), %ecx    # 0x218884
leal (%rax,%rcx), %edi
addl $-0x2, %edi
movl 0x200d58(%rip), %esi    # 0x21887c
addl 0x200d6a(%rip), %esi    # 0x218894
addl %r13d, %esi
movl $0xf, %edx
callq 0xe6a0
movl 0x200d43(%rip), %edi    # 0x218880
addl $0x2, %edi
movl 0x200d36(%rip), %esi    # 0x21887c
addl 0x200d48(%rip), %esi    # 0x218894
addl %r14d, %esi
movl $0xf, %edx
callq 0xe6a0
movl 0x200d21(%rip), %edi    # 0x218880
addl $0x2, %edi
movl 0x200d14(%rip), %esi    # 0x21887c
addl 0x200d26(%rip), %esi    # 0x218894
addl %r13d, %esi
movl $0xf, %edx
callq 0xe6a0
movl 0x200cff(%rip), %eax    # 0x218880
movl 0x200cfd(%rip), %ecx    # 0x218884
leal (%rax,%rcx), %edi
addl $-0x3, %edi
movl 0x200ce9(%rip), %esi    # 0x21887c
addl 0x200cfb(%rip), %esi    # 0x218894
addl %r14d, %esi
movl $0xf, %edx
callq 0xe6a0
movl 0x200cd4(%rip), %eax    # 0x218880
movl 0x200cd2(%rip), %ecx    # 0x218884
leal (%rax,%rcx), %edi
addl $-0x3, %edi
movl 0x200cbe(%rip), %esi    # 0x21887c
addl 0x200cd0(%rip), %esi    # 0x218894
addl %r13d, %esi
movl $0xf, %edx
callq 0xe6a0
movl 0x200ca9(%rip), %edi    # 0x218880
addl $0x3, %edi
movl $0xfffffffc, %r15d      # imm = 0xFFFFFFFC
movl $0x3, %r12d
movl 0x200c90(%rip), %esi    # 0x21887c
leaq 0x200ca1(%rip), %rax    # 0x218894
addl (%rax), %esi
addl %r14d, %esi
movl $0xf, %edx
callq 0xe6a0
addl 0x200c77(%rip), %r12d   # 0x218880
movl 0x200c6d(%rip), %esi    # 0x21887c
addl 0x200c7f(%rip), %esi    # 0x218894
addl %r13d, %esi
movl %r12d, %edi
movl $0xf, %edx
callq 0xe6a0
movl 0x200c55(%rip), %edi    # 0x218880
addl %r15d, %edi
addl 0x200c50(%rip), %edi    # 0x218884
movl 0x200c42(%rip), %esi    # 0x21887c
addl 0x200c54(%rip), %esi    # 0x218894
addl %r14d, %esi
movl $0xf, %edx
callq 0xe6a0
addl 0x200c2c(%rip), %r15d   # 0x218880
addl 0x200c29(%rip), %r15d   # 0x218884
movl 0x200c1b(%rip), %esi    # 0x21887c
addl 0x200c2d(%rip), %esi    # 0x218894
addl %r13d, %esi
movl %r15d, %edi
movl $0xf, %edx
callq 0xe6a0
leal 0x1(%r14), %eax
movl 0x200c13(%rip), %esi    # 0x218894
decl %r13d
cmpl %esi, %r14d
movl %eax, %r14d
jl 0x17a5c
movl 0x200bea(%rip), %edi    # 0x218880
movl 0x200be0(%rip), %esi    # 0x21887c
incl %esi
movl 0x200be0(%rip), %edx    # 0x218884
decl %edx
movl 0x200bdc(%rip), %ecx    # 0x218888
addl $-0x2, %ecx
movl $0xf, %r8d
callq 0xf296
movl 0x200bd4(%rip), %edi    # 0x218894
callq 0x169f2
movl %ebx, %edi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xfeadd