LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: star_sat_sec()
int star_sat_sec()
{
   // The Star receivers use two messages to get the sat info.  We don't want
   // to update the sat count plot during the period between the two messages
   // or else we get spikes on the sat count plot.
   //
   // Returns true if time is such that the sat count info might be invalid
   if(rcvr_type != STAR_RCVR) return 0;

   if(star_msg && star_line) {  // don't update sat table during faked seconds
      return 1;  // ... otherwise you get spikes on the sat count plot
   }

   // piss3
   if(pri_seconds == (SCPI_STATUS_SECOND+0)) {  // don't update sat table during sat info retreival
      return 1;  // ... otherwise you get spikes on the sat count plot
   }
   if(pri_seconds == (SCPI_STATUS_SECOND+1)) {  // don't update sat table during sat info retreival
      return 1;  // ... otherwise you get spikes on the sat count plot
   }
   return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x1ba40d(%rip), %rcx    # 0x2188d0
xorl %eax, %eax
cmpq $0x1000, (%rcx)         # imm = 0x1000
jne 0x5e4ff
leaq 0x1bcb27(%rip), %rax    # 0x21affc
cmpl $0x0, (%rax)
je 0x5e4eb
leaq 0x1bcb17(%rip), %rcx    # 0x21aff8
movl $0x1, %eax
cmpl $0x0, (%rcx)
jne 0x5e4ff
leaq 0x2af00e(%rip), %rax    # 0x30d500
movl (%rax), %ecx
andl $-0x2, %ecx
xorl %eax, %eax
cmpl $0x20, %ecx
sete %al
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: find_sat_changes()
void find_sat_changes()
{
int prn, j;
int sats_changed;

   // see if the satellite constellation has changed
   // Also converts sat_count from number of visible sats to tracked sats.

   for(prn=1; prn<=MAX_PRN; prn++) {  // save old tracking list
      last_const[prn] = this_const[prn];
      this_const[prn] = 0;
   }

   j = 0;
   sat_count = track_count = vis_count = 0;
   sats_changed = 0;
   for(prn=1; prn<=MAX_PRN; prn++) { 
      if(sat[prn].level_msg == 0x00) continue;
//    if(++j > max_sats) break;

      if(sat[prn].tracking > 0) {
         this_const[prn] = 1;
         if(last_const[prn] != this_const[prn]) ++sats_changed;
         ++sat_count;
         ++track_count;
         ++vis_count;
         have_count = 100;
      }
      else if(sat[prn].tracking < 0) {
         ++track_count;
      }
   }
   if(lte_lite && (have_sawtooth == 0)) sat_count = jackson_sat_count;

   if(sats_changed) {
      if(sat_count > SAT_COUNT_MASK) new_const = (SAT_COUNT_MASK | CONST_CHANGE);
      else                           new_const = (sat_count | CONST_CHANGE);
   }
}

// Assembly:
movl $0x1, %ecx
leaq 0x312013(%rip), %rax    # 0x370520
leaq 0x3123fc(%rip), %rsi    # 0x370910
movb (%rcx,%rax), %dl
movb %dl, (%rcx,%rsi)
movb $0x0, (%rcx,%rax)
incq %rcx
cmpq $0x3e8, %rcx            # imm = 0x3E8
jne 0x5e514
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
leaq 0x1e09c8(%rip), %rdi    # 0x23ef04
xorl %edx, %edx
movl %edx, (%rdi)
leaq 0x1e09b9(%rip), %r8     # 0x23ef00
movl %edx, (%r8)
leaq 0x1e09bb(%rip), %rcx    # 0x23ef0c
movl %edx, (%rcx)
movl $0x364, %r9d            # imm = 0x364
addq 0xf19e0(%rip), %r9      # 0x14ff40
movl $0x1, %r10d
leaq 0x2aedab(%rip), %r11    # 0x30d318
xorl %ebx, %ebx
xorl %r14d, %r14d
xorl %r15d, %r15d
cmpl $0x0, (%r9)
je 0x5e5ba
cmpl $0x0, 0x1fc(%r9)
jle 0x5e5b3
movb $0x1, (%r10,%rax)
xorl %r12d, %r12d
cmpb $0x1, (%r10,%rsi)
setne %r12b
addl %r12d, %edx
incl %r14d
movl %r14d, (%rcx)
incl %ebx
movl %ebx, (%r8)
incl %r15d
movl %r15d, (%rdi)
movl $0x64, (%r11)
jmp 0x5e5ba
jns 0x5e5ba
incl %ebx
movl %ebx, (%r8)
incq %r10
addq $0x348, %r9             # imm = 0x348
cmpq $0x3e8, %r10            # imm = 0x3E8
jne 0x5e575
leaq 0x1bc9fc(%rip), %rax    # 0x21afd0
cmpl $0x0, (%rax)
je 0x5e5f0
leaq 0x2aede4(%rip), %rax    # 0x30d3c4
cmpl $0x0, (%rax)
jne 0x5e5f0
leaq 0x1e0924(%rip), %rax    # 0x23ef10
movl (%rax), %eax
movl %eax, (%rcx)
testl %edx, %edx
je 0x5e614
movl (%rcx), %eax
movl %eax, %ecx
orl $0x800, %ecx            # imm = 0x800
cmpl $0x100, %eax            # imm = 0x100
movl $0x8ff, %eax            # imm = 0x8FF
cmovll %ecx, %eax
leaq 0x1e0936(%rip), %rcx    # 0x23ef48
movl %eax, (%rcx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: fmt_fp(int, int, int, int)
void fmt_fp(int v1,int v2,int v3,int v4)
{
unsigned char v[4];

   // debug routine for show showing four integers as a floating point value

   v[3] = v1;
   v[2] = v2;
   v[1] = v3;
   v[0] = v4;
   sprintf(plot_title, "%02X:%02X:%02X:%02X -> %f", v1,v2,v3,v4, *((float *) (void *) &v));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %ecx, %r9d
movl %edx, %r8d
movl %esi, %ecx
movl %edi, %eax
shll $0x18, %eax
movl $0xff, %edx
andl %edx, %esi
shll $0x10, %esi
orl %eax, %esi
movl %r8d, %eax
shll $0x8, %eax
movzwl %ax, %eax
orl %esi, %eax
andl %r9d, %edx
orl %eax, %edx
movd %edx, %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x2e01f7(%rip), %rax    # 0x33e850
leaq 0xc1ccb(%rip), %rsi     # 0x12032b
movl %edi, %edx
movq %rax, %rdi
movb $0x1, %al
popq %rbp
jmp 0x9060
// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: calc_msg_ofs()
void calc_msg_ofs()
{
double rcvr_jd;

   rcvr_jd = jd_utc;
   rcvr_jd *= (24.0*60.0*60.0*1000.0);  // convert Julian to milliseconds

   get_clock_time();   // the system clock time when the message arrived
   clk_jd *= (24.0*60.0*60.0*1000.0);
   if(1 || !fake_time_stamp) {
      msg_ofs = clk_jd - rcvr_jd;  // ffff offset from message time to time the message arrived
   }

   if(measure_jitter) {   // rrrrrr
      sprintf(plot_title, "rcvr-clock %d: %f  rcvr:%f  clk:%f  /tsx=%f", fake_time_stamp,msg_ofs, fmod(rcvr_jd,10000.0), fmod(clk_jd,10000.0), time_sync_offset);
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
leaq 0x2aeeb1(%rip), %rax    # 0x30d530
movsd (%rax), %xmm0
mulsd 0xbfa65(%rip), %xmm0    # 0x11e0f0
movsd %xmm0, -0x18(%rbp)
callq 0xa495
movsd -0x18(%rbp), %xmm0
leaq 0x2af03f(%rip), %r14    # 0x30d6e0
movsd 0xbfa47(%rip), %xmm1    # 0x11e0f0
mulsd (%r14), %xmm1
movsd %xmm1, (%r14)
subsd %xmm0, %xmm1
leaq 0x2af812(%rip), %rax    # 0x30ded0
movsd %xmm1, -0x20(%rbp)
movsd %xmm1, (%rax)
leaq 0x1de5fa(%rip), %rax    # 0x23ccc8
cmpl $0x0, (%rax)
je 0x5e737
leaq 0x2af016(%rip), %rax    # 0x30d6f0
movl (%rax), %ebx
movsd 0xaa9f4(%rip), %xmm1    # 0x1090d8
callq 0x94d0
movsd %xmm0, -0x18(%rbp)
movsd (%r14), %xmm0
movsd 0xaa9dd(%rip), %xmm1    # 0x1090d8
callq 0x94d0
movaps %xmm0, %xmm2
leaq 0x2af7be(%rip), %rax    # 0x30dec8
movsd (%rax), %xmm3
leaq 0x2e013b(%rip), %rdi    # 0x33e850
leaq 0xc1c29(%rip), %rsi     # 0x120345
movl %ebx, %edx
movsd -0x20(%rbp), %xmm0
movsd -0x18(%rbp), %xmm1
movb $0x4, %al
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x9060
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: send_tsip_start(unsigned char)
void send_tsip_start(u08 id)
{
   if(log_file && (log_stream & LOG_PACKET_START)) {
      fprintf(log_file, "\nSend tsip start %02X\n", id);
   }
// if(log_file && (log_stream & LOG_SENT_DATA)) fprintf(log_file, "send start: %02X\n", id); //wax 
   sts = 1;

   sendout(RCVR_PORT, DLE, ADD_CHAR);
   nvs_tx_crc = 0;
   send_byte(id);
   tsip_send_count = 2;

   if(id == 0x8E) superpacket = id;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %edi, %ebx
leaq 0x1dfc10(%rip), %rax    # 0x23e360
movq (%rax), %rdi
movzbl %bl, %r14d
testq %rdi, %rdi
je 0x5e779
leaq 0x1dfcad(%rip), %rax    # 0x23e410
testb $0x4, (%rax)
je 0x5e779
leaq 0xc1c02(%rip), %rsi     # 0x120371
movl %r14d, %edx
xorl %eax, %eax
callq 0x9560
movl $0x1, 0x311891(%rip)    # 0x370014
movl $0xa, %edi
movl $0x10, %esi
xorl %edx, %edx
callq 0xbcc0
movw $0x0, 0x30e367(%rip)    # 0x36cb04
movl %r14d, %edi
callq 0x591af
movl $0x2, 0x30d669(%rip)    # 0x36be18
cmpb $-0x72, %r14b
jne 0x5e7bb
movb %bl, 0x311855(%rip)     # 0x370010
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: send_tsip_end()
void send_tsip_end()
{
   if(log_file && (log_stream & LOG_SENT_DATA)) fprintf(log_file, "tsip end\n"); //wax 
   sendout(RCVR_PORT, DLE, ADD_CHAR);
   sendout(RCVR_PORT, ETX, EOM);  // sending last byte of a TSIP message
   tsip_send_count += 2;
   if(sim_file == 0) Sleep(20); 

   sts = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x1dfb95(%rip), %rax    # 0x23e360
movq (%rax), %rcx
testq %rcx, %rcx
je 0x5e7f5
leaq 0x1dfc36(%rip), %rax    # 0x23e410
testb $0x10, (%rax)
je 0x5e7f5
leaq 0xc1ba2(%rip), %rdi     # 0x120388
movl $0x9, %esi
movl $0x1, %edx
callq 0x9750
movl $0xa, %edi
movl $0x10, %esi
xorl %edx, %edx
callq 0xbcc0
movl $0xa, %edi
movl $0x3, %esi
movl $0x1, %edx
callq 0xbcc0
addl $0x2, 0x30d5f7(%rip)    # 0x36be18
leaq 0x1dfb98(%rip), %rax    # 0x23e3c0
cmpq $0x0, (%rax)
jne 0x5e838
movl $0x14, %edi
callq 0xaff7
movl $0x0, 0x3117d2(%rip)    # 0x370014
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: send_nvs_end()
void send_nvs_end()
{
u16 crc;

if(1) {  // send CRC
   crc = nvs_tx_crc;
   sendout(RCVR_PORT, DLE, ADD_CHAR);
   sendout(RCVR_PORT, 0xFF, ADD_CHAR);
   sendout(RCVR_PORT, crc & 0xFF, ADD_CHAR);
   sendout(RCVR_PORT, (crc/256) & 0xFF, ADD_CHAR);
}

   sendout(RCVR_PORT, DLE, ADD_CHAR);
   sendout(RCVR_PORT, ETX, EOM);  // sending last byte of a TSIP message to an NVS receiver
   tsip_send_count += 2;
   if(sim_file == 0) Sleep(50);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movzwl 0x30e2b3(%rip), %ebx    # 0x36cb04
movl $0xa, %edi
movl $0x10, %esi
xorl %edx, %edx
callq 0xbcc0
movl $0xa, %edi
movl $0xff, %esi
xorl %edx, %edx
callq 0xbcc0
movzbl %bl, %esi
movl $0xa, %edi
xorl %edx, %edx
callq 0xbcc0
shrl $0x8, %ebx
movl $0xa, %edi
movl %ebx, %esi
xorl %edx, %edx
callq 0xbcc0
movl $0xa, %edi
movl $0x10, %esi
xorl %edx, %edx
callq 0xbcc0
movl $0xa, %edi
movl $0x3, %esi
movl $0x1, %edx
callq 0xbcc0
addl $0x2, 0x30d559(%rip)    # 0x36be18
leaq 0x1dfafa(%rip), %rax    # 0x23e3c0
cmpq $0x0, (%rax)
je 0x5e8d3
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movl $0x32, %edi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xaff7
// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: send_ascii_string(char*, int)
void send_ascii_string(char *s, int add_crlf)
{
   if(s) {
      send_nmea_string(s, 0);
   }

   if(add_crlf) {
      send_byte(0x0D);
      eom_flag = EOM;
      send_byte(0x0A);
      eom_flag = ADD_CHAR;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %esi, %ebx
testq %rdi, %rdi
je 0x5e8f7
xorl %esi, %esi
callq 0x5e92a
testl %ebx, %ebx
je 0x5e923
movl $0xd, %edi
callq 0x591af
movl $0x1, 0x30d501(%rip)    # 0x36be10
movl $0xa, %edi
callq 0x591af
movl $0x0, 0x30d4ed(%rip)    # 0x36be10
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: send_nmea_string(char*, int)
void send_nmea_string(char *s, int comma)
{
int i, j;

   if(s == 0) return;

   j = strlen(s);
   for(i=0; i<j; i++) send_byte((u08) s[i]);

   if(comma) send_byte((u08) ',');
}

// Assembly:
testq %rdi, %rdi
je 0x5e97e
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
callq 0x9120
movq %rax, %r15
testl %r15d, %r15d
jle 0x5e968
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
xorl %r12d, %r12d
movzbl (%r14,%r12), %edi
callq 0x591af
incq %r12
cmpq %r12, %r15
jne 0x5e956
testl %ebx, %ebx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
je 0x5e97e
movl $0x2c, %edi
jmp 0x591af
retq
// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: send_acron_cmd(char*)
void send_acron_cmd(char *s)
{
int i, j;

   if(s == 0) return;
   
   j = strlen(s);
   if(j) this_acron_cmd = toupper(s[j-1]);
   else  this_acron_cmd = 0;
//if(debug_file) fprintf(debug_file, "send acron cmd:[%s]  len:%d  cmd:%c\n", s, j, this_acron_cmd);

   for(i=0; i<j; i++) {
      send_acron_byte((u08) s[i]);
   }

   send_acron_byte((u08) 0x0D);

//if(debug_file) fprintf(debug_file, "this_acron_cmd: %c\n", this_acron_cmd);

   if(FAKE_ACRON_RCVR) {
      if(this_acron_cmd == 'O') {
         get_clock_time();   // get system clock time in UTC
         sprintf(out, "%02d%02d%02d6%02d%02d%02d47\r", clk_hours,clk_minutes,clk_seconds,
         clk_day,clk_month,clk_year-2000);
         strcpy((char *) &com[RCVR_PORT].rcv_buffer[0], (char *) out);
         com[RCVR_PORT].next_rcv_byte = 0;
         com[RCVR_PORT].rcv_byte_count = 16;
      }
      else if(this_acron_cmd == 'G') {
         sprintf(out, "1%c\r", '0'+(pri_minutes%6));
         strcpy((char *) &com[RCVR_PORT].rcv_buffer[0], (char *) out);
         com[RCVR_PORT].next_rcv_byte = 0;
         com[RCVR_PORT].rcv_byte_count = 3;
      }
      else if(this_acron_cmd == 'H') {  // receiver sync request
      }
   }
}

// Assembly:
testq %rdi, %rdi
je 0x5ee14
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x9120
movq %rax, %r14
testl %r14d, %r14d
je 0x5ee15
leal -0x1(%r14), %eax
cltq
movsbl (%rbx,%rax), %edi
callq 0x9700
jmp 0x5ee17
retq
xorl %eax, %eax
movb %al, 0x30de0f(%rip)     # 0x36cc2c
testl %r14d, %r14d
jle 0x5ee3e
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
xorl %r15d, %r15d
movzbl (%rbx,%r15), %edi
callq 0xa5a3d
incq %r15
cmpq %r15, %r14
jne 0x5ee2c
movl $0xd, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xa5a3d
// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: queue_polled_cmd(char*, int)
void queue_polled_cmd(char *s, int id)
{
static int last_id = 0;

   // add a command to a queue of messages to send to the receiver.  SCPI 
   // receivers are REALLY dumb and not designed for talking to computer
   // programs.  Their responses to messages have NO indication of what
   // request the response is from.  If responses get out of sync with
   // requests, you a SCREWED!
   if((id == STAR_CONF_MSG) && (last_id == STAR_CONF_MSG)) {
      return;
   }
   last_id = id;
   brandy_msg_id = id;

   strcpy(polled_q[polled_q_in].msg, s);
   polled_q[polled_q_in].id = id;
   ++polled_q_entries;
   if(++polled_q_in >= POLLED_Q_SIZE) polled_q_in = 0;

if(debug_file) fprintf(debug_file,   "\nQ SCPI id:%d  sqe:%d  in:%d out:%d: %s\n", id, polled_q_entries, polled_q_in,polled_q_out, s);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
cmpl $0xca, %esi
jne 0x5ee7d
cmpl $0xca, 0x313061(%rip)   # 0x371ed8
je 0x5ef04
movl %ebx, 0x313055(%rip)    # 0x371ed8
movl %ebx, 0x313003(%rip)    # 0x371e8c
movslq 0x311140(%rip), %r15    # 0x36ffd0
movq %r15, %rax
shlq $0x7, %rax
leaq (%rax,%r15,4), %r12
leaq 0x30dd9e(%rip), %r13    # 0x36cc40
leaq (%r12,%r13), %rdi
movq %r14, %rsi
callq 0x9340
movl %ebx, 0x80(%r13,%r12)
movl 0x31111c(%rip), %ecx    # 0x36ffd8
incl %ecx
leal 0x1(%r15), %eax
xorl %r8d, %r8d
cmpq $0x63, %r15
movl %ecx, 0x311109(%rip)    # 0x36ffd8
cmovll %eax, %r8d
movl %r8d, 0x3110f6(%rip)    # 0x36ffd0
leaq 0x1df4af(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x5ef04
movl 0x3110e4(%rip), %r9d    # 0x36ffd4
movq %r14, (%rsp)
leaq 0xc62f6(%rip), %rsi     # 0x1251f1
movl %ebx, %edx
xorl %eax, %eax
callq 0x9560
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: send_esip_cmd(char*)
void send_esip_cmd(char *s)
{
int p;

   if(s == 0) return;

   if(debug_file) fprintf(debug_file, "Sent eSIP:%s\n", s);

   send_nmea_start();
   if(s[0] == '$')    send_nmea_string(&s[1], 0);
   else               send_nmea_string(&s[0], 0);
   if(strchr(s, '*')) send_nmea_end(0);
   else               send_nmea_end(1);

   if(ESIP_SLEEP) Sleep(ESIP_SLEEP);

   s = strstr(s, "PERDCFG,UART1");  // baud rate change command was just sent
   if(s) {  // adjust com port setting
      Sleep(1000);
      s += 14;   // skip over the command and get the baud rate
      p = atoi(s);

      if     (p == 4800) ;
      else if(p == 9600) ;
      else if(p == 19200) ;
      else if(p == 38400) ;
      else if(p == 57600) ;
      else if(p == 115200) ;
      else if(p == 230400) ;
      else p = 0;
      if(p) {
         have_doppler = 0;
         have_range = 0;
         com[RCVR_PORT].baud_rate = p;
         init_com(RCVR_PORT, 100);
         Sleep(800);
         need_redraw = 9600;
         init_receiver(9600, 0);   // setup the receiver
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x5f069
movq %rdi, %rbx
leaq 0x1df464(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x5ef45
leaq 0xc1546(%rip), %rsi     # 0x120481
movq %rbx, %rdx
xorl %eax, %eax
callq 0x9560
movl $0xa, %edi
movl $0x24, %esi
xorl %edx, %edx
callq 0xbcc0
movb $0x0, 0x30db59(%rip)    # 0x36cab6
xorl %edi, %edi
cmpb $0x24, (%rbx)
sete %dil
addq %rbx, %rdi
xorl %esi, %esi
callq 0x5e92a
movq %rbx, %rdi
movl $0x2a, %esi
callq 0x9100
xorl %edi, %edi
testq %rax, %rax
sete %dil
callq 0x5f541
leaq 0xc14fd(%rip), %rsi     # 0x12048f
movq %rbx, %rdi
callq 0x9090
testq %rax, %rax
je 0x5f069
movq %rax, %rbx
movl $0x3e8, %edi            # imm = 0x3E8
callq 0xaff7
addq $0xe, %rbx
movq %rbx, %rdi
callq 0x95e0
cmpl $0x12c0, %eax           # imm = 0x12C0
setne %cl
cmpl $0x2580, %eax           # imm = 0x2580
setne %dil
cmpl $0x4b00, %eax           # imm = 0x4B00
setne %r8b
cmpl $0x9600, %eax           # imm = 0x9600
setne %dl
cmpl $0xe100, %eax           # imm = 0xE100
setne %r9b
cmpl $0x1c200, %eax          # imm = 0x1C200
setne %r10b
cmpl $0x38400, %eax          # imm = 0x38400
setne %sil
testl %eax, %eax
je 0x5f069
andb %dil, %cl
andb %r8b, %dl
andb %cl, %dl
andb %r9b, %r10b
andb %r10b, %sil
andb %dl, %sil
jne 0x5f069
leaq 0x2ae329(%rip), %rcx    # 0x30d340
xorl %edx, %edx
movl %edx, (%rcx)
leaq 0x2ae326(%rip), %rcx    # 0x30d348
movl %edx, (%rcx)
leaq 0x2af2b5(%rip), %rcx    # 0x30e2e0
movl %eax, 0x159d0(%rcx)
movl $0xa, %edi
movl $0x64, %esi
callq 0xb49f
movl $0x320, %edi            # imm = 0x320
callq 0xaff7
leaq 0x1b97f3(%rip), %rax    # 0x218844
movl $0x2580, (%rax)         # imm = 0x2580
movl $0x2580, %edi           # imm = 0x2580
xorl %esi, %esi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x5fc8f
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: send_furuno_cmd(char*)
void send_furuno_cmd(char *s)
{
   if(s == 0) return;


   send_nmea_start();
   if(strstr(s, "PFEC") || (strstr(s, "pfec"))) {
      if(s[0] == '$') {
         if(debug_file) fprintf(debug_file, "Sent1 furuno:$%s\n", &s[1]);
         send_nmea_string(&s[1], 0);
      }
      else {
         if(debug_file) fprintf(debug_file, "Sent2 furuno:$%s\n", &s[0]);
         send_nmea_string(&s[0], 0);
      }
   }
   else {
      if(s[0] == '$') {
         if(debug_file) fprintf(debug_file, "Sent3 furuno:%s\n", &s[0]);
         send_nmea_string(&s[1], 0);
      }
      else {
         if(debug_file) fprintf(debug_file, "Sent furuno:$PFEC,%s\n", &s[0]);
         send_nmea_string("PFEC,", 0);
         send_nmea_string(&s[0], 0);
      }
   }

send_nmea_end(0);  // !!!!! don't send checksums
return;
   if(strchr(s, '*')) send_nmea_end(0);
   else               send_nmea_end(1);
}

// Assembly:
testq %rdi, %rdi
je 0x5f0e9
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0xa, %edi
movl $0x24, %esi
xorl %edx, %edx
callq 0xbcc0
movb $0x0, 0x30da20(%rip)    # 0x36cab6
leaq 0xcb93a(%rip), %rsi     # 0x12a9d7
movq %rbx, %rdi
callq 0x9090
testq %rax, %rax
jne 0x5f0be
leaq 0xc13ec(%rip), %rsi     # 0x12049d
movq %rbx, %rdi
callq 0x9090
testq %rax, %rax
je 0x5f102
cmpb $0x24, (%rbx)
leaq 0x1df2c8(%rip), %rax    # 0x23e390
movq (%rax), %rdi
jne 0x5f0ea
testq %rdi, %rdi
je 0x5f0e4
leaq 0x1(%rbx), %rdx
leaq 0xc13c5(%rip), %rsi     # 0x1204a2
xorl %eax, %eax
callq 0x9560
incq %rbx
jmp 0x5f146
retq
testq %rdi, %rdi
je 0x5f146
leaq 0xc13be(%rip), %rsi     # 0x1204b4
movq %rbx, %rdx
xorl %eax, %eax
callq 0x9560
jmp 0x5f146
cmpb $0x24, (%rbx)
leaq 0x1df284(%rip), %rax    # 0x23e390
movq (%rax), %rdi
jne 0x5f122
testq %rdi, %rdi
je 0x5f0e4
leaq 0xc13a9(%rip), %rsi     # 0x1204c6
movq %rbx, %rdx
jmp 0x5f0dd
testq %rdi, %rdi
je 0x5f138
leaq 0xc13a9(%rip), %rsi     # 0x1204d7
movq %rbx, %rdx
xorl %eax, %eax
callq 0x9560
leaq 0xc13ae(%rip), %rdi     # 0x1204ed
xorl %esi, %esi
callq 0x5e92a
movq %rbx, %rdi
xorl %esi, %esi
callq 0x5e92a
xorl %edi, %edi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x5f541
// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: send_nmea_cmd(char*)
void send_nmea_cmd(char *s)
{
   if(s == 0) return;

   if(log_file && (log_stream & LOG_PACKET_START)) {
      fprintf(log_file, "\nSend nmea cmd: %s\n", s);
   }

   send_nmea_start();
   if(s[0] == '$')    send_nmea_string(&s[1], 0);
   else               send_nmea_string(&s[0], 0);
   if(strchr(s, '*')) send_nmea_end(0);
   else               send_nmea_end(1);
}

// Assembly:
testq %rdi, %rdi
je 0x5f1e7
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x1df1ea(%rip), %rax    # 0x23e360
movq (%rax), %rdi
testq %rdi, %rdi
je 0x5f19b
leaq 0x1df28b(%rip), %rax    # 0x23e410
testb $0x4, (%rax)
je 0x5f19b
leaq 0xc1276(%rip), %rsi     # 0x120407
movq %rbx, %rdx
xorl %eax, %eax
callq 0x9560
movl $0xa, %edi
movl $0x24, %esi
xorl %edx, %edx
callq 0xbcc0
movb $0x0, 0x30d903(%rip)    # 0x36cab6
xorl %edi, %edi
cmpb $0x24, (%rbx)
sete %dil
addq %rbx, %rdi
xorl %esi, %esi
callq 0x5e92a
movq %rbx, %rdi
movl $0x2a, %esi
callq 0x9100
xorl %edi, %edi
testq %rax, %rax
sete %dil
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x5f541
retq
// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: send_tm4_cmd(char*)
void send_tm4_cmd(char *s)
{
   // Spectrum TM4

   if(s == 0) return;

   if(log_file && (log_stream & LOG_PACKET_START)) {
      fprintf(log_file, "\nSend TM4 cmd: %s\n", s);
   }
if(debug_file) fprintf(debug_file, "\nSend TM4 cmd: %s\n", s);

   sendout(RCVR_PORT, '#', ADD_CHAR);
   if(s[0] == '#')    send_nmea_string(&s[1], 0);
   else               send_nmea_string(&s[0], 0);
   sendout(RCVR_PORT, 0x0D, ADD_CHAR);
   sendout(RCVR_PORT, 0x0A, EOM);

   if(TM4_SLEEP) Sleep(TM4_SLEEP);
}

// Assembly:
testq %rdi, %rdi
je 0x5f29f
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x1df15f(%rip), %rax    # 0x23e360
movq (%rax), %rdi
testq %rdi, %rdi
je 0x5f226
leaq 0x1df200(%rip), %rax    # 0x23e410
testb $0x4, (%rax)
je 0x5f226
leaq 0xc1212(%rip), %rsi     # 0x12042e
movq %rbx, %rdx
xorl %eax, %eax
callq 0x9560
leaq 0x1df163(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x5f246
leaq 0xc11f2(%rip), %rsi     # 0x12042e
movq %rbx, %rdx
xorl %eax, %eax
callq 0x9560
movl $0xa, %edi
movl $0x23, %esi
xorl %edx, %edx
callq 0xbcc0
xorl %edi, %edi
cmpb $0x23, (%rbx)
sete %dil
addq %rbx, %rdi
xorl %esi, %esi
callq 0x5e92a
movl $0xa, %edi
movl $0xd, %esi
xorl %edx, %edx
callq 0xbcc0
movl $0xa, %edi
movl $0xa, %esi
movl $0x1, %edx
callq 0xbcc0
movl $0x32, %edi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xaff7
retq
// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: send_true_cmd(char*)
void send_true_cmd(char *s)
{
int i, j;

   if(s == 0) return;

   if(s[0] != '$') {
      sendout(RCVR_PORT, '$', ADD_CHAR);
   }

   j = strlen(s);
   for(i=0; i<j; i++) send_byte((u08) s[i]);

   sendout(RCVR_PORT, 0x0D, ADD_CHAR);
   sendout(RCVR_PORT, 0x0A, EOM);

   if(sim_file == 0) Sleep(50);
}

// Assembly:
testq %rdi, %rdi
je 0x5f335
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpb $0x24, (%rdi)
je 0x5f2cc
movl $0xa, %edi
movl $0x24, %esi
xorl %edx, %edx
callq 0xbcc0
movq %rbx, %rdi
callq 0x9120
movq %rax, %r14
testl %r14d, %r14d
jle 0x5f2f8
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
xorl %r15d, %r15d
movzbl (%rbx,%r15), %edi
callq 0x591af
incq %r15
cmpq %r15, %r14
jne 0x5f2e6
movl $0xa, %edi
movl $0xd, %esi
xorl %edx, %edx
callq 0xbcc0
movl $0xa, %edi
movl $0xa, %esi
movl $0x1, %edx
callq 0xbcc0
leaq 0x1df09c(%rip), %rax    # 0x23e3c0
cmpq $0x0, (%rax)
leaq 0x8(%rsp), %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
je 0x5f336
retq
movl $0x32, %edi
jmp 0xaff7
// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: send_z12_cmd(char*)
void send_z12_cmd(char *s)
{
   // Ashtech Z12

   if(s == 0) return;

   if(log_file && (log_stream & LOG_PACKET_START)) {
      fprintf(log_file, "\nSend Z12 cmd: %s\n", s);
   }
if(debug_file) fprintf(debug_file, "\nSend Z12 cmd: %s\n", s);

   send_nmea_start();
   if(s[0] == '$')    send_nmea_string(&s[1], 0);
   else               send_nmea_string(&s[0], 0);
   if(strchr(s, '*')) send_nmea_end(0);
   else               send_nmea_end(1);

   if(Z12_SLEEP) Sleep(Z12_SLEEP);
}

// Assembly:
testq %rdi, %rdi
je 0x5f3f4
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x1df007(%rip), %rax    # 0x23e360
movq (%rax), %rdi
testq %rdi, %rdi
je 0x5f37e
leaq 0x1df0a8(%rip), %rax    # 0x23e410
testb $0x4, (%rax)
je 0x5f37e
leaq 0xc10a7(%rip), %rsi     # 0x12041b
movq %rbx, %rdx
xorl %eax, %eax
callq 0x9560
leaq 0x1df00b(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x5f39e
leaq 0xc1087(%rip), %rsi     # 0x12041b
movq %rbx, %rdx
xorl %eax, %eax
callq 0x9560
movl $0xa, %edi
movl $0x24, %esi
xorl %edx, %edx
callq 0xbcc0
movb $0x0, 0x30d700(%rip)    # 0x36cab6
xorl %edi, %edi
cmpb $0x24, (%rbx)
sete %dil
addq %rbx, %rdi
xorl %esi, %esi
callq 0x5e92a
movq %rbx, %rdi
movl $0x2a, %esi
callq 0x9100
xorl %edi, %edi
testq %rax, %rax
sete %dil
callq 0x5f541
movl $0x32, %edi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xaff7
retq
// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: send_ubx_start(unsigned short, int)
void send_ubx_start(u16 ubx_cmd, int len)
{
   if(log_file && (log_stream & LOG_PACKET_START)) {
      fprintf(log_file, "\nSend UBX start %04X  len:%d+6\n", ubx_cmd, len);
   }
   if(1 && debug_file) {  //plugh
      fprintf(debug_file, "Sent UBX start %04X  len:%d+6\n", ubx_cmd, len);
   }

   // start sending a ublox message
   sendout(RCVR_PORT, 0xB5, ADD_CHAR);  // send message start code
   sendout(RCVR_PORT, 0x62, ADD_CHAR);
   ubx_txa = ubx_txb = 0; // init transmit checksum bytes

   send_byte((ubx_cmd >> 8) & 0xFF);  // send message class
   send_byte(ubx_cmd & 0xFF);         // send message identifier

   send_byte((len % 256) & 0xFF);     // send message length
   send_byte((len/256) & 0xFF);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movl %edi, %eax
leaq 0x1def56(%rip), %rcx    # 0x23e360
movq (%rcx), %rdi
movzwl %ax, %r14d
testq %rdi, %rdi
je 0x5f435
leaq 0x1deff3(%rip), %rax    # 0x23e410
testb $0x4, (%rax)
je 0x5f435
leaq 0xc0f9f(%rip), %rsi     # 0x1203c8
movl %r14d, %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x9560
leaq 0x1def54(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x5f457
leaq 0xc0f9d(%rip), %rsi     # 0x1203e8
movl %r14d, %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x9560
xorl %r15d, %r15d
movl $0xa, %edi
movl $0xb5, %esi
xorl %edx, %edx
callq 0xbcc0
movl $0xa, %edi
movl $0x62, %esi
xorl %edx, %edx
callq 0xbcc0
movb %r15b, 0x30d5f6(%rip)   # 0x36ca79
movb %r15b, 0x30d5ee(%rip)   # 0x36ca78
movl %r14d, %edi
shrl $0x8, %edi
callq 0x591af
movl $0xff, %r15d
andl %r15d, %r14d
movl %r14d, %edi
callq 0x591af
movl %ebx, %edi
andl %r15d, %edi
callq 0x591af
leal (%rbx,%r15), %edi
testl %ebx, %ebx
cmovnsl %ebx, %edi
shrl $0x8, %edi
andl %r15d, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x591af
// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: send_ubx_end()
void send_ubx_end()
{
u08 a,b;

   // end the ublox message
   a = ubx_txa;  // transmitted message checksum
   b = ubx_txb;
   sendout(RCVR_PORT, a, ADD_CHAR);  // send checksum
   sendout(RCVR_PORT, b, EOM);

   if(sim_file == 0) Sleep(50);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movzbl 0x30d59d(%rip), %esi    # 0x36ca78
movzbl 0x30d597(%rip), %ebx    # 0x36ca79
movl $0xa, %edi
xorl %edx, %edx
callq 0xbcc0
movl $0xa, %edi
movl %ebx, %esi
movl $0x1, %edx
callq 0xbcc0
leaq 0x1deeba(%rip), %rax    # 0x23e3c0
cmpq $0x0, (%rax)
je 0x5f513
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movl $0x32, %edi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xaff7
// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: send_nmea_end(int)
void send_nmea_end(int do_cksum)
{
char cksum[10];

   sprintf(cksum, "%02X", (nmea_tx_cksum & 0xFF));

   if(rcvr_type == ZYFER_RCVR) {
      sendout(RCVR_PORT, '*', ADD_CHAR);
   }
   else if(do_cksum) {
      sendout(RCVR_PORT, '*', ADD_CHAR);
      sendout(RCVR_PORT, cksum[0], ADD_CHAR);
      sendout(RCVR_PORT, cksum[1], ADD_CHAR);
   }
   sendout(RCVR_PORT, 0x0D, ADD_CHAR);
   sendout(RCVR_PORT, 0x0A, EOM);

   if(sim_file == 0) Sleep(50);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x18, %rsp
movl %edi, %ebx
movzbl 0x30d563(%rip), %edx    # 0x36cab6
leaq 0xcb456(%rip), %rsi     # 0x12a9b0
leaq -0x12(%rbp), %rdi
xorl %eax, %eax
callq 0x9060
leaq 0x1b9364(%rip), %rcx    # 0x2188d0
movb $0x2a, %al
cmpq $0x100000, (%rcx)       # imm = 0x100000
je 0x5f59f
testl %ebx, %ebx
je 0x5f5ae
movl $0xa, %edi
movl $0x2a, %esi
xorl %edx, %edx
callq 0xbcc0
movzbl -0x12(%rbp), %esi
movl $0xa, %edi
xorl %edx, %edx
callq 0xbcc0
movb -0x11(%rbp), %al
movzbl %al, %esi
movl $0xa, %edi
xorl %edx, %edx
callq 0xbcc0
movl $0xa, %edi
movl $0xd, %esi
xorl %edx, %edx
callq 0xbcc0
movl $0xa, %edi
movl $0xa, %esi
movl $0x1, %edx
callq 0xbcc0
leaq 0x1dede6(%rip), %rax    # 0x23e3c0
cmpq $0x0, (%rax)
je 0x5f5e7
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
movl $0x32, %edi
addq $0x18, %rsp
popq %rbx
popq %rbp
jmp 0xaff7
// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: send_fan_cmd(char*)
void send_fan_cmd(char *s)
{
int i, j;
unsigned port;

   // send a command to the temperature control device

   if(s == 0) return;
   port = fan_port;

   if((com[port].process_com == 0) || (com[port].com_running <= 0)) {  // fan port not open
      if(enviro_mode() && (enviro_type == HEATHER_ENVIRO)) {  // Heather environmental sensor in use
         if(rcvr_type == THERMO_RCVR) port = RCVR_PORT;
         else                         port = THERMO_PORT;
         if((com[port].process_com == 0) || (com[port].com_running <= 0)) return;  // sensor not running
      }
      else return;
   }

   j = strlen(s);
   for(i=0; i<j; i++) sendout(port,(u08) s[i], ADD_CHAR);
   sendout(port, 0x0D, ADD_CHAR);
   sendout(port, 0x0A, EOM);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testq %rdi, %rdi
je 0x5f73a
movq %rdi, %rbx
leaq 0x2aecb1(%rip), %rax    # 0x30e2cc
movl (%rax), %r14d
imulq $0x2260, %r14, %rcx     # imm = 0x2260
leaq 0x2aecb4(%rip), %rax    # 0x30e2e0
cmpl $0x0, 0x2234(%rax,%rcx)
je 0x5f646
addq %rax, %rcx
cmpl $0x0, 0x2230(%rcx)
jg 0x5f6e0
leaq 0x1b9283(%rip), %rcx    # 0x2188d0
movq (%rcx), %rcx
cmpq $0x80000, %rcx          # imm = 0x80000
sete %dl
cmpl $0x0, 0x225d4(%rax)
setne %sil
cmpl $0x0, 0x225d0(%rax)
setg %dil
andb %sil, %dil
leaq 0x1c3f92(%rip), %rsi    # 0x22360c
cmpl $0x0, (%rsi)
setne %sil
cmpl $0x0, 0x225cc(%rax)
setne %r8b
andb %sil, %r8b
orb %dil, %r8b
orb %dl, %r8b
cmpb $0x1, %r8b
jne 0x5f73a
leaq 0x1b926e(%rip), %rdx    # 0x218914
cmpl $0x2, (%rdx)
jne 0x5f73a
xorl %edx, %edx
cmpq $0x80000, %rcx          # imm = 0x80000
setne %dl
leal (%rdx,%rdx,4), %r14d
addl $0xa, %r14d
imulq $0x2260, %r14, %rcx     # imm = 0x2260
cmpl $0x0, 0x2234(%rax,%rcx)
je 0x5f73a
addq %rcx, %rax
cmpl $0x0, 0x2230(%rax)
jle 0x5f73a
movq %rbx, %rdi
callq 0x9120
movq %rax, %r15
testl %r15d, %r15d
jle 0x5f711
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
xorl %r12d, %r12d
movzbl (%rbx,%r12), %esi
movl %r14d, %edi
xorl %edx, %edx
callq 0xbcc0
incq %r12
cmpq %r12, %r15
jne 0x5f6fa
movl %r14d, %edi
movl $0xd, %esi
xorl %edx, %edx
callq 0xbcc0
movl %r14d, %edi
movl $0xa, %esi
movl $0x1, %edx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xbcc0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: enviro_mode()
int enviro_mode()
{
int i;

   // returns true if external envidonmental sensor in use
   
   i = 0x00;
   if(rcvr_type == THERMO_RCVR) i |= 0x01;
   if(enviro_port_open()) i |= 0x02;
// if(com[THERMO_PORT].port_used > 0) i |= 0x04;  //lfs
   if(sim_file_read && (com[THERMO_PORT].port_used)) i |= 0x80;
   return i;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x1b9182(%rip), %rax    # 0x2188d0
xorl %ecx, %ecx
cmpq $0x80000, (%rax)        # imm = 0x80000
sete %cl
leaq 0x2aeb7f(%rip), %rdx    # 0x30e2e0
leal 0x2(%rcx), %esi
cmpl $0x0, 0x225d0(%rdx)
cmovlel %ecx, %esi
cmpl $0x0, 0x225d4(%rdx)
cmovel %ecx, %esi
leaq 0x1c3e8d(%rip), %rcx    # 0x22360c
leal 0x80(%rsi), %eax
cmpl $0x0, 0x225cc(%rdx)
cmovel %esi, %eax
cmpl $0x0, (%rcx)
cmovel %esi, %eax
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: send_sirf_start(unsigned short, int)
void send_sirf_start(u16 sirf_cmd, int len)
{
   // start sending a Sirf message
   if(log_file && (log_stream & LOG_PACKET_START)) {
      fprintf(log_file, "\nSend sirf start %04X  len:%d\n", sirf_cmd, len);
   }

   sendout(RCVR_PORT, 0xA0, ADD_CHAR); // send message start code
   sendout(RCVR_PORT, 0xA2, ADD_CHAR);

   send_byte((len / 256) & 0xFF);  // send message length
   send_byte((len % 256) & 0xFF); 

   sirf_tx_cksum = 0; // init transmit checksum bytes

   send_byte(sirf_cmd & 0xFF);  // send message id
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r14d
movl %edi, %ebx
leaq 0x1de8b3(%rip), %rax    # 0x23e360
movq (%rax), %rdi
testq %rdi, %rdi
je 0x5fad5
leaq 0x1de954(%rip), %rax    # 0x23e410
testb $0x4, (%rax)
je 0x5fad5
movzwl %bx, %edx
leaq 0xc4c9e(%rip), %rsi     # 0x124769
movl %r14d, %ecx
xorl %eax, %eax
callq 0x9560
movl $0xa, %edi
movl $0xa0, %esi
xorl %edx, %edx
callq 0xbcc0
movl $0xa, %edi
movl $0xa2, %esi
xorl %edx, %edx
callq 0xbcc0
movl $0xff, %r15d
leal (%r14,%r15), %edi
testl %r14d, %r14d
cmovnsl %r14d, %edi
shrl $0x8, %edi
andl %r15d, %edi
callq 0x591af
andl %r15d, %r14d
movl %r14d, %edi
callq 0x591af
movw $0x0, 0x30cfcd(%rip)    # 0x36caf4
andl %r15d, %ebx
movl %ebx, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x591af
// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: send_sirf_end()
void send_sirf_end()
{
u16 cksum;

   // end the sirf message
   cksum = sirf_tx_cksum;
   cksum &= 0x7FFF;
   sendout(RCVR_PORT, cksum / 256, ADD_CHAR);   // send checksum
   sendout(RCVR_PORT, (cksum % 256) & 0xFF, ADD_CHAR);

   sendout(RCVR_PORT, 0xB0, ADD_CHAR);
   sendout(RCVR_PORT, 0xB3, EOM);

   if(sim_file == 0) Sleep(100); // rate limit send messages gggg
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movzwl 0x30cfac(%rip), %ebx    # 0x36caf4
movl %ebx, %esi
shrl $0x8, %esi
andl $0x7f, %esi
movl $0xa, %edi
xorl %edx, %edx
callq 0xbcc0
movzbl %bl, %esi
movl $0xa, %edi
xorl %edx, %edx
callq 0xbcc0
movl $0xa, %edi
movl $0xb0, %esi
xorl %edx, %edx
callq 0xbcc0
movl $0xa, %edi
movl $0xb3, %esi
movl $0x1, %edx
callq 0xbcc0
leaq 0x1de829(%rip), %rax    # 0x23e3c0
cmpq $0x0, (%rax)
je 0x5fba4
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movl $0x64, %edi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xaff7
// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: send_venus_start(int, int)
void send_venus_start(int id, int len)
{
   // send a Venus binary message start header
   if(log_file && (log_stream & LOG_PACKET_START)) {
      fprintf(log_file, "\nSend venus start %02X  len=%d\n", id, len);
   }

   if(id == 0x08) return;  // protect against possible brickage (firmware download)
   venus_start = id;
   venus_len = len;

   sendout(RCVR_PORT, 0xA0, ADD_CHAR);
   sendout(RCVR_PORT, 0xA1, ADD_CHAR);
   send_word(len);
   venus_tx_cksum = 0;
   send_byte(id);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %esi, %r14d
movl %edi, %ebx
leaq 0x1de799(%rip), %rax    # 0x23e360
movq (%rax), %rdi
testq %rdi, %rdi
je 0x5fbee
leaq 0x1de83a(%rip), %rax    # 0x23e410
testb $0x4, (%rax)
je 0x5fbee
leaq 0xc4c44(%rip), %rsi     # 0x124826
movl %ebx, %edx
movl %r14d, %ecx
xorl %eax, %eax
callq 0x9560
cmpl $0x8, %ebx
jne 0x5fbf8
popq %rbx
popq %r14
popq %rbp
retq
movl %ebx, 0x30ceea(%rip)    # 0x36cae8
movl %r14d, 0x30cee7(%rip)   # 0x36caec
movl $0xa, %edi
movl $0xa0, %esi
xorl %edx, %edx
callq 0xbcc0
movl $0xa, %edi
movl $0xa1, %esi
xorl %edx, %edx
callq 0xbcc0
movzwl %r14w, %edi
callq 0x5936c
movb $0x0, 0x30ce9c(%rip)    # 0x36cad3
movzbl %bl, %edi
popq %rbx
popq %r14
popq %rbp
jmp 0x591af
// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: send_venus_save(int)
void send_venus_save(int allow_eeprom)
{
   if(VENUS_SAVE && allow_eeprom && (no_eeprom_writes == 0)) {
      send_byte(1);  // update SRAM and EEPROM
BEEP(507);  // gggg
      ++ee_write_count;
   }
   else {
      send_byte(0);           // update SRAM
   }
   send_venus_end();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
testl %edi, %edi
je 0x5fc82
leaq 0x2ad482(%rip), %rax    # 0x30d0d4
cmpl $0x0, (%rax)
je 0x5fc82
leaq 0x1bb5d8(%rip), %rax    # 0x21b236
cmpb $0x0, (%rax)
jne 0x5fc82
movl $0x1, %edi
callq 0x591af
movl $0x1fb, %edi            # imm = 0x1FB
callq 0x9d80
leaq 0x1bb5ba(%rip), %rax    # 0x21b238
incl (%rax)
jmp 0x5fc89
xorl %edi, %edi
callq 0x591af
popq %rbp
jmp 0x61bc3
// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: send_enviro_cmd(char*, unsigned int)
void send_enviro_cmd(char *s, unsigned port)
{
unsigned i,j;

   // send a command to the environmental sensor
   if(s == 0) return;
   if(port >= NUM_COM_PORTS) return;

   j = strlen(s);
   for(i=0; i<j; i++) {
      sendout(port, (u08) s[i], ADD_CHAR);
   }
   sendout(port, 0, FLUSH_COM);
if(ENVIRO_SLEEP) Sleep(ENVIRO_SLEEP);
if(0 && debug_file) fprintf(debug_file, "send thermo port %d[%d]:%s\n", port,com[port].com_port, s);
}

// Assembly:
testq %rdi, %rdi
sete %al
cmpl $0x13, %esi
setae %cl
orb %al, %cl
je 0x60f07
retq
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
callq 0x9120
testl %eax, %eax
je 0x60f3c
movl %eax, %r15d
xorl %r12d, %r12d
movzbl (%r14,%r12), %esi
movl %ebx, %edi
xorl %edx, %edx
callq 0xbcc0
incq %r12
cmpq %r12, %r15
jne 0x60f26
movl %ebx, %edi
xorl %esi, %esi
movl $0x2, %edx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xbcc0
// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: request_fw_ver()
void request_fw_ver()
{
   if(luxor) return;
   if(no_poll) return;

   if(rcvr_type == TSIP_RCVR) {
      if(ACU_GG) ;
      else if(ACU_360) ;
      else if(ACUTIME) ;
      else if(PALISADE) ;
      else if(SV6_FAMILY) return;
      send_tsip_start(0x1C);   //!!! ThunderBolt-E, Resolution only
      send_byte(0x01);
      send_tsip_end();
   }
}

// Assembly:
leaq 0x1ddfe5(%rip), %rax    # 0x23ef3e
cmpb $0x0, (%rax)
je 0x60f5f
retq
leaq 0x2d60ba(%rip), %rax    # 0x337020
cmpb $0x0, (%rax)
jne 0x60f5e
leaq 0x1b795e(%rip), %rax    # 0x2188d0
cmpq $0x1, (%rax)
jne 0x60f5e
leaq 0x1ba055(%rip), %rax    # 0x21afd4
movl (%rax), %eax
movl %eax, %edx
xorl $0x41, %edx
leaq 0x1b796b(%rip), %rcx    # 0x2188f8
movl (%rcx), %ecx
movl %ecx, %esi
xorl $0x47, %esi
orl %edx, %esi
jne 0x60fb6
pushq %rbp
movq %rsp, %rbp
movl $0x1c, %edi
callq 0x5e740
movl $0x1, %edi
callq 0x591af
popq %rbp
jmp 0x5e7c0
cmpl $0x41, %eax
jne 0x60fd9
cmpl $0x33, %ecx
je 0x60f98
cmpl $0x47, %ecx
je 0x60f98
cmpl $0x41, %eax
je 0x60f98
addl $-0x33, %eax
cmpl $0x1d, %eax
ja 0x60f98
movl $0x20004009, %ecx       # imm = 0x20004009
jmp 0x60fe6
addl $-0x33, %eax
cmpl $0xe, %eax
ja 0x60f98
movl $0x4009, %ecx           # imm = 0x4009
btl %eax, %ecx
jb 0x60f5e
jmp 0x60f98
// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: request_unk_ver()
void request_unk_ver()
{
   if(luxor) return;
   if(no_poll) return;
   if(rcvr_type != TSIP_RCVR) return;
   if(SV6_FAMILY) return;

   send_tsip_start(0x1C);   //!!! ??? receiver only
   send_byte(0x02);
   send_tsip_end();
}

// Assembly:
leaq 0x1ddf46(%rip), %rax    # 0x23ef3e
cmpb $0x0, (%rax)
jne 0x61031
leaq 0x2d601c(%rip), %rax    # 0x337020
cmpb $0x0, (%rax)
jne 0x61031
leaq 0x1b78c0(%rip), %rax    # 0x2188d0
cmpq $0x1, (%rax)
jne 0x61031
leaq 0x1b9fb7(%rip), %rax    # 0x21afd4
movl (%rax), %eax
addl $-0x33, %eax
cmpl $0x1d, %eax
ja 0x61032
movl $0x20004009, %ecx       # imm = 0x20004009
btl %eax, %ecx
jae 0x61032
retq
pushq %rbp
movq %rsp, %rbp
movl $0x1c, %edi
callq 0x5e740
movl $0x2, %edi
callq 0x591af
popq %rbp
jmp 0x5e7c0
// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: request_hw_ver()
void request_hw_ver()
{
   if(luxor) return;
   if(no_poll) return;

   if(rcvr_type == TSIP_RCVR) {
      if(ACU_GG) ;
      else if(ACU_360) ;
      else if(ACUTIME) ;
      else if(PALISADE) ;
      else if(SV6_FAMILY) return;
      send_tsip_start(0x1C);   //!!! ThunderBolt-E, Resolution only
      send_byte(0x03);
      send_tsip_end();
   }
}

// Assembly:
leaq 0x1ddee7(%rip), %rax    # 0x23ef3e
cmpb $0x0, (%rax)
je 0x6105d
retq
leaq 0x2d5fbc(%rip), %rax    # 0x337020
cmpb $0x0, (%rax)
jne 0x6105c
leaq 0x1b7860(%rip), %rax    # 0x2188d0
cmpq $0x1, (%rax)
jne 0x6105c
leaq 0x1b9f57(%rip), %rax    # 0x21afd4
movl (%rax), %eax
movl %eax, %edx
xorl $0x41, %edx
leaq 0x1b786d(%rip), %rcx    # 0x2188f8
movl (%rcx), %ecx
movl %ecx, %esi
xorl $0x47, %esi
orl %edx, %esi
jne 0x610b4
pushq %rbp
movq %rsp, %rbp
movl $0x1c, %edi
callq 0x5e740
movl $0x3, %edi
callq 0x591af
popq %rbp
jmp 0x5e7c0
cmpl $0x41, %eax
jne 0x610d7
cmpl $0x33, %ecx
je 0x61096
cmpl $0x47, %ecx
je 0x61096
cmpl $0x41, %eax
je 0x61096
addl $-0x33, %eax
cmpl $0x1d, %eax
ja 0x61096
movl $0x20004009, %ecx       # imm = 0x20004009
jmp 0x610e4
addl $-0x33, %eax
cmpl $0xe, %eax
ja 0x61096
movl $0x4009, %ecx           # imm = 0x4009
btl %eax, %ecx
jb 0x6105c
jmp 0x61096
// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: request_c2()
void request_c2()
{
   if(luxor) return;
   if(no_poll) return;
   if(rcvr_type != TSIP_RCVR) return;
   if(SV6_FAMILY) return;

   send_tsip_start(0xC2);   //!!! ??? receiver
   send_tsip_end();
}

// Assembly:
leaq 0x1dde48(%rip), %rax    # 0x23ef3e
cmpb $0x0, (%rax)
jne 0x6112f
leaq 0x2d5f1e(%rip), %rax    # 0x337020
cmpb $0x0, (%rax)
jne 0x6112f
leaq 0x1b77c2(%rip), %rax    # 0x2188d0
cmpq $0x1, (%rax)
jne 0x6112f
leaq 0x1b9eb9(%rip), %rax    # 0x21afd4
movl (%rax), %eax
addl $-0x33, %eax
cmpl $0x1d, %eax
ja 0x61130
movl $0x20004009, %ecx       # imm = 0x20004009
btl %eax, %ecx
jae 0x61130
retq
pushq %rbp
movq %rsp, %rbp
movl $0xc2, %edi
callq 0x5e740
popq %rbp
jmp 0x5e7c0
// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: request_7A_00()
void request_7A_00()
{
   if(luxor) return;
   if(no_poll) return;
   if(rcvr_type != TSIP_RCVR) return;
   if(ACU_GG) return;
   if(ACU_360) return;
   if(ACUTIME) return;
   if(PALISADE) return;
   if(SV6_FAMILY) return;
   // config NMEA output

   send_tsip_start(0x7A);   //!!! ??? receiver
   send_byte(0x00);
   send_tsip_end();
}

// Assembly:
leaq 0x1dddf3(%rip), %rax    # 0x23ef3e
leaq 0x2d5ece(%rip), %rcx    # 0x337020
movb (%rcx), %cl
orb (%rax), %cl
setne %al
leaq 0x1b7770(%rip), %rcx    # 0x2188d0
movq (%rcx), %rcx
cmpq $0x1, %rcx
setne %dl
orb %al, %dl
jne 0x611cd
leaq 0x1b9e5f(%rip), %rax    # 0x21afd4
movl (%rax), %eax
movl %eax, %esi
xorl $0x41, %esi
leaq 0x1b7775(%rip), %rdx    # 0x2188f8
movl (%rdx), %edx
movl %edx, %edi
xorl $0x47, %edi
orl %esi, %edi
je 0x611cd
cmpl $0x41, %eax
jne 0x6119d
cmpl $0x33, %edx
je 0x611cd
cmpl $0x47, %edx
je 0x611cd
cmpl $0x41, %eax
sete %dl
cmpl $0x50, %eax
sete %sil
cmpq $0x1, %rcx
jne 0x611b5
orb %sil, %dl
jne 0x611cd
cmpq $0x1, %rcx
jne 0x611ce
addl $-0x33, %eax
cmpl $0x1d, %eax
ja 0x611ce
movl $0x20004009, %ecx       # imm = 0x20004009
btl %eax, %ecx
jae 0x611ce
retq
pushq %rbp
movq %rsp, %rbp
movl $0x7a, %edi
callq 0x5e740
xorl %edi, %edi
callq 0x591af
popq %rbp
jmp 0x5e7c0
// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: request_rcvr_health()
void request_rcvr_health()
{
   if(luxor) return;
   if(no_poll) return;
   if(rcvr_type != TSIP_RCVR) return;

   send_tsip_start(0x26);   //!!! ThunderBolt-E only
   send_tsip_end();
}

// Assembly:
leaq 0x1ddd4e(%rip), %rax    # 0x23ef3e
cmpb $0x0, (%rax)
jne 0x61222
leaq 0x2d5e24(%rip), %rax    # 0x337020
cmpb $0x0, (%rax)
jne 0x61222
leaq 0x1b76c8(%rip), %rax    # 0x2188d0
cmpq $0x1, (%rax)
jne 0x61222
pushq %rbp
movq %rsp, %rbp
movl $0x26, %edi
callq 0x5e740
popq %rbp
jmp 0x5e7c0
retq
// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: request_utc_info()
void request_utc_info()
{
   if(luxor) return;
   if(no_poll) return;

   if(rcvr_type == BRANDY_RCVR) {
      queue_brandy_cmd("j", BRANDY_LEAP_MSG);
   }
   else if(rcvr_type == FURUNO_RCVR) {
//    send_furuno_cmp("GPint,tlp00");  // we get this from GPtps message
   }
   else if(rcvr_type == TSIP_RCVR) {
      if(saw_version == 0) return;
      if(res_t == RES_T) return;   // this message can hose up this receiver for 3 seconds
      if(SV6_FAMILY) {
         send_tsip_start(0x2F);       // get UTC (leapsecond) info from sat data
         send_tsip_end();
      }
      else {
         send_tsip_start(0x38);       // get UTC (leapsecond) info from sat data
         send_byte(0x01);
         send_byte(0x05);
         send_byte(0x00);
         send_tsip_end();
      }
   }
   else if(rcvr_type == MOTO_RCVR) {
      request_moto_leap(0);
   }
   else if(rcvr_type == NVS_RCVR) {
      send_nvs_start(0x2B);
      send_nvs_end();
   }
   else if(rcvr_type == SS_RCVR) {  // get leapsecond info
//    request_ss_msg(75);           // ... now set in conig_rcvr
   }
   else if(rcvr_type == UBX_RCVR) {  // get leapsecond info
      request_ubx_msg(UBX_LEAP);
   }
   else if(rcvr_type == ZYFER_RCVR) {  // get leapsecond info
      send_zyfer_cmd("$LEAP");
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x1ddd10(%rip), %rax    # 0x23ef3e
leaq 0x2d5deb(%rip), %rcx    # 0x337020
movb (%rcx), %cl
orb (%rax), %cl
je 0x6123d
popq %rbp
retq
leaq 0x1b768c(%rip), %rax    # 0x2188d0
movq (%rax), %rax
cmpq $0x7ff, %rax            # imm = 0x7FF
jg 0x6126d
cmpq $0x1, %rax
je 0x61297
cmpq $0x4, %rax
je 0x612ea
cmpq $0x20, %rax
jne 0x6123b
xorl %edi, %edi
popq %rbp
jmp 0x61330
cmpq $0x800, %rax            # imm = 0x800
je 0x612da
cmpq $0x100000, %rax         # imm = 0x100000
je 0x612fc
cmpq $0x40000, %rax          # imm = 0x40000
jne 0x6123b
leaq 0xc3873(%rip), %rdi     # 0x124aff
movl $0x195, %esi            # imm = 0x195
popq %rbp
jmp 0x5ee52
leaq 0x2ac16a(%rip), %rax    # 0x30d408
cmpl $0x0, (%rax)
je 0x6123b
leaq 0x1b765a(%rip), %rax    # 0x218904
cmpb $0x1, (%rax)
je 0x6123b
leaq 0x1b9d1e(%rip), %rax    # 0x21afd4
movl (%rax), %eax
addl $-0x33, %eax
cmpl $0x1d, %eax
ja 0x61309
movl $0x20004009, %ecx       # imm = 0x20004009
btl %eax, %ecx
jae 0x61309
movl $0x2f, %edi
callq 0x5e740
popq %rbp
jmp 0x5e7c0
movl $0x2b, %edi
callq 0x5e740
popq %rbp
jmp 0x5e844
movl $0xb02, %edi            # imm = 0xB02
xorl %esi, %esi
callq 0x5f3f5
popq %rbp
jmp 0x5f4ce
leaq 0xbf1f1(%rip), %rdi     # 0x1204f4
popq %rbp
jmp 0x5f15d
movl $0x38, %edi
callq 0x5e740
movl $0x1, %edi
callq 0x591af
movl $0x5, %edi
callq 0x591af
xorl %edi, %edi
callq 0x591af
jmp 0x612d4