// File: /workspace/github_cpp_makefile_star2_O2/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 0x20ffec(%rip), %eax    # 0x226c7c
xorl %ecx, %ecx
cmpl $0x1, %eax
setne %cl
leal 0x1(,%rcx,2), %ecx
cmpl $0x8, %eax
pushq $0x4
popq %rax
cmovnel %ecx, %eax
movl %eax, -0x34(%rbp)
cmpq $0x400, 0x1ebc1a(%rip) # imm = 0x400
jne 0x16cc7
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r12d, %r12d
movl 0x1ebb34(%rip), %eax    # 0x202804
movl %eax, -0x30(%rbp)
pushq $0xf
popq %r15
cmpl 0x1ebba6(%rip), %r12d   # 0x202884
jge 0x17083
movl 0x1ebb95(%rip), %r13d   # 0x202880
addl %r12d, %r13d
movl %r12d, %eax
cltd
idivl 0x1ebb7c(%rip)          # 0x202874
testl %edx, %edx
je 0x16e2e
movl %r12d, %eax
cltd
idivl 0x1ebb6e(%rip)          # 0x202878
testl %edx, %edx
jne 0x1702d
movl %r12d, -0x2c(%rbp)
movl 0x1ebb60(%rip), %esi    # 0x20287c
incl %esi
movl %r13d, %edi
movl %r15d, %edx
callq 0xe1a7
movl 0x1ebb65(%rip), %esi    # 0x202894
addl 0x1ebb47(%rip), %esi    # 0x20287c
movl %r13d, %edi
pushq $0x8
popq %rdx
callq 0xe1a7
movl 0x1ebb36(%rip), %eax    # 0x20287c
movl 0x1ebb3c(%rip), %ecx    # 0x202888
leal (%rax,%rcx), %esi
addl $-0x2, %esi
movl %r13d, %edi
movl %r15d, %edx
callq 0xe1a7
xorl %eax, %eax
cmpb $0x0, 0x1ee673(%rip)    # 0x2053d9
setne %al
leal (%rax,%rax,2), %r12d
addl $0x8, %r12d
movl 0x1ebaf5(%rip), %ebx    # 0x20286c
movl 0x1ebb17(%rip), %esi    # 0x202894
cmpl %esi, %ebx
jg 0x17029
addl %ebx, %esi
addl 0x1ebaef(%rip), %esi    # 0x20287c
movzbl %r12b, %r14d
movl %r13d, %edi
movl %r14d, %edx
callq 0xe1a7
movl 0x1ebada(%rip), %esi    # 0x20287c
subl %ebx, %esi
addl 0x1ebaea(%rip), %esi    # 0x202894
movl %r13d, %edi
movl %r14d, %edx
callq 0xe1a7
movl 0x1ebad9(%rip), %esi    # 0x202894
movl 0x1ebabb(%rip), %eax    # 0x20287c
addl %esi, %eax
movl %eax, %ecx
subl %ebx, %ecx
cmpl $0xb, %r12d
movl -0x30(%rbp), %edi
movl %edi, %edx
cmovel %ecx, %edx
cmpl %edi, %ecx
cmovll %edx, %edi
movl %edi, -0x30(%rbp)
cmpl $0x259, 0x1eba1f(%rip)  # imm = 0x259
jge 0x16df0
cmpb $0x50, 0x2df9ba(%rip)   # 0x2f67a8
jne 0x16e10
cmpb $0x0, 0x1ee5e2(%rip)    # 0x2053d9
setne %al
cmpl $0xb, %r12d
setne %cl
andb %al, %cl
movzbl %cl, %eax
leal (%rax,%rax,2), %r12d
addl $0x8, %r12d
jmp 0x16e23
movl %r13d, %edi
movl %eax, %esi
movl %r14d, %edx
callq 0xe1a7
movl 0x1eba71(%rip), %esi    # 0x202894
addl 0x1eba43(%rip), %ebx    # 0x20286c
jmp 0x16d7d
movl %r12d, -0x2c(%rbp)
movl 0x1eba44(%rip), %esi    # 0x20287c
incl %esi
movl %r13d, %edi
movl %r15d, %edx
callq 0xe1a7
movl 0x1eba31(%rip), %esi    # 0x20287c
addl $0x2, %esi
movl %r13d, %edi
movl %r15d, %edx
callq 0xe1a7
movl 0x1eba1d(%rip), %esi    # 0x20287c
addl $0x3, %esi
movl %r13d, %edi
movl %r15d, %edx
callq 0xe1a7
movl 0x1eba09(%rip), %eax    # 0x20287c
movl 0x1eba0f(%rip), %ecx    # 0x202888
leal (%rax,%rcx), %esi
addl $-0x2, %esi
movl %r13d, %edi
movl %r15d, %edx
callq 0xe1a7
movl 0x1eb9ec(%rip), %eax    # 0x20287c
movl 0x1eb9f2(%rip), %ecx    # 0x202888
leal (%rax,%rcx), %esi
addl $-0x3, %esi
movl %r13d, %edi
movl %r15d, %edx
callq 0xe1a7
movl 0x1eb9cf(%rip), %eax    # 0x20287c
movl 0x1eb9d5(%rip), %ecx    # 0x202888
leal (%rax,%rcx), %esi
addl $-0x4, %esi
movl %r13d, %edi
movl %r15d, %edx
callq 0xe1a7
leal -0x1(%r13), %r12d
leal 0x1(%r13), %r14d
xorl %ebx, %ebx
movl 0x1eb9c0(%rip), %esi    # 0x202894
cmpl %esi, %ebx
jg 0x16ffd
movl 0x1eb99a(%rip), %eax    # 0x20287c
addl %ebx, %esi
addl %eax, %esi
decl %esi
movl %r13d, %edi
movl %r15d, %edx
callq 0xe1a7
movl 0x1eb983(%rip), %esi    # 0x20287c
addl %ebx, %esi
addl 0x1eb993(%rip), %esi    # 0x202894
movl %r13d, %edi
movl %r15d, %edx
callq 0xe1a7
movl 0x1eb982(%rip), %eax    # 0x202894
movl 0x1eb964(%rip), %ecx    # 0x20287c
addl %ebx, %ecx
leal (%rax,%rcx), %esi
incl %esi
movl %r13d, %edi
movl %r15d, %edx
callq 0xe1a7
cmpl 0x1eb94f(%rip), %r13d   # 0x202880
jle 0x16f4c
movl 0x1eb943(%rip), %esi    # 0x20287c
addl %ebx, %esi
addl 0x1eb953(%rip), %esi    # 0x202894
movl %r12d, %edi
movl %r15d, %edx
callq 0xe1a7
movl 0x1eb92a(%rip), %esi    # 0x20287c
addl %ebx, %esi
addl 0x1eb93a(%rip), %esi    # 0x202894
movl %r14d, %edi
movl %r15d, %edx
callq 0xe1a7
movl %ebx, %esi
notl %esi
addl 0x1eb90d(%rip), %esi    # 0x20287c
addl 0x1eb91f(%rip), %esi    # 0x202894
movl %r13d, %edi
movl %r15d, %edx
callq 0xe1a7
movl 0x1eb8f6(%rip), %esi    # 0x20287c
subl %ebx, %esi
addl 0x1eb906(%rip), %esi    # 0x202894
movl %r13d, %edi
movl %r15d, %edx
callq 0xe1a7
movl 0x1eb8dd(%rip), %eax    # 0x20287c
movl 0x1eb8ef(%rip), %ecx    # 0x202894
subl %ebx, %eax
leal (%rax,%rcx), %esi
incl %esi
movl %r13d, %edi
movl %r15d, %edx
callq 0xe1a7
cmpl 0x1eb8c2(%rip), %r13d   # 0x202880
jle 0x16fd9
movl 0x1eb8b6(%rip), %esi    # 0x20287c
subl %ebx, %esi
addl 0x1eb8c6(%rip), %esi    # 0x202894
movl %r12d, %edi
movl %r15d, %edx
callq 0xe1a7
movl 0x1eb89d(%rip), %esi    # 0x20287c
subl %ebx, %esi
addl 0x1eb8ad(%rip), %esi    # 0x202894
movl %r14d, %edi
movl %r15d, %edx
callq 0xe1a7
addl 0x1eb874(%rip), %ebx    # 0x20286c
jmp 0x16ece
cmpb $0x0, 0x1ee3d5(%rip)    # 0x2053d9
je 0x17035
movl 0x1eb868(%rip), %ecx    # 0x202874
imull -0x34(%rbp), %ecx
movl -0x2c(%rbp), %r12d
movl %r12d, %eax
cltd
idivl %ecx
xorl %eax, %eax
testl %edx, %edx
sete %al
leal (%rax,%rax,2), %eax
orl $0x8, %eax
jmp 0x1703b
movl -0x2c(%rbp), %r12d
incl %r12d
jmp 0x16cd7
movb $0x8, %al
movl -0x2c(%rbp), %r12d
movl 0x1eb82f(%rip), %ebx    # 0x202870
movzbl %al, %r14d
cmpl %esi, %ebx
jg 0x1702d
addl %ebx, %esi
addl 0x1eb82b(%rip), %esi    # 0x20287c
movl %r13d, %edi
movl %r14d, %edx
callq 0xe1a7
movl 0x1eb81a(%rip), %esi    # 0x20287c
subl %ebx, %esi
addl 0x1eb82a(%rip), %esi    # 0x202894
movl %r13d, %edi
movl %r14d, %edx
callq 0xe1a7
addl 0x1eb7f5(%rip), %ebx    # 0x202870
movl 0x1eb813(%rip), %esi    # 0x202894
jmp 0x17045
xorl %r14d, %r14d
pushq $0xf
popq %rbx
xorl %r15d, %r15d
movl 0x1eb802(%rip), %esi    # 0x202894
cmpl %esi, %r15d
jg 0x17293
movl %r15d, %eax
cltd
idivl 0x1eb7c7(%rip)          # 0x20286c
testl %edx, %edx
je 0x170d5
movl %r15d, %eax
cltd
idivl 0x1eb7bd(%rip)          # 0x202870
testl %edx, %edx
jne 0x17288
movl 0x1eb7bf(%rip), %edi    # 0x202880
incl %edi
leaq 0x1eb7b2(%rip), %rax    # 0x20287c
pushq $0x1
popq %r13
pushq $-0x2
jmp 0x1720e
testl %r14d, %r14d
je 0x17288
movl 0x1eb79c(%rip), %edi    # 0x202880
incl %edi
addl 0x1eb790(%rip), %esi    # 0x20287c
addl %r15d, %esi
movl %ebx, %edx
callq 0xe1a7
movl 0x1eb784(%rip), %edi    # 0x202880
incl %edi
movl 0x1eb778(%rip), %esi    # 0x20287c
addl 0x1eb78a(%rip), %esi    # 0x202894
addl %r14d, %esi
movl %ebx, %edx
callq 0xe1a7
movl 0x1eb766(%rip), %eax    # 0x202880
movl 0x1eb764(%rip), %ecx    # 0x202884
leal (%rax,%rcx), %edi
addl $-0x2, %edi
movl 0x1eb750(%rip), %esi    # 0x20287c
addl 0x1eb762(%rip), %esi    # 0x202894
addl %r15d, %esi
movl %ebx, %edx
callq 0xe1a7
movl 0x1eb73e(%rip), %eax    # 0x202880
movl 0x1eb73c(%rip), %ecx    # 0x202884
leal (%rax,%rcx), %edi
addl $-0x2, %edi
movl 0x1eb728(%rip), %esi    # 0x20287c
addl 0x1eb73a(%rip), %esi    # 0x202894
addl %r14d, %esi
movl %ebx, %edx
callq 0xe1a7
movl 0x1eb716(%rip), %edi    # 0x202880
addl $0x2, %edi
movl 0x1eb709(%rip), %esi    # 0x20287c
addl 0x1eb71b(%rip), %esi    # 0x202894
addl %r15d, %esi
movl %ebx, %edx
callq 0xe1a7
movl 0x1eb6f7(%rip), %edi    # 0x202880
addl $0x2, %edi
movl 0x1eb6ea(%rip), %esi    # 0x20287c
addl 0x1eb6fc(%rip), %esi    # 0x202894
addl %r14d, %esi
movl %ebx, %edx
callq 0xe1a7
movl 0x1eb6d8(%rip), %eax    # 0x202880
movl 0x1eb6d6(%rip), %ecx    # 0x202884
leal (%rax,%rcx), %edi
addl $-0x3, %edi
movl 0x1eb6c2(%rip), %esi    # 0x20287c
addl 0x1eb6d4(%rip), %esi    # 0x202894
addl %r15d, %esi
movl %ebx, %edx
callq 0xe1a7
movl 0x1eb6b0(%rip), %eax    # 0x202880
movl 0x1eb6ae(%rip), %ecx    # 0x202884
leal (%rax,%rcx), %edi
addl $-0x3, %edi
movl 0x1eb69a(%rip), %esi    # 0x20287c
addl 0x1eb6ac(%rip), %esi    # 0x202894
addl %r14d, %esi
movl %ebx, %edx
callq 0xe1a7
movl 0x1eb688(%rip), %edi    # 0x202880
addl $0x3, %edi
movl 0x1eb67b(%rip), %esi    # 0x20287c
leaq 0x1eb68c(%rip), %rax    # 0x202894
pushq $0x3
popq %r13
pushq $-0x4
popq %r12
addl (%rax), %esi
addl %r15d, %esi
movl %ebx, %edx
callq 0xe1a7
addl 0x1eb65d(%rip), %r13d   # 0x202880
movl 0x1eb653(%rip), %esi    # 0x20287c
addl 0x1eb665(%rip), %esi    # 0x202894
addl %r14d, %esi
movl %r13d, %edi
movl %ebx, %edx
callq 0xe1a7
movl 0x1eb63e(%rip), %edi    # 0x202880
addl %r12d, %edi
addl 0x1eb639(%rip), %edi    # 0x202884
movl 0x1eb62b(%rip), %esi    # 0x20287c
addl 0x1eb63d(%rip), %esi    # 0x202894
addl %r15d, %esi
movl %ebx, %edx
callq 0xe1a7
addl 0x1eb618(%rip), %r12d   # 0x202880
addl 0x1eb615(%rip), %r12d   # 0x202884
movl 0x1eb607(%rip), %esi    # 0x20287c
addl 0x1eb619(%rip), %esi    # 0x202894
addl %r14d, %esi
movl %r12d, %edi
movl %ebx, %edx
callq 0xe1a7
incl %r15d
decl %r14d
jmp 0x1708c
movl 0x1eb5e7(%rip), %edi    # 0x202880
movl 0x1eb5dd(%rip), %esi    # 0x20287c
incl %esi
movl 0x1eb5dd(%rip), %edx    # 0x202884
decl %edx
movl 0x1eb5d9(%rip), %ecx    # 0x202888
addl $-0x2, %ecx
pushq $0xf
popq %r8
callq 0xecd5
movl 0x1eb5d3(%rip), %edi    # 0x202894
callq 0x160cb
movl -0x30(%rbp), %edi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe919a