LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: exec_program()
void exec_program()
{
char *e;

   // run a user defined program on a schedule
   if(no_exec) return;

   e = getenv("HEATHER_EXEC");
   if(!e || !*e) {
      e = heather_exec;
   }
   strcpy(edit_buffer, e);
   strcpy(out, e);

   run_program(out, 0);
}

// Assembly:
cmpl $0x0, 0x2edfb0(%rip)    # 0x2f80b4
je 0xa107
retq
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
leaq 0xe97d3(%rip), %rdi     # 0xf38e8
callq 0x9460
testq %rax, %rax
je 0xa127
movq %rax, %rbx
cmpb $0x0, (%rax)
jne 0xa12e
movq 0x13dbf2(%rip), %rbx    # 0x147d20
leaq 0x31f1ab(%rip), %rdi    # 0x3292e0
movq %rbx, %rsi
callq 0x9330
leaq 0x31c0dc(%rip), %r14    # 0x326220
movq %r14, %rdi
movq %rbx, %rsi
callq 0x9330
movq %r14, %rdi
xorl %esi, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x9f69
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: path_unlink(char*)
int path_unlink(char *fn)
{
char name[2048+1];
char *f;

   // delete a file, add path name if none given
   f = trim_whitespace(fn);
   if(f == 0) return 1;

   strcpy(name, f);

#ifdef WINDOWS
#else // __linux__  __MACH__  __FreeBSD__
   if(f[0] == '.') ;       // user gave a path
   else if(f[0] == '/') ;  // user gave a path
   else {  // add path to heather directory
      strcpy(name, heather_path);
      strcat(name, f);
   }
#endif

   return unlink(name);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x810, %rsp            # imm = 0x810
callq 0x9f43
testq %rax, %rax
je 0xa1be
movq %rax, %rbx
leaq -0x820(%rbp), %rdi
movq %rax, %rsi
callq 0x9330
movb (%rbx), %al
andb $-0x2, %al
cmpb $0x2e, %al
je 0xa1b0
leaq 0x150afa(%rip), %rsi    # 0x15ac90
leaq -0x820(%rbp), %r14
movq %r14, %rdi
callq 0x9330
movq %r14, %rdi
movq %rbx, %rsi
callq 0x96c0
leaq -0x820(%rbp), %rdi
callq 0x9130
jmp 0xa1c1
pushq $0x1
popq %rax
addq $0x810, %rsp            # imm = 0x810
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: path_open(char*, char*)
FILE *path_open(char *fn, char *m)
{
char name[2048+1];
char *f;
FILE *fp;

   // open a file, add path name if none given
   if(m == 0) return 0;
   f = trim_whitespace(fn);
   if(f == 0) return 0;

   strcpy(name, f);

#ifdef WINDOWS
#else // __linux__  __MACH__  __FreeBSD__
   if(f[0] == '.') ;       // user gave a path
   else if(f[0] == '/') ;  // user gave a path
   else {  // add path to heather directory
      strcpy(name, heather_path);
      strcat(name, f);
   }
#endif

   fp = fopen(name, m);
   if(fp) {
      if(debug_file) fprintf(debug_file, "! file %s opened\n", name);
   }
if(show_debug_info) printf("path_open(%s, %s) -> %p\n", name, m, fp);
   return fp;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x808, %rsp            # imm = 0x808
testq %rsi, %rsi
je 0xa29a
movq %rsi, %rbx
callq 0x9f43
testq %rax, %rax
je 0xa29a
movq %rax, %r14
leaq -0x820(%rbp), %rdi
movq %rax, %rsi
callq 0x9330
movb (%r14), %al
andb $-0x2, %al
cmpb $0x2e, %al
je 0xa233
leaq 0x150a77(%rip), %rsi    # 0x15ac90
leaq -0x820(%rbp), %r15
movq %r15, %rdi
callq 0x9330
movq %r15, %rdi
movq %r14, %rsi
callq 0x96c0
leaq -0x820(%rbp), %rdi
movq %rbx, %rsi
callq 0x9430
movq %rax, %r14
testq %rax, %rax
setne %al
movq 0x21e13e(%rip), %rdi    # 0x228390
testq %rdi, %rdi
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xa274
leaq 0xe968f(%rip), %rsi     # 0xf38f5
leaq -0x820(%rbp), %rdx
xorl %eax, %eax
callq 0x9560
cmpb $0x0, 0x1f8649(%rip)    # 0x2028c4
je 0xa29d
leaq 0xe9683(%rip), %rdi     # 0xf3907
leaq -0x820(%rbp), %rsi
movq %rbx, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x9030
jmp 0xa29d
xorl %r14d, %r14d
movq %r14, %rax
addq $0x808, %rsp            # imm = 0x808
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: open_debug_file(char*)
FILE *open_debug_file(char *f)
{
char *s;
char *star;

   s = trim_whitespace(f);
   if(s == 0) return 0;

   if(debug_file) {
      fclose(debug_file);
      debug_file = 0;
   }

   star = strchr(s, FLUSH_CHAR);
   if(star) {
      *star = 0;
      dbg_flush_mode = 1;
   }
   else dbg_flush_mode = 0;

   debug_file = topen(s, "w");
   strcpy(debug_name, s);
   return debug_file;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
callq 0x9f43
testq %rax, %rax
je 0xa2f3
movq %rax, %rbx
movq 0x21e0c7(%rip), %rdi    # 0x228390
testq %rdi, %rdi
je 0xa2db
callq 0x9360
andq $0x0, 0x21e0b5(%rip)    # 0x228390
pushq $0x2a
popq %rsi
movq %rbx, %rdi
callq 0x9100
testq %rax, %rax
je 0xa2f8
movb $0x0, (%rax)
pushq $0x1
popq %rax
jmp 0xa2fa
xorl %r14d, %r14d
jmp 0xa328
xorl %eax, %eax
movl %eax, 0x21e128(%rip)    # 0x228428
leaq 0x100ffc(%rip), %rsi    # 0x10b303
movq %rbx, %rdi
callq 0x9a22
movq %rax, %r14
movq %rax, 0x21e077(%rip)    # 0x228390
leaq 0x21d740(%rip), %rdi    # 0x227a60
movq %rbx, %rsi
callq 0x9330
movq %r14, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: open_rinex_file(char*)
FILE *open_rinex_file(char *f)
{
char *s;
char *star;

   s = trim_whitespace(f);
   if(s == 0) return 0;

   if(rinex_file) {
      fclose(rinex_file);
      rinex_file = 0;
   }

   star = strchr(s, FLUSH_CHAR);
   if(star) {
      *star = 0;
      rinex_flush_mode = 1;
   }
   else rinex_flush_mode = 0;

   rinex_file = topen(s, "w");
   if(rinex_file) {
      if(debug_file) fprintf(debug_file, "! RINEX file %s opened\n", s);
   }
   strcpy(rinex_name, s);
   rinex_header_written = 0;
   first_obs = 1;
   return rinex_file;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
callq 0x9f43
testq %rax, %rax
je 0xa48c
movq %rax, %rbx
movq 0x21df06(%rip), %rdi    # 0x228368
testq %rdi, %rdi
je 0xa474
callq 0x9360
andq $0x0, 0x21def4(%rip)    # 0x228368
pushq $0x2a
popq %rsi
movq %rbx, %rdi
callq 0x9100
testq %rax, %rax
je 0xa491
movb $0x0, (%rax)
pushq $0x1
popq %rax
jmp 0xa493
xorl %r14d, %r14d
jmp 0xa504
xorl %eax, %eax
movl %eax, 0x21df8b(%rip)    # 0x228424
leaq 0x100e63(%rip), %rsi    # 0x10b303
movq %rbx, %rdi
callq 0x9a22
movq %rax, %r14
movq %rax, 0x21deb6(%rip)    # 0x228368
testq %rax, %rax
setne %al
movq 0x21ded1(%rip), %rdi    # 0x228390
testq %rdi, %rdi
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xa4e4
leaq 0xe946d(%rip), %rsi     # 0xf3940
movq %rbx, %rdx
xorl %eax, %eax
callq 0x9560
movq 0x21de84(%rip), %r14    # 0x228368
leaq 0x21ca75(%rip), %rdi    # 0x226f60
movq %rbx, %rsi
callq 0x9330
andl $0x0, 0x21def2(%rip)    # 0x2283ec
movl $0x1, 0x2ed07c(%rip)    # 0x2f7580
movq %r14, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: open_raw_file(char*, char*)
FILE *open_raw_file(char *name, char *mode)
{
char *s;
FILE *file;

   if(name == 0) return 0;
   if(mode == 0) return 0;

   if(raw_file) {
      fclose(raw_file);
      raw_file = 0;
   }

   s = strchr(name, FLUSH_CHAR);
   if(s) {
      *s = 0;
      raw_flush_mode = 1;
   }
   else raw_flush_mode = 0;

//lfs drain_port(RCVR_PORT);
   wakeup_tsip_msg = 0;        // cause wait for full receiver message before logging raw data
   saw_rcvr_msg = 0;
   file = topen(name, mode);
   if(file) {
      if(debug_file) fprintf(debug_file, "! raw capture file %s opened\n", name);
   }
   wakeup_tsip_msg = 0;        // cause wait for full receiver message before logging raw data
   saw_rcvr_msg = 0;

   return file;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
je 0xa52b
xorl %r14d, %r14d
jmp 0xa5c1
movq %rsi, %r14
movq %rdi, %rbx
movq 0x21de38(%rip), %rdi    # 0x228370
testq %rdi, %rdi
je 0xa54a
callq 0x9360
andq $0x0, 0x21de26(%rip)    # 0x228370
pushq $0x2a
popq %rsi
movq %rbx, %rdi
callq 0x9100
testq %rax, %rax
je 0xa562
movb $0x0, (%rax)
pushq $0x1
popq %rax
jmp 0xa564
xorl %eax, %eax
andq $0x0, 0x21ea2c(%rip)    # 0x228f98
movl %eax, 0x21deaa(%rip)    # 0x22841c
andl $0x0, 0x21ea27(%rip)    # 0x228fa0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9a22
movq %rax, %r14
testq %rax, %rax
setne %al
movq 0x21ddfc(%rip), %rdi    # 0x228390
testq %rdi, %rdi
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xa5b2
leaq 0xe93b0(%rip), %rsi     # 0xf3958
movq %rbx, %rdx
xorl %eax, %eax
callq 0x9560
andq $0x0, 0x21e9de(%rip)    # 0x228f98
andl $0x0, 0x21e9df(%rip)    # 0x228fa0
movq %r14, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: open_prn_file(char*, char*)
FILE *open_prn_file(char *name, char *mode)
{
char *s;
FILE *file;

   if(name == 0) return 0;
   if(mode == 0) return 0;

   if(prn_file) {
      fclose(prn_file);
      prn_file = 0;
      prn_count = 0;
   }

   s = strchr(name, FLUSH_CHAR);
   if(s) {
      *s = 0;
      prn_flush_mode = 1;
   }
   else prn_flush_mode = 0;

//lfs drain_port(RCVR_PORT);
   file = topen(name, mode);
   if(file) {
      fprintf(file, "#JD UTC         PRN   AZ     EL     SIG\n");
      fprintf(file, "# 1\n");
      if(prn_flush_mode) fflush(file);
      prn_count = 1;
      if(debug_file) fprintf(debug_file, "! PRN file %s opened\n", name);
   }

   return file;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0xa6a8
movq %rsi, %r14
movq %rdi, %rbx
movq 0x21dd84(%rip), %rdi    # 0x228378
testq %rdi, %rdi
je 0xa60d
callq 0x9360
andq $0x0, 0x21dd72(%rip)    # 0x228378
andl $0x0, 0x21de0b(%rip)    # 0x228418
pushq $0x2a
popq %rsi
movq %rbx, %rdi
callq 0x9100
testq %rax, %rax
je 0xa625
movb $0x0, (%rax)
pushq $0x1
popq %rax
jmp 0xa627
xorl %eax, %eax
movl %eax, 0x21ddff(%rip)    # 0x22842c
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9a22
testq %rax, %rax
je 0xa6a8
movq %rax, %r14
leaq 0xe932f(%rip), %rdi     # 0xf3976
pushq $0x28
popq %rsi
pushq $0x1
popq %r15
movq %r15, %rdx
movq %rax, %rcx
callq 0x9750
leaq 0xe933f(%rip), %rdi     # 0xf399f
pushq $0x4
popq %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x9750
cmpl $0x0, 0x21ddb7(%rip)    # 0x22842c
je 0xa67f
movq %r14, %rdi
callq 0x9420
movl $0x1, 0x21dd8f(%rip)    # 0x228418
movq 0x21dd00(%rip), %rdi    # 0x228390
testq %rdi, %rdi
je 0xa6ab
leaq 0xe9308(%rip), %rsi     # 0xf39a4
movq %rbx, %rdx
xorl %eax, %eax
callq 0x9560
jmp 0xa6ab
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: get_sim_char(unsigned int)
u08 get_sim_char(unsigned port)
{
int flag;
u08 c;

   // get a character from a simulation file.
   if(sim_file == 0) return 0;  // simulation file not being used

   if(sim_eof) {
      return 0;
   }

   flag = fread(&c, 1, 1, sim_file);
   if(flag <= 0) {  // just reached the end of file
      BEEP(4);
      sim_eof = 1;

      sprintf(plot_title, "Reached end of simulation file: %s", sim_name);
      refresh_page();
      return 0;
   }

   if((zoom_screen == 'O') && (port == monitor_port)) {   // send char to "terminal" format monitor screen
      echo_term(monitor_port, c, monitor_hex, 0);
   }
   return c;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq 0x21da54(%rip), %rcx    # 0x2283c0
xorl %ebx, %ebx
testq %rcx, %rcx
je 0xa9fa
cmpl $0x0, 0x21da5a(%rip)    # 0x2283d8
jne 0xa9fa
movl %edi, %r14d
leaq -0x11(%rbp), %rdi
pushq $0x1
popq %rdx
movq %rdx, %rsi
callq 0x9590
testl %eax, %eax
jle 0xa9c0
cmpb $0x4f, 0x2ebe0b(%rip)   # 0x2f67a8
jne 0xa9f7
movb -0x11(%rbp), %bl
cmpl %r14d, 0x2ed927(%rip)   # 0x2f82d0
jne 0xa9fa
movzbl %bl, %esi
movl 0x21da90(%rip), %edx    # 0x228444
movl %r14d, %edi
xorl %ecx, %ecx
callq 0xaad9
jmp 0xa9fa
pushq $0x4
popq %rdi
callq 0x9d23
movl $0x1, 0x21da06(%rip)    # 0x2283d8
leaq 0x31de77(%rip), %rdi    # 0x328850
leaq 0xe8fda(%rip), %rsi     # 0xf39ba
leaq 0x21cb79(%rip), %rdx    # 0x227560
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x9060
callq 0xaa05
jmp 0xa9fa
movb -0x11(%rbp), %bl
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: refresh_page()
void refresh_page(void)
{
   // if double buffering the screen, copy background pixmap to display window
   // also flush the X11 drawing queue

   if(display == 0) return;

if(0 && sim_file && (sim_eof == 0)) {  // this can double the sim file rate
   if((com_tick % 200) != 10) return;
}

   if(pix_map && x11_io_done) {
      SWAP(SCREEN_WIDTH,SCREEN_HEIGHT);
      XCopyArea(display,pix_map,screen,gc, 0,0, SCREEN_WIDTH,SCREEN_HEIGHT, 0,0);
      SWAP(SCREEN_WIDTH,SCREEN_HEIGHT);
   }

   XFlush(display);

   x11_io_done = 0;
}

// Assembly:
movq 0x1504b4(%rip), %rdi    # 0x15aec0
testq %rdi, %rdi
je 0xaad8
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x28, %rsp
movq 0x1504ab(%rip), %rsi    # 0x15aed0
testq %rsi, %rsi
je 0xaabf
cmpb $0x0, 0x150473(%rip)    # 0x15aea8
je 0xaabf
cmpl $0x0, 0x1f7de6(%rip)    # 0x202828
movl 0x1f7db8(%rip), %ecx    # 0x202800
movl 0x1f7db6(%rip), %eax    # 0x202804
je 0xaa67
movl %eax, 0x1f7dd6(%rip)    # 0x20282c
movl %ecx, 0x1f7da8(%rip)    # 0x202804
movl %eax, 0x1f7d9e(%rip)    # 0x202800
movl %ecx, %r8d
jmp 0xaa6c
movl %eax, %r8d
movl %ecx, %eax
movq 0x150455(%rip), %rdx    # 0x15aec8
movq 0x150466(%rip), %rcx    # 0x15aee0
andl $0x0, 0x18(%rsp)
movl %r8d, 0x8(%rsp)
andl $0x0, 0x10(%rsp)
movl %eax, (%rsp)
xorl %ebx, %ebx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x9150
cmpl %ebx, 0x1f7d89(%rip)    # 0x202828
je 0xaabf
movl 0x1f7d5d(%rip), %eax    # 0x202804
movl %eax, 0x1f7d7f(%rip)    # 0x20282c
movl 0x1f7d4d(%rip), %ecx    # 0x202800
movl %ecx, 0x1f7d4b(%rip)    # 0x202804
movl %eax, 0x1f7d41(%rip)    # 0x202800
movq 0x1503fa(%rip), %rdi    # 0x15aec0
callq 0x95c0
movb $0x0, 0x1503d6(%rip)    # 0x15aea8
addq $0x28, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: SendBreak(unsigned int)
void SendBreak(unsigned port)
{
   // This routine sends a 300 msec BREAK signal to the serial port
   if(port >= NUM_COM_PORTS) return;
   if(com[port].com_fd < 0) return;  // !!!! should also return if IP connected

// tcsendbreak(com[port].com_fd, 0);  // send a 200..500 ms (supposedly) break
   SetBreak(port, 1);  // a more reliable way to do the BREAK
   Sleep(500);
   SetBreak(port, 0);
   Sleep(100);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
cmpl $0x12, %edi
ja 0xae7c
movl %edi, %ebx
movl %edi, %eax
imulq $0x2260, %rax, %rax     # imm = 0x2260
leaq 0x2ed496(%rip), %rcx    # 0x2f82e0
cmpl $0x0, 0x8(%rax,%rcx)
js 0xae7c
pushq $0x1
popq %rsi
movl %ebx, %edi
callq 0xadf0
movl $0x1f4, %edi            # imm = 0x1F4
callq 0xae83
movl %ebx, %edi
xorl %esi, %esi
callq 0xadf0
pushq $0x64
popq %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xae83
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: Sleep(int)
void Sleep(int time)
{
   time *= 1000;   // convert msecs to usecs
   while(time > 1000000) {
      usleep(1000000);
      time -= 1000000;
   }
   usleep(time);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
imull $0x3e8, %edi, %ebx      # imm = 0x3E8
cmpl $0xf4241, %ebx          # imm = 0xF4241
jl 0xaea9
movl $0xf4240, %edi          # imm = 0xF4240
callq 0x9540
addl $0xfff0bdc0, %ebx       # imm = 0xFFF0BDC0
jmp 0xae8f
movl %ebx, %edi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x9540
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: kill_com(unsigned int, int)
void kill_com(unsigned port, int why)
{
   // close the serial communications device
   if(port >= NUM_COM_PORTS) return;
   com[port].port_used = 1;   // port has been closed

   if(com[port].com_fd < 0) return;

   tcsetattr(com[port].com_fd, TCSANOW, &oldtio);
   close(com[port].com_fd);

   com[port].com_fd = (-1);
   com[port].com_running = (-11); //NOT_RUNNING;
}

// Assembly:
cmpl $0x12, %edi
ja 0xaf11
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, %eax
imulq $0x2260, %rax, %rax     # imm = 0x2260
leaq 0x2ed40f(%rip), %rbx    # 0x2f82e0
movl $0x1, 0x222c(%rax,%rbx)
movl 0x8(%rax,%rbx), %edi
testl %edi, %edi
js 0xaf0b
addq %rax, %rbx
leaq 0x150012(%rip), %rdx    # 0x15af00
xorl %esi, %esi
callq 0x94c0
movl 0x8(%rbx), %edi
callq 0x9760
orl $-0x1, 0x8(%rbx)
movl $0xfffffff5, 0x2230(%rbx) # imm = 0xFFFFFFF5
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: error_exit(int, char*)
void error_exit(int num,  char *s)
{
char err[1024];

   if(s) sprintf(err, "Error exit %d: %s", num, s);
   else  sprintf(err, "Error exit %d!", num);

   break_flag = 1;

   #ifdef WIN_VFX
      SAL_alert_box("Error", err);
   #else   // __linux__  __MACH__  __FreeBSD__
      printf("*** ERROR: %s\n", err);
   #endif

   if(num) shut_down(num);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movl %edi, %ebx
testq %rsi, %rsi
je 0xb2bf
movq %rsi, %rcx
leaq 0xe8e8c(%rip), %rsi     # 0xf4139
leaq -0x410(%rbp), %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0x9060
jmp 0xb2d6
leaq 0xe8e85(%rip), %rsi     # 0xf414b
leaq -0x410(%rbp), %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0x9060
movl $0x1, 0x315d44(%rip)    # 0x321024
leaq 0xe8e73(%rip), %rdi     # 0xf415a
leaq -0x410(%rbp), %rsi
xorl %eax, %eax
callq 0x9030
testl %ebx, %ebx
jne 0xb303
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %rbp
retq
movl %ebx, %edi
callq 0xd8d5
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: check_incoming_data(unsigned int)
int check_incoming_data(unsigned port)
{
int flag;

   // return true if we have a serial port byte available to read
   if(port >= NUM_COM_PORTS) return 0;

   if((port == RCVR_PORT) && (rcvr_type == NO_RCVR) && (enable_terminal == 0)) { // alternate ready/not ready each check
      return(++com_tick & 0x01);
   }
if((port == RCVR_PORT) && (rcvr_type == TIDE_RCVR) && (enable_terminal == 0)) {
   return (++com_tick & 0x01);
}

   if((port == RCVR_PORT) && sim_file) {  // using a simulation file
      return sim_kbd_check();
   }

   if(com[port].com_fd < 0) return 0;

   if(com[port].com_error & RCV_ERR) {
//printf("com port %d avail err:%02X\n", port, com[port].com_error);
      return -100; // !!!! return 0;
   }
   if(com[port].next_rcv_byte < com[port].rcv_byte_count) return 2000|com[port].next_rcv_byte;  // we have already read and buffered the char

   com[port].rcv_byte_count = 0;
   com[port].next_rcv_byte = 0;

   if(1 || (com[port].com_port != 0) || (com[port].usb_port != 0)) {  // zork COM port in use: read bytes from serial port
      flag = read(com[port].com_fd, &com[port].rcv_buffer[0], RCV_BUF_SIZE);
      if(flag < 0) {  // !!!! error or no serial data available - we should check errno()
         com[port].rcv_byte_count = 0;
         return 0;
      }
      else {
         com[port].rcv_byte_count = flag;
         if(com[port].rcv_byte_count == 0) return FALSE;  // no serial port data is available
      }
   }

   return (0x8000 | com[port].rcv_byte_count);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
xorl %ebx, %ebx
cmpl $0x12, %edi
ja 0xb7d9
cmpl $0xa, %edi
sete %cl
movq 0x1f7144(%rip), %rax    # 0x2028d0
cmpq $0x400, %rax            # imm = 0x400
sete %dl
andb %cl, %dl
movl 0x21d793(%rip), %ecx    # 0x228f30
testl %ecx, %ecx
sete %sil
andb %dl, %sil
cmpb $0x1, %sil
je 0xb7c8
testl %ecx, %ecx
sete %cl
cmpl $0xa, %edi
sete %dl
cmpq $0x800000, %rax         # imm = 0x800000
sete %al
andb %dl, %al
andb %cl, %al
cmpb $0x1, %al
jne 0xb7e0
movl 0x31e72e(%rip), %ebx    # 0x329efc
incl %ebx
movl %ebx, 0x31e726(%rip)    # 0x329efc
andl $0x1, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
cmpl $0xa, %edi
jne 0xb7f8
cmpq $0x0, 0x21cbd3(%rip)    # 0x2283c0
je 0xb7f8
popq %rbx
popq %r14
popq %rbp
jmp 0xa92b
movl %edi, %eax
imulq $0x2260, %rax, %rax     # imm = 0x2260
leaq 0x2ecad8(%rip), %r14    # 0x2f82e0
movl 0x8(%rax,%r14), %edi
testl %edi, %edi
js 0xb7d9
addq %rax, %r14
testb $0x1, 0x2251(%r14)
jne 0xb837
movl 0x2224(%r14), %eax
cmpl 0x2220(%r14), %eax
jge 0xb83c
orl $0x7d0, %eax            # imm = 0x7D0
movl %eax, %ebx
jmp 0xb7d9
pushq $-0x64
popq %rbx
jmp 0xb7d9
andq $0x0, 0x2220(%r14)
leaq 0x1220(%r14), %rsi
movl $0x1000, %edx           # imm = 0x1000
callq 0x9570
testl %eax, %eax
js 0xb872
movl %eax, 0x2220(%r14)
movl %eax, %ebx
orl $0x8000, %ebx           # imm = 0x8000
testl %eax, %eax
cmovel %eax, %ebx
jmp 0xb7d9
andl $0x0, 0x2220(%r14)
jmp 0xb7d9
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: init_hardware()
void init_hardware(void)
{
   init_com(RCVR_PORT, 2);
   init_screen(9103);

   if(NO_SCPI_BREAK && (rcvr_type == SCPI_RCVR)) ;
   else if(nortel == 0) {    // To wake up a Nortel NTGS55A, etc receiver
      SendBreak(RCVR_PORT);
   }

   need_screen_init = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq $0xa
popq %rdi
callq 0xb30a
movl $0x238f, %edi           # imm = 0x238F
callq 0xbc0b
cmpb $0x0, 0x21d341(%rip)    # 0x228f39
jne 0xbc02
pushq $0xa
popq %rdi
callq 0xae2d
andl $0x0, 0x1f6bdf(%rip)    # 0x2027e8
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: kill_screen()
void kill_screen(void)
{
   // shutdown the X11 server and screen

   if(display == 0) return;
   XFlush(display);

   if(pix_map) XFreePixmap(display, pix_map);
   pix_map = 0;

   if(icon_map) XFreePixmap(display, icon_map);
   icon_map = 0;

   XDestroyWindow(display, screen);
   screen = 0;
   XFlush(display);

   XFreeGC(display, gc);
   gc = 0;
   XFlush(display);

   if(size_hints) XFree(size_hints);
   size_hints = 0;
   if(wm_hints) XFree(wm_hints);
   wm_hints = 0;
   if(class_hints) XFree(class_hints);
   class_hints = 0;

   XFlush(display);
   XCloseDisplay(display);
   display = 0;

   x11_io_done = 0;
   last_x11_color = 0x80;
   Sleep(X11_sleep);
}

// Assembly:
movq 0x14e904(%rip), %rdi    # 0x15aec0
testq %rdi, %rdi
je 0xc6de
pushq %rbp
movq %rsp, %rbp
callq 0x95c0
movq 0x14e8fb(%rip), %rsi    # 0x15aed0
testq %rsi, %rsi
je 0xc5e6
movq 0x14e8df(%rip), %rdi    # 0x15aec0
callq 0x96e0
andq $0x0, 0x14e8e2(%rip)    # 0x15aed0
movq 0x14e8e3(%rip), %rsi    # 0x15aed8
testq %rsi, %rsi
je 0xc606
movq 0x14e8bf(%rip), %rdi    # 0x15aec0
callq 0x96e0
andq $0x0, 0x14e8ca(%rip)    # 0x15aed8
movq 0x14e8ab(%rip), %rdi    # 0x15aec0
movq 0x14e8ac(%rip), %rsi    # 0x15aec8
callq 0x9620
andq $0x0, 0x14e89f(%rip)    # 0x15aec8
movq 0x14e890(%rip), %rdi    # 0x15aec0
callq 0x95c0
movq 0x14e884(%rip), %rdi    # 0x15aec0
movq 0x14e89d(%rip), %rsi    # 0x15aee0
callq 0x91e0
andq $0x0, 0x14e890(%rip)    # 0x15aee0
movq 0x14e869(%rip), %rdi    # 0x15aec0
callq 0x95c0
movq 0x31d8f5(%rip), %rdi    # 0x329f58
testq %rdi, %rdi
je 0xc66d
callq 0x94b0
andq $0x0, 0x31d8e3(%rip)    # 0x329f58
movq 0x31d8e4(%rip), %rdi    # 0x329f60
testq %rdi, %rdi
je 0xc686
callq 0x94b0
andq $0x0, 0x31d8d2(%rip)    # 0x329f60
movq 0x31d8d3(%rip), %rdi    # 0x329f68
testq %rdi, %rdi
je 0xc69f
callq 0x94b0
andq $0x0, 0x31d8c1(%rip)    # 0x329f68
movq 0x14e812(%rip), %rdi    # 0x15aec0
callq 0x95c0
movq 0x14e806(%rip), %rdi    # 0x15aec0
callq 0x9720
andq $0x0, 0x14e7f9(%rip)    # 0x15aec0
movb $0x0, 0x14e7da(%rip)    # 0x15aea8
movb $-0x80, 0x13c9ff(%rip)  # 0x1490d4
pushq $0x64
popq %rdi
popq %rbp
jmp 0xae83
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: RGB_NATIVE(int, int, int)
u32 RGB_NATIVE(int r, int g, int b)
{
u32 color;

   // convert 8-bit R,G,B values to X11 pixel color
   // !!!!!! we need to use the proper X11 way to do this... whatever that is

   if     (wattr.depth == 15) color = (((u32) (r>>3))<<10)  | (((u32) (g>>3))<<5) | ((u32) (b>>3));
   else if(wattr.depth == 16) color = (((u32) (r>>3))<<11)  | (((u32) (g>>2))<<5) | ((u32) (b>>3));
   else if(wattr.depth == 18) color = (((u32) (r>>2))<<12)  | (((u32) (g>>2))<<6) | ((u32) (b>>2));
   else if(wattr.depth == 24) color = (((u32) r)<<16)       | (((u32) g)<<8)      | ((u32) b);
   else if(wattr.depth == 30) color = (((u32) r)<<20)       | (((u32) g)<<10)     | ((u32) (b<<2));
   else                       color = (((u32) r)<<16)       | (((u32) g)<<8)      | ((u32) b) | 0xFF000000;
   return color;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
movl 0x31d3c0(%rip), %esi    # 0x329f84
leal -0xf(%rsi), %ecx
cmpl $0x9, %ecx
ja 0xcbe7
leaq 0xe65fd(%rip), %rsi     # 0xf31d0
movslq (%rsi,%rcx,4), %rcx
addq %rsi, %rcx
jmpq *%rcx
andl $-0x8, %edi
shll $0x7, %edi
shll $0x2, %eax
jmp 0xcc30
cmpl $0x1e, %esi
jne 0xcbf9
shll $0x14, %edi
shll $0xa, %eax
orl %edi, %eax
shll $0x2, %edx
jmp 0xcc38
shll $0x10, %edi
shll $0x8, %eax
orl %edi, %eax
orl %edx, %eax
orl $0xff000000, %eax       # imm = 0xFF000000
jmp 0xcc3a
andl $-0x4, %edi
shll $0xa, %edi
shll $0x4, %eax
andl $-0x40, %eax
orl %edi, %eax
sarl $0x2, %edx
jmp 0xcc38
shll $0x10, %edi
shll $0x8, %eax
orl %edi, %eax
jmp 0xcc38
andl $-0x8, %edi
shll $0x8, %edi
shll $0x3, %eax
andl $-0x20, %eax
orl %edi, %eax
sarl $0x3, %edx
orl %edx, %eax
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: setup_palette()
void setup_palette()
{
int i;
int j;

   // initialize working palettes from the standard palette table

   j = 0;
   for(i=0; i<16; i++) {  // setup native device and .BMP file palettes
      palette[i] = RGB_NATIVE(cmap[i].r, cmap[i].g, cmap[i].b);

      bmp_pal[j++] = cmap[i].b;   // bitmap palette is BGRx format
      bmp_pal[j++] = cmap[i].g;
      bmp_pal[j++] = cmap[i].r;
      bmp_pal[j++] = 0;
   }

   bmp_pal[j++] = 0;    // bmp_yellow - special color used to print yellow on white background
   bmp_pal[j++] = 168;
   bmp_pal[j++] = 92;
   bmp_pal[j++] = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x13d42d(%rip), %r12    # 0x14a498
xorl %r13d, %r13d
cmpq $0x40, %r13
je 0xd0c1
movl -0x8(%r12), %ebx
movl -0x4(%r12), %r14d
movl (%r12), %r15d
movl %ebx, %edi
movl %r14d, %esi
movl %r15d, %edx
callq 0xcbb8
leaq 0x14deea(%rip), %rcx    # 0x15af80
movl %eax, (%r13,%rcx)
leaq 0x31cfbe(%rip), %rax    # 0x32a060
movb %r15b, (%r13,%rax)
movb %r14b, 0x1(%r13,%rax)
movb %bl, 0x2(%r13,%rax)
movb $0x0, 0x3(%r13,%rax)
addq $0x4, %r13
addq $0xc, %r12
jmp 0xd06e
movl $0x5ca800, 0x31cfd5(%rip) # imm = 0x5CA800
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: set_x11_color(unsigned char)
void set_x11_color(u08 color)
{
   // set the graphics context color

   if(color != last_x11_color) {  // color has changed, update context
      last_x11_color = color;
      if(color == 0xFF) XSetForeground(display, gc, RGB_NATIVE(0,0,35)); // special plot area background color highlight
      else              XSetForeground(display, gc, palette[color]);
   }
}

// Assembly:
cmpb %dil, 0x13bfe6(%rip)    # 0x1490d4
jne 0xd0f1
retq
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movb %dil, 0x13bfd5(%rip)    # 0x1490d4
movq 0x14ddba(%rip), %rbx    # 0x15aec0
movq 0x14ddd3(%rip), %r14    # 0x15aee0
cmpb $-0x1, %dil
je 0xd123
movzbl %dil, %eax
leaq 0x14de62(%rip), %rcx    # 0x15af80
movl (%rcx,%rax,4), %eax
jmp 0xd12f
pushq $0x23
popq %rdx
xorl %edi, %edi
xorl %esi, %esi
callq 0xcbb8
movl %eax, %edx
movq %rbx, %rdi
movq %r14, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0x90d0
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: add_kbd(int)
void add_kbd(int key)
{
   // add a keystroke to the keyboard queue

   last_kbd_jd = jd_utc;
   if(++kbd_in >= KBD_Q_SIZE) kbd_in = 0;
   if(kbd_in == kbd_out) {  // kbd queue is full
      if(--kbd_in < 0) kbd_in = KBD_Q_SIZE-1;
   }
   else {  // put keystoke in the queue
      kbd_queue[kbd_in] = key;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movsd 0x2ea3e4(%rip), %xmm0   # 0x2f7530
movl 0x31cef2(%rip), %ecx    # 0x32a044
leal 0x1(%rcx), %edx
xorl %eax, %eax
cmpl $0xf, %ecx
cmovll %edx, %eax
movsd %xmm0, 0x2ea42b(%rip)   # 0x2f7590
movl %eax, 0x31ced9(%rip)    # 0x32a044
cmpl 0x31ced7(%rip), %eax    # 0x32a048
jne 0xd188
leal -0x1(%rax), %ecx
testl %eax, %eax
movl $0xf, %eax
cmovgl %ecx, %eax
movl %eax, 0x31cebe(%rip)    # 0x32a044
jmp 0xd194
cltq
leaq 0x31ce6f(%rip), %rcx    # 0x32a000
movl %edi, (%rcx,%rax,4)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: set_title_bar(int)
void set_title_bar(int why)
{
unsigned i;

   // set program title bar to the string szAppName
   // use executable file name and unit_file_name if no szAppName string.

   if((szAppName[0] == 0) && unit_file_name) {
      strcpy(szAppName, unit_file_name);  // the device name
      szAppName[32] = 0;
      strupr(szAppName);

      if(1) {   // include the executable file name
         strcat(szAppName, " - ");
         strcpy(out, exe_name);
         out[255-32-3] = 0;
         strcat(szAppName, out);
      }
   }

   for(i=0; i<strlen(szAppName); i++) {
      if(szAppName[i] == '_') szAppName[i] = ' ';
   }

   #ifdef WINDOWS
      SetWindowText(hWnd, &szAppName[0]);
   #endif

   #ifdef USE_X11
      init_screen(3498);
   #endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
cmpb $0x0, 0x13a1c2(%rip)    # 0x147c10
sete %al
movq 0x14d230(%rip), %rsi    # 0x15ac88
testq %rsi, %rsi
setne %cl
andb %al, %cl
leaq 0x13a1a9(%rip), %rbx    # 0x147c10
cmpb $0x1, %cl
jne 0xdabd
movq %rbx, %rdi
callq 0x9330
xorl %r15d, %r15d
movb %r15b, 0x13a1b2(%rip)   # 0x147c30
movq %rbx, %rdi
callq 0x988f
movq %rbx, %rdi
callq 0x9120
movl $0x202d20, (%rax,%rbx)  # imm = 0x202D20
leaq 0x318784(%rip), %r14    # 0x326220
leaq 0x31c33d(%rip), %rsi    # 0x329de0
movq %r14, %rdi
callq 0x9330
movb %r15b, 0x31884a(%rip)   # 0x3262fc
movq %rbx, %rdi
movq %r14, %rsi
callq 0x96c0
xorl %r14d, %r14d
movl %r14d, %r14d
movq %rbx, %rdi
callq 0x9120
cmpq %r14, %rax
jbe 0xdae1
cmpb $0x5f, (%r14,%rbx)
jne 0xdadc
movb $0x20, (%r14,%rbx)
incl %r14d
jmp 0xdac0
movl $0xdaa, %edi            # imm = 0xDAA
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xbc0b
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: character_width(unsigned char)
int character_width(u08 c)
{
int h,w;
int p;

   // get the width of a (mono-spaced) VFX font character

   if(dot_font == 0) dot_font = &h_font_12[0];
   if(c > 127) c = ' ';  // char out of range

   h = dot_font[8];      // char height

   p = (4*4) + (c*4);    // index of offset to char definition
   p = (dot_font[p+1] * 256) + dot_font[p+0];  // pointer to char definition
   w = dot_font[p];      // char width
   return w;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x31c3e8(%rip), %rax    # 0x329ee8
testq %rax, %rax
jne 0xdb13
leaq 0x12ecd4(%rip), %rax    # 0x13c7e0
movq %rax, 0x31c3d5(%rip)    # 0x329ee8
testb %dil, %dil
movzbl %dil, %ecx
movl $0x20, %edx
cmovnsl %ecx, %edx
movzbl %dl, %ecx
movzwl 0x10(%rax,%rcx,4), %ecx
movzbl (%rax,%rcx), %eax
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: line(int, int, int, int, unsigned char)
void line(COORD x1,COORD y1, COORD x2,COORD y2, u08 color)
{
   // draw a single pixel width line on the screen

   SWAPXY(x1,y1);
   SWAPXY(x2,y2);

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

   VFX_io_done = 1;
   VFX_line_draw(stage, x1,y1, x2,y2, LD_DRAW, palette[color]);
#endif


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

   set_x11_color(color);
   XDrawLine(display,win,gc, x1,y1, x2,y2);
   flush_x11();
#endif

#ifdef USE_SDL
   lineColor(display, x1,y1,x2,y2,get_sdl_color(color));
#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %edx, %r14d
movl %edi, %ebx
cmpl $0x0, 0x1f492e(%rip)    # 0x202828
je 0xdf18
movl 0x1f4902(%rip), %eax    # 0x202804
notl %esi
addl %eax, %esi
movl %ecx, 0x1f4920(%rip)    # 0x20282c
notl %ecx
addl %eax, %ecx
movl %esi, %r15d
movl %ecx, %r12d
jmp 0xdf23
movl %ebx, %r15d
movl %esi, %ebx
movl %r14d, %r12d
movl %ecx, %r14d
cmpq $0x0, 0x14cf95(%rip)    # 0x15aec0
je 0xdf64
movzbl %r8b, %edi
callq 0xd0e7
movq 0x14cf83(%rip), %rdi    # 0x15aec0
movq 0x14cf8c(%rip), %rsi    # 0x15aed0
movq 0x14cf95(%rip), %rdx    # 0x15aee0
movl %r14d, (%rsp)
movl %r15d, %ecx
movl %ebx, %r8d
movl %r12d, %r9d
callq 0x9630
movb $0x1, 0x14cf44(%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: dot(int, int, unsigned char)
void dot(int x, int y, u08 color)
{
   // draw a pixel on the screen

   SWAPXY(x,y);

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

   VFX_io_done = 1;
   VFX_pixel_write(stage, x,y, palette[color]);
#endif

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

   set_x11_color(color);
   XDrawPoint(display,win, gc, x,y);
   flush_x11();
#endif

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %esi, %ebx
movl %edi, %r14d
cmpl $0x0, 0x1f466e(%rip)    # 0x202828
je 0xe1d2
movl %ebx, 0x1f466a(%rip)    # 0x20282c
notl %ebx
movl %ebx, %eax
addl 0x1f4638(%rip), %eax    # 0x202804
movl %r14d, %ebx
movl %eax, %r14d
cmpq $0x0, 0x14cce6(%rip)    # 0x15aec0
je 0xe20b
movzbl %dl, %edi
callq 0xd0e7
movq 0x14ccd5(%rip), %rdi    # 0x15aec0
movq 0x14ccde(%rip), %rsi    # 0x15aed0
movq 0x14cce7(%rip), %rdx    # 0x15aee0
movl %r14d, %ecx
movl %ebx, %r8d
callq 0x9290
movb $0x1, 0x14cc9d(%rip)    # 0x15aea8
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: deg_char(int, int, unsigned char)
int deg_char(COORD row, COORD col, u08 color)
{
   // erase the old character cell (and probably a little extra)
   erase_rectangle(col,row, TEXT_WIDTH,TEXT_HEIGHT);

   // draw the degrees symbol (which is not in the normal font)
   dot(col+2, row+0, color);
   dot(col+3, row+0, color);
   dot(col+1, row+1, color);
   dot(col+4, row+1, color);
   dot(col+1, row+2, color);
   dot(col+4, row+2, color);
   dot(col+2, row+3, color);
   dot(col+3, row+3, color);

   return DEG_WIDTH;  // width
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movl %esi, %r15d
movl %edi, %r14d
movl 0x1f45e4(%rip), %edx    # 0x202810
movl 0x1f45e2(%rip), %ecx    # 0x202814
movl %esi, %edi
movl %r14d, %esi
callq 0xd0da
leal 0x2(%r15), %edi
movl %edi, -0x30(%rbp)
movl %r14d, %esi
movl %ebx, %edx
callq 0xe1a7
leal 0x3(%r15), %edi
movl %edi, -0x2c(%rbp)
movl %r14d, %esi
movl %ebx, %edx
callq 0xe1a7
leal 0x1(%r15), %r12d
leal 0x1(%r14), %r13d
movl %r12d, %edi
movl %r13d, %esi
movl %ebx, %edx
callq 0xe1a7
addl $0x4, %r15d
movl %r15d, %edi
movl %r13d, %esi
movl %ebx, %edx
callq 0xe1a7
leal 0x2(%r14), %r13d
movl %r12d, %edi
movl %r13d, %esi
movl %ebx, %edx
callq 0xe1a7
movl %r15d, %edi
movl %r13d, %esi
movl %ebx, %edx
callq 0xe1a7
addl $0x3, %r14d
movl -0x30(%rbp), %edi
movl %r14d, %esi
movl %ebx, %edx
callq 0xe1a7
movl -0x2c(%rbp), %edi
movl %r14d, %esi
movl %ebx, %edx
callq 0xe1a7
pushq $0x6
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: xthick_line(int, int, int, int, unsigned char, unsigned char)
void xthick_line(COORD x1,COORD y1,  COORD x2,COORD y2, u08 color, u08 thickness)
{
COORD x,y;

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

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

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

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

   // draw a text string using vector graphics characters

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

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movl %esi, %r14d
movl %edi, %r15d
cmpb $0x0, 0x1f41cb(%rip)    # 0x202868
jne 0xe6ba
incl %r15d
imull 0x1f416a(%rip), %r15d   # 0x202814
addl $0x2, %r14d
imull 0x1f415a(%rip), %r14d   # 0x202810
addl $0x2, %r15d
movl %r14d, 0x316cc7(%rip)   # 0x325388
movl %r15d, 0x316cbc(%rip)   # 0x325384
movzbl %dl, %r12d
pushq $0x1
popq %r13
movb (%rbx), %al
testb %al, %al
je 0xe709
movzbl %al, %r8d
movl %r14d, %edi
movl %r15d, %esi
movl %r13d, %edx
movl %r12d, %ecx
callq 0xdd47
movl 0x1fee4b(%rip), %eax    # 0x20d53c
cmpl $0x2, %eax
jge 0xe6fe
movl 0x1f4114(%rip), %eax    # 0x202810
jmp 0xe701
shll $0x3, %eax
incq %rbx
addl %eax, %r14d
jmp 0xe6d0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x1fee03(%rip), %r13d   # 0x20d53c
movl %esi, 0x1fedfd(%rip)    # 0x20d53c
movq %rcx, %rdi
callq 0x9120
movl 0x1f40b3(%rip), %ecx    # 0x202800
imull %r12d, %eax
shll $0x3, %eax
subl %eax, %ecx
movl %ecx, %eax
cltd
idivl 0x1f40b1(%rip)          # 0x202810
pushq $0x2
popq %rcx
cltd
idivl %ecx
movzbl %r14b, %edx
movl %r15d, %edi
movl %eax, %esi
movq %rbx, %rcx
callq 0xe67f
movl %r13d, 0x1fedbf(%rip)   # 0x20d53c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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
movl 0x1f401d(%rip), %edx    # 0x202800
movl 0x1f401b(%rip), %ecx    # 0x202804
xorl %edi, %edi
xorl %esi, %esi
callq 0xd0da
xorl %edi, %edi
callq 0xe8d9
andl $0x0, 0x316ac0(%rip)    # 0x3252c0
andl $0x0, 0x2e7f89(%rip)    # 0x2f6790
andl $0x0, 0x2e7f7e(%rip)    # 0x2f678c
pushq $0xa
popq %rdi
popq %rbp
jmp 0xc9736
// File: /workspace/github_cpp_makefile_star2_O2/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, 0x2e7f21(%rip)    # 0x2f67a8
movl 0x316b03(%rip), %esi    # 0x325390
movl 0x316af9(%rip), %ecx    # 0x32538c
jne 0xe8a0
leal (%rcx,%rsi), %eax
cmpl 0x1f3fde(%rip), %eax    # 0x20287c
jge 0xe8c3
movl 0x316aee(%rip), %edi    # 0x325394
movl %ecx, %edx
callq 0xd0da
movl $0x1, 0x316ae5(%rip)    # 0x32539c
movl $0x8, 0x316ae7(%rip)    # 0x3253a8
popq %rbp
retq
movl 0x1f3fbb(%rip), %edi    # 0x202884
addl 0x1f3fb1(%rip), %edi    # 0x202880
movl 0x1f3f2b(%rip), %edx    # 0x202800
subl %edi, %edx
jmp 0xe8a8
// File: /workspace/github_cpp_makefile_star2_O2/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 0x1f3ddc(%rip), %eax    # 0x2027d8
orl 0x21a556(%rip), %eax    # 0x228f58
jne 0xeaee
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, %ebx
movzbl 0x2e7d91(%rip), %eax    # 0x2f67a8
cmpl $0x50, %eax
je 0xea24
testl %eax, %eax
jne 0xeae8
movl 0x1f682a(%rip), %eax    # 0x205254
testl %eax, %eax
jle 0xea7f
movl 0x1f3e4c(%rip), %edx    # 0x202880
leal (%rdx,%rax), %edi
decl %edi
movl 0x1f3e3d(%rip), %ecx    # 0x20287c
leal 0x1(%rdx,%rax), %edx
pushq $0xf
popq %r8
movl %ecx, %esi
callq 0xdedf
movl 0x1f3e2c(%rip), %eax    # 0x202880
movl 0x1f67fa(%rip), %edx    # 0x205254
leal (%rdx,%rax), %edi
decl %edi
movl 0x1f3e17(%rip), %ecx    # 0x20287c
decl %ecx
addl %eax, %edx
incl %edx
movl %ecx, %esi
xorl %r8d, %r8d
callq 0xdedf
orl $-0x1, 0x1f67d8(%rip)   # 0x205254
pushq $-0x1
popq %rax
movl 0x1f67cb(%rip), %edx    # 0x205250
testl %edx, %edx
setle %cl
cmpl %eax, %edx
sete %al
orb %cl, %al
jne 0xeae8
movl 0x1f3de7(%rip), %eax    # 0x202880
leal (%rax,%rdx), %edi
decl %edi
movl 0x1f3dd8(%rip), %ecx    # 0x20287c
leal 0x1(%rax,%rdx), %edx
movzbl %bl, %ebx
movl %ecx, %esi
movl %ebx, %r8d
callq 0xdedf
movl 0x1f3dc5(%rip), %eax    # 0x202880
movl 0x1f678f(%rip), %edx    # 0x205250
leal (%rdx,%rax), %edi
decl %edi
movl 0x1f3db0(%rip), %ecx    # 0x20287c
decl %ecx
addl %eax, %edx
incl %edx
movl %ecx, %esi
movl %ebx, %r8d
callq 0xdedf
movl 0x1f676e(%rip), %eax    # 0x205250
movl %eax, 0x1f676c(%rip)    # 0x205254
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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, 0x1f3cdc(%rip)    # 0x2027d8
je 0xeb05
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movl %edi, %ebx
cmpq $0x400, 0x1f3dbe(%rip) # imm = 0x400
sete %cl
cmpl $0x0, 0x31b24c(%rip)    # 0x329d68
setne %al
orb %cl, %al
movl %eax, %ecx
xorb $0x1, %cl
testl %edi, %edi
setns %dl
orb %cl, %dl
jne 0xeb3a
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xe7d9
testl %ebx, %ebx
setns %cl
testb %al, %cl
jne 0xeafe
movzbl 0x2e7c5e(%rip), %eax    # 0x2f67a8
cmpl $0x50, %eax
je 0xeb53
testl %eax, %eax
jne 0xeafe
movl 0x1f3d27(%rip), %eax    # 0x202880
testl %eax, %eax
jle 0xeb7a
movl 0x1f3d19(%rip), %esi    # 0x20287c
movl 0x1f3c9b(%rip), %ecx    # 0x202804
subl %esi, %ecx
xorl %edi, %edi
movl %eax, %edx
callq 0xd0da
movl 0x1f3d06(%rip), %eax    # 0x202880
movl 0x1f3cfc(%rip), %esi    # 0x20287c
movl 0x1f3cfe(%rip), %edx    # 0x202884
movl 0x1f3c78(%rip), %ecx    # 0x202804
subl %esi, %ecx
movl %eax, %edi
callq 0xd0da
testl %ebx, %ebx
je 0xeafe
movl 0x1f3ce1(%rip), %edi    # 0x202884
addl 0x1f3cd7(%rip), %edi    # 0x202880
movl 0x1f3c51(%rip), %edx    # 0x202800
subl %edi, %edx
jle 0xeafe
movl 0x1f3cbf(%rip), %esi    # 0x20287c
movl 0x1f3c41(%rip), %ecx    # 0x202804
subl %esi, %ecx
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xd0da
// File: /workspace/github_cpp_makefile_star2_O2/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, 0x1f3c4d(%rip)    # 0x202828
je 0xebef
movl %eax, 0x1f3c49(%rip)    # 0x20282c
notl %eax
addl 0x1f3c19(%rip), %eax    # 0x202804
movl %eax, %esi
jmp 0xebf3
movl %edx, %esi
movl %eax, %edx
movq 0x31b356(%rip), %rdi    # 0x329f50
testq %rdi, %rdi
je 0xec28
pushq %rbp
movq %rsp, %rbp
callq *0x68(%rdi)
movq %rax, %rcx
leaq 0x14c370(%rip), %rdx    # 0x15af80
xorl %eax, %eax
cmpq $0x10, %rax
je 0xec2b
movl (%rdx), %esi
cmpq %rsi, %rcx
je 0xec2d
incq %rax
addq $0x4, %rdx
jmp 0xec12
xorl %eax, %eax
retq
xorl %eax, %eax
popq %rbp
retq