LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/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, 0x1f3bdf(%rip)    # 0x202828
je 0xec61
movl %ebx, 0x1f3bdb(%rip)    # 0x20282c
notl %ebx
movl %ebx, %eax
addl 0x1f3ba9(%rip), %eax    # 0x202804
movl %r14d, %ebx
movl %eax, %r14d
cmpq $0x0, 0x14c257(%rip)    # 0x15aec0
je 0xeccc
leal (%rdx,%rdx), %r12d
subl %edx, %r14d
subl %edx, %ebx
movzbl %cl, %edi
callq 0xd0e7
movq 0x14c23d(%rip), %rdi    # 0x15aec0
movq 0x14c246(%rip), %rsi    # 0x15aed0
movq 0x14c24f(%rip), %rdx    # 0x15aee0
subq $0x8, %rsp
movl %r14d, %ecx
movl %ebx, %r8d
movl %r12d, %r9d
testl %r15d, %r15d
je 0xecb3
pushq $0x5a00                 # imm = 0x5A00
pushq $0x0
pushq %r12
callq 0x9610
jmp 0xecc1
pushq $0x5a00                 # imm = 0x5A00
pushq $0x0
pushq %r12
callq 0x9250
addq $0x20, %rsp
movb $0x1, 0x14c1dc(%rip)    # 0x15aea8
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0xdedf
addl %ebx, %r14d
movl %r13d, %edi
movl %ebx, %esi
movl %r13d, %edx
movl %r14d, %ecx
movl %r12d, %r8d
callq 0xdedf
movl %r13d, %edi
movl %r14d, %esi
movl %r15d, %edx
movl %r14d, %ecx
movl %r12d, %r8d
callq 0xdedf
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 0xdedf
// File: /workspace/github_cpp_makefile_star2_O2/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, 0x14c16d(%rip)    # 0x15aec0
je 0xede9
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %ecx, %r14d
movl %esi, %ebx
cmpl $0x0, 0x1f3ab4(%rip)    # 0x202828
je 0xed95
notl %ebx
addl 0x1f3a86(%rip), %ebx    # 0x202804
movl %r14d, 0x1f3aa7(%rip)   # 0x20282c
movl %r14d, %eax
movl %ebx, %r15d
movl %edi, %ebx
movl %r14d, %r12d
movl %edx, %r14d
jmp 0xed9d
xorl %eax, %eax
movl %edi, %r15d
movl %edx, %r12d
subl %eax, %r15d
movzbl %r8b, %edi
callq 0xd0e7
movq 0x14c110(%rip), %rdi    # 0x15aec0
movq 0x14c119(%rip), %rsi    # 0x15aed0
movq 0x14c122(%rip), %rdx    # 0x15aee0
incl %r12d
incl %r14d
movl %r14d, (%rsp)
movl %r15d, %ecx
movl %ebx, %r8d
movl %r12d, %r9d
callq 0x9190
movb $0x1, 0x14c0cb(%rip)    # 0x15aea8
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0xee40
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
imulq $0xc, %rcx, %rcx
leaq 0x13b66b(%rip), %rdi    # 0x14a490
movl %esi, (%rcx,%rdi)
movl %edx, 0x4(%rcx,%rdi)
movl %eax, 0x8(%rcx,%rdi)
callq 0xd056
movl $0x22ae, 0x1f3a05(%rip) # imm = 0x22AE
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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
imulq $0xc, %rax, %rcx
leaq 0x13b63d(%rip), %rdx    # 0x14a490
movl 0x4(%rcx,%rdx), %eax
movl 0x8(%rcx,%rdx), %esi
shll $0x10, %esi
shll $0x8, %eax
orl %esi, %eax
orl (%rcx,%rdx), %eax
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0xef3c
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
leaq 0xe4c67(%rip), %rsi     # 0xf3b64
leaq -0x4(%rbp), %rdx
leaq -0x10(%rbp), %rcx
leaq -0xc(%rbp), %r8
leaq -0x8(%rbp), %r9
xorl %eax, %eax
callq 0x9350
cmpl $0x4, %eax
jne 0xef2b
movl -0x4(%rbp), %eax
cmpq $0x10, %rax
jb 0xef3d
leaq 0xe5025(%rip), %rdi     # 0xf3f4e
jmp 0xef32
leaq 0xe4ff7(%rip), %rdi     # 0xf3f29
callq 0x214df
addq $0x10, %rsp
popq %rbp
retq
movl -0x10(%rbp), %ecx
cmpl $0x100, %ecx            # imm = 0x100
jb 0xef51
leaq 0xe501b(%rip), %rdi     # 0xf3f6a
jmp 0xef32
movl -0xc(%rbp), %edx
cmpl $0x100, %edx            # imm = 0x100
jb 0xef65
leaq 0xe5022(%rip), %rdi     # 0xf3f85
jmp 0xef32
movl -0x8(%rbp), %esi
cmpl $0x100, %esi            # imm = 0x100
jb 0xef79
leaq 0xe502b(%rip), %rdi     # 0xf3fa2
jmp 0xef32
imulq $0xc, %rax, %rax
leaq 0x13b50c(%rip), %rdi    # 0x14a490
movl %ecx, (%rax,%rdi)
movl %edx, 0x4(%rax,%rdi)
movl %esi, 0x8(%rax,%rdi)
callq 0xd056
movl $0x22c3, 0x1f38a6(%rip) # imm = 0x22C3
jmp 0xef37
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: dump_dword(unsigned int)
void dump_dword(u32 d)
{
   dump_byte(d);
   dump_byte(d>>8);
   dump_byte(d>>16);
   dump_byte(d>>24);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %edi, %ebx
movl $0xff, %r14d
andl %r14d, %edi
callq 0xefa0
movl %ebx, %edi
shrl $0x8, %edi
andl %r14d, %edi
callq 0xefa0
movl %ebx, %edi
shrl $0x10, %edi
andl %r14d, %edi
callq 0xefa0
shrl $0x18, %ebx
movl %ebx, %edi
popq %rbx
popq %r14
popq %rbp
jmp 0xefa0
// File: /workspace/github_cpp_makefile_star2_O2/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, 0x219b2b(%rip)    # 0x228f58
je 0xf430
retq
andl $0x0, 0x1f340d(%rip)    # 0x202844
orl $-0x1, 0x1f5e16(%rip)   # 0x205254
movb $0x0, 0x2e8a55(%rip)    # 0x2f7e9a
cmpb $0x0, 0x315e94(%rip)    # 0x3252e0
jne 0xf467
cmpb $0x0, 0x2e8a43(%rip)    # 0x2f7e98
jne 0xf467
cmpb $0x0, 0x315e76(%rip)    # 0x3252d4
jne 0xf467
movb $0x0, 0x315e49(%rip)    # 0x3252b0
pushq %rbp
movq %rsp, %rbp
callq 0xe7d9
callq 0xb1018
callq 0x5d7c2
cmpb $0x0, 0x1f5f92(%rip)    # 0x205413
popq %rbp
je 0xf48b
movb $0x1, 0x1f5f89(%rip)    # 0x205414
pushq $0x1
popq %rdi
jmp 0x18cb0
// File: /workspace/github_cpp_makefile_star2_O2/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, 0x218b8f(%rip)    # 0x228360
je 0xf8c6
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
cmpb $0x0, 0x218c30(%rip)    # 0x228414
je 0xf800
movw $0x23, 0x218171(%rip)   # 0x227960
pushq $0x1
popq %rbx
movl %ebx, %edi
callq 0xb25f5
movl %ebx, %edi
callq 0xb25f5
movl 0x31180e(%rip), %esi    # 0x321014
testq %rsi, %rsi
je 0xf83c
leaq 0xe485d(%rip), %rdi     # 0xf406f
xorl %eax, %eax
callq 0x9030
movl 0x3117f5(%rip), %edx    # 0x321014
leaq 0x21813a(%rip), %rdi    # 0x227960
leaq 0xe485e(%rip), %rsi     # 0xf408b
xorl %eax, %eax
callq 0x9060
pushq $0x1
popq %rdi
callq 0xb25f5
movl 0x21974a(%rip), %esi    # 0x228f8c
testq %rsi, %rsi
je 0xf878
leaq 0xe4859(%rip), %rdi     # 0xf40a7
xorl %eax, %eax
callq 0x9030
movl 0x219731(%rip), %edx    # 0x228f8c
leaq 0x2180fe(%rip), %rdi    # 0x227960
leaq 0xe4856(%rip), %rsi     # 0xf40bf
xorl %eax, %eax
callq 0x9060
pushq $0x1
popq %rdi
callq 0xb25f5
movl 0x2196f6(%rip), %esi    # 0x228f74
movl 0x219704(%rip), %edx    # 0x228f88
leaq 0xe484c(%rip), %rdi     # 0xf40d7
xorl %eax, %eax
callq 0x9030
movl 0x2196dc(%rip), %edx    # 0x228f74
movl 0x2196ea(%rip), %ecx    # 0x228f88
leaq 0x2180bb(%rip), %rdi    # 0x227960
leaq 0xe485a(%rip), %rsi     # 0xf4106
xorl %eax, %eax
callq 0x9060
pushq $0x1
popq %rdi
callq 0xb25f5
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xb2b9e
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x31a4ce(%rip), %rdi    # 0x329da0
callq 0x9440
movq 0x31a4da(%rip), %rdi    # 0x329db8
callq 0x9440
movq 0x31a4be(%rip), %rdi    # 0x329da8
callq 0x9440
movq 0x31a4ba(%rip), %rdi    # 0x329db0
callq 0x9440
andq $0x0, 0x31a49d(%rip)    # 0x329da0
andq $0x0, 0x31a4ad(%rip)    # 0x329db8
andq $0x0, 0x31a495(%rip)    # 0x329da8
andq $0x0, 0x31a495(%rip)    # 0x329db0
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x2171de(%rip), %rdi    # 0x226b20
testq %rdi, %rdi
je 0xf954
callq 0x9440
andq $0x0, 0x2171cc(%rip)    # 0x226b20
movq 0x217215(%rip), %rdi    # 0x226b70
testq %rdi, %rdi
je 0xf96d
callq 0x9440
andq $0x0, 0x217203(%rip)    # 0x226b70
movq 0x21724c(%rip), %rdi    # 0x226bc0
testq %rdi, %rdi
je 0xf986
callq 0x9440
andq $0x0, 0x21723a(%rip)    # 0x226bc0
movq 0x217283(%rip), %rdi    # 0x226c10
testq %rdi, %rdi
je 0xf99f
callq 0x9440
andq $0x0, 0x217271(%rip)    # 0x226c10
andl $0x0, 0x21733a(%rip)    # 0x226ce0
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0xf9c7
leaq -0xb8(%rbp), %rdi
movq %rbx, %rsi
callq 0xf9c7
leaq 0x1(%rbx), %rsi
leaq -0x218(%rbp), %rdi
callq 0xf9c7
pushq $0x2
popq %rax
cmpq $0x16, %rax
je 0xfc21
movsd -0x168(%rbp,%rax,8), %xmm0
movsd %xmm0, -0xb8(%rbp,%rax,8)
incq %rax
jmp 0xfc04
testq %rbx, %rbx
js 0xfc4e
cmpq %rbx, 0x1f56f3(%rip)    # 0x205320
jle 0xfc4e
imulq $0xb0, %rbx, %rdi
addq 0x1f56d3(%rip), %rdi    # 0x205310
leaq -0xb8(%rbp), %rsi
movl $0xb0, %edx
callq 0x92a0
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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, 0x1f55f9(%rip)    # 0x205258
je 0xfc84
pushq %rbp
movq %rsp, %rbp
movq 0x1f5614(%rip), %rdi    # 0x205280
callq 0xfbc3
incq 0x1f5608(%rip)          # 0x205280
movl $0x16c8, 0x1f2bc2(%rip) # imm = 0x16C8
popq %rbp
retq
pushq $0x7
popq %rdi
jmp 0x9d23
// File: /workspace/github_cpp_makefile_star2_O2/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 0xfff7
movq 0x1f52bd(%rip), %rcx    # 0x205268
movq %rcx, %rdx
subq 0x1f537b(%rip), %rdx    # 0x205330
movq 0x1f5364(%rip), %rax    # 0x205320
movq %rdx, %rsi
sarq $0x3f, %rsi
andq %rax, %rsi
addq %rdx, %rsi
cmpq %rax, %rsi
setg %r8b
movq 0x1f5361(%rip), %rdx    # 0x205338
subq %rsi, %rdx
setl %sil
orb %r8b, %sil
jne 0xfff7
movq %rcx, 0x1f5346(%rip)    # 0x205330
movq %rdx, 0x1f5347(%rip)    # 0x205338
testb $0x2, %dil
jne 0x10050
testb $0x2, %dil
je 0x1004e
movq 0x1f526c(%rip), %rsi    # 0x205270
movq 0x1f525d(%rip), %rcx    # 0x205268
subq %rcx, %rsi
movq 0x1f530b(%rip), %rax    # 0x205320
movq %rsi, %rdx
sarq $0x3f, %rdx
andq %rax, %rdx
addq %rsi, %rdx
cmpq %rax, %rdx
jg 0x1004e
movq 0x1f530a(%rip), %rax    # 0x205338
subq %rdx, %rax
setl %sil
testq %rdx, %rdx
sets %dl
orb %sil, %dl
jne 0x1004e
movq %rcx, 0x1f52e1(%rip)    # 0x205328
movq %rax, 0x1f52ea(%rip)    # 0x205338
popq %rbp
retq
movq 0x1f52d1(%rip), %rcx    # 0x205328
movq %rcx, %rsi
subq 0x1f520f(%rip), %rsi    # 0x205270
movq %rsi, %rdx
sarq $0x3f, %rdx
andq %rax, %rdx
addq %rsi, %rdx
subq %rdx, %rcx
movq %rcx, 0x1f51f0(%rip)    # 0x205268
jns 0x10022
addq %rax, %rcx
movq %rcx, 0x1f51e4(%rip)    # 0x205268
jmp 0x10022
// File: /workspace/github_cpp_makefile_star2_O2/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
subq $0xb8, %rsp
movq %rdi, %rbx
pushq $0x2
popq %rax
cmpq $0x16, %rax
je 0x100ac
andq $0x0, -0xb8(%rbp,%rax,8)
incq %rax
jmp 0x10098
andw $0x0, -0xb8(%rbp)
andq $0x0, -0xb0(%rbp)
testq %rbx, %rbx
js 0x100e9
cmpq %rbx, 0x1f5258(%rip)    # 0x205320
jle 0x100e9
imulq $0xb0, %rbx, %rdi
addq 0x1f5238(%rip), %rdi    # 0x205310
leaq -0xb8(%rbp), %rsi
movl $0xb0, %edx
callq 0x92a0
testq %rbx, %rbx
je 0x1010e
xorl %eax, %eax
leaq 0x1f51b9(%rip), %rcx    # 0x2052b0
cmpq $0x50, %rax
je 0x1010e
cmpq %rbx, (%rax,%rcx)
jne 0x10108
andq $0x0, (%rax,%rcx)
addq $0x8, %rax
jmp 0x100f7
addq $0xb8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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
callq 0xf9a8
cmpq $0x0, 0x1f509d(%rip)    # 0x205310
jne 0x10298
movq 0x1f50a4(%rip), %rbx    # 0x205320
incq %rbx
movl $0xb0, %esi
movq %rbx, %rdi
callq 0x9220
movq %rax, 0x1f507d(%rip)    # 0x205310
testq %rax, %rax
je 0x1029d
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x315f7c(%rip), %r14    # 0x326220
leaq 0xe4034(%rip), %rsi     # 0xf42df
movl $0xb0, %ecx
movq %r14, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x9060
pushq $0x33
popq %rdi
movq %r14, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0xb290
// File: /workspace/github_cpp_makefile_star2_O2/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
cmpq $0x0, 0x1f503e(%rip)    # 0x205318
je 0x102e1
callq 0xf91d
pushq $0x8
popq %rsi
movl $0x2001, %edi           # imm = 0x2001
callq 0x9220
movq %rax, 0x1f5023(%rip)    # 0x205318
testq %rax, %rax
je 0x10301
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x315f18(%rip), %rbx    # 0x326220
leaq 0xe3ffd(%rip), %rsi     # 0xf430c
pushq $0x8
popq %rcx
movl $0x2001, %edx           # imm = 0x2001
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
pushq $0x34
popq %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xb290
// File: /workspace/github_cpp_makefile_star2_O2/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 %r13
pushq %r12
pushq %rbx
pushq %rax
callq 0xf8c7
movq 0x319a2c(%rip), %rbx    # 0x329d78
testq %rbx, %rbx
jne 0x10361
movq $0x400, 0x319a1c(%rip) # imm = 0x400
movl $0x400, %ebx            # imm = 0x400
cmpq $0x0, 0x319a37(%rip)    # 0x329da0
je 0x10370
xorl %r14d, %r14d
jmp 0x1038e
leaq 0x8(,%rbx,4), %rdi
pushq $0x1
popq %rsi
callq 0x9220
movq %rax, 0x319a19(%rip)    # 0x329da0
testq %rax, %rax
sete %r14b
cmpq $0x0, 0x319a22(%rip)    # 0x329db8
pushq $0x2
popq %r12
je 0x103a1
xorl %r15d, %r15d
jmp 0x103c7
movq %rbx, %rax
cqto
idivq %r12
leaq 0x10(,%rax,8), %rdi
pushq $0x1
popq %rsi
callq 0x9220
movq %rax, 0x3199f8(%rip)    # 0x329db8
testq %rax, %rax
sete %r15b
cmpq $0x0, 0x3199d9(%rip)    # 0x329da8
je 0x103d6
xorl %r13d, %r13d
jmp 0x103fc
movq %rbx, %rax
cqto
idivq %r12
leaq 0x10(,%rax,8), %rdi
pushq $0x1
popq %rsi
callq 0x9220
movq %rax, 0x3199b3(%rip)    # 0x329da8
testq %rax, %rax
sete %r13b
cmpq $0x0, 0x3199ac(%rip)    # 0x329db0
je 0x1040a
xorl %eax, %eax
jmp 0x1042f
movq %rbx, %rax
cqto
idivq %r12
leaq 0x10(,%rax,8), %rdi
pushq $0x1
popq %rsi
callq 0x9220
movq %rax, 0x319987(%rip)    # 0x329db0
testq %rax, %rax
sete %al
orb %r15b, %r14b
orb %r13b, %r14b
jne 0x1044a
testb %al, %al
jne 0x1044a
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movups 0xe3efb(%rip), %xmm0    # 0xf434c
movups %xmm0, 0x315dd6(%rip)   # 0x32622e
movups 0xe3edf(%rip), %xmm0    # 0xf433e
movaps %xmm0, 0x315dba(%rip)   # 0x326220
leaq 0x315db3(%rip), %rsi    # 0x326220
pushq $0x35
popq %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xb290
// File: /workspace/github_cpp_makefile_star2_O2/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 0xe3ece(%rip), %rdi     # 0xf435c
xorl %eax, %eax
callq 0x9030
callq 0x1025f
callq 0x102cc
callq 0x10332
pushq $0x7
popq %rdi
callq 0x104b9
leaq 0xe53cf(%rip), %rdi     # 0xf5882
popq %rbp
jmp 0x95d0
// File: /workspace/github_cpp_makefile_star2_O2/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 0x104b9
movb $0x0, 0x217951(%rip)    # 0x2283fa
cmpl $0x0, 0x1f4910(%rip)    # 0x2053c0
je 0x10abb
cmpb $0x2, 0x1f490c(%rip)    # 0x2053c5
je 0x10ac3
pushq $0x1
popq %rdi
callq 0x10ac9
popq %rbp
jmp 0xf426
// File: /workspace/github_cpp_makefile_star2_O2/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, 0x216268(%rip)    # 0x226d40
movq 0x1f4859(%rip), %rax    # 0x205338
movq %rax, 0x216262(%rip)    # 0x226d48
movq 0x1f483b(%rip), %rcx    # 0x205328
movslq 0x1f1d90(%rip), %rax    # 0x202884
movslq 0x1f1d9d(%rip), %rdx    # 0x202898
subq %rdx, %rax
imulq 0x1f489a(%rip), %rax    # 0x2053a0
movslq 0x1f48c3(%rip), %rsi    # 0x2053d0
cqto
idivq %rsi
addq 0x1f4817(%rip), %rax    # 0x205330
subq %rax, %rcx
movq %rcx, 0x1f4825(%rip)    # 0x205348
jns 0x10b49
cmpb $0x0, 0x1f4814(%rip)    # 0x205340
je 0x10b40
addq 0x1f47eb(%rip), %rcx    # 0x205320
xorl %eax, %eax
testq %rcx, %rcx
cmovgq %rcx, %rax
jmp 0x10b42
xorl %eax, %eax
movq %rax, 0x1f47ff(%rip)    # 0x205348
callq 0xc24a2
testb %bl, %bl
je 0x10b60
pushq $0x1
popq %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x18cb0
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x10c2b
movl %esi, %r14d
movq %rdi, %rbx
movq 0x1f4791(%rip), %rax    # 0x205320
addq %rax, %rbx
subq %rax, %rbx
cmpq %rax, %rbx
jge 0x10b92
pushq $-0x1
popq %r12
leaq -0xd0(%rbp), %r15
cmpq 0x1f477c(%rip), %rbx    # 0x205328
je 0x10bdd
movq %r15, %rdi
movq %rbx, %rsi
callq 0xf9c7
testw %r14w, -0xd0(%rbp)
je 0x10bdd
incq %rbx
cmpq 0x1f4753(%rip), %rbx    # 0x205320
jl 0x10bd1
xorl %ebx, %ebx
incq %r12
cmpq 0x1f475d(%rip), %r12    # 0x205338
jl 0x10ba5
cmpq 0x1f4744(%rip), %rbx    # 0x205328
je 0x10c2e
pushq $-0x1
popq %r12
leaq -0xd0(%rbp), %r15
cmpq 0x1f4730(%rip), %rbx    # 0x205328
je 0x10c2e
movq %r15, %rdi
movq %rbx, %rsi
callq 0xf9c7
testw %r14w, -0xd0(%rbp)
jne 0x10c2e
incq %rbx
cmpq 0x1f4707(%rip), %rbx    # 0x205320
jl 0x10c1d
xorl %ebx, %ebx
incq %r12
cmpq 0x1f4711(%rip), %r12    # 0x205338
jl 0x10bf1
jmp 0x10c2e
pushq $-0x1
popq %rbx
movq %rbx, %rax
addq $0xb0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x3195f9(%rip)          # 0x32a248
movq 0x1f4622(%rip), %rdi    # 0x205278
callq 0x10b67
movq %rax, %rbx
testq %rax, %rax
js 0x10cc1
movq 0x1f46ce(%rip), %rax    # 0x205338
leaq -0x1(%rax), %rcx
cmpq %rax, %rbx
cmovleq %rbx, %rcx
xorl %ebx, %ebx
testq %rcx, %rcx
cmovgq %rcx, %rbx
movq %rbx, 0x1f45f3(%rip)    # 0x205278
movq %rbx, 0x1f45f4(%rip)    # 0x205280
movq %rbx, 0x1f45f5(%rip)    # 0x205288
movslq 0x1f4736(%rip), %rcx    # 0x2053d0
testq %rcx, %rcx
je 0x10cb6
movslq 0x1f45aa(%rip), %rax    # 0x205250
imulq 0x1f46f2(%rip), %rax    # 0x2053a0
cqto
idivq %rcx
subq %rax, %rbx
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x10ccb
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x1f4657(%rip), %rdi    # 0x205330
movl %esi, %ebx
movq %rdi, %r14
subq 0x1f4653(%rip), %r14    # 0x205338
jl 0x10cf6
testb %bl, %bl
je 0x10d0b
pushq $0xa
popq %rdi
callq 0x9d23
movq %r14, %rdi
testq %rdi, %rdi
jns 0x10d14
testb %bl, %bl
je 0x10d07
pushq $0xb
popq %rdi
callq 0x9d23
xorl %edi, %edi
jmp 0x10d14
xorl %edi, %edi
testq %r14, %r14
cmovgq %r14, %rdi
movq %rdi, 0x21602d(%rip)    # 0x226d48
movb $0x1, 0x21601e(%rip)    # 0x226d40
movq %rdi, 0x1f461f(%rip)    # 0x205348
xorl %edi, %edi
callq 0x18cb0
cmpl $0x0, 0x3191c1(%rip)    # 0x329ef8
jne 0x10d3e
callq 0x1b5eb
popq %rbx
popq %r14
popq %rbp
jmp 0xaa05
// File: /workspace/github_cpp_makefile_star2_O2/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 0x1f467b(%rip), %eax    # 0x2053cc
movl 0x1f4679(%rip), %ecx    # 0x2053d0
addl %eax, %ecx
movl %ecx, 0x1f466d(%rip)    # 0x2053cc
cmpl $0x1, %esi
jne 0x10d81
cmpl 0x1f1b1a(%rip), %ecx    # 0x202884
jl 0x10d81
movl %eax, 0x1f465a(%rip)    # 0x2053cc
movabsq $-0x2, %rax
jmp 0x10e41
cmpb $0x0, 0x1f463e(%rip)    # 0x2053c6
movabsq $-0x1, %rax
je 0x10dcd
movq 0x1f4605(%rip), %rcx    # 0x2053a0
movq 0x1f4586(%rip), %rdx    # 0x205328
movq 0x1f4577(%rip), %rsi    # 0x205320
leaq 0x1(%rsi), %r8
subq $0x1, %rcx
jb 0x10dea
leaq 0x1(%rdi), %r9
cmpq %rdx, %r9
je 0x10e41
addq %r8, %rdi
subq %rsi, %rdi
cmpq %rsi, %rdi
jge 0x10dc3
jmp 0x10dad
movq 0x1f4554(%rip), %rdx    # 0x205328
movq 0x1f45c5(%rip), %rcx    # 0x2053a0
addq %rdi, %rcx
cmpq %rdi, %rdx
jge 0x10df6
cmpq %rdx, %rcx
jg 0x10dfb
jmp 0x10e41
movq 0x1f453f(%rip), %rdx    # 0x205330
movq %rdi, %rcx
jmp 0x10e30
cmpq %rdx, %rcx
jge 0x10e41
xorl %edx, %edx
movq 0x1f451c(%rip), %rsi    # 0x205320
movq %rcx, %rdi
subq %rsi, %rdi
jl 0x10e13
decl %edx
movq %rdi, %rcx
jmp 0x10e07
testl %edx, %edx
sete %sil
movq 0x1f4510(%rip), %rdx    # 0x205330
cmpq %rdx, %rcx
setl %dil
orb %sil, %dil
cmpb $0x1, %dil
jne 0x10e41
cmpq %rdx, %rcx
movabsq $-0x1, %rax
cmovneq %rcx, %rax
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: disp_filter_size()
long disp_filter_size()
{
DATA_SIZE show_time;

   // return the length of the display averaging filter

   if(filter_count < 0) {   // filter size based up display config
      show_time = (DATA_SIZE) (view_interval*queue_interval*PLOT_WIDTH);  // seconds per screen
show_time *= (DATA_SIZE) (0-filter_count);
      show_time /= plot_mag;
      show_time /= nav_rate;
      show_time /= PLOT_WIDTH;
      show_time += (DATA_SIZE) 0.5;
      if(show_time < 1.0) show_time = (DATA_SIZE) 1.0;
      if(show_time > PLOT_WIDTH) show_time = (DATA_SIZE) PLOT_WIDTH;

      return (long) show_time;
   }
   else {  // fixed filter size
      if(filter_count > PLOT_WIDTH) return PLOT_WIDTH;
      return filter_count;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x1f4622(%rip), %rcx    # 0x205470
testq %rcx, %rcx
js 0x10e63
movslq 0x1f1a2a(%rip), %rax    # 0x202884
cmpq %rax, %rcx
cmovlq %rcx, %rax
popq %rbp
retq
movq 0x1f452e(%rip), %rax    # 0x205398
imulq 0x1f452e(%rip), %rax    # 0x2053a0
movslq 0x1f1a0b(%rip), %rdx    # 0x202884
imulq %rdx, %rax
cvtsi2sd %rax, %xmm0
negq %rcx
cvtsi2sd %rcx, %xmm1
cvtsi2sdl 0x1f453e(%rip), %xmm2 # 0x2053d0
mulsd %xmm0, %xmm1
divsd %xmm2, %xmm1
divsd 0x1f44b6(%rip), %xmm1   # 0x205358
cvtsi2sd %edx, %xmm0
divsd %xmm0, %xmm1
addsd 0xe21b6(%rip), %xmm1    # 0xf3068
movsd 0xe21b6(%rip), %xmm2    # 0xf3070
maxsd %xmm1, %xmm2
minsd %xmm2, %xmm0
cvttsd2si %xmm0, %rax
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: filter_plot_q(long)
struct PLOT_Q filter_plot_q(long point)
{
long i;
long f_count;
int back_ok, center_ok, fwd_ok;

   if     (disp_filter_type == 'B') return back_filter(point);    // user forced filter type
   else if(disp_filter_type == 'C') return center_filter(point);
   else if(disp_filter_type == 'F') return forward_filter(point);

   f_count = disp_filter_size();

   back_ok = center_ok = fwd_ok = 1;

   i = point - f_count;
   if(i < 0) i += plot_q_size;
   if(i > plot_q_count) {  // too near the start of the plot to do a back filter
      back_ok = 0;
   }

   i = point - (f_count / 2);
   if(i < 0) i += plot_q_size;
   if(i > plot_q_count) {  // too near the start of the plot to do a center filter
      center_ok = 0;
   }

   i = point + f_count;
   if(i > plot_q_size) i -= plot_q_size;
   if(i > plot_q_count) {  // too near the end of the plot to do a forward filter
      fwd_ok = 0;
   }

   if(center_ok) {  // filter points each side of the point
      return center_filter(point);
   }
   else if(fwd_ok) {  // filter points after the point
      return forward_filter(point);
   }
   else if(back_ok) {  // filter points before the point
      return back_filter(point);
   }
   else {  // not enough data to do a proper filter
      return forward_filter(point);
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movl 0x1f3fed(%rip), %eax    # 0x205478
cmpl $0x46, %eax
je 0x1150c
cmpl $0x43, %eax
je 0x11519
cmpl $0x42, %eax
jne 0x114ab
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10ec9
jmp 0x11524
callq 0x10e43
movq %rax, %rcx
movq 0x1f3e66(%rip), %rdi    # 0x205320
movq 0x1f3e77(%rip), %rsi    # 0x205338
pushq $-0x2
popq %r8
cqto
idivq %r8
addq %r14, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
andq %rdi, %rdx
addq %rax, %rdx
cmpq %rsi, %rdx
jle 0x11519
leaq (%rcx,%r14), %rax
xorl %edx, %edx
cmpq %rdi, %rax
cmovgq %rdi, %rdx
subq %rdx, %rax
cmpq %rsi, %rax
jle 0x1150c
movq %r14, %rax
subq %rcx, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
andq %rdi, %rcx
addq %rax, %rcx
cmpq %rsi, %rcx
jle 0x1149e
movq %rbx, %rdi
movq %r14, %rsi
callq 0x112ac
jmp 0x11524
movq %rbx, %rdi
movq %r14, %rsi
callq 0x110a8
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: config_text()
void config_text()
{
int i;

   // text drawing stuff
   PLOT_TEXT_COL = (PLOT_COL / TEXT_WIDTH);
   PLOT_TEXT_ROW = (PLOT_ROW / TEXT_HEIGHT);

   MOUSE_COL = (PLOT_TEXT_COL)+2;
   MOUSE_ROW = ((PLOT_TEXT_ROW)-6-eofs);
   MOUSE_ROW -= ((TEXT_Y_MARGIN+TEXT_HEIGHT-1)/TEXT_HEIGHT);
   if((TEXT_HEIGHT == 16) && (SCREEN_HEIGHT <= SHORT_SCREEN)) --MOUSE_ROW;
   if(MOUSE_ROW < 0) MOUSE_ROW = 0;

   TEXT_COLS = ((SCREEN_WIDTH+TEXT_WIDTH-1)/TEXT_WIDTH);
   if(TEXT_COLS >= (int)sizeof(blanks)) TEXT_COLS = sizeof(blanks)-1;
   TEXT_ROWS = ((SCREEN_HEIGHT+TEXT_HEIGHT-1)/TEXT_HEIGHT);
   if(text_mode) MOUSE_ROW = TEXT_ROWS;

   EDIT_ROW = PLOT_TEXT_ROW+2;   // where to put the string input dialog
   if(SCREEN_HEIGHT <= TINY_HEIGHT) EDIT_ROW = PLOT_TEXT_ROW+1;  // piss3
   EDIT_COL = PLOT_TEXT_COL;

   if(text_mode) {
      EDIT_ROW = EDIT_COL = 0;
      PLOT_ROW += (TEXT_HEIGHT*3);
      PLOT_TEXT_ROW = 100;
   }

   for(i=0; i<TEXT_COLS; i++) blanks[i] = ' ';
   blanks[TEXT_COLS] = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl 0x1f134a(%rip), %eax    # 0x202880
movl 0x1f12d3(%rip), %r9d    # 0x202810
cltd
idivl %r9d
movl %eax, %ecx
movl %eax, 0x1f1343(%rip)    # 0x20288c
movl 0x1f132d(%rip), %edi    # 0x20287c
movl 0x1f12be(%rip), %r8d    # 0x202814
movl %edi, %eax
cltd
idivl %r8d
movl %eax, %esi
movl %eax, 0x1f132c(%rip)    # 0x202890
leal 0x2(%rcx), %eax
movl %eax, 0x1f123f(%rip)    # 0x2027ac
leal -0x1(,%r8,2), %eax
cltd
idivl %r8d
addl 0x2179c1(%rip), %eax    # 0x228f40
negl %eax
addl %esi, %eax
addl $-0x6, %eax
movl %eax, 0x1f121c(%rip)    # 0x2027a8
cmpl $0x10, %r8d
sete %dl
movl 0x1f126a(%rip), %r10d   # 0x202804
cmpl $0x259, %r10d           # imm = 0x259
setl %r11b
andb %dl, %r11b
movzbl %r11b, %edx
subl %edx, %eax
testb %dl, %dl
jne 0x115b6
testl %eax, %eax
jns 0x115c3
xorl %edx, %edx
testl %eax, %eax
cmovgl %eax, %edx
movl %edx, 0x1f11e5(%rip)    # 0x2027a8
movl 0x1f1237(%rip), %eax    # 0x202800
addl %r9d, %eax
decl %eax
cltd
idivl %r9d
movl $0x200, %r9d            # imm = 0x200
cmpl %r9d, %eax
cmovll %eax, %r9d
movl %r9d, 0x1f1222(%rip)    # 0x202808
leal (%r8,%r10), %eax
decl %eax
cltd
idivl %r8d
movl %eax, 0x1f1216(%rip)    # 0x20280c
cmpl $0x0, 0x1f11db(%rip)    # 0x2027d8
je 0x11621
movl %eax, 0x1f11a3(%rip)    # 0x2027a8
leal (%r8,%r8,2), %eax
addl %edi, %eax
movl %eax, 0x1f126b(%rip)    # 0x20287c
movl $0x64, 0x1f1275(%rip)   # 0x202890
xorl %esi, %esi
xorl %ecx, %ecx
jmp 0x11632
xorl %eax, %eax
cmpl $0x1e1, %r10d           # imm = 0x1E1
setl %al
subl %eax, %esi
addl $0x2, %esi
movl %esi, 0x317fd4(%rip)    # 0x32960c
movl %ecx, 0x317fd2(%rip)    # 0x329610
xorl %eax, %eax
testl %r9d, %r9d
movl $0x0, %ecx
cmovgl %r9d, %ecx
leaq 0x3149bd(%rip), %rdx    # 0x326010
cmpq %rax, %rcx
je 0x11661
movb $0x20, (%rax,%rdx)
incq %rax
jmp 0x11653
movslq %r9d, %rax
movb $0x0, (%rax,%rdx)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: scale_plot_row()
int scale_plot_row()
{
   // adjust plot row for scaled up text size
   if(use_vc_fonts) {
      PLOT_ROW = (PLOT_ROW * vc_font_scale) / 100;
if(vc_font_scale < 100) PLOT_ROW += TEXT_HEIGHT*2;  // piss
      config_text();
      vidstr(0,0, WHITE, " ");
   }
   return PLOT_ROW;
}

// Assembly:
cmpl $0x0, 0x1fbecf(%rip)    # 0x20d540
je 0x116bf
movl 0x1fbecb(%rip), %ecx    # 0x20d544
movl 0x1f11fd(%rip), %eax    # 0x20287c
imull %ecx, %eax
pushq $0x64
popq %rsi
cltd
idivl %esi
movl %eax, 0x1f11ee(%rip)    # 0x20287c
cmpl $0x63, %ecx
jg 0x116a2
movl 0x1f117b(%rip), %ecx    # 0x202814
leal (%rax,%rcx,2), %eax
movl %eax, 0x1f11da(%rip)    # 0x20287c
pushq %rbp
movq %rsp, %rbp
callq 0x1152c
leaq 0xfb3ea(%rip), %rcx     # 0x10ca9c
pushq $0xf
popq %rdx
xorl %edi, %edi
xorl %esi, %esi
callq 0xe2d2
popq %rbp
movl 0x1f11b7(%rip), %eax    # 0x20287c
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: config_undersized()
void config_undersized()
{
   // setup for 640x480 screen
   if(user_font_size > 12) user_font_size = 12;

   HORIZ_MAJOR = 30;
   HORIZ_MINOR = 5;
   VERT_MAJOR = 20;
   VERT_MINOR = 4;
   COUNT_SCALE = (VERT_MAJOR/2);

   if(rcvr_type == NO_RCVR) {  // size of the analog watch area
      AZEL_SIZE = LLA_SIZE = (SCREEN_WIDTH / 4); // piss (160);
   }

   if(user_set_plot_row == 0) {
      if(user_font_size && (user_font_size <= 8)) PLOT_ROW = SCREEN_HEIGHT-VERT_MAJOR*8;
      else PLOT_ROW = SCREEN_HEIGHT-VERT_MAJOR*6;
      scale_plot_row();
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movb 0x1f1188(%rip), %cl     # 0x202858
cmpb $0xd, %cl
jb 0x116de
movb $0xc, 0x1f117c(%rip)    # 0x202858
movb $0xc, %cl
movl $0x1e, 0x1f118c(%rip)   # 0x202874
movl $0x5, 0x1f1186(%rip)    # 0x202878
movl $0x14, 0x1f1170(%rip)   # 0x20286c
movl $0x4, 0x1f116a(%rip)    # 0x202870
movl $0xa, 0x1f1198(%rip)    # 0x2028a8
cmpq $0x400, 0x1f11b5(%rip) # imm = 0x400
jne 0x11737
movl 0x1f10dd(%rip), %eax    # 0x202800
movl $0x4, %esi
cltd
idivl %esi
movl %eax, 0x313b67(%rip)    # 0x325298
movl %eax, 0x313c55(%rip)    # 0x32538c
cmpl $0x0, 0x1fbe0e(%rip)    # 0x20d54c
je 0x11742
popq %rbp
retq
decb %cl
cmpb $0x8, %cl
movl $0xffffff60, %eax       # imm = 0xFFFFFF60
movl $0xffffff88, %ecx       # imm = 0xFFFFFF88
cmovbl %eax, %ecx
addl 0x1f10aa(%rip), %ecx    # 0x202804
movl %ecx, 0x1f111c(%rip)    # 0x20287c
popq %rbp
jmp 0x1166a
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: config_small()
void config_small()
{
   // setup for 800x600 screen
   if(user_set_plot_row == 0) {
      PLOT_ROW = (400+8);
      scale_plot_row();
   }

   FILTER_ROW = 17;
   FILTER_COL = INFO_COL;

   COUNT_SCALE = (VERT_MAJOR/2);

   AZEL_SIZE = LLA_SIZE = (160);       // size of the az/el map area

   if(TEXT_HEIGHT >= 16) eofs = 0;
}

// Assembly:
cmpl $0x0, 0x1fbddf(%rip)    # 0x20d54c
jne 0x11783
pushq %rbp
movq %rsp, %rbp
movl $0x198, 0x1f10ff(%rip)  # imm = 0x198
callq 0x1166a
popq %rbp
movl $0x11, 0x1f1013(%rip)   # 0x2027a0
movl 0x1f1009(%rip), %eax    # 0x20279c
movl %eax, 0x1f100b(%rip)    # 0x2027a4
movl 0x1f10cd(%rip), %eax    # 0x20286c
pushq $0x2
popq %rcx
cltd
idivl %ecx
movl %eax, 0x1f10fd(%rip)    # 0x2028a8
movl $0xa0, %eax
movl %eax, 0x313ae2(%rip)    # 0x325298
movl %eax, 0x313bd0(%rip)    # 0x32538c
cmpl $0x10, 0x1f1051(%rip)   # 0x202814
jl 0x117cc
andl $0x0, 0x217774(%rip)    # 0x228f40
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: config_zoom()
void config_zoom()
{
   if(zoom_screen == 0) return;
   if(plot_signals) return;
   if(plot_watch) return;
   if(plot_digital_clock) return;
   if(plot_azel) return;
   if(plot_lla && (zoom_screen == 'L')) return;

   if(text_mode) cancel_zoom(3);
   if(zoom_screen == 'L') cancel_zoom(4);
//zzzzzzz   zoom_lla = 0;
}

// Assembly:
movb 0x2e4644(%rip), %al     # 0x2f67a8
testb %al, %al
je 0x121c1
cmpb $0x0, 0x1f32a6(%rip)    # 0x205415
jne 0x121c1
cmpb $0x0, 0x1f3290(%rip)    # 0x205408
jne 0x121c1
cmpb $0x0, 0x1f3264(%rip)    # 0x2053e5
jne 0x121c1
cmpb $0x0, 0x1f3289(%rip)    # 0x205413
jne 0x121c1
cmpb $0x4c, %al
jne 0x12199
cmpb $0x0, 0x313119(%rip)    # 0x3252b0
jne 0x121c1
cmpl $0x0, 0x1f0638(%rip)    # 0x2027d8
je 0x121b5
pushq %rbp
movq %rsp, %rbp
pushq $0x3
popq %rdi
callq 0x258aa
movb 0x2e45f4(%rip), %al     # 0x2f67a8
popq %rbp
cmpb $0x4c, %al
jne 0x121c1
pushq $0x4
popq %rdi
jmp 0x258aa
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: scale_temp(double)
DATA_SIZE scale_temp(double t)
{
double x;

   // convert degrees C into user specified measurement system
   x = (double) t;
   if     (DEG_SCALE == 'C') ;
   else if(DEG_SCALE == 'D') x = (100.0-x) * 1.5;
   else if(DEG_SCALE == 'E') x = (x * (21.0 / 40.0)) + 7.5;
   else if(DEG_SCALE == 'F') x = (x * 1.8) + 32.0;
   else if(DEG_SCALE == 'H') x = (x - 20.0) / 10.0;   // degrees Hilton (as in Paris Hilton)
   else if(DEG_SCALE == 'N') x = x * 0.33F;
   else if(DEG_SCALE == 'O') x = (x * (21.0 / 40.0)) + 7.5;
   else if(DEG_SCALE == 'R') x = (x + 273.15) * 1.8;
   else if(DEG_SCALE == 'K') x = x + 273.15;

   return (DATA_SIZE) x;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movzbl 0x2e4648(%rip), %eax    # 0x2f6fa5
addl $-0x44, %eax
cmpl $0xe, %eax
ja 0x129ed
leaq 0xe0a78(%rip), %rcx     # 0xf33e8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
mulsd 0xe0707(%rip), %xmm0    # 0xf3088
addsd 0xe0707(%rip), %xmm0    # 0xf3090
jmp 0x129ed
addsd 0xe06e5(%rip), %xmm0    # 0xf3078
jmp 0x129ed
movsd 0xe06c3(%rip), %xmm1    # 0xf3060
subsd %xmm0, %xmm1
mulsd 0xe070f(%rip), %xmm1    # 0xf30b8
movapd %xmm1, %xmm0
jmp 0x129ed
mulsd 0xe06e1(%rip), %xmm0    # 0xf3098
jmp 0x129ed
addsd 0xe06b7(%rip), %xmm0    # 0xf3078
mulsd 0xe06b7(%rip), %xmm0    # 0xf3080
jmp 0x129ed
mulsd 0xe06ad(%rip), %xmm0    # 0xf3080
addsd 0xe06d5(%rip), %xmm0    # 0xf30b0
jmp 0x129ed
addsd 0xe06bb(%rip), %xmm0    # 0xf30a0
divsd 0xe06bb(%rip), %xmm0    # 0xf30a8
popq %rbp
retq