LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: record_sig_levels(int)
void record_sig_levels(int prn)
{
float sig;

   // check the signal level for sat PRN "prn", update the sats' max signal
   // level,  and update the signal level map info

   if(prn < 0) return;
   if(prn > MAX_PRN) return;
   if(rcvr_type == RFTG_RCVR) ; 
   else if((lat == 0.0) && (lon == 0.0)) return;

#ifdef SIG_LEVELS
   if(sat[prn].level_msg != 0) { 
      sig = sat[prn].sig_level;
      if(sig < 0.0F) sig = 0.0F - sig;

      if(sat[prn].sig_level > max_sat_db[prn]) {
         max_sat_db[prn] = sig;
      }

      if(sig > max_sig_level) {
         max_sig_level = sig;
      }
      if(sig) {
         if(sig < min_sig_level) {
            min_sig_level = sig;
         }
      }

      sig_level_sum += sig;
      ++sig_level_count;

      if(pause_data) ;
      else if(reading_signals == 0) {
         log_signal(sat[prn].azimuth+0.5F, sat[prn].elevation+0.5F, sig, amu_mode);
      }
      have_snr |= rinex_gnss(prn);
   }
#endif
}

// Assembly:
cmpl $0x3e7, %edi            # imm = 0x3E7
ja 0x5cf0d
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, %ebx
leaq 0x1bbb0a(%rip), %rax    # 0x2188d0
cmpq $0x400000, (%rax)       # imm = 0x400000
jne 0x5cecd
movl %ebx, %ecx
imulq $0x348, %rcx, %rdx      # imm = 0x348
leaq 0x1e21cd(%rip), %rax    # 0x23efb0
cmpl $0x0, 0x1c(%rax,%rdx)
je 0x5cf07
addq %rdx, %rax
movss 0x20(%rax), %xmm0
xorpd %xmm1, %xmm1
movaps %xmm0, %xmm2
cmpltss %xmm1, %xmm2
subss %xmm0, %xmm1
andps %xmm2, %xmm1
andnps %xmm0, %xmm2
orps %xmm1, %xmm2
leaq 0x1564aa(%rip), %rdx    # 0x1b32c0
ucomiss (%rdx,%rcx,4), %xmm0
jbe 0x5ce21
movss %xmm2, (%rdx,%rcx,4)
leaq 0x157440(%rip), %rcx    # 0x1b4268
ucomiss (%rcx), %xmm2
jbe 0x5ce31
movss %xmm2, (%rcx)
xorps %xmm0, %xmm0
ucomiss %xmm0, %xmm2
jne 0x5ce3b
jnp 0x5ce4f
leaq 0x15742a(%rip), %rcx    # 0x1b426c
movss (%rcx), %xmm0
ucomiss %xmm2, %xmm0
jbe 0x5ce4f
movss %xmm2, (%rcx)
xorps %xmm0, %xmm0
cvtss2sd %xmm2, %xmm0
leaq 0x157413(%rip), %rcx    # 0x1b4270
addsd (%rcx), %xmm0
movsd %xmm0, (%rcx)
leaq 0x15740c(%rip), %rcx    # 0x1b4278
movsd (%rcx), %xmm0
addsd 0xac1f8(%rip), %xmm0    # 0x109070
movsd %xmm0, (%rcx)
leaq 0x1be3b1(%rip), %rcx    # 0x21b234
leaq 0x2de44e(%rip), %rdx    # 0x33b2d8
movb (%rdx), %dl
orb (%rcx), %dl
jne 0x5cebb
movss 0xb01e0(%rip), %xmm1    # 0x10d078
movss 0x208(%rax), %xmm0
addss %xmm1, %xmm0
addss 0x20c(%rax), %xmm1
leaq 0x1e203d(%rip), %rax    # 0x23eef0
movzbl (%rax), %edi
callq 0xf9622
movl %ebx, %edi
callq 0xdc1dd
leaq 0x2b0483(%rip), %rcx    # 0x30d34c
orl %eax, (%rcx)
jmp 0x5cf07
leaq 0x2b00fc(%rip), %rax    # 0x30cfd0
movsd (%rax), %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jne 0x5cdd3
jp 0x5cdd3
leaq 0x2b00e5(%rip), %rax    # 0x30cfd8
movsd (%rax), %xmm1
ucomisd %xmm0, %xmm1
jne 0x5cdd3
jp 0x5cdd3
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: config_sat_rows()
void config_sat_rows()
{
   // calculate how many rows on the screen the sat info display will use

   if(sat_cols <= 0) return;

   sat_rows = max_sat_display / sat_cols;
   ms_row = ms_col = 0;
   if(sat_cols > 1) {
      if(max_sat_display & 1) ++sat_rows;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x2ae440(%rip), %rax    # 0x30c784
movl (%rax), %esi
testl %esi, %esi
jle 0x5e38e
leaq 0x1e0c53(%rip), %rax    # 0x23efa4
movl (%rax), %ecx
movl %ecx, %eax
cltd
idivl %esi
leaq 0x2ae429(%rip), %rdx    # 0x30c788
movl %eax, (%rdx)
leaq 0x2ae428(%rip), %rdi    # 0x30c790
xorl %r8d, %r8d
movl %r8d, (%rdi)
leaq 0x2ae417(%rip), %rdi    # 0x30c78c
movl %r8d, (%rdi)
cmpl $0x1, %esi
sete %sil
testb $0x1, %cl
sete %cl
orb %sil, %cl
jne 0x5e38e
incl %eax
movl %eax, (%rdx)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: config_sat_count(int)
void config_sat_count(int sat_count)
{
   // configure the display for the number of satellite channels

   if(first_key) return;  // delay screen size update until not in a menu
// sprintf(debug_text3, "csc:%d   msd:%d  msc:%d", sat_count, max_sat_display, max_sat_count);
   if(sat_count > max_sat_display) {
      sat_count = max_sat_display;
      have_count = 30;
   }

   if(sat_count > max_sat_count) {
      max_sat_count = sat_count;
      last_ebolt = (-1);
      saw_ebolt();  // !!!! we should do this better  zzzzz
   }

   config_sat_rows();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0x1e0bbb(%rip), %rax    # 0x23ef58
cmpl $0x0, (%rax)
je 0x5e3a9
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x1e0bf4(%rip), %rbx    # 0x23efa4
movl (%rbx), %eax
cmpl %edi, %eax
jge 0x5e3c5
leaq 0x2aef5b(%rip), %rcx    # 0x30d318
movl $0x1e, (%rcx)
movl %eax, %edi
leaq 0x2ae3b4(%rip), %rax    # 0x30c780
cmpl (%rax), %edi
jle 0x5e3e4
movl %edi, (%rax)
leaq 0x1e0b4f(%rip), %rax    # 0x23ef28
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
callq 0x5e140
leaq 0x2ae399(%rip), %rax    # 0x30c784
movl (%rax), %esi
testl %esi, %esi
jle 0x5e3a2
movl (%rbx), %ecx
movl %ecx, %eax
cltd
idivl %esi
leaq 0x2ae389(%rip), %rdx    # 0x30c788
movl %eax, (%rdx)
leaq 0x2ae388(%rip), %rdi    # 0x30c790
xorl %r8d, %r8d
movl %r8d, (%rdi)
leaq 0x2ae377(%rip), %rdi    # 0x30c78c
movl %r8d, (%rdi)
cmpl $0x1, %esi
sete %sil
testb $0x1, %cl
sete %cl
orb %sil, %cl
jne 0x5e3a2
incl %eax
movl %eax, (%rdx)
jmp 0x5e3a2
// File: /workspace/github_cpp_makefile_star2_O3/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 0x1ba48e(%rip), %rcx    # 0x2188d0
xorl %eax, %eax
cmpq $0x1000, (%rcx)         # imm = 0x1000
jne 0x5e47e
leaq 0x1bcba8(%rip), %rax    # 0x21affc
cmpl $0x0, (%rax)
je 0x5e46a
leaq 0x1bcb98(%rip), %rcx    # 0x21aff8
movl $0x1, %eax
cmpl $0x0, (%rcx)
jne 0x5e47e
leaq 0x2af08f(%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_O3/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, %eax
leaq 0x312094(%rip), %rcx    # 0x370520
leaq 0x31247d(%rip), %rdx    # 0x370910
movb (%rax,%rcx), %sil
movb %sil, (%rax,%rdx)
movb $0x0, (%rax,%rcx)
incq %rax
cmpq $0x3e8, %rax            # imm = 0x3E8
jne 0x5e493
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
leaq 0x1e0a48(%rip), %r8     # 0x23ef04
xorl %eax, %eax
movl %eax, (%r8)
leaq 0x1e0a38(%rip), %r9     # 0x23ef00
movl %eax, (%r9)
leaq 0x1e0a3a(%rip), %rsi    # 0x23ef0c
movl %eax, (%rsi)
movl $0x364, %r10d           # imm = 0x364
addq 0xf1a5f(%rip), %r10     # 0x14ff40
movl $0x1, %r11d
leaq 0x2aee2a(%rip), %rbx    # 0x30d318
xorl %r14d, %r14d
xorl %edi, %edi
xorl %r15d, %r15d
cmpl $0x0, (%r10)
je 0x5e53a
cmpl $0x0, 0x1fc(%r10)
jle 0x5e532
movb $0x1, (%r11,%rcx)
xorl %r12d, %r12d
cmpb $0x1, (%r11,%rdx)
setne %r12b
addl %r12d, %eax
incl %edi
movl %edi, (%rsi)
incl %r14d
movl %r14d, (%r9)
incl %r15d
movl %r15d, (%r8)
movl $0x64, (%rbx)
jmp 0x5e53a
jns 0x5e53a
incl %r14d
movl %r14d, (%r9)
incq %r11
addq $0x348, %r10            # imm = 0x348
cmpq $0x3e8, %r11            # imm = 0x3E8
jne 0x5e4f6
leaq 0x1bca7c(%rip), %rcx    # 0x21afd0
cmpl $0x0, (%rcx)
je 0x5e570
leaq 0x2aee64(%rip), %rcx    # 0x30d3c4
cmpl $0x0, (%rcx)
jne 0x5e570
leaq 0x1e09a4(%rip), %rcx    # 0x23ef10
movl (%rcx), %edi
movl %edi, (%rsi)
testl %eax, %eax
je 0x5e592
movl %edi, %eax
orl $0x800, %eax            # imm = 0x800
cmpl $0x100, %edi            # imm = 0x100
movl $0x8ff, %ecx            # imm = 0x8FF
cmovll %eax, %ecx
leaq 0x1e09b8(%rip), %rax    # 0x23ef48
movl %ecx, (%rax)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x2e0279(%rip), %rax    # 0x33e850
leaq 0xc1e2d(%rip), %rsi     # 0x12040b
movl %edi, %edx
movq %rax, %rdi
movb $0x1, %al
popq %rbp
jmp 0x9060
// File: /workspace/github_cpp_makefile_star2_O3/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 0x2aef33(%rip), %rax    # 0x30d530
movsd (%rax), %xmm0
mulsd 0xbfb8f(%rip), %xmm0    # 0x11e198
movsd %xmm0, -0x18(%rbp)
callq 0xa477
movsd -0x18(%rbp), %xmm0
leaq 0x2af0c1(%rip), %r14    # 0x30d6e0
movsd 0xbfb71(%rip), %xmm1    # 0x11e198
mulsd (%r14), %xmm1
movsd %xmm1, (%r14)
subsd %xmm0, %xmm1
leaq 0x2af894(%rip), %rax    # 0x30ded0
movsd %xmm1, -0x20(%rbp)
movsd %xmm1, (%rax)
leaq 0x1de67c(%rip), %rax    # 0x23ccc8
cmpl $0x0, (%rax)
je 0x5e6b5
leaq 0x2af098(%rip), %rax    # 0x30d6f0
movl (%rax), %ebx
movsd 0xaaa76(%rip), %xmm1    # 0x1090d8
callq 0x94d0
movsd %xmm0, -0x18(%rbp)
movsd (%r14), %xmm0
movsd 0xaaa5f(%rip), %xmm1    # 0x1090d8
callq 0x94d0
movaps %xmm0, %xmm2
leaq 0x2af840(%rip), %rax    # 0x30dec8
movsd (%rax), %xmm3
leaq 0x2e01bd(%rip), %rdi    # 0x33e850
leaq 0xc1d8b(%rip), %rsi     # 0x120425
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_O3/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 %rbx
pushq %rax
movl %edi, %eax
leaq 0x1dfc93(%rip), %rcx    # 0x23e360
movq (%rcx), %rdi
movzbl %al, %ebx
testq %rdi, %rdi
je 0x5e6f4
leaq 0x1dfd31(%rip), %rax    # 0x23e410
testb $0x4, (%rax)
je 0x5e6f4
leaq 0xc1d66(%rip), %rsi     # 0x120451
movl %ebx, %edx
xorl %eax, %eax
callq 0x9560
movl $0x1, 0x311916(%rip)    # 0x370014
movl $0xa, %edi
movl $0x10, %esi
xorl %edx, %edx
callq 0xbcaa
movw $0x0, 0x30e3ec(%rip)    # 0x36cb04
movl %ebx, %edi
callq 0x590f7
movl $0x2, 0x30d6ef(%rip)    # 0x36be18
cmpb $-0x72, %bl
jne 0x5e735
movb $-0x72, 0x3118db(%rip)  # 0x370010
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x1dfc19(%rip), %rax    # 0x23e360
movq (%rax), %rcx
testq %rcx, %rcx
je 0x5e771
leaq 0x1dfcba(%rip), %rax    # 0x23e410
testb $0x10, (%rax)
je 0x5e771
leaq 0xc1d06(%rip), %rdi     # 0x120468
movl $0x9, %esi
movl $0x1, %edx
callq 0x9750
movl $0xa, %edi
movl $0x10, %esi
xorl %edx, %edx
callq 0xbcaa
movl $0xa, %edi
movl $0x3, %esi
movl $0x1, %edx
callq 0xbcaa
addl $0x2, 0x30d67b(%rip)    # 0x36be18
leaq 0x1dfc1c(%rip), %rax    # 0x23e3c0
cmpq $0x0, (%rax)
jne 0x5e7b4
movl $0x14, %edi
callq 0xafe8
movl $0x0, 0x311856(%rip)    # 0x370014
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x30e337(%rip), %ebx    # 0x36cb04
movl $0xa, %edi
movl $0x10, %esi
xorl %edx, %edx
callq 0xbcaa
movl $0xa, %edi
movl $0xff, %esi
xorl %edx, %edx
callq 0xbcaa
movzbl %bl, %esi
movl $0xa, %edi
xorl %edx, %edx
callq 0xbcaa
shrl $0x8, %ebx
movl $0xa, %edi
movl %ebx, %esi
xorl %edx, %edx
callq 0xbcaa
movl $0xa, %edi
movl $0x10, %esi
xorl %edx, %edx
callq 0xbcaa
movl $0xa, %edi
movl $0x3, %esi
movl $0x1, %edx
callq 0xbcaa
addl $0x2, 0x30d5dd(%rip)    # 0x36be18
leaq 0x1dfb7e(%rip), %rax    # 0x23e3c0
cmpq $0x0, (%rax)
je 0x5e84f
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movl $0x32, %edi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xafe8
// File: /workspace/github_cpp_makefile_star2_O3/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 0x5e873
xorl %esi, %esi
callq 0x5e8a6
testl %ebx, %ebx
je 0x5e89f
movl $0xd, %edi
callq 0x590f7
movl $0x1, 0x30d585(%rip)    # 0x36be10
movl $0xa, %edi
callq 0x590f7
movl $0x0, 0x30d571(%rip)    # 0x36be10
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x5e8fa
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 0x5e8e4
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
xorl %r12d, %r12d
movzbl (%r14,%r12), %edi
callq 0x590f7
incq %r12
cmpq %r12, %r15
jne 0x5e8d2
testl %ebx, %ebx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
je 0x5e8fa
movl $0x2c, %edi
jmp 0x590f7
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x5edbe
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 0x5edbf
leal -0x1(%r14), %eax
cltq
movsbl (%rbx,%rax), %edi
callq 0x9700
movb %al, 0x30de91(%rip)     # 0x36cc2c
testl %r14d, %r14d
jle 0x5edc6
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
xorl %r15d, %r15d
movzbl (%rbx,%r15), %edi
callq 0xa5c27
incq %r15
cmpq %r15, %r14
jne 0x5edaa
jmp 0x5edc6
retq
movb $0x0, 0x30de66(%rip)    # 0x36cc2c
movl $0xd, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xa5c27
// File: /workspace/github_cpp_makefile_star2_O3/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 0x5ee05
cmpl $0xca, 0x3130d9(%rip)   # 0x371ed8
je 0x5ee8c
movl %ebx, 0x3130cd(%rip)    # 0x371ed8
movl %ebx, 0x31307b(%rip)    # 0x371e8c
movslq 0x3111b8(%rip), %r15    # 0x36ffd0
movq %r15, %rax
shlq $0x7, %rax
leaq (%rax,%r15,4), %r12
leaq 0x30de16(%rip), %r13    # 0x36cc40
leaq (%r12,%r13), %rdi
movq %r14, %rsi
callq 0x9340
movl %ebx, 0x80(%r13,%r12)
movl 0x311194(%rip), %ecx    # 0x36ffd8
incl %ecx
leal 0x1(%r15), %eax
xorl %r8d, %r8d
cmpq $0x63, %r15
movl %ecx, 0x311181(%rip)    # 0x36ffd8
cmovll %eax, %r8d
movl %r8d, 0x31116e(%rip)    # 0x36ffd0
leaq 0x1df527(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x5ee8c
movl 0x31115c(%rip), %r9d    # 0x36ffd4
movq %r14, (%rsp)
leaq 0xc644e(%rip), %rsi     # 0x1252d1
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_O3/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 0x5eff1
movq %rdi, %rbx
leaq 0x1df4dc(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x5eecd
leaq 0xc169e(%rip), %rsi     # 0x120561
movq %rbx, %rdx
xorl %eax, %eax
callq 0x9560
movl $0xa, %edi
movl $0x24, %esi
xorl %edx, %edx
callq 0xbcaa
movb $0x0, 0x30dbd1(%rip)    # 0x36cab6
xorl %edi, %edi
cmpb $0x24, (%rbx)
sete %dil
addq %rbx, %rdi
xorl %esi, %esi
callq 0x5e8a6
movq %rbx, %rdi
movl $0x2a, %esi
callq 0x9100
xorl %edi, %edi
testq %rax, %rax
sete %dil
callq 0x5f4c9
leaq 0xc1655(%rip), %rsi     # 0x12056f
movq %rbx, %rdi
callq 0x9090
testq %rax, %rax
je 0x5eff1
movq %rax, %rbx
movl $0x3e8, %edi            # imm = 0x3E8
callq 0xafe8
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 0x5eff1
andb %dil, %cl
andb %r8b, %dl
andb %cl, %dl
andb %r9b, %r10b
andb %r10b, %sil
andb %dl, %sil
jne 0x5eff1
leaq 0x2ae3a1(%rip), %rcx    # 0x30d340
xorl %edx, %edx
movl %edx, (%rcx)
leaq 0x2ae39e(%rip), %rcx    # 0x30d348
movl %edx, (%rcx)
leaq 0x2af32d(%rip), %rcx    # 0x30e2e0
movl %eax, 0x159d0(%rcx)
movl $0xa, %edi
movl $0x64, %esi
callq 0xb49e
movl $0x320, %edi            # imm = 0x320
callq 0xafe8
leaq 0x1b986b(%rip), %rax    # 0x218844
movl $0x2580, (%rax)         # imm = 0x2580
movl $0x2580, %edi           # imm = 0x2580
xorl %esi, %esi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x5fc4c
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x5f071
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0xa, %edi
movl $0x24, %esi
xorl %edx, %edx
callq 0xbcaa
movb $0x0, 0x30da98(%rip)    # 0x36cab6
leaq 0xcba7d(%rip), %rsi     # 0x12aaa2
movq %rbx, %rdi
callq 0x9090
testq %rax, %rax
jne 0x5f046
leaq 0xc1544(%rip), %rsi     # 0x12057d
movq %rbx, %rdi
callq 0x9090
testq %rax, %rax
je 0x5f08a
cmpb $0x24, (%rbx)
leaq 0x1df340(%rip), %rax    # 0x23e390
movq (%rax), %rdi
jne 0x5f072
testq %rdi, %rdi
je 0x5f06c
leaq 0x1(%rbx), %rdx
leaq 0xc151d(%rip), %rsi     # 0x120582
xorl %eax, %eax
callq 0x9560
incq %rbx
jmp 0x5f0ce
retq
testq %rdi, %rdi
je 0x5f0ce
leaq 0xc1516(%rip), %rsi     # 0x120594
movq %rbx, %rdx
xorl %eax, %eax
callq 0x9560
jmp 0x5f0ce
cmpb $0x24, (%rbx)
leaq 0x1df2fc(%rip), %rax    # 0x23e390
movq (%rax), %rdi
jne 0x5f0aa
testq %rdi, %rdi
je 0x5f06c
leaq 0xc1501(%rip), %rsi     # 0x1205a6
movq %rbx, %rdx
jmp 0x5f065
testq %rdi, %rdi
je 0x5f0c0
leaq 0xc1501(%rip), %rsi     # 0x1205b7
movq %rbx, %rdx
xorl %eax, %eax
callq 0x9560
leaq 0xc1506(%rip), %rdi     # 0x1205cd
xorl %esi, %esi
callq 0x5e8a6
movq %rbx, %rdi
xorl %esi, %esi
callq 0x5e8a6
xorl %edi, %edi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x5f4c9
// File: /workspace/github_cpp_makefile_star2_O3/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 0x5f16f
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x1df262(%rip), %rax    # 0x23e360
movq (%rax), %rdi
testq %rdi, %rdi
je 0x5f123
leaq 0x1df303(%rip), %rax    # 0x23e410
testb $0x4, (%rax)
je 0x5f123
leaq 0xc13ce(%rip), %rsi     # 0x1204e7
movq %rbx, %rdx
xorl %eax, %eax
callq 0x9560
movl $0xa, %edi
movl $0x24, %esi
xorl %edx, %edx
callq 0xbcaa
movb $0x0, 0x30d97b(%rip)    # 0x36cab6
xorl %edi, %edi
cmpb $0x24, (%rbx)
sete %dil
addq %rbx, %rdi
xorl %esi, %esi
callq 0x5e8a6
movq %rbx, %rdi
movl $0x2a, %esi
callq 0x9100
xorl %edi, %edi
testq %rax, %rax
sete %dil
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x5f4c9
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x5f227
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x1df1d7(%rip), %rax    # 0x23e360
movq (%rax), %rdi
testq %rdi, %rdi
je 0x5f1ae
leaq 0x1df278(%rip), %rax    # 0x23e410
testb $0x4, (%rax)
je 0x5f1ae
leaq 0xc136a(%rip), %rsi     # 0x12050e
movq %rbx, %rdx
xorl %eax, %eax
callq 0x9560
leaq 0x1df1db(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x5f1ce
leaq 0xc134a(%rip), %rsi     # 0x12050e
movq %rbx, %rdx
xorl %eax, %eax
callq 0x9560
movl $0xa, %edi
movl $0x23, %esi
xorl %edx, %edx
callq 0xbcaa
xorl %edi, %edi
cmpb $0x23, (%rbx)
sete %dil
addq %rbx, %rdi
xorl %esi, %esi
callq 0x5e8a6
movl $0xa, %edi
movl $0xd, %esi
xorl %edx, %edx
callq 0xbcaa
movl $0xa, %edi
movl $0xa, %esi
movl $0x1, %edx
callq 0xbcaa
movl $0x32, %edi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xafe8
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x5f2bd
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpb $0x24, (%rdi)
je 0x5f254
movl $0xa, %edi
movl $0x24, %esi
xorl %edx, %edx
callq 0xbcaa
movq %rbx, %rdi
callq 0x9120
movq %rax, %r14
testl %r14d, %r14d
jle 0x5f280
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
xorl %r15d, %r15d
movzbl (%rbx,%r15), %edi
callq 0x590f7
incq %r15
cmpq %r15, %r14
jne 0x5f26e
movl $0xa, %edi
movl $0xd, %esi
xorl %edx, %edx
callq 0xbcaa
movl $0xa, %edi
movl $0xa, %esi
movl $0x1, %edx
callq 0xbcaa
leaq 0x1df114(%rip), %rax    # 0x23e3c0
cmpq $0x0, (%rax)
leaq 0x8(%rsp), %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
je 0x5f2be
retq
movl $0x32, %edi
jmp 0xafe8
// File: /workspace/github_cpp_makefile_star2_O3/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 0x5f37c
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x1df07f(%rip), %rax    # 0x23e360
movq (%rax), %rdi
testq %rdi, %rdi
je 0x5f306
leaq 0x1df120(%rip), %rax    # 0x23e410
testb $0x4, (%rax)
je 0x5f306
leaq 0xc11ff(%rip), %rsi     # 0x1204fb
movq %rbx, %rdx
xorl %eax, %eax
callq 0x9560
leaq 0x1df083(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x5f326
leaq 0xc11df(%rip), %rsi     # 0x1204fb
movq %rbx, %rdx
xorl %eax, %eax
callq 0x9560
movl $0xa, %edi
movl $0x24, %esi
xorl %edx, %edx
callq 0xbcaa
movb $0x0, 0x30d778(%rip)    # 0x36cab6
xorl %edi, %edi
cmpb $0x24, (%rbx)
sete %dil
addq %rbx, %rdi
xorl %esi, %esi
callq 0x5e8a6
movq %rbx, %rdi
movl $0x2a, %esi
callq 0x9100
xorl %edi, %edi
testq %rax, %rax
sete %dil
callq 0x5f4c9
movl $0x32, %edi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xafe8
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x1defce(%rip), %rcx    # 0x23e360
movq (%rcx), %rdi
movzwl %ax, %r14d
testq %rdi, %rdi
je 0x5f3bd
leaq 0x1df06b(%rip), %rax    # 0x23e410
testb $0x4, (%rax)
je 0x5f3bd
leaq 0xc10f7(%rip), %rsi     # 0x1204a8
movl %r14d, %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x9560
leaq 0x1defcc(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x5f3df
leaq 0xc10f5(%rip), %rsi     # 0x1204c8
movl %r14d, %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x9560
xorl %r15d, %r15d
movl $0xa, %edi
movl $0xb5, %esi
xorl %edx, %edx
callq 0xbcaa
movl $0xa, %edi
movl $0x62, %esi
xorl %edx, %edx
callq 0xbcaa
movb %r15b, 0x30d66e(%rip)   # 0x36ca79
movb %r15b, 0x30d666(%rip)   # 0x36ca78
movl %r14d, %edi
shrl $0x8, %edi
callq 0x590f7
movl $0xff, %r15d
andl %r15d, %r14d
movl %r14d, %edi
callq 0x590f7
movl %ebx, %edi
andl %r15d, %edi
callq 0x590f7
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 0x590f7
// File: /workspace/github_cpp_makefile_star2_O3/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 0x30d615(%rip), %esi    # 0x36ca78
movzbl 0x30d60f(%rip), %ebx    # 0x36ca79
movl $0xa, %edi
xorl %edx, %edx
callq 0xbcaa
movl $0xa, %edi
movl %ebx, %esi
movl $0x1, %edx
callq 0xbcaa
leaq 0x1def32(%rip), %rax    # 0x23e3c0
cmpq $0x0, (%rax)
je 0x5f49b
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movl $0x32, %edi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xafe8
// File: /workspace/github_cpp_makefile_star2_O3/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 0x30d5db(%rip), %edx    # 0x36cab6
leaq 0xcb599(%rip), %rsi     # 0x12aa7b
leaq -0x12(%rbp), %rdi
xorl %eax, %eax
callq 0x9060
leaq 0x1b93dc(%rip), %rcx    # 0x2188d0
movb $0x2a, %al
cmpq $0x100000, (%rcx)       # imm = 0x100000
je 0x5f527
testl %ebx, %ebx
je 0x5f536
movl $0xa, %edi
movl $0x2a, %esi
xorl %edx, %edx
callq 0xbcaa
movzbl -0x12(%rbp), %esi
movl $0xa, %edi
xorl %edx, %edx
callq 0xbcaa
movb -0x11(%rbp), %al
movzbl %al, %esi
movl $0xa, %edi
xorl %edx, %edx
callq 0xbcaa
movl $0xa, %edi
movl $0xd, %esi
xorl %edx, %edx
callq 0xbcaa
movl $0xa, %edi
movl $0xa, %esi
movl $0x1, %edx
callq 0xbcaa
leaq 0x1dee5e(%rip), %rax    # 0x23e3c0
cmpq $0x0, (%rax)
je 0x5f56f
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
movl $0x32, %edi
addq $0x18, %rsp
popq %rbx
popq %rbp
jmp 0xafe8
// File: /workspace/github_cpp_makefile_star2_O3/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 0x5f6c2
movq %rdi, %rbx
leaq 0x2aed29(%rip), %rax    # 0x30e2cc
movl (%rax), %r14d
imulq $0x2260, %r14, %rcx     # imm = 0x2260
leaq 0x2aed2c(%rip), %rax    # 0x30e2e0
cmpl $0x0, 0x2234(%rax,%rcx)
je 0x5f5ce
addq %rax, %rcx
cmpl $0x0, 0x2230(%rcx)
jg 0x5f668
leaq 0x1b92fb(%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 0x1c400a(%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 0x5f6c2
leaq 0x1b92e6(%rip), %rdx    # 0x218914
cmpl $0x2, (%rdx)
jne 0x5f6c2
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 0x5f6c2
addq %rcx, %rax
cmpl $0x0, 0x2230(%rax)
jle 0x5f6c2
movq %rbx, %rdi
callq 0x9120
movq %rax, %r15
testl %r15d, %r15d
jle 0x5f699
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
xorl %r12d, %r12d
movzbl (%rbx,%r12), %esi
movl %r14d, %edi
xorl %edx, %edx
callq 0xbcaa
incq %r12
cmpq %r12, %r15
jne 0x5f682
movl %r14d, %edi
movl $0xd, %esi
xorl %edx, %edx
callq 0xbcaa
movl %r14d, %edi
movl $0xa, %esi
movl $0x1, %edx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xbcaa
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x1b91fa(%rip), %rax    # 0x2188d0
xorl %ecx, %ecx
cmpq $0x80000, (%rax)        # imm = 0x80000
sete %cl
leaq 0x2aebf7(%rip), %rdx    # 0x30e2e0
leal 0x2(%rcx), %esi
cmpl $0x0, 0x225d0(%rdx)
cmovlel %ecx, %esi
cmpl $0x0, 0x225d4(%rdx)
cmovel %ecx, %esi
leaq 0x1c3f05(%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_O3/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 0x1de92b(%rip), %rax    # 0x23e360
movq (%rax), %rdi
testq %rdi, %rdi
je 0x5fa5d
leaq 0x1de9cc(%rip), %rax    # 0x23e410
testb $0x4, (%rax)
je 0x5fa5d
movzwl %bx, %edx
leaq 0xc4df6(%rip), %rsi     # 0x124849
movl %r14d, %ecx
xorl %eax, %eax
callq 0x9560
movl $0xa, %edi
movl $0xa0, %esi
xorl %edx, %edx
callq 0xbcaa
movl $0xa, %edi
movl $0xa2, %esi
xorl %edx, %edx
callq 0xbcaa
movl $0xff, %r15d
leal (%r14,%r15), %edi
testl %r14d, %r14d
cmovnsl %r14d, %edi
shrl $0x8, %edi
andl %r15d, %edi
callq 0x590f7
andl %r15d, %r14d
movl %r14d, %edi
callq 0x590f7
movw $0x0, 0x30d045(%rip)    # 0x36caf4
andl %r15d, %ebx
movl %ebx, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x590f7
// File: /workspace/github_cpp_makefile_star2_O3/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 0x30d024(%rip), %ebx    # 0x36caf4
movl %ebx, %esi
shrl $0x8, %esi
andl $0x7f, %esi
movl $0xa, %edi
xorl %edx, %edx
callq 0xbcaa
movzbl %bl, %esi
movl $0xa, %edi
xorl %edx, %edx
callq 0xbcaa
movl $0xa, %edi
movl $0xb0, %esi
xorl %edx, %edx
callq 0xbcaa
movl $0xa, %edi
movl $0xb3, %esi
movl $0x1, %edx
callq 0xbcaa
leaq 0x1de8a1(%rip), %rax    # 0x23e3c0
cmpq $0x0, (%rax)
je 0x5fb2c
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movl $0x64, %edi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xafe8
// File: /workspace/github_cpp_makefile_star2_O3/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
subq $0x10, %rsp
movl %esi, %r14d
movl %edi, %ebx
leaq 0x1de80d(%rip), %rax    # 0x23e360
movq (%rax), %rdi
testq %rdi, %rdi
je 0x5fb7a
leaq 0x1de8ae(%rip), %rax    # 0x23e410
testb $0x4, (%rax)
je 0x5fb7a
leaq 0xc4d98(%rip), %rsi     # 0x124906
movl %ebx, %edx
movl %r14d, %ecx
xorl %eax, %eax
callq 0x9560
cmpl $0x8, %ebx
jne 0x5fb88
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movl %ebx, 0x30cf5a(%rip)    # 0x36cae8
movl %r14d, 0x30cf57(%rip)   # 0x36caec
movl $0xa, %edi
movl $0xa0, %esi
xorl %edx, %edx
callq 0xbcaa
movl $0xa, %edi
movl $0xa1, %esi
xorl %edx, %edx
callq 0xbcaa
movw %r14w, -0x12(%rbp)
leaq 0x1b8c11(%rip), %r14    # 0x2187d4
xorl %eax, %eax
cmpb $0x0, (%r14)
sete %al
movzbl -0x12(%rbp,%rax), %edi
callq 0x590f7
xorl %eax, %eax
cmpb $0x0, (%r14)
setne %al
movzbl -0x12(%rbp,%rax), %edi
callq 0x590f7
movb $0x0, 0x30cee3(%rip)    # 0x36cad3
movzbl %bl, %edi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x590f7
// File: /workspace/github_cpp_makefile_star2_O3/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 0x5fc3f
leaq 0x2ad4c5(%rip), %rax    # 0x30d0d4
cmpl $0x0, (%rax)
je 0x5fc3f
leaq 0x1bb61b(%rip), %rax    # 0x21b236
cmpb $0x0, (%rax)
jne 0x5fc3f
movl $0x1, %edi
callq 0x590f7
movl $0x1fb, %edi            # imm = 0x1FB
callq 0x9d78
leaq 0x1bb5fd(%rip), %rax    # 0x21b238
incl (%rax)
jmp 0x5fc46
xorl %edi, %edi
callq 0x590f7
popq %rbp
jmp 0x61bc1
// File: /workspace/github_cpp_makefile_star2_O3/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 0x60f8c
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 0x60fc1
movl %eax, %r15d
xorl %r12d, %r12d
movzbl (%r14,%r12), %esi
movl %ebx, %edi
xorl %edx, %edx
callq 0xbcaa
incq %r12
cmpq %r12, %r15
jne 0x60fab
movl %ebx, %edi
xorl %esi, %esi
movl $0x2, %edx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xbcaa
// File: /workspace/github_cpp_makefile_star2_O3/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 0x1ddf60(%rip), %rax    # 0x23ef3e
cmpb $0x0, (%rax)
je 0x60fe4
retq
leaq 0x2d6035(%rip), %rax    # 0x337020
cmpb $0x0, (%rax)
jne 0x60fe3
leaq 0x1b78d9(%rip), %rax    # 0x2188d0
cmpq $0x1, (%rax)
jne 0x60fe3
leaq 0x1b9fd0(%rip), %rax    # 0x21afd4
movl (%rax), %eax
cmpl $0x33, %eax
je 0x60fe3
cmpl $0x36, %eax
je 0x60fe3
pushq %rbp
movq %rsp, %rbp
movl $0x1c, %edi
callq 0x5e6be
movl $0x1, %edi
callq 0x590f7
popq %rbp
jmp 0x5e73c
// File: /workspace/github_cpp_makefile_star2_O3/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 0x1ddf09(%rip), %rax    # 0x23ef3e
cmpb $0x0, (%rax)
jne 0x6106e
leaq 0x2d5fdf(%rip), %rax    # 0x337020
cmpb $0x0, (%rax)
jne 0x6106e
leaq 0x1b7883(%rip), %rax    # 0x2188d0
cmpq $0x1, (%rax)
jne 0x6106e
leaq 0x1b9f7a(%rip), %rax    # 0x21afd4
movl (%rax), %eax
addl $-0x33, %eax
cmpl $0x1d, %eax
ja 0x6106f
movl $0x20004009, %ecx       # imm = 0x20004009
btl %eax, %ecx
jae 0x6106f
retq
pushq %rbp
movq %rsp, %rbp
movl $0x1c, %edi
callq 0x5e6be
movl $0x2, %edi
callq 0x590f7
popq %rbp
jmp 0x5e73c
// File: /workspace/github_cpp_makefile_star2_O3/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 0x1ddeaa(%rip), %rax    # 0x23ef3e
cmpb $0x0, (%rax)
je 0x6109a
retq
leaq 0x2d5f7f(%rip), %rax    # 0x337020
cmpb $0x0, (%rax)
jne 0x61099
leaq 0x1b7823(%rip), %rax    # 0x2188d0
cmpq $0x1, (%rax)
jne 0x61099
leaq 0x1b9f1a(%rip), %rax    # 0x21afd4
movl (%rax), %eax
cmpl $0x33, %eax
je 0x61099
cmpl $0x36, %eax
je 0x61099
pushq %rbp
movq %rsp, %rbp
movl $0x1c, %edi
callq 0x5e6be
movl $0x3, %edi
callq 0x590f7
popq %rbp
jmp 0x5e73c
// File: /workspace/github_cpp_makefile_star2_O3/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 0x1dde53(%rip), %rax    # 0x23ef3e
cmpb $0x0, (%rax)
jne 0x61124
leaq 0x2d5f29(%rip), %rax    # 0x337020
cmpb $0x0, (%rax)
jne 0x61124
leaq 0x1b77cd(%rip), %rax    # 0x2188d0
cmpq $0x1, (%rax)
jne 0x61124
leaq 0x1b9ec4(%rip), %rax    # 0x21afd4
movl (%rax), %eax
addl $-0x33, %eax
cmpl $0x1d, %eax
ja 0x61125
movl $0x20004009, %ecx       # imm = 0x20004009
btl %eax, %ecx
jae 0x61125
retq
pushq %rbp
movq %rsp, %rbp
movl $0xc2, %edi
callq 0x5e6be
popq %rbp
jmp 0x5e73c