LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: erase_vchar(int, int)
void erase_vchar(int x, int y)
{
int i,j;

   // erase a vector graphics character

//   i = 0;
//   if(VCharThickness > 1) i = 1;
//   if(VCharThickness > 1) i = VCharThickness;
   i = VCharThickness;
   j = 0;
++i;

// if(VCharThickness > 1) ++j;
   erase_rectangle(x,y-j, VCharWidth+VCharThickness,VCharHeight+VCharThickness-i);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl 0x214abd(%rip), %ecx    # 0x22353c
cmpl $0x1, %ecx
jg 0xea9f
movl 0x209d86(%rip), %edx    # 0x218810
incl %edx
movl $0x1, %eax
movl $0xfffffffe, %r8d       # imm = 0xFFFFFFFE
movl 0x209d77(%rip), %ecx    # 0x218814
jmp 0xead7
cmpl $0x4, %ecx
setb %al
cmpl $0x65, 0x214a98(%rip)   # 0x223544
setge %dl
orb %al, %dl
movl %ecx, %r8d
shrl %r8d
testb %dl, %dl
movl $0x2, %eax
cmovel %r8d, %eax
movl %r8d, %edx
notl %edx
movl $0xfffffffd, %r8d       # imm = 0xFFFFFFFD
cmovel %edx, %r8d
leal (%rax,%rcx,8), %edx
shll $0x4, %ecx
addl %r8d, %ecx
addl %eax, %ecx
xorl %r8d, %r8d
popq %rbp
jmp 0xf298
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: xthick_line(int, int, int, int, unsigned char, unsigned char)
void xthick_line(COORD x1,COORD y1,  COORD x2,COORD y2, u08 color, u08 thickness)
{
COORD x,y;

   // draw a thick line on the screen (using single pixel wide lines)

   if(thickness <= 1) {
      return line(x1,y1, x2,y2, color);
   }

   for(x=0; x<thickness; x++) {
      for(y=0; y<thickness; y++) {
         line(x1+x,y1+y, x2+x,y2+y, color);
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r9d, %ebx
movl %ecx, %r15d
movl %esi, %r13d
cmpb $0x2, %bl
jae 0xeb21
movzbl %r8b, %r8d
movl %r13d, %esi
movl %r15d, %ecx
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe38a
xorl %eax, %eax
movzbl %r8b, %r14d
movl %r15d, -0x34(%rbp)
movq %rdx, -0x48(%rbp)
movl %ebx, -0x30(%rbp)
movl %r13d, -0x2c(%rbp)
movq %rdi, -0x40(%rbp)
addl %eax, %edi
movl %edi, -0x38(%rbp)
movq %rax, -0x50(%rbp)
leal (%rax,%rdx), %r12d
movl -0x38(%rbp), %edi
movl %r13d, %esi
movl %r12d, %edx
movl %r15d, %ecx
movl %r14d, %r8d
callq 0xe38a
incl %r15d
incl %r13d
decl %ebx
jne 0xeb47
movq -0x50(%rbp), %rax
incl %eax
movl -0x30(%rbp), %ebx
cmpl %ebx, %eax
movl -0x34(%rbp), %r15d
movq -0x48(%rbp), %rdx
movl -0x2c(%rbp), %r13d
movq -0x40(%rbp), %rdi
jne 0xeb3a
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: vchar_string(int, int, unsigned char, char*)
void vchar_string(int row, int col, u08 color, char *s)
{
u08 c;
int i;

   // draw a text string using vector graphics characters

   if(1 && graphics_coords) {
   }
   else {
      row *= TEXT_HEIGHT;  //!!!!!!
      col *= TEXT_WIDTH;
      row += TEXT_Y_MARGIN;
      col += TEXT_X_MARGIN;
row += 2;
   }
   vc_col = col;
   vc_row = row;

   i = 0;
   while((c = *s++)) {  // to save time,  we only draw the chars that changed
      vchar(col, row, 1, color, c);
      if(i<(VSTRING_LEN-1)) ++i;
      col += VCharWidth;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rcx, %rbx
movl %esi, %r14d
movl %edi, %r15d
cmpb $0x0, 0x209cbc(%rip)    # 0x218868
jne 0xebc9
incl %r15d
imull 0x209c5b(%rip), %r15d   # 0x218814
addl $0x2, %r14d
imull 0x209c4b(%rip), %r14d   # 0x218810
addl $0x2, %r15d
movl %r14d, 0x32c7b8(%rip)   # 0x33b388
movl %r15d, 0x32c7ad(%rip)   # 0x33b384
movb (%rbx), %al
testb %al, %al
je 0xec1d
incq %rbx
movzbl %dl, %r12d
movzbl %al, %r8d
movl %r14d, %edi
movl %r15d, %esi
movl $0x1, %edx
movl %r12d, %ecx
callq 0xe1d8
movl 0x21493b(%rip), %eax    # 0x22353c
cmpl $0x2, %eax
jge 0xec0e
movl 0x209c04(%rip), %eax    # 0x218810
jmp 0xec11
shll $0x3, %eax
addl %eax, %r14d
movb (%rbx), %al
incq %rbx
testb %al, %al
jne 0xebe4
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: center_vstring(int, int, int, char*)
void center_vstring(int row, int scale, int color, char *s)
{
int col;
int len;
int i;

   // draw a scaled vector graphics text string that is centered on the screen

   i = VCHAR_SCALE;
   VCHAR_SCALE = scale;

   len = strlen(s);
   col = ((SCREEN_WIDTH-((VCHAR_W*VCHAR_SCALE)*len)) / TEXT_WIDTH) / 2;
   vchar_string(row, col, color, s);

   VCHAR_SCALE = i;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movl %edx, %r14d
movl %esi, %r12d
movl %edi, %r15d
movl 0x2148f5(%rip), %r13d   # 0x22353c
movl %esi, 0x2148ef(%rip)    # 0x22353c
movq %rcx, %rdi
callq 0x9120
movl 0x209ba5(%rip), %ecx    # 0x218800
imull %r12d, %eax
shll $0x3, %eax
subl %eax, %ecx
movl %ecx, %eax
cltd
idivl 0x209ba3(%rip)          # 0x218810
movl %eax, %esi
shrl $0x1f, %esi
addl %eax, %esi
sarl %esi
movzbl %r14b, %edx
movl %r15d, %edi
movq %rbx, %rcx
callq 0xeb91
movl %r13d, 0x2148b0(%rip)   # 0x22353c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: erase_help()
void erase_help()
{
   // erase the help area on the screen

   if(text_mode) {
      erase_screen();
      return;
   }
   erase_rectangle(PLOT_LEFT,PLOT_ROW, SCREEN_WIDTH-PLOT_LEFT,SCREEN_HEIGHT-PLOT_ROW);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpl $0x0, 0x209b14(%rip)    # 0x2187d8
je 0xeccc
popq %rbp
jmp 0xeceb
movl 0x209baa(%rip), %esi    # 0x21887c
movl 0x209b28(%rip), %edx    # 0x218800
movl 0x209b26(%rip), %ecx    # 0x218804
subl %esi, %ecx
xorl %edi, %edi
xorl %r8d, %r8d
popq %rbp
jmp 0xf298
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: erase_screen()
void erase_screen()
{
   // erase the screen
   erase_rectangle(0,0, SCREEN_WIDTH,SCREEN_HEIGHT);
   show_touch_kbd(0);
   lla_showing = 0;
   ms_row = ms_col = 0;

   #ifdef PRECISE_STUFF
      plot_lla_axes(10);
   #endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl 0x209b09(%rip), %edx    # 0x218800
movl 0x209b07(%rip), %ecx    # 0x218804
xorl %ebx, %ebx
xorl %edi, %edi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0xf298
xorl %edi, %edi
callq 0xedfe
movl %ebx, 0x32c5a8(%rip)    # 0x33b2c0
movl %ebx, 0x2fda72(%rip)    # 0x30c790
movl %ebx, 0x2fda68(%rip)    # 0x30c78c
movl $0xa, %edi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xdb2e0
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: erase_lla()
void erase_lla()
{
   // erase the lat/lon scattergram area on the screen

   if(text_mode) return;
   if(zoom_screen == 'P');
   else if(zoom_screen) return;

   erase_rectangle(LLA_COL,LLA_ROW, LLA_SIZE,LLA_SIZE);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpl $0x0, 0x209a99(%rip)    # 0x2187d8
je 0xed43
popq %rbp
retq
movzbl 0x2fda5e(%rip), %eax    # 0x30c7a8
cmpl $0x50, %eax
je 0xed53
testl %eax, %eax
jne 0xed41
movl 0x32c553(%rip), %edi    # 0x33b2ac
movl 0x32c549(%rip), %esi    # 0x33b2a8
movl 0x32c533(%rip), %ecx    # 0x33b298
movl %ecx, %edx
xorl %r8d, %r8d
popq %rbp
jmp 0xf298
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: erase_azel(int)
void erase_azel(int why)
{
   // erase the satellite map area on the screen

   if((zoom_screen == 0) && ((AZEL_ROW+AZEL_SIZE) >= PLOT_ROW)) {  // az/el map is in the normal plot window
      erase_rectangle(PLOT_COL+PLOT_WIDTH,AZEL_ROW, SCREEN_WIDTH-(PLOT_COL+PLOT_WIDTH),AZEL_SIZE);
   }
   else {
      erase_rectangle(AZEL_COL,AZEL_ROW, AZEL_SIZE,AZEL_SIZE);
   }

   azel_erased = 1;
   azel_grid_color = GREY;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpb $0x0, 0x2fd9ff(%rip)    # 0x30c7a8
movl 0x32c5e1(%rip), %esi    # 0x33b390
movl 0x32c5d7(%rip), %ecx    # 0x33b38c
jne 0xedc2
leal (%rcx,%rsi), %eax
cmpl 0x209abc(%rip), %eax    # 0x21887c
jge 0xede8
movl 0x32c5cc(%rip), %edi    # 0x33b394
movl %ecx, %edx
xorl %r8d, %r8d
callq 0xf298
movl $0x1, 0x32c5c0(%rip)    # 0x33b39c
movl $0x8, 0x32c5c2(%rip)    # 0x33b3a8
popq %rbp
retq
movl 0x209a96(%rip), %edi    # 0x218884
addl 0x209a8c(%rip), %edi    # 0x218880
movl 0x209a06(%rip), %edx    # 0x218800
subl %edi, %edx
jmp 0xedca
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: show_last_mouse_x(int)
void show_last_mouse_x(int color)
{
  // highlight what column the mouse was last in the plot area at

  if(first_key) return;
  if(text_mode) return;
  if(zoom_screen && (zoom_screen != 'P')) return;

  if(last_plot_tick >= 1) {  // erase the old tick mark
     line(PLOT_COL+last_plot_tick-1,PLOT_ROW+0, PLOT_COL+last_plot_tick+1,PLOT_ROW+0, WHITE); // lmq
     line(PLOT_COL+last_plot_tick-1,PLOT_ROW-1, PLOT_COL+last_plot_tick+1,PLOT_ROW-1, BLACK); // lmq
     last_plot_tick = (-1);
  }

  if(last_plot_mouse_x < 1) return;
  if(last_plot_mouse_x == last_plot_tick) return;

  line(PLOT_COL+last_plot_mouse_x-1,PLOT_ROW+0, PLOT_COL+last_plot_mouse_x+1,PLOT_ROW+0, color); // lmq
  line(PLOT_COL+last_plot_mouse_x-1,PLOT_ROW-1, PLOT_COL+last_plot_mouse_x+1,PLOT_ROW-1, color); // lmq
  last_plot_tick = last_plot_mouse_x;
}

// Assembly:
movl 0x20989d(%rip), %eax    # 0x2187d8
orl 0x230017(%rip), %eax    # 0x23ef58
jne 0xf034
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, %ebx
movzbl 0x2fd852(%rip), %eax    # 0x30c7a8
cmpl $0x50, %eax
je 0xef63
testl %eax, %eax
jne 0xf02e
movl 0x20c2eb(%rip), %eax    # 0x21b254
testl %eax, %eax
jle 0xefc5
movl 0x20990d(%rip), %edx    # 0x218880
leal (%rdx,%rax), %edi
decl %edi
movl 0x2098fe(%rip), %ecx    # 0x21887c
addl %eax, %edx
incl %edx
movl %ecx, %esi
movl $0xf, %r8d
callq 0xe38a
movl 0x2098eb(%rip), %eax    # 0x218880
movl 0x20c2b9(%rip), %edx    # 0x21b254
leal (%rdx,%rax), %edi
decl %edi
movl 0x2098d6(%rip), %ecx    # 0x21887c
decl %ecx
addl %eax, %edx
incl %edx
movl %ecx, %esi
xorl %r8d, %r8d
callq 0xe38a
movl $0xffffffff, 0x20c294(%rip) # imm = 0xFFFFFFFF
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl 0x20c285(%rip), %edx    # 0x21b250
testl %edx, %edx
setle %cl
cmpl %eax, %edx
sete %al
orb %cl, %al
jne 0xf02e
movl 0x2098a1(%rip), %eax    # 0x218880
leal (%rax,%rdx), %edi
decl %edi
movl 0x209892(%rip), %ecx    # 0x21887c
leal 0x1(%rax,%rdx), %edx
movzbl %bl, %ebx
movl %ecx, %esi
movl %ebx, %r8d
callq 0xe38a
movl 0x20987f(%rip), %eax    # 0x218880
movl 0x20c249(%rip), %edx    # 0x21b250
leal (%rdx,%rax), %edi
decl %edi
movl 0x20986a(%rip), %ecx    # 0x21887c
decl %ecx
addl %eax, %edx
incl %edx
movl %ecx, %esi
movl %ebx, %r8d
callq 0xe38a
movl 0x20c228(%rip), %eax    # 0x21b250
movl %eax, 0x20c226(%rip)    # 0x21b254
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: erase_plot(int)
void erase_plot(int full_plot)
{
   // erase the plot area on the screen
   //   if full_plot < 0 and plots are disabled, erase the full screen
   //   if full_plot = 0 erase only the graph area
   //   if full_plot > 0 erase the whole plot area

   if(text_mode) return;

   if(((rcvr_type == NO_RCVR) || no_plots) && (full_plot < 0)) {
      erase_screen();
      return;
   }

   if(full_plot < 0) ;
   else if(rcvr_type == NO_RCVR) return;
   else if(no_plots) return;

   if(zoom_screen == 'P');
   else if(zoom_screen) return;

   if(PLOT_COL > PLOT_LEFT) {
      erase_rectangle(PLOT_LEFT,PLOT_ROW, PLOT_COL-PLOT_LEFT,SCREEN_HEIGHT-PLOT_ROW);
   }

   erase_rectangle(PLOT_COL,PLOT_ROW, PLOT_WIDTH,SCREEN_HEIGHT-PLOT_ROW);

   // erase area to the right of the plot area
   if(full_plot && ((PLOT_COL+PLOT_WIDTH) < SCREEN_WIDTH)) {
      erase_rectangle(PLOT_COL+PLOT_WIDTH,PLOT_ROW, SCREEN_WIDTH-(PLOT_COL+PLOT_WIDTH),SCREEN_HEIGHT-PLOT_ROW);
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
cmpl $0x0, 0x209796(%rip)    # 0x2187d8
je 0xf04b
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movl %edi, %ebx
cmpq $0x400, 0x209878(%rip) # imm = 0x400
sete %cl
cmpl $0x0, 0x330d06(%rip)    # 0x33fd68
setne %al
orb %cl, %al
movl %eax, %ecx
xorb $0x1, %cl
testl %edi, %edi
setns %dl
orb %cl, %dl
jne 0xf080
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xeceb
testl %ebx, %ebx
setns %cl
testb %al, %cl
jne 0xf044
movzbl 0x2fd718(%rip), %eax    # 0x30c7a8
cmpl $0x50, %eax
je 0xf099
testl %eax, %eax
jne 0xf044
movl 0x2097e1(%rip), %eax    # 0x218880
testl %eax, %eax
jle 0xf0c3
movl 0x2097d3(%rip), %esi    # 0x21887c
movl 0x209755(%rip), %ecx    # 0x218804
subl %esi, %ecx
xorl %edi, %edi
movl %eax, %edx
xorl %r8d, %r8d
callq 0xf298
movl 0x2097bd(%rip), %eax    # 0x218880
movl 0x2097b3(%rip), %esi    # 0x21887c
movl 0x2097b5(%rip), %edx    # 0x218884
movl 0x20972f(%rip), %ecx    # 0x218804
subl %esi, %ecx
movl %eax, %edi
xorl %r8d, %r8d
callq 0xf298
testl %ebx, %ebx
je 0xf044
movl 0x209795(%rip), %edi    # 0x218884
addl 0x20978b(%rip), %edi    # 0x218880
movl 0x209705(%rip), %edx    # 0x218800
subl %edi, %edx
jle 0xf044
movl 0x209773(%rip), %esi    # 0x21887c
movl 0x2096f5(%rip), %ecx    # 0x218804
subl %esi, %ecx
xorl %r8d, %r8d
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xf298
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: get_pixel(int, int)
u08 get_pixel(COORD x,COORD y)
{
unsigned long pixel;
int i;

   // gets a pixel from the current screen image

   SWAPXY(x,y);

#ifdef WIN_VFX
   if(stage == 0) return 0;

   VFX_io_done = 1;
   pixel = (unsigned long) VFX_pixel_read(stage, x,y) & 0xFFFF;
   for(i=0; i<16; i++) {  // convert screen value to color code
      if(((u32) pixel) == (palette[i]&0xFFFF)) return i;
   }
#endif

#ifdef USE_X11
   // X11 uses the screen capture image buffer

   if(capture_image == 0) return 0;

   pixel = XGetPixel(capture_image, x,y);
   for(i=0; i<16; i++) {  // convert screen value to color code
      if(pixel == palette[i]) return i;
   }
#endif

   return 0;
}

// Assembly:
movl %esi, %eax
movl %edi, %edx
cmpl $0x0, 0x2096fe(%rip)    # 0x218828
je 0xf13e
movl %eax, 0x2096fa(%rip)    # 0x21882c
notl %eax
addl 0x2096ca(%rip), %eax    # 0x218804
movl %eax, %esi
jmp 0xf142
movl %edx, %esi
movl %eax, %edx
movq 0x330e07(%rip), %rdi    # 0x33ff50
testq %rdi, %rdi
je 0xf179
pushq %rbp
movq %rsp, %rbp
callq *0x68(%rdi)
movq %rax, %rcx
leaq 0x161e21(%rip), %rdx    # 0x170f80
xorl %eax, %eax
movl (%rdx), %esi
cmpq %rsi, %rcx
je 0xf177
incq %rax
addq $0x4, %rdx
cmpq $0x10, %rax
jne 0xf161
xorl %eax, %eax
popq %rbp
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: draw_circle(int, int, int, int, int)
void draw_circle(int x,int y, int r, int color, int fill)
{
   // draw a filled or hollow circle on the screen

   SWAPXY(x,y);

   #ifdef WIN_VFX
      if(stage == 0) return;

      if(fill) VFX_ellipse_fill(stage, x,y, r,r, palette[color]);
      else     VFX_ellipse_draw(stage, x,y, r,r, palette[color]);
   #endif

   #ifdef USE_SDL
      if(fill)  filledCircleColor(display,x,y,r, get_sdl_color(color));
      circleColor(display,x,y,r, get_sdl_color(color));
   #endif

   #ifdef USE_X11
      if(display == 0) return;

      r *= 2;
      x = x - (r/2);  // upper left corner of bounding box
      y = y - (r/2);
      set_x11_color(color);
      if(fill) XFillArc(display,win,gc, x,y, r,r, 0,(360*64));
      else     XDrawArc(display,win,gc, x,y, r,r, 0,(360*64));
      flush_x11();
   #endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %r8d, %r15d
movl %esi, %ebx
movl %edi, %r14d
cmpl $0x0, 0x209692(%rip)    # 0x218828
je 0xf1ae
movl %ebx, 0x20968e(%rip)    # 0x21882c
notl %ebx
movl %ebx, %eax
addl 0x20965c(%rip), %eax    # 0x218804
movl %r14d, %ebx
movl %eax, %r14d
cmpq $0x0, 0x161d0a(%rip)    # 0x170ec0
je 0xf219
leal (%rdx,%rdx), %r12d
subl %edx, %r14d
subl %edx, %ebx
movzbl %cl, %edi
callq 0xd44a
movq 0x161cf0(%rip), %rdi    # 0x170ec0
movq 0x161cf9(%rip), %rsi    # 0x170ed0
movq 0x161d02(%rip), %rdx    # 0x170ee0
subq $0x8, %rsp
movl %r14d, %ecx
movl %ebx, %r8d
movl %r12d, %r9d
testl %r15d, %r15d
je 0xf200
pushq $0x5a00                 # imm = 0x5A00
pushq $0x0
pushq %r12
callq 0x9610
jmp 0xf20e
pushq $0x5a00                 # imm = 0x5A00
pushq $0x0
pushq %r12
callq 0x9260
addq $0x20, %rsp
movb $0x1, 0x161c8f(%rip)    # 0x170ea8
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: draw_rectangle(int, int, int, int, int)
void draw_rectangle(int x,int y, int width,int height, int color)
{
   // draw a rectangle outline

   line(x,y,              x+width,y,        color);
   line(x+width,y,        x+width,y+height, color);
   line(x+width,y+height, x,y+height,       color);
   line(x,y+height,       x,y,              color);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %r14d
movl %esi, %ebx
movl %edi, %r15d
leal (%rdx,%r15), %r13d
movzbl %r8b, %r12d
movl %r13d, %edx
movl %esi, %ecx
movl %r12d, %r8d
callq 0xe38a
addl %ebx, %r14d
movl %r13d, %edi
movl %ebx, %esi
movl %r13d, %edx
movl %r14d, %ecx
movl %r12d, %r8d
callq 0xe38a
movl %r13d, %edi
movl %r14d, %esi
movl %r15d, %edx
movl %r14d, %ecx
movl %r12d, %r8d
callq 0xe38a
movl %r15d, %edi
movl %r14d, %esi
movl %r15d, %edx
movl %ebx, %ecx
movl %r12d, %r8d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe38a
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: fill_rectangle(int, int, int, int, int)
void fill_rectangle(int x,int y, int width,int height, int color)
{
   // fill a rectangle on the screen with color

   #ifdef WIN_VFX
      if(stage == 0) return;
      SWAPXY(x,y);
      SWAP(width,height);
      if(rotate_screen) width = 0-width;

      VFX_io_done = 1;
      VFX_rectangle_fill(stage, x,y, x+width,y+height, LD_DRAW, palette[color]);
   #endif

   #ifdef USE_X11
      if(display == 0) return;
      SWAPXY(x,y);
      SWAP(width,height);
      if(rotate_screen) {
         x -= width;
      }

      set_x11_color(color);
      XFillRectangle(display,win,gc, x,y, width+1,height+1);
      flush_x11();
   #endif

   #ifdef USE_SDL
      SDL_Rect r;
      r.x = x;
      r.y = y;
      r.w = width;
      r.h = height;
      //set_sdl_color(BLACK);
      //SDL_RenderFillRect(ne_renderer, &r);
      SDL_FillRect(display, &r, palette[BLACK]);
   #endif
}

// Assembly:
cmpq $0x0, 0x161c20(%rip)    # 0x170ec0
je 0xf336
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %ecx, %r14d
movl %esi, %ebx
cmpl $0x0, 0x209567(%rip)    # 0x218828
je 0xf2e2
notl %ebx
addl 0x209539(%rip), %ebx    # 0x218804
movl %r14d, 0x20955a(%rip)   # 0x21882c
movl %r14d, %eax
movl %ebx, %r15d
movl %edi, %ebx
movl %r14d, %r12d
movl %edx, %r14d
jmp 0xf2ea
xorl %eax, %eax
movl %edi, %r15d
movl %edx, %r12d
subl %eax, %r15d
movzbl %r8b, %edi
callq 0xd44a
movq 0x161bc3(%rip), %rdi    # 0x170ec0
movq 0x161bcc(%rip), %rsi    # 0x170ed0
movq 0x161bd5(%rip), %rdx    # 0x170ee0
incl %r12d
incl %r14d
movl %r14d, (%rsp)
movl %r15d, %ecx
movl %ebx, %r8d
movl %r12d, %r9d
callq 0x9190
movb $0x1, 0x161b7e(%rip)    # 0x170ea8
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: edit_cmap(int, int, int, int)
void edit_cmap(int color, int r, int g, int b)
{
   // change a palette color map entry

   if(color < 0) return;
   if(color > 15) return;

   if(r < 0) r = 0;
   if(g < 0) g = 0;
   if(b < 0) b = 0;
   if(r > 255) r = 255;
   if(g > 255) g = 255;
   if(b > 255) b = 255;

   cmap[color].r = r;
   cmap[color].g = g;
   cmap[color].b = b;

   setup_palette();
   need_redraw = 8878;
}

// Assembly:
cmpl $0xf, %edi
ja 0xf38d
pushq %rbp
movq %rsp, %rbp
xorl %eax, %eax
testl %esi, %esi
cmovlel %eax, %esi
testl %edx, %edx
cmovlel %eax, %edx
testl %ecx, %ecx
cmovgl %ecx, %eax
movl $0xff, %ecx
cmpl %ecx, %esi
cmovgel %ecx, %esi
cmpl %ecx, %edx
cmovgel %ecx, %edx
cmpl %ecx, %eax
cmovgel %ecx, %eax
movl %edi, %ecx
leaq (%rcx,%rcx,2), %rcx
leaq 0x15111e(%rip), %rdi    # 0x160490
movl %esi, (%rdi,%rcx,4)
movl %edx, 0x4(%rdi,%rcx,4)
movl %eax, 0x8(%rdi,%rcx,4)
callq 0xd3bb
movl $0x22ae, 0x2094b8(%rip) # imm = 0x22AE
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: get_bgr_palette(int)
u32 get_bgr_palette(int i)
{
u32 color;

   // return BGR color palette table entry i

   color = cmap[i].b;
   color <<= 16;
   color |= ((u32) cmap[i].g) << 8;
   color |= cmap[i].r;
   return color;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movslq %edi, %rax
leaq (%rax,%rax,2), %rcx
leaq 0x1510f0(%rip), %rdx    # 0x160490
movl 0x4(%rdx,%rcx,4), %eax
movl 0x8(%rdx,%rcx,4), %esi
shll $0x10, %esi
shll $0x8, %eax
orl %esi, %eax
orl (%rdx,%rcx,4), %eax
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: change_palette(char*)
void change_palette(char *s)
{
int r,g,b;
int i;
int n;

   // change a color palette table BGR entry

   if(s == 0) return;

   n = sscanf(s, "%d %d %d %d", &i, &r,&g,&b);
   if(n != 4) {
      edit_error("Must specify four value: COLOR R G B");
      return;
   }
   if((i < 0) || (i > 15)) {
      edit_error("COLOR value must be 0 .. 15");
      return;
   }
   if((r < 0) || (r > 255)) {
      edit_error("RED value must be 0 .. 255");
      return;
   }
   if((g < 0) || (g > 255)) {
      edit_error("GREEN value must be 0 .. 255");
      return;
   }
   if((b < 0) || (b > 255)) {
      edit_error("BLUE value must be 0 .. 255");
      return;
   }

   cmap[i].r = r;
   cmap[i].g = g;
   cmap[i].b = b;

   setup_palette();
   need_redraw = 8899;
}

// Assembly:
testq %rdi, %rdi
je 0xf48e
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
leaq 0xfa6c5(%rip), %rsi     # 0x109b14
leaq -0x4(%rbp), %rdx
leaq -0x10(%rbp), %rcx
leaq -0xc(%rbp), %r8
leaq -0x8(%rbp), %r9
xorl %eax, %eax
callq 0x9360
cmpl $0x4, %eax
jne 0xf47d
movl -0x4(%rbp), %eax
cmpq $0x10, %rax
jb 0xf48f
leaq 0xfaa83(%rip), %rdi     # 0x109efe
jmp 0xf484
leaq 0xfaa55(%rip), %rdi     # 0x109ed9
callq 0x23027
addq $0x10, %rsp
popq %rbp
retq
movl -0x10(%rbp), %ecx
cmpl $0x100, %ecx            # imm = 0x100
jb 0xf4a3
leaq 0xfaa79(%rip), %rdi     # 0x109f1a
jmp 0xf484
movl -0xc(%rbp), %edx
cmpl $0x100, %edx            # imm = 0x100
jb 0xf4b7
leaq 0xfaa80(%rip), %rdi     # 0x109f35
jmp 0xf484
movl -0x8(%rbp), %esi
cmpl $0x100, %esi            # imm = 0x100
jb 0xf4cb
leaq 0xfaa89(%rip), %rdi     # 0x109f52
jmp 0xf484
leaq (%rax,%rax,2), %rax
leaq 0x150fba(%rip), %rdi    # 0x160490
movl %ecx, (%rdi,%rax,4)
movl %edx, 0x4(%rdi,%rax,4)
movl %esi, 0x8(%rdi,%rax,4)
callq 0xd3bb
movl $0x22c3, 0x209354(%rip) # imm = 0x22C3
jmp 0xf489
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: redraw_screen()
void redraw_screen()
{
   // redraw everything on the screen
   if(first_key) {  // we are showing a keyboard menu show hold off on the redraw
      return;
   }

   need_redraw = 0;
   last_plot_tick = (-1);

   precise_survey_done = 0;
   if((check_precise_posn == 0) && (precision_survey == 0) && (show_fixes == 0)) {
      plot_lla = 0;
////  if(doing_survey == 0) plot_lla = 0;
   }

   erase_screen();
   show_log_state();
//!!!!! request_rcvr_info(202);
   request_version();
   if(plot_azel) update_azel = 1;

   draw_plot(REFRESH_SCREEN);  // redraw the plot area
}

// Assembly:
cmpl $0x0, 0x22f4ba(%rip)    # 0x23ef58
je 0xfaa1
retq
movl $0x0, 0x208d99(%rip)    # 0x218844
movl $0xffffffff, 0x20b79f(%rip) # imm = 0xFFFFFFFF
movb $0x0, 0x2fe3de(%rip)    # 0x30de9a
cmpb $0x0, 0x32b81d(%rip)    # 0x33b2e0
jne 0xfade
cmpb $0x0, 0x2fe3cc(%rip)    # 0x30de98
jne 0xfade
cmpb $0x0, 0x32b7ff(%rip)    # 0x33b2d4
jne 0xfade
movb $0x0, 0x32b7d2(%rip)    # 0x33b2b0
pushq %rbp
movq %rsp, %rbp
callq 0xeceb
callq 0xc1ff4
callq 0x65c0d
cmpb $0x0, 0x20b91b(%rip)    # 0x21b413
popq %rbp
je 0xfb02
movb $0x1, 0x20b912(%rip)    # 0x21b414
movl $0x1, %edi
jmp 0x197ae
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: end_log()
void end_log()
{
   // close out the log file if it is open

   if(log_file == 0) return;

   if(log_comments) {
      sprintf(log_text, "#");
      write_log_comment(1);
      write_log_comment(1);
   }

   if(com_errors) {
      printf("*** %lu COM PORT ERRORS!!!\n", (unsigned long) com_errors);
      sprintf(log_text, "#*** %lu COM PORT ERRORS!!!", (unsigned long) com_errors);
      write_log_comment(1);
   }
   if(math_errors) {
      printf("*** %lu MATH ERRORS!!!\n", (unsigned long) math_errors);
      sprintf(log_text, "#*** %lu MATH ERRORS!!!", (unsigned long) math_errors);
      write_log_comment(1);
   }
   if(1 || bad_packets) {
      printf("%lu Rvcr packets processed.  %lu bad packets.\n", (unsigned long) packet_count, (unsigned long) bad_packets);
      sprintf(log_text, "#*** %lu Rcvr packets processed.  %lu bad packets.", (unsigned long) packet_count, (unsigned long) bad_packets);
      write_log_comment(1);
   }

   close_log_file();  // close the log file
}

// Assembly:
cmpq $0x0, 0x22e4c6(%rip)    # 0x23e360
je 0xff91
pushq %rbp
movq %rsp, %rbp
cmpb $0x0, 0x22e569(%rip)    # 0x23e414
je 0xfeca
movw $0x23, 0x22daaa(%rip)   # 0x23d960
movl $0x1, %edi
callq 0xc36e2
movl $0x1, %edi
callq 0xc36e2
movl 0x327144(%rip), %esi    # 0x337014
testq %rsi, %rsi
je 0xff08
leaq 0xfa143(%rip), %rdi     # 0x10a01f
xorl %eax, %eax
callq 0x9030
movl 0x32712b(%rip), %edx    # 0x337014
leaq 0x22da70(%rip), %rdi    # 0x23d960
leaq 0xfa144(%rip), %rsi     # 0x10a03b
xorl %eax, %eax
callq 0x9060
movl $0x1, %edi
callq 0xc36e2
movl 0x22f07e(%rip), %esi    # 0x23ef8c
testq %rsi, %rsi
je 0xff46
leaq 0xfa13d(%rip), %rdi     # 0x10a057
xorl %eax, %eax
callq 0x9030
movl 0x22f065(%rip), %edx    # 0x23ef8c
leaq 0x22da32(%rip), %rdi    # 0x23d960
leaq 0xfa13a(%rip), %rsi     # 0x10a06f
xorl %eax, %eax
callq 0x9060
movl $0x1, %edi
callq 0xc36e2
movl 0x22f028(%rip), %esi    # 0x23ef74
movl 0x22f036(%rip), %edx    # 0x23ef88
leaq 0xfa12e(%rip), %rdi     # 0x10a087
xorl %eax, %eax
callq 0x9030
movl 0x22f00e(%rip), %edx    # 0x23ef74
movl 0x22f01c(%rip), %ecx    # 0x23ef88
leaq 0x22d9ed(%rip), %rdi    # 0x23d960
leaq 0xfa13c(%rip), %rsi     # 0x10a0b6
xorl %eax, %eax
callq 0x9060
movl $0x1, %edi
callq 0xc36e2
popq %rbp
jmp 0xc3cd4
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: free_fft()
void free_fft()
{
#ifdef FFT_STUFF
   if(tsignal) free(tsignal);
   if(fft_out) free(fft_out);
   if(w) free(w);
   if(cf) free(cf);

   tsignal = 0;
   fft_out = 0;
   w = 0;
   cf = 0;
#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x32fe03(%rip), %rdi    # 0x33fda0
testq %rdi, %rdi
je 0xffa7
callq 0x9440
movq 0x32fe0a(%rip), %rdi    # 0x33fdb8
testq %rdi, %rdi
je 0xffb8
callq 0x9440
movq 0x32fde9(%rip), %rdi    # 0x33fda8
testq %rdi, %rdi
je 0xffc9
callq 0x9440
movq 0x32fde0(%rip), %rdi    # 0x33fdb0
testq %rdi, %rdi
je 0xffda
callq 0x9440
xorl %eax, %eax
movq %rax, 0x32fdbd(%rip)    # 0x33fda0
movq %rax, 0x32fdce(%rip)    # 0x33fdb8
movq %rax, 0x32fdb7(%rip)    # 0x33fda8
movq %rax, 0x32fdb8(%rip)    # 0x33fdb0
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: free_adev_queues()
void free_adev_queues()
{
   // release the adev queue memory
   if(pps_adev_q) {
      free(pps_adev_q);
      pps_adev_q = 0;
   }

   if(osc_adev_q) {
      free(osc_adev_q);
      osc_adev_q = 0;
   }

   if(chc_adev_q) {
      free(chc_adev_q);
      chc_adev_q = 0;
   }

   if(chd_adev_q) {
      free(chd_adev_q);
      chd_adev_q = 0;
   }

   adev_q_allocated = 0;
   return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x22caf9(%rip), %rdi    # 0x23cb20
testq %rdi, %rdi
je 0x1003c
callq 0x9440
movq $0x0, 0x22cae4(%rip) # 0x23cb20
movq 0x22cb2d(%rip), %rdi    # 0x23cb70
testq %rdi, %rdi
je 0x10058
callq 0x9440
movq $0x0, 0x22cb18(%rip) # 0x23cb70
movq 0x22cb61(%rip), %rdi    # 0x23cbc0
testq %rdi, %rdi
je 0x10074
callq 0x9440
movq $0x0, 0x22cb4c(%rip) # 0x23cbc0
movq 0x22cb95(%rip), %rdi    # 0x23cc10
testq %rdi, %rdi
je 0x10090
callq 0x9440
movq $0x0, 0x22cb80(%rip) # 0x23cc10
movl $0x0, 0x22cc46(%rip)    # 0x23cce0
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: replace_plot_q(long)
void replace_plot_q(long i)
{
struct PLOT_Q q0, q1, q2;
int j;

   // replace a plot queue point's data with the average of the adjacent points

   q0 = get_plot_q(i-1);
   q1 = get_plot_q(i);
   q2 = get_plot_q(i+1);
   for(j=0; j<NUM_PLOTS+DERIVED_PLOTS; j++) {
      q1.data[j] = q0.data[j];  // replace with previous point's data
//    q1.data[j] = (q0.data[j] + q2.data[j]) / (DATA_SIZE) 2.0;  // replace with average of adjacent points
//    q1.data[j] = q2.data[j];  // replace with next point's data
   }
   put_plot_q(i, q1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
movq %rdi, %rbx
leaq -0x1(%rdi), %rsi
leaq -0x168(%rbp), %rdi
callq 0x100be
leaq -0xb8(%rbp), %rdi
movq %rbx, %rsi
callq 0x100be
leaq 0x1(%rbx), %rsi
leaq -0x218(%rbp), %rdi
callq 0x100be
leaq -0x158(%rbp), %rsi
leaq -0xa8(%rbp), %rdi
movl $0xa0, %edx
callq 0x92b0
testq %rbx, %rbx
js 0x1033d
cmpq %rbx, 0x20b004(%rip)    # 0x21b320
jle 0x1033d
imulq $0xb0, %rbx, %rdi
addq 0x20afe4(%rip), %rdi    # 0x21b310
leaq -0xb8(%rbp), %rsi
movl $0xb0, %edx
callq 0x92b0
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: deglitch_queue_point()
void deglitch_queue_point()
{
   // replace a plot queue mouse point data with the average of the adjacent points

   if(mouse_plot_valid) {
      replace_plot_q(last_plot_glitch);
      ++last_plot_glitch;
      need_redraw = 5832;
   }
   else {
      BEEP(7);
   }
}

// Assembly:
cmpb $0x0, 0x20af0a(%rip)    # 0x21b258
je 0x10373
pushq %rbp
movq %rsp, %rbp
movq 0x20af25(%rip), %rdi    # 0x21b280
callq 0x102ba
incq 0x20af19(%rip)          # 0x21b280
movl $0x16c8, 0x2084d3(%rip) # imm = 0x16C8
popq %rbp
retq
movl $0x7, %edi
jmp 0x9d78
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: trim_plot_queue(int)
void trim_plot_queue(int trim)
{
long count;

   // trim leading (the entries before the first displayed point)
   // entries from the plot queue

   if(trim & TRIM_Q_START) {
      count = plot_q_col0 - plot_q_out;
      if(count < 0) count += plot_q_size;  // number of entries to remove

      if(count > plot_q_size) ;   // can't trim the start
      else if(count > plot_q_count) ;
      else {
         plot_q_out = plot_q_col0;
         plot_q_count -= count;

         if(trim & TRIM_Q_END) {  //trimming both ends from the queue
            count = plot_q_in - plot_q_last_col;
            if(count < 0) count += plot_q_size;  // number of entries to remove
            plot_q_col0 = plot_q_in - count;
            if(plot_q_col0 < 0) plot_q_col0 += plot_q_size;
            goto both_ends;
         }
      }
   }

   if(trim & TRIM_Q_END) {
      count = plot_q_last_col - plot_q_col0;
      if(count < 0) count += plot_q_size;  // number of entries to remove

      both_ends:
      if(count > plot_q_size) ;
      else if(count > plot_q_count) ;
      else if(count < 0) ;
      else {
         plot_q_in = plot_q_col0;
         plot_q_count -= count;
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
testb $0x1, %dil
je 0x10707
movq 0x20abad(%rip), %rcx    # 0x21b268
movq %rcx, %rdx
subq 0x20ac6b(%rip), %rdx    # 0x21b330
movq 0x20ac54(%rip), %rax    # 0x21b320
movq %rdx, %rsi
sarq $0x3f, %rsi
andq %rax, %rsi
addq %rdx, %rsi
cmpq %rax, %rsi
setg %r8b
movq 0x20ac51(%rip), %rdx    # 0x21b338
subq %rsi, %rdx
setl %sil
orb %r8b, %sil
jne 0x10707
movq %rcx, 0x20ac36(%rip)    # 0x21b330
movq %rdx, 0x20ac37(%rip)    # 0x21b338
testb $0x2, %dil
jne 0x10760
testb $0x2, %dil
je 0x1075e
movq 0x20ab5c(%rip), %rsi    # 0x21b270
movq 0x20ab4d(%rip), %rcx    # 0x21b268
subq %rcx, %rsi
movq 0x20abfb(%rip), %rax    # 0x21b320
movq %rsi, %rdx
sarq $0x3f, %rdx
andq %rax, %rdx
addq %rsi, %rdx
cmpq %rax, %rdx
jg 0x1075e
movq 0x20abfa(%rip), %rax    # 0x21b338
subq %rdx, %rax
setl %sil
testq %rdx, %rdx
sets %dl
orb %sil, %dl
jne 0x1075e
movq %rcx, 0x20abd1(%rip)    # 0x21b328
movq %rax, 0x20abda(%rip)    # 0x21b338
popq %rbp
retq
movq 0x20abc1(%rip), %rcx    # 0x21b328
movq %rcx, %rsi
subq 0x20aaff(%rip), %rsi    # 0x21b270
movq %rsi, %rdx
sarq $0x3f, %rdx
andq %rax, %rdx
addq %rsi, %rdx
subq %rdx, %rcx
movq %rcx, 0x20aae0(%rip)    # 0x21b268
jns 0x10732
addq %rax, %rcx
movq %rcx, 0x20aad4(%rip)    # 0x21b268
jmp 0x10732
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: clear_plot_entry(long)
void clear_plot_entry(long i)
{
struct PLOT_Q q;
int j;

   // clear out the data in a plot queue entry

// for(j=0; j<NUM_PLOTS; j++) q.data[j] = (DATA_SIZE) 0.0;  // derived_plots OK
   for(j=0; j<NUM_PLOTS+DERIVED_PLOTS; j++) q.data[j] = (DATA_SIZE) 0.0;  // derived_plots OK

   q.sat_flags = 0;
   q.q_jd = 0.0;

   put_plot_q(i, q);

   if(i) {   // clear q entry marker, if set
      for(j=0; j<MAX_MARKER; j++) {
         if(mark_q_entry[j] == i) mark_q_entry[j] = 0;
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
testq %rdi, %rdi
js 0x107d5
cmpq %rbx, 0x20ab75(%rip)    # 0x21b320
jle 0x107d5
movq 0x20ab5c(%rip), %rax    # 0x21b310
imulq $0xb0, %rbx, %rcx
leaq (%rax,%rcx), %rdi
addq $0x8, %rdi
movw $0x0, -0x8(%rdi)
movl $0xa8, %edx
xorl %esi, %esi
callq 0x91a0
testq %rbx, %rbx
je 0x107fb
xorl %eax, %eax
leaq 0x20aacd(%rip), %rcx    # 0x21b2b0
cmpq %rbx, (%rax,%rcx)
jne 0x107f1
movq $0x0, (%rax,%rcx)
addq $0x8, %rax
cmpq $0x50, %rax
jne 0x107e3
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: alloc_plot()
void alloc_plot()
{
long i;

   // allocate memory for the plot data queue

   free_plot();
   if(plot_q) return; // plot queue memory already allocated

   plot_q = (struct PLOT_Q *) calloc(plot_q_size+1L, sizeof(struct PLOT_Q));
   if(plot_q == 0) i = 0;
   else            i = 1;

   if(plot_q == 0) {
      sprintf(out, "Could not allocate %lu x %lu byte plot queue",
                    (unsigned long) (plot_q_size+1L), (unsigned long) sizeof(struct PLOT_Q));
      error_exit(51, out);
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq 0x20a9a1(%rip), %rdi    # 0x21b310
testq %rdi, %rdi
je 0x10979
callq 0x9440
movq 0x20a9a0(%rip), %rbx    # 0x21b320
incq %rbx
movl $0xb0, %esi
movq %rbx, %rdi
callq 0x9230
movq %rax, 0x20a979(%rip)    # 0x21b310
testq %rax, %rax
je 0x109a1
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x32b878(%rip), %r14    # 0x33c220
leaq 0xf98e0(%rip), %rsi     # 0x10a28f
movl $0xb0, %ecx
movq %r14, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x9060
movl $0x33, %edi
movq %r14, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0xb424
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: alloc_gif()
void alloc_gif()
{
#ifdef GIF_FILES
long i;

   // allocate memory for the .GIF file encoder

   if(hash_table) {  // memory alrady allocated
      free_gif();
   }

   hash_table = (unsigned long *) calloc(HT_SIZE+1L, sizeof (unsigned long));
   if(hash_table == 0) i = 0;
   else                i = 1;

   if(hash_table == 0) {
      sprintf(out, "Could not allocate %lu x %lud byte GIF hash table",
                    (unsigned long) (HT_SIZE+1L), (unsigned long) sizeof (unsigned long));
      error_exit(52, out);
   }
#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq 0x20a939(%rip), %rdi    # 0x21b318
testq %rdi, %rdi
je 0x109e9
callq 0x9440
movl $0x2001, %edi           # imm = 0x2001
movl $0x8, %esi
callq 0x9230
movq %rax, 0x20a919(%rip)    # 0x21b318
testq %rax, %rax
je 0x10a0b
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x32b80e(%rip), %rbx    # 0x33c220
leaq 0xf98a3(%rip), %rsi     # 0x10a2bc
movl $0x2001, %edx           # imm = 0x2001
movl $0x8, %ecx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movl $0x34, %edi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xb424
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: alloc_fft()
void alloc_fft()
{
#ifdef FFT_STUFF
long i;

   // allocate memory for the FFT routine
   free_fft();
   if(max_fft_len == 0) max_fft_len = 1024;

   if(tsignal == 0) {
      i = sizeof(float);
      i *= (max_fft_len+2);
      tsignal = (float *) (void *) calloc(i, 1);
   }
   if(fft_out == 0) {
      i = sizeof(COMPLEX);
      i *= (max_fft_len/2+2);
      fft_out = (COMPLEX *) (void *) calloc(i, 1);
   }
   if(w == 0) {
      i = sizeof(COMPLEX);
      i *= (max_fft_len/2+2);
      w = (COMPLEX *) (void *) calloc(i, 1);
   }
   if(cf == 0) {
      i = sizeof(COMPLEX);
      i *= (max_fft_len/2+2);
      cf = (COMPLEX *) (void *) calloc(i, 1);
   }
   if((tsignal == 0) || (fft_out == 0) || (w == 0) || (cf == 0)) {
      sprintf(out, "Could not allocate FFT tables");
      error_exit(53, out);
   }
#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
callq 0xff92
movq 0x32f321(%rip), %r14    # 0x33fd78
testq %r14, %r14
jne 0x10a6d
movq $0x400, 0x32f311(%rip) # imm = 0x400
movl $0x400, %r14d           # imm = 0x400
cmpq $0x0, 0x32f32b(%rip)    # 0x33fda0
je 0x10a7b
xorl %ebx, %ebx
jmp 0x10a9a
leaq 0x8(,%r14,4), %rdi
movl $0x1, %esi
callq 0x9230
movq %rax, 0x32f30c(%rip)    # 0x33fda0
testq %rax, %rax
sete %bl
cmpq $0x0, 0x32f316(%rip)    # 0x33fdb8
je 0x10aa9
xorl %r15d, %r15d
jmp 0x10ad7
movq %r14, %rax
shrq $0x3f, %rax
addq %r14, %rax
andq $-0x2, %rax
leaq 0x10(,%rax,4), %rdi
movl $0x1, %esi
callq 0x9230
movq %rax, 0x32f2e8(%rip)    # 0x33fdb8
testq %rax, %rax
sete %r15b
cmpq $0x0, 0x32f2c9(%rip)    # 0x33fda8
je 0x10ae6
xorl %r12d, %r12d
jmp 0x10b14
movq %r14, %rax
shrq $0x3f, %rax
addq %r14, %rax
andq $-0x2, %rax
leaq 0x10(,%rax,4), %rdi
movl $0x1, %esi
callq 0x9230
movq %rax, 0x32f29b(%rip)    # 0x33fda8
testq %rax, %rax
sete %r12b
cmpq $0x0, 0x32f294(%rip)    # 0x33fdb0
je 0x10b22
xorl %eax, %eax
jmp 0x10b4f
movq %r14, %rax
shrq $0x3f, %rax
addq %r14, %rax
andq $-0x2, %rax
leaq 0x10(,%rax,4), %rdi
movl $0x1, %esi
callq 0x9230
movq %rax, 0x32f267(%rip)    # 0x33fdb0
testq %rax, %rax
sete %al
orb %r15b, %bl
orb %r12b, %bl
jne 0x10b64
testb %al, %al
jne 0x10b64
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movups 0xf9791(%rip), %xmm0    # 0x10a2fc
movups %xmm0, 0x32b6bc(%rip)   # 0x33c22e
movups 0xf9775(%rip), %xmm0    # 0x10a2ee
movaps %xmm0, 0x32b6a0(%rip)   # 0x33c220
leaq 0x32b699(%rip), %rsi    # 0x33c220
movl $0x35, %edi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xb424
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: alloc_memory()
void alloc_memory()
{
   printf("\nInitializing memory...");

//!!!! alloc_adev();
   alloc_plot();
   alloc_gif();
   alloc_fft();

   reset_queues(RESET_ALL_QUEUES, 1000);

   printf("\nDone...\n\n");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0xf9768(%rip), %rdi     # 0x10a30c
xorl %eax, %eax
callq 0x9030
callq 0x10961
callq 0x109d2
callq 0x10a40
movl $0x7, %edi
callq 0x10bd1
leaq 0xfac3c(%rip), %rdi     # 0x10b807
popq %rbp
jmp 0x95d0
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: new_queue(int, int)
void new_queue(int queue_type, int why)
{
   // flush the queue contents and start up a new data capture
//sprintf(debug_text, "new queue:%04x  why:%d", queue_type, why);
   reset_queues(queue_type, why);
   log_loaded = 0;
   if(need_view_auto && (view_all_data == 2)) ;
   else end_review(1);
   redraw_screen();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
callq 0x10bd1
movb $0x0, 0x22d25e(%rip)    # 0x23e3fa
cmpl $0x0, 0x20a21d(%rip)    # 0x21b3c0
je 0x111ae
cmpb $0x2, 0x20a219(%rip)    # 0x21b3c5
je 0x111b8
movl $0x1, %edi
callq 0x111be
popq %rbp
jmp 0xfa97
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: end_review(unsigned char)
void end_review(u08 draw_flag)
{
   // exit plot review mode
   review_mode = 0;
   review = plot_q_count;

   plot_start = plot_q_in - (((PLOT_WIDTH - PLOT_SCROLL)*view_interval)/(long)plot_mag) - plot_q_out;
   if(plot_start < 0) {
       if(plot_q_full) {
          plot_start += plot_q_size;
          if(plot_start < 0) plot_start = 0;
       }
       else plot_start = 0;
   }

//!!!!- pause_data = 0;
   restore_plot_config();
   if(draw_flag) draw_plot(REFRESH_SCREEN);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, %ebx
movb $0x0, 0x22bb73(%rip)    # 0x23cd40
movq 0x20a164(%rip), %rax    # 0x21b338
movq %rax, 0x22bb6d(%rip)    # 0x23cd48
movq 0x20a146(%rip), %rcx    # 0x21b328
movslq 0x20769b(%rip), %rax    # 0x218884
movslq 0x2076a8(%rip), %rdx    # 0x218898
subq %rdx, %rax
imulq 0x20a1a5(%rip), %rax    # 0x21b3a0
movslq 0x20a1ce(%rip), %rsi    # 0x21b3d0
cqto
idivq %rsi
addq 0x20a122(%rip), %rax    # 0x21b330
subq %rax, %rcx
movq %rcx, 0x20a130(%rip)    # 0x21b348
jns 0x1123e
cmpb $0x0, 0x20a11f(%rip)    # 0x21b340
je 0x11235
addq 0x20a0f6(%rip), %rcx    # 0x21b320
xorl %eax, %eax
testq %rcx, %rcx
cmovgq %rcx, %rax
jmp 0x11237
xorl %eax, %eax
movq %rax, 0x20a10a(%rip)    # 0x21b348
callq 0xd3dce
testb %bl, %bl
je 0x11257
movl $0x1, %edi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x197ae
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: find_event(long, unsigned short)
long find_event(long i, u16 flags)
{
struct PLOT_Q q;
long count;

   // locate the next holdover event or time sequence error in the plot queue
   if(i < 0) return (-1);  // should never happen

   count = 0;
   while(i >= plot_q_size) i -= plot_q_size;  // !!! perhaps we should return (-1)

   while(i != plot_q_in) {  // skip over leading queue entries that match the flags
      q = get_plot_q(i);
      if((q.sat_flags & flags) == 0) break;
      ++i;
      if(i >= plot_q_size) i = 0;       // wrap the queue
      if(++count > plot_q_count) break; // prevent run-away loop
   }
   if(i == plot_q_in) {  // event not found
      return i;
   }

   count = 0;
   while(i != plot_q_in) {  // find the next occurance of the event
      q = get_plot_q(i);
      if((q.sat_flags & flags) != 0) break;
      ++i;
      if(i >= plot_q_size) i = 0;
      if(++count > plot_q_count) break;
   }

   return i;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xb0, %rsp
testq %rdi, %rdi
js 0x11328
movl %esi, %r14d
movq %rdi, %rbx
movq 0x20a09a(%rip), %rax    # 0x21b320
addq %rax, %rbx
subq %rax, %rbx
cmpq %rax, %rbx
jge 0x11289
movq $-0x1, %r12
leaq -0xd0(%rbp), %r15
cmpq 0x20a082(%rip), %rbx    # 0x21b328
je 0x112d7
movq %r15, %rdi
movq %rbx, %rsi
callq 0x100be
testw %r14w, -0xd0(%rbp)
je 0x112d7
incq %rbx
cmpq 0x20a059(%rip), %rbx    # 0x21b320
jl 0x112cb
xorl %ebx, %ebx
incq %r12
cmpq 0x20a063(%rip), %r12    # 0x21b338
jl 0x1129f
cmpq 0x20a04a(%rip), %rbx    # 0x21b328
je 0x1132f
movq $-0x1, %r12
leaq -0xd0(%rbp), %r15
cmpq 0x20a033(%rip), %rbx    # 0x21b328
je 0x1132f
movq %r15, %rdi
movq %rbx, %rsi
callq 0x100be
testw %r14w, -0xd0(%rbp)
jne 0x1132f
incq %rbx
cmpq 0x20a00a(%rip), %rbx    # 0x21b320
jl 0x1131a
xorl %ebx, %ebx
incq %r12
cmpq 0x20a014(%rip), %r12    # 0x21b338
jl 0x112ee
jmp 0x1132f
movq $-0x1, %rbx
movq %rbx, %rax
addq $0xb0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: goto_event(unsigned short)
long goto_event(u16 flags)
{
long val;

   // move plot to the next holdover event or time sequence error
++go_count;

   val = find_event(last_mouse_q, flags);
   if(val < 0) return val;

//   if(1 || !mouse_plot_valid) ; // mouse is out of the plot area
//   else if(plot_mag) val -= ((last_plot_mouse_x * view_interval) / (long) plot_mag); // center point on mouse

   if(val > plot_q_count) val = plot_q_count - 1;
   if(val < 0) val = 0;

   if(val != last_mouse_q) last_plot_glitch = val; // mouse was moved
   last_mouse_q = val;
   last_plot_glitch = last_mouse_q;
   last_plot_mouse_q = val;
   if(1 || !mouse_plot_valid) {  // mouse is out of the plot area
      if(plot_mag) val -= ((last_plot_mouse_x * view_interval) / (long) plot_mag); // center point on mouse
   }
   zoom_review(val, REVIEW_BEEP);

   return val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, %esi
incl 0x32eef8(%rip)          # 0x340248
movq 0x209f21(%rip), %rdi    # 0x21b278
callq 0x1125e
movq %rax, %rbx
testq %rax, %rax
js 0x113c4
movq 0x209fcd(%rip), %rax    # 0x21b338
leaq -0x1(%rax), %rcx
cmpq %rax, %rbx
cmovleq %rbx, %rcx
xorl %ebx, %ebx
testq %rcx, %rcx
cmovgq %rcx, %rbx
movq %rbx, 0x209ef2(%rip)    # 0x21b278
movq %rbx, 0x209ef3(%rip)    # 0x21b280
movq %rbx, 0x209ef4(%rip)    # 0x21b288
movslq 0x20a035(%rip), %rcx    # 0x21b3d0
testq %rcx, %rcx
je 0x113b7
movslq 0x209ea9(%rip), %rax    # 0x21b250
imulq 0x209ff1(%rip), %rax    # 0x21b3a0
cqto
idivq %rcx
subq %rax, %rbx
movq %rbx, %rdi
movl $0x1, %esi
callq 0x113ce
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: zoom_review(long, unsigned char)
void zoom_review(long i, u08 beep_ok)
{
   i -= plot_q_out;

   if(i >= plot_q_count) {  // we are past the end of the data, back up a minor tick
      i -= plot_q_count;
      if(beep_ok) BEEP(10);
   }
   if(i < 0) {  // we are at the start of the data in the queue
      i = 0;
      if(beep_ok) BEEP(11);
   }

   review = i;
   review_mode = 1;
   plot_start = review;

   draw_plot(NO_REFRESH);

   if(no_mouse_review) ;
   else get_mouse_info();  // update cursor info in case we are not doing live data

   refresh_page();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq 0x209f54(%rip), %rdi    # 0x21b330
movl %esi, %ebx
movq %rdi, %r14
subq 0x209f50(%rip), %r14    # 0x21b338
jl 0x113fb
testb %bl, %bl
je 0x11412
movl $0xa, %edi
callq 0x9d78
movq %r14, %rdi
testq %rdi, %rdi
jns 0x1141b
testb %bl, %bl
je 0x1140e
movl $0xb, %edi
callq 0x9d78
xorl %edi, %edi
jmp 0x1141b
xorl %edi, %edi
testq %r14, %r14
cmovgq %r14, %rdi
movq %rdi, 0x22b926(%rip)    # 0x23cd48
movb $0x1, 0x22b917(%rip)    # 0x23cd40
movq %rdi, 0x209f18(%rip)    # 0x21b348
xorl %edi, %edi
callq 0x197ae
cmpl $0x0, 0x32eaba(%rip)    # 0x33fef8
jne 0x11445
callq 0x1c461
popq %rbx
popq %r14
popq %rbp
jmp 0xab54