LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/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 0x214882(%rip), %r13d   # 0x22353c
movl %esi, 0x21487c(%rip)    # 0x22353c
movq %rcx, %rdi
callq 0x9120
movl 0x209b32(%rip), %ecx    # 0x218800
imull %r12d, %eax
shll $0x3, %eax
subl %eax, %ecx
movl %ecx, %eax
cltd
idivl 0x209b30(%rip)          # 0x218810
movl %eax, %esi
shrl $0x1f, %esi
addl %eax, %esi
sarl %esi
movzbl %r14b, %edx
movl %r15d, %edi
movq %rbx, %rcx
callq 0xec04
movl %r13d, 0x21483d(%rip)   # 0x22353c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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, 0x209aa1(%rip)    # 0x2187d8
je 0xed3f
popq %rbp
jmp 0xed5e
movl 0x209b37(%rip), %esi    # 0x21887c
movl 0x209ab5(%rip), %edx    # 0x218800
movl 0x209ab3(%rip), %ecx    # 0x218804
subl %esi, %ecx
xorl %edi, %edi
xorl %r8d, %r8d
popq %rbp
jmp 0xf30c
// File: /workspace/github_cpp_makefile_star2_O1/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 0x209a96(%rip), %edx    # 0x218800
movl 0x209a94(%rip), %ecx    # 0x218804
xorl %ebx, %ebx
xorl %edi, %edi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0xf30c
xorl %edi, %edi
callq 0xee7d
movl %ebx, 0x32c535(%rip)    # 0x33b2c0
movl %ebx, 0x2fd9ff(%rip)    # 0x30c790
movl %ebx, 0x2fd9f5(%rip)    # 0x30c78c
movl $0xa, %edi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xdac25
// File: /workspace/github_cpp_makefile_star2_O1/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, 0x209a26(%rip)    # 0x2187d8
je 0xedb6
popq %rbp
retq
movzbl 0x2fd9eb(%rip), %eax    # 0x30c7a8
cmpl $0x50, %eax
je 0xedc6
testl %eax, %eax
jne 0xedb4
movl 0x32c4e0(%rip), %edi    # 0x33b2ac
movl 0x32c4d6(%rip), %esi    # 0x33b2a8
movl 0x32c4c0(%rip), %ecx    # 0x33b298
movl %ecx, %edx
xorl %r8d, %r8d
popq %rbp
jmp 0xf30c
// File: /workspace/github_cpp_makefile_star2_O1/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, 0x2fd98c(%rip)    # 0x30c7a8
jne 0xee35
movl 0x32c56c(%rip), %esi    # 0x33b390
movl 0x32c562(%rip), %ecx    # 0x33b38c
leal (%rcx,%rsi), %eax
cmpl 0x209a49(%rip), %eax    # 0x21887c
jge 0xee67
movl 0x32c559(%rip), %edi    # 0x33b394
movl 0x32c54f(%rip), %esi    # 0x33b390
movl 0x32c545(%rip), %ecx    # 0x33b38c
movl %ecx, %edx
xorl %r8d, %r8d
callq 0xf30c
movl $0x1, 0x32c541(%rip)    # 0x33b39c
movl $0x8, 0x32c543(%rip)    # 0x33b3a8
popq %rbp
retq
movl 0x209a17(%rip), %edi    # 0x218884
addl 0x209a0d(%rip), %edi    # 0x218880
movl 0x209987(%rip), %edx    # 0x218800
subl %edi, %edx
jmp 0xee49
// File: /workspace/github_cpp_makefile_star2_O1/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 0x20981e(%rip), %eax    # 0x2187d8
orl 0x22ff98(%rip), %eax    # 0x23ef58
jne 0xf0ac
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, %ebx
movzbl 0x2fd7d3(%rip), %eax    # 0x30c7a8
cmpl $0x50, %eax
je 0xefe2
testl %eax, %eax
jne 0xf0a6
movl 0x20c26c(%rip), %eax    # 0x21b254
testl %eax, %eax
jle 0xf03f
movl 0x20988e(%rip), %edx    # 0x218880
leal (%rdx,%rax), %edi
decl %edi
movl 0x20987f(%rip), %ecx    # 0x21887c
addl %eax, %edx
incl %edx
movl %ecx, %esi
movl $0xf, %r8d
callq 0xe3c3
movl 0x20986c(%rip), %eax    # 0x218880
movl 0x20c23a(%rip), %edx    # 0x21b254
leal (%rdx,%rax), %edi
decl %edi
movl 0x209857(%rip), %ecx    # 0x21887c
decl %ecx
addl %eax, %edx
incl %edx
movl %ecx, %esi
xorl %r8d, %r8d
callq 0xe3c3
movl $0xffffffff, 0x20c215(%rip) # imm = 0xFFFFFFFF
movl 0x20c20b(%rip), %eax    # 0x21b250
testl %eax, %eax
jle 0xf0a6
cmpl 0x20c205(%rip), %eax    # 0x21b254
je 0xf0a6
movl 0x209829(%rip), %edx    # 0x218880
leal (%rdx,%rax), %edi
decl %edi
movl 0x20981a(%rip), %ecx    # 0x21887c
leal 0x1(%rdx,%rax), %edx
movzbl %bl, %ebx
movl %ecx, %esi
movl %ebx, %r8d
callq 0xe3c3
movl 0x209807(%rip), %eax    # 0x218880
movl 0x20c1d1(%rip), %edx    # 0x21b250
leal (%rdx,%rax), %edi
decl %edi
movl 0x2097f2(%rip), %ecx    # 0x21887c
decl %ecx
addl %eax, %edx
incl %edx
movl %ecx, %esi
movl %ebx, %r8d
callq 0xe3c3
movl 0x20c1b0(%rip), %eax    # 0x21b250
movl %eax, 0x20c1ae(%rip)    # 0x21b254
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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, 0x20971e(%rip)    # 0x2187d8
je 0xf0c3
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movl %edi, %ebx
cmpq $0x400, 0x209800(%rip) # imm = 0x400
sete %cl
cmpl $0x0, 0x330c8e(%rip)    # 0x33fd68
setne %al
orb %cl, %al
movl %eax, %ecx
xorb $0x1, %cl
testl %edi, %edi
setns %dl
orb %cl, %dl
jne 0xf0f8
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xed5e
testl %ebx, %ebx
setns %cl
testb %al, %cl
jne 0xf0bc
movzbl 0x2fd6a0(%rip), %eax    # 0x30c7a8
cmpl $0x50, %eax
je 0xf111
testl %eax, %eax
jne 0xf0bc
movl 0x209769(%rip), %edx    # 0x218880
testl %edx, %edx
jle 0xf133
movl 0x20975b(%rip), %esi    # 0x21887c
movl 0x2096dd(%rip), %ecx    # 0x218804
subl %esi, %ecx
xorl %edi, %edi
xorl %r8d, %r8d
callq 0xf30c
movl 0x209747(%rip), %edi    # 0x218880
movl 0x20973d(%rip), %esi    # 0x21887c
movl 0x20973f(%rip), %edx    # 0x218884
movl 0x2096b9(%rip), %ecx    # 0x218804
subl %esi, %ecx
xorl %r8d, %r8d
callq 0xf30c
testl %ebx, %ebx
je 0xf0bc
movl 0x209721(%rip), %edi    # 0x218884
addl 0x209717(%rip), %edi    # 0x218880
movl 0x209691(%rip), %edx    # 0x218800
subl %edi, %edx
jle 0xf0bc
movl 0x2096ff(%rip), %esi    # 0x21887c
movl 0x209681(%rip), %ecx    # 0x218804
subl %esi, %ecx
xorl %r8d, %r8d
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xf30c
// File: /workspace/github_cpp_makefile_star2_O1/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, 0x20968a(%rip)    # 0x218828
je 0xf1b2
movl %eax, 0x209686(%rip)    # 0x21882c
notl %eax
addl 0x209656(%rip), %eax    # 0x218804
movl %eax, %esi
jmp 0xf1b6
movl %edx, %esi
movl %eax, %edx
movq 0x330d93(%rip), %rdi    # 0x33ff50
testq %rdi, %rdi
je 0xf1ed
pushq %rbp
movq %rsp, %rbp
callq *0x68(%rdi)
movq %rax, %rcx
leaq 0x161dad(%rip), %rdx    # 0x170f80
xorl %eax, %eax
movl (%rdx), %esi
cmpq %rsi, %rcx
je 0xf1eb
incq %rax
addq $0x4, %rdx
cmpq $0x10, %rax
jne 0xf1d5
xorl %eax, %eax
popq %rbp
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/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, 0x20961e(%rip)    # 0x218828
je 0xf222
movl %ebx, 0x20961a(%rip)    # 0x21882c
notl %ebx
movl %ebx, %eax
addl 0x2095e8(%rip), %eax    # 0x218804
movl %r14d, %ebx
movl %eax, %r14d
cmpq $0x0, 0x161c96(%rip)    # 0x170ec0
je 0xf28d
leal (%rdx,%rdx), %r12d
subl %edx, %r14d
subl %edx, %ebx
movzbl %cl, %edi
callq 0xd469
movq 0x161c7c(%rip), %rdi    # 0x170ec0
movq 0x161c85(%rip), %rsi    # 0x170ed0
movq 0x161c8e(%rip), %rdx    # 0x170ee0
subq $0x8, %rsp
movl %r14d, %ecx
movl %ebx, %r8d
movl %r12d, %r9d
testl %r15d, %r15d
je 0xf274
pushq $0x5a00                 # imm = 0x5A00
pushq $0x0
pushq %r12
callq 0x9610
jmp 0xf282
pushq $0x5a00                 # imm = 0x5A00
pushq $0x0
pushq %r12
callq 0x9260
addq $0x20, %rsp
movb $0x1, 0x161c1b(%rip)    # 0x170ea8
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0xe3c3
addl %ebx, %r14d
movl %r13d, %edi
movl %ebx, %esi
movl %r13d, %edx
movl %r14d, %ecx
movl %r12d, %r8d
callq 0xe3c3
movl %r13d, %edi
movl %r14d, %esi
movl %r15d, %edx
movl %r14d, %ecx
movl %r12d, %r8d
callq 0xe3c3
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 0xe3c3
// File: /workspace/github_cpp_makefile_star2_O1/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, 0x161bac(%rip)    # 0x170ec0
je 0xf3b8
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %ecx, %r15d
movl %esi, %ebx
movl %edi, %r14d
movl 0x2094f1(%rip), %eax    # 0x218828
testl %eax, %eax
je 0xf351
movl %ebx, 0x2094eb(%rip)    # 0x21882c
notl %ebx
movl %ebx, %ecx
addl 0x2094b9(%rip), %ecx    # 0x218804
movl %r14d, %ebx
movl %ecx, %r14d
testl %eax, %eax
je 0xf367
movl %r15d, 0x2094d0(%rip)   # 0x21882c
movl %r15d, %eax
movl %r15d, %r12d
movl %edx, %r15d
jmp 0xf36c
xorl %eax, %eax
movl %edx, %r12d
subl %eax, %r14d
movzbl %r8b, %edi
callq 0xd469
movq 0x161b41(%rip), %rdi    # 0x170ec0
movq 0x161b4a(%rip), %rsi    # 0x170ed0
movq 0x161b53(%rip), %rdx    # 0x170ee0
incl %r12d
incl %r15d
movl %r15d, (%rsp)
movl %r14d, %ecx
movl %ebx, %r8d
movl %r12d, %r9d
callq 0x9190
movb $0x1, 0x161afc(%rip)    # 0x170ea8
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0xf40f
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 0x15109c(%rip), %rdi    # 0x160490
movl %esi, (%rdi,%rcx,4)
movl %edx, 0x4(%rdi,%rcx,4)
movl %eax, 0x8(%rdi,%rcx,4)
callq 0xd3da
movl $0x22ae, 0x209436(%rip) # imm = 0x22AE
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x15106e(%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_O1/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 0xf510
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
leaq 0xfa633(%rip), %rsi     # 0x109b04
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 0xf4ff
movl -0x4(%rbp), %eax
cmpq $0x10, %rax
jb 0xf511
leaq 0xfa9f1(%rip), %rdi     # 0x109eee
jmp 0xf506
leaq 0xfa9c3(%rip), %rdi     # 0x109ec9
callq 0x2326e
addq $0x10, %rsp
popq %rbp
retq
movl -0x10(%rbp), %ecx
cmpl $0x100, %ecx            # imm = 0x100
jb 0xf525
leaq 0xfa9e7(%rip), %rdi     # 0x109f0a
jmp 0xf506
movl -0xc(%rbp), %edx
cmpl $0x100, %edx            # imm = 0x100
jb 0xf539
leaq 0xfa9ee(%rip), %rdi     # 0x109f25
jmp 0xf506
movl -0x8(%rbp), %esi
cmpl $0x100, %esi            # imm = 0x100
jb 0xf54d
leaq 0xfa9f7(%rip), %rdi     # 0x109f42
jmp 0xf506
leaq (%rax,%rax,2), %rax
leaq 0x150f38(%rip), %rdi    # 0x160490
movl %ecx, (%rdi,%rax,4)
movl %edx, 0x4(%rdi,%rax,4)
movl %esi, 0x8(%rdi,%rax,4)
callq 0xd3da
movl $0x22c3, 0x2092d2(%rip) # imm = 0x22C3
jmp 0xf50b
// File: /workspace/github_cpp_makefile_star2_O1/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, 0x22f437(%rip)    # 0x23ef58
je 0xfb24
retq
movl $0x0, 0x208d16(%rip)    # 0x218844
movl $0xffffffff, 0x20b71c(%rip) # imm = 0xFFFFFFFF
movb $0x0, 0x2fe35b(%rip)    # 0x30de9a
cmpb $0x0, 0x32b79a(%rip)    # 0x33b2e0
jne 0xfb61
cmpb $0x0, 0x2fe349(%rip)    # 0x30de98
jne 0xfb61
cmpb $0x0, 0x32b77c(%rip)    # 0x33b2d4
jne 0xfb61
movb $0x0, 0x32b74f(%rip)    # 0x33b2b0
pushq %rbp
movq %rsp, %rbp
callq 0xed5e
callq 0xc1a24
callq 0x659e2
cmpb $0x0, 0x20b898(%rip)    # 0x21b413
popq %rbp
je 0xfb85
movb $0x1, 0x20b88f(%rip)    # 0x21b414
movl $0x1, %edi
jmp 0x19792
// File: /workspace/github_cpp_makefile_star2_O1/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, 0x22e443(%rip)    # 0x23e360
je 0x10014
pushq %rbp
movq %rsp, %rbp
cmpb $0x0, 0x22e4e6(%rip)    # 0x23e414
je 0xff4d
movw $0x23, 0x22da27(%rip)   # 0x23d960
movl $0x1, %edi
callq 0xc3105
movl $0x1, %edi
callq 0xc3105
movl 0x3270c1(%rip), %esi    # 0x337014
testq %rsi, %rsi
je 0xff8b
leaq 0xfa0b0(%rip), %rdi     # 0x10a00f
xorl %eax, %eax
callq 0x9030
movl 0x3270a8(%rip), %edx    # 0x337014
leaq 0x22d9ed(%rip), %rdi    # 0x23d960
leaq 0xfa0b1(%rip), %rsi     # 0x10a02b
xorl %eax, %eax
callq 0x9060
movl $0x1, %edi
callq 0xc3105
movl 0x22effb(%rip), %esi    # 0x23ef8c
testq %rsi, %rsi
je 0xffc9
leaq 0xfa0aa(%rip), %rdi     # 0x10a047
xorl %eax, %eax
callq 0x9030
movl 0x22efe2(%rip), %edx    # 0x23ef8c
leaq 0x22d9af(%rip), %rdi    # 0x23d960
leaq 0xfa0a7(%rip), %rsi     # 0x10a05f
xorl %eax, %eax
callq 0x9060
movl $0x1, %edi
callq 0xc3105
movl 0x22efa5(%rip), %esi    # 0x23ef74
movl 0x22efb3(%rip), %edx    # 0x23ef88
leaq 0xfa09b(%rip), %rdi     # 0x10a077
xorl %eax, %eax
callq 0x9030
movl 0x22ef8b(%rip), %edx    # 0x23ef74
movl 0x22ef99(%rip), %ecx    # 0x23ef88
leaq 0x22d96a(%rip), %rdi    # 0x23d960
leaq 0xfa0a9(%rip), %rsi     # 0x10a0a6
xorl %eax, %eax
callq 0x9060
movl $0x1, %edi
callq 0xc3105
popq %rbp
jmp 0xc36a4
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x32fd80(%rip), %rdi    # 0x33fda0
testq %rdi, %rdi
je 0x1002a
callq 0x9440
movq 0x32fd87(%rip), %rdi    # 0x33fdb8
testq %rdi, %rdi
je 0x1003b
callq 0x9440
movq 0x32fd66(%rip), %rdi    # 0x33fda8
testq %rdi, %rdi
je 0x1004c
callq 0x9440
movq 0x32fd5d(%rip), %rdi    # 0x33fdb0
testq %rdi, %rdi
je 0x1005d
callq 0x9440
xorl %eax, %eax
movq %rax, 0x32fd3a(%rip)    # 0x33fda0
movq %rax, 0x32fd4b(%rip)    # 0x33fdb8
movq %rax, 0x32fd34(%rip)    # 0x33fda8
movq %rax, 0x32fd35(%rip)    # 0x33fdb0
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x22ca76(%rip), %rdi    # 0x23cb20
testq %rdi, %rdi
je 0x100bf
callq 0x9440
movq $0x0, 0x22ca61(%rip) # 0x23cb20
movq 0x22caaa(%rip), %rdi    # 0x23cb70
testq %rdi, %rdi
je 0x100db
callq 0x9440
movq $0x0, 0x22ca95(%rip) # 0x23cb70
movq 0x22cade(%rip), %rdi    # 0x23cbc0
testq %rdi, %rdi
je 0x100f7
callq 0x9440
movq $0x0, 0x22cac9(%rip) # 0x23cbc0
movq 0x22cb12(%rip), %rdi    # 0x23cc10
testq %rdi, %rdi
je 0x10113
callq 0x9440
movq $0x0, 0x22cafd(%rip) # 0x23cc10
movl $0x0, 0x22cbc3(%rip)    # 0x23cce0
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x10141
leaq -0xb8(%rbp), %rdi
movq %rbx, %rsi
callq 0x10141
leaq 0x1(%rbx), %rsi
leaq -0x218(%rbp), %rdi
callq 0x10141
leaq -0x158(%rbp), %rsi
leaq -0xa8(%rbp), %rdi
movl $0xa0, %edx
callq 0x92b0
testq %rbx, %rbx
js 0x103c0
cmpq %rbx, 0x20af81(%rip)    # 0x21b320
jle 0x103c0
imulq $0xb0, %rbx, %rdi
addq 0x20af61(%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_O1/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, 0x20ae87(%rip)    # 0x21b258
je 0x103f6
pushq %rbp
movq %rsp, %rbp
movq 0x20aea2(%rip), %rdi    # 0x21b280
callq 0x1033d
incq 0x20ae96(%rip)          # 0x21b280
movl $0x16c8, 0x208450(%rip) # imm = 0x16C8
popq %rbp
retq
movl $0x7, %edi
jmp 0x9d80
// File: /workspace/github_cpp_makefile_star2_O1/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 0x1078a
movq 0x20ab2a(%rip), %rcx    # 0x21b268
movq %rcx, %rdx
subq 0x20abe8(%rip), %rdx    # 0x21b330
movq 0x20abd1(%rip), %rax    # 0x21b320
movq %rdx, %rsi
sarq $0x3f, %rsi
andq %rax, %rsi
addq %rdx, %rsi
cmpq %rax, %rsi
setg %r8b
movq 0x20abce(%rip), %rdx    # 0x21b338
subq %rsi, %rdx
setl %sil
orb %r8b, %sil
jne 0x1078a
movq %rcx, 0x20abb3(%rip)    # 0x21b330
movq %rdx, 0x20abb4(%rip)    # 0x21b338
testb $0x2, %dil
jne 0x107ad
testb $0x2, %dil
je 0x10816
movq 0x20aad5(%rip), %rcx    # 0x21b270
subq 0x20aac6(%rip), %rcx    # 0x21b268
jns 0x107e1
addq 0x20ab75(%rip), %rcx    # 0x21b320
jmp 0x107e1
movq 0x20ab74(%rip), %rdx    # 0x21b328
movq %rdx, %rsi
subq 0x20aab2(%rip), %rsi    # 0x21b270
movq %rsi, %rcx
sarq $0x3f, %rcx
andq %rax, %rcx
addq %rsi, %rcx
subq %rcx, %rdx
movq %rdx, 0x20aa93(%rip)    # 0x21b268
jns 0x107e1
addq %rax, %rdx
movq %rdx, 0x20aa87(%rip)    # 0x21b268
cmpq 0x20ab38(%rip), %rcx    # 0x21b320
jg 0x10816
movq 0x20ab47(%rip), %rax    # 0x21b338
subq %rcx, %rax
setl %dl
testq %rcx, %rcx
sets %cl
orb %dl, %cl
jne 0x10816
movq 0x20aa60(%rip), %rcx    # 0x21b268
movq %rcx, 0x20ab19(%rip)    # 0x21b328
movq %rax, 0x20ab22(%rip)    # 0x21b338
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x10857
cmpq %rbx, 0x20aaf3(%rip)    # 0x21b320
jle 0x10857
movq 0x20aada(%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 0x1087d
xorl %eax, %eax
leaq 0x20aa4b(%rip), %rcx    # 0x21b2b0
cmpq %rbx, (%rax,%rcx)
jne 0x10873
movq $0x0, (%rax,%rcx)
addq $0x8, %rax
cmpq $0x50, %rax
jne 0x10865
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heather.cpp
// Function: alloc_adev()
void alloc_adev()
{
#ifdef ADEV_STUFF
long i;

   // allocate memory for the adev data queues

   free_adev_queues(); // adev queue memory already allocated, free it

//   adev_q_size++;  // add an extra entry for overflow protection
   i = 0L;

   pps_adev_q = (OFS_SIZE *) calloc(adev_q_size+10L, sizeof (OFS_SIZE));
   if(pps_adev_q == 0) {
      sprintf(out, "Could not allocate %lu x %lu byte PPS adev queue",
                    (unsigned long) (adev_q_size), (unsigned long) sizeof(OFS_SIZE));
      error_exit(50, out);
   }

   osc_adev_q = (OFS_SIZE *) calloc(adev_q_size+10L, sizeof (OFS_SIZE));
   if(osc_adev_q == 0) {
      sprintf(out, "Could not allocate %lu x %lu byte OSC adev queue",
                    (unsigned long) (adev_q_size), (unsigned long) sizeof(OFS_SIZE));
      error_exit(50, out);
   }

   chc_adev_q = (OFS_SIZE *) calloc(adev_q_size+10L, sizeof (OFS_SIZE));
   if(chc_adev_q == 0) {
      sprintf(out, "Could not allocate %lu x %lu byte chC adev queue",
                    (unsigned long) (adev_q_size), (unsigned long) sizeof(OFS_SIZE));
      error_exit(50, out);
   }

   chd_adev_q = (OFS_SIZE *) calloc(adev_q_size+10L, sizeof (OFS_SIZE));
   if(chd_adev_q == 0) {
      sprintf(out, "Could not allocate %lu x %lu byte chD adev queue",
                    (unsigned long) (adev_q_size), (unsigned long) sizeof(OFS_SIZE));
      error_exit(50, out);
   }

   adev_q_allocated = 1;
#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
callq 0x1009f
movq 0x22c441(%rip), %rbx    # 0x23ccd8
leaq 0xa(%rbx), %rdi
movl $0x8, %esi
callq 0x9230
movq %rax, 0x22c274(%rip)    # 0x23cb20
testq %rax, %rax
jne 0x108de
leaq 0x32b968(%rip), %r14    # 0x33c220
leaq 0xf98fc(%rip), %rsi     # 0x10a1bb
movl $0x8, %ecx
movq %r14, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x9060
movl $0x32, %edi
movq %r14, %rsi
callq 0xb425
movq 0x22c3f3(%rip), %rbx    # 0x23ccd8
leaq 0xa(%rbx), %rdi
movl $0x8, %esi
callq 0x9230
movq %rax, 0x22c276(%rip)    # 0x23cb70
testq %rax, %rax
jne 0x1092c
leaq 0x32b91a(%rip), %r14    # 0x33c220
leaq 0xf98df(%rip), %rsi     # 0x10a1ec
movl $0x8, %ecx
movq %r14, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x9060
movl $0x32, %edi
movq %r14, %rsi
callq 0xb425
movq 0x22c3a5(%rip), %rbx    # 0x23ccd8
leaq 0xa(%rbx), %rdi
movl $0x8, %esi
callq 0x9230
movq %rax, 0x22c278(%rip)    # 0x23cbc0
testq %rax, %rax
jne 0x1097a
leaq 0x32b8cc(%rip), %r14    # 0x33c220
leaq 0xf98c2(%rip), %rsi     # 0x10a21d
movl $0x8, %ecx
movq %r14, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x9060
movl $0x32, %edi
movq %r14, %rsi
callq 0xb425
movq 0x22c357(%rip), %rbx    # 0x23ccd8
leaq 0xa(%rbx), %rdi
movl $0x8, %esi
callq 0x9230
movq %rax, 0x22c27a(%rip)    # 0x23cc10
testq %rax, %rax
jne 0x109c8
leaq 0x32b87e(%rip), %r14    # 0x33c220
leaq 0xf98a5(%rip), %rsi     # 0x10a24e
movl $0x8, %ecx
movq %r14, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x9060
movl $0x32, %edi
movq %r14, %rsi
callq 0xb425
movl $0x1, 0x22c30e(%rip)    # 0x23cce0
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x20a92b(%rip), %rdi    # 0x21b310
testq %rdi, %rdi
je 0x109fa
callq 0x9440
movq $0x0, 0x20a916(%rip) # 0x21b310
cmpq $0x0, 0x20a90e(%rip)    # 0x21b310
jne 0x10a27
movq 0x20a915(%rip), %rbx    # 0x21b320
incq %rbx
movl $0xb0, %esi
movq %rbx, %rdi
callq 0x9230
movq %rax, 0x20a8ee(%rip)    # 0x21b310
testq %rax, %rax
je 0x10a2c
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x32b7ed(%rip), %r14    # 0x33c220
leaq 0xf9845(%rip), %rsi     # 0x10a27f
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 0xb425
// File: /workspace/github_cpp_makefile_star2_O1/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 0x20a8ae(%rip), %rdi    # 0x21b318
testq %rdi, %rdi
je 0x10a7f
callq 0x9440
movq $0x0, 0x20a899(%rip) # 0x21b318
movl $0x2001, %edi           # imm = 0x2001
movl $0x8, %esi
callq 0x9230
movq %rax, 0x20a883(%rip)    # 0x21b318
testq %rax, %rax
je 0x10aa1
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x32b778(%rip), %rbx    # 0x33c220
leaq 0xf97fd(%rip), %rsi     # 0x10a2ac
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 0xb425
// File: /workspace/github_cpp_makefile_star2_O1/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
callq 0x10015
cmpq $0x0, 0x32f291(%rip)    # 0x33fd78
jne 0x10af4
movq $0x400, 0x32f284(%rip) # imm = 0x400
cmpq $0x0, 0x32f2a4(%rip)    # 0x33fda0
jne 0x10b1e
movq 0x32f273(%rip), %rax    # 0x33fd78
leaq 0x8(,%rax,4), %rdi
movl $0x1, %esi
callq 0x9230
movq %rax, 0x32f282(%rip)    # 0x33fda0
cmpq $0x0, 0x32f292(%rip)    # 0x33fdb8
jne 0x10b56
movq 0x32f249(%rip), %rax    # 0x33fd78
movq %rax, %rcx
shrq $0x3f, %rcx
addq %rax, %rcx
andq $-0x2, %rcx
leaq 0x10(,%rcx,4), %rdi
movl $0x1, %esi
callq 0x9230
movq %rax, 0x32f262(%rip)    # 0x33fdb8
cmpq $0x0, 0x32f24a(%rip)    # 0x33fda8
jne 0x10b8e
movq 0x32f211(%rip), %rax    # 0x33fd78
movq %rax, %rcx
shrq $0x3f, %rcx
addq %rax, %rcx
andq $-0x2, %rcx
leaq 0x10(,%rcx,4), %rdi
movl $0x1, %esi
callq 0x9230
movq %rax, 0x32f21a(%rip)    # 0x33fda8
cmpq $0x0, 0x32f21a(%rip)    # 0x33fdb0
jne 0x10bc6
movq 0x32f1d9(%rip), %rax    # 0x33fd78
movq %rax, %rcx
shrq $0x3f, %rcx
addq %rax, %rcx
andq $-0x2, %rcx
leaq 0x10(,%rcx,4), %rdi
movl $0x1, %esi
callq 0x9230
movq %rax, 0x32f1ea(%rip)    # 0x33fdb0
cmpq $0x0, 0x32f1d2(%rip)    # 0x33fda0
je 0x10bf0
cmpq $0x0, 0x32f1e0(%rip)    # 0x33fdb8
je 0x10bf0
cmpq $0x0, 0x32f1c6(%rip)    # 0x33fda8
je 0x10bf0
cmpq $0x0, 0x32f1c4(%rip)    # 0x33fdb0
je 0x10bf0
popq %rbp
retq
movups 0xf96f5(%rip), %xmm0    # 0x10a2ec
movups %xmm0, 0x32b630(%rip)   # 0x33c22e
movups 0xf96d9(%rip), %xmm0    # 0x10a2de
movaps %xmm0, 0x32b614(%rip)   # 0x33c220
leaq 0x32b60d(%rip), %rsi    # 0x33c220
movl $0x35, %edi
popq %rbp
jmp 0xb425
// File: /workspace/github_cpp_makefile_star2_O1/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 0xf96d3(%rip), %rdi     # 0x10a2fc
xorl %eax, %eax
callq 0x9030
callq 0x109d7
callq 0x10a5d
callq 0x10ad6
movl $0x7, %edi
callq 0x10c56
leaq 0xfabaa(%rip), %rdi     # 0x10b7fa
popq %rbp
jmp 0x95d0
// File: /workspace/github_cpp_makefile_star2_O1/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 0x10c56
movb $0x0, 0x22d1db(%rip)    # 0x23e3fa
cmpl $0x0, 0x20a19a(%rip)    # 0x21b3c0
je 0x11231
cmpb $0x2, 0x20a196(%rip)    # 0x21b3c5
je 0x1123b
movl $0x1, %edi
callq 0x11241
popq %rbp
jmp 0xfb1a
// File: /workspace/github_cpp_makefile_star2_O1/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, 0x22baf0(%rip)    # 0x23cd40
movq 0x20a0e1(%rip), %rax    # 0x21b338
movq %rax, 0x22baea(%rip)    # 0x23cd48
movq 0x20a0c3(%rip), %rcx    # 0x21b328
movslq 0x207618(%rip), %rax    # 0x218884
movslq 0x207625(%rip), %rdx    # 0x218898
subq %rdx, %rax
imulq 0x20a122(%rip), %rax    # 0x21b3a0
movslq 0x20a14b(%rip), %rsi    # 0x21b3d0
cqto
idivq %rsi
addq 0x20a09f(%rip), %rax    # 0x21b330
subq %rax, %rcx
movq %rcx, 0x20a0ad(%rip)    # 0x21b348
jns 0x112c1
cmpb $0x0, 0x20a09c(%rip)    # 0x21b340
je 0x112b8
addq 0x20a073(%rip), %rcx    # 0x21b320
xorl %eax, %eax
testq %rcx, %rcx
cmovgq %rcx, %rax
jmp 0x112ba
xorl %eax, %eax
movq %rax, 0x20a087(%rip)    # 0x21b348
callq 0xd36b7
testb %bl, %bl
je 0x112da
movl $0x1, %edi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x19792
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x113ab
movl %esi, %r14d
movq %rdi, %rbx
movq 0x20a017(%rip), %rax    # 0x21b320
addq %rax, %rbx
subq %rax, %rbx
cmpq %rax, %rbx
jge 0x1130c
movq $-0x1, %r12
leaq -0xd0(%rbp), %r15
cmpq 0x209fff(%rip), %rbx    # 0x21b328
je 0x1135a
movq %r15, %rdi
movq %rbx, %rsi
callq 0x10141
testw %r14w, -0xd0(%rbp)
je 0x1135a
incq %rbx
cmpq 0x209fd6(%rip), %rbx    # 0x21b320
jl 0x1134e
xorl %ebx, %ebx
incq %r12
cmpq 0x209fe0(%rip), %r12    # 0x21b338
jl 0x11322
cmpq 0x209fc7(%rip), %rbx    # 0x21b328
je 0x113b2
movq $-0x1, %r12
leaq -0xd0(%rbp), %r15
cmpq 0x209fb0(%rip), %rbx    # 0x21b328
je 0x113b2
movq %r15, %rdi
movq %rbx, %rsi
callq 0x10141
testw %r14w, -0xd0(%rbp)
jne 0x113b2
incq %rbx
cmpq 0x209f87(%rip), %rbx    # 0x21b320
jl 0x1139d
xorl %ebx, %ebx
incq %r12
cmpq 0x209f91(%rip), %r12    # 0x21b338
jl 0x11371
jmp 0x113b2
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_O1/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 0x32ee75(%rip)          # 0x340248
movq 0x209e9e(%rip), %rdi    # 0x21b278
callq 0x112e1
movq %rax, %rbx
testq %rax, %rax
js 0x11457
movq 0x209f4a(%rip), %rax    # 0x21b338
leaq -0x1(%rax), %rcx
cmpq %rax, %rbx
cmovleq %rbx, %rcx
xorl %ebx, %ebx
testq %rcx, %rcx
cmovgq %rcx, %rbx
cmpq 0x209e6f(%rip), %rbx    # 0x21b278
je 0x11412
movq %rbx, 0x209e6e(%rip)    # 0x21b280
movq %rbx, 0x209e5f(%rip)    # 0x21b278
movq %rbx, 0x209e60(%rip)    # 0x21b280
movq %rbx, 0x209e61(%rip)    # 0x21b288
movslq 0x209fa2(%rip), %rcx    # 0x21b3d0
testq %rcx, %rcx
je 0x1144a
movslq 0x209e16(%rip), %rax    # 0x21b250
imulq 0x209f5e(%rip), %rax    # 0x21b3a0
cqto
idivq %rcx
subq %rax, %rbx
movq %rbx, %rdi
movl $0x1, %esi
callq 0x11461
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x209ec1(%rip), %rdi    # 0x21b330
movl %esi, %ebx
movq %rdi, %r14
subq 0x209ebd(%rip), %r14    # 0x21b338
jl 0x1148e
testb %bl, %bl
je 0x1148b
movl $0xa, %edi
callq 0x9d80
movq %r14, %rdi
testq %rdi, %rdi
jns 0x114a3
testb %bl, %bl
je 0x114a1
movl $0xb, %edi
callq 0x9d80
xorl %edi, %edi
movq %rdi, 0x22b89e(%rip)    # 0x23cd48
movb $0x1, 0x22b88f(%rip)    # 0x23cd40
movq %rdi, 0x209e90(%rip)    # 0x21b348
xorl %edi, %edi
callq 0x19792
cmpl $0x0, 0x32ea32(%rip)    # 0x33fef8
jne 0x114cd
callq 0x1c406
popq %rbx
popq %r14
popq %rbp
jmp 0xab5f
// File: /workspace/github_cpp_makefile_star2_O1/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
movl 0x209eec(%rip), %eax    # 0x21b3cc
movl 0x209eea(%rip), %ecx    # 0x21b3d0
addl %eax, %ecx
movl %ecx, 0x209ede(%rip)    # 0x21b3cc
cmpl $0x1, %esi
jne 0x1150d
cmpl 0x20738b(%rip), %ecx    # 0x218884
jl 0x1150d
movl %eax, 0x209ecb(%rip)    # 0x21b3cc
movq $-0x2, %rax
jmp 0x115c8
cmpb $0x0, 0x209eb2(%rip)    # 0x21b3c6
je 0x1157c
movq 0x209e83(%rip), %rcx    # 0x21b3a0
movb $0x1, %al
testq %rcx, %rcx
je 0x11552
movq 0x209dfd(%rip), %rdx    # 0x21b328
movq 0x209dee(%rip), %rsi    # 0x21b320
leaq 0x1(%rsi), %r8
leaq 0x1(%rdi), %r9
cmpq %rdx, %r9
je 0x115a0
decq %rcx
addq %r8, %rdi
subq %rsi, %rdi
cmpq %rsi, %rdi
jge 0x11545
testq %rcx, %rcx
jne 0x11536
movq %rdi, %rcx
movq 0x209dd4(%rip), %rdx    # 0x21b330
testb %al, %al
jne 0x1156c
movq $-0x1, %rax
cmpq %rdx, %rcx
jge 0x115c8
cmpq %rdx, %rcx
movq $-0x1, %rax
cmovneq %rcx, %rax
jmp 0x115c8
movq 0x209da5(%rip), %rdx    # 0x21b328
movq 0x209e16(%rip), %rcx    # 0x21b3a0
addq %rdi, %rcx
movq $-0x1, %rax
cmpq %rdi, %rdx
jge 0x115a9
cmpq %rdx, %rcx
jg 0x115ae
jmp 0x115c8
movq $-0x1, %rax
jmp 0x115c8
cmpq %rdx, %rcx
jge 0x115c8
movq 0x209d6b(%rip), %rdx    # 0x21b320
movb $0x1, %al
cmpq %rdx, %rcx
jl 0x11555
subq %rdx, %rcx
cmpq %rdx, %rcx
jge 0x115bc
xorl %eax, %eax
jmp 0x11555
popq %rbp
retq