LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: get_sv6_sat_list()
void get_sv6_sat_list()
{
int prn[4];
int mode;

   log_packet_id("Packet 0x44 (SV6_FAMILY sats and dops - nav mode)");

   mode = tsip_byte();   // mode
   if(ACU_GG) ;
   else if(ACU_360) ;
   else if(ACUTIME) ;
   else {
      if     (mode == 0x01) rcvr_mode = RCVR_MODE_SINGLE;    // auto modes
      else if(mode == 0x03) rcvr_mode = RCVR_MODE_2D;
      else if(mode == 0x04) rcvr_mode = RCVR_MODE_3D;
      else if(mode == 0x11) rcvr_mode = RCVR_MODE_SINGLE;    // maunal modes
      else if(mode == 0x13) rcvr_mode = RCVR_MODE_2D;
      else if(mode == 0x14) rcvr_mode = RCVR_MODE_3D;
      else                  rcvr_mode = RCVR_MODE_UNKNOWN;
   }

   prn[0] = tsip_byte();   // prn1
   prn[1] = tsip_byte();   // prn2
   prn[2] = tsip_byte();   // prn3
   prn[3] = tsip_byte();   // prn4

   have_dops = 0;
   pdop = tsip_single();
   hdop = tsip_single();
   vdop = tsip_single();
   tdop = tsip_single();

   if(pdop > 20.0) pdop = 20.0;
   if(hdop > 20.0) hdop = 20.0;
   if(vdop > 20.0) vdop = 20.0;
   if(tdop > 20.0) tdop = 20.0;

   have_dops |= (PDOP | HDOP | VDOP | TDOP);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
leaq 0xa3252(%rip), %rdi     # 0x10ba3c
callq 0x520bf
callq 0x51c47
leaq 0x19a0d5(%rip), %rcx    # 0x2028d0
cmpq $0x1, (%rcx)
jne 0x6880d
leaq 0x19c7cc(%rip), %rcx    # 0x204fd4
cmpl $0x41, (%rcx)
je 0x68848
movb $0x1, %cl
cmpb $0x1, %al
je 0x6883f
movzbl %al, %eax
cmpl $0x14, %eax
je 0x6883d
cmpl $0x4, %eax
je 0x68835
cmpl $0x11, %eax
je 0x6883f
cmpl $0x13, %eax
je 0x68839
movl %eax, %ecx
cmpl $0x3, %eax
je 0x6883f
movb $0x63, %cl
jmp 0x6883f
movl %eax, %ecx
jmp 0x6883f
movb $0x3, %cl
jmp 0x6883f
movb $0x4, %cl
leaq 0x28e88a(%rip), %rax    # 0x2f70d0
movb %cl, (%rax)
callq 0x51c47
callq 0x51c47
callq 0x51c47
callq 0x51c47
leaq 0x1a4c81(%rip), %rbx    # 0x20d4e4
andl $0x0, (%rbx)
callq 0x51dc3
cvtss2sd %xmm0, %xmm0
leaq 0x1a4c72(%rip), %r14    # 0x20d4e8
movsd %xmm0, (%r14)
callq 0x51dc3
cvtss2sd %xmm0, %xmm0
leaq 0x1a4c65(%rip), %r15    # 0x20d4f0
movsd %xmm0, (%r15)
callq 0x51dc3
cvtss2sd %xmm0, %xmm0
leaq 0x1a4c58(%rip), %r12    # 0x20d4f8
movsd %xmm0, (%r12)
callq 0x51dc3
cvtss2sd %xmm0, %xmm1
leaq 0x1a4c52(%rip), %rax    # 0x20d508
movsd %xmm1, (%rax)
movsd (%r14), %xmm1
ucomisd 0x8d2f1(%rip), %xmm1    # 0xf5bb8
movabsq $0x4034000000000000, %rcx # imm = 0x4034000000000000
jbe 0x688d6
movq %rcx, (%r14)
movsd (%r15), %xmm1
ucomisd 0x8d2d5(%rip), %xmm1    # 0xf5bb8
jbe 0x688e8
movq %rcx, (%r15)
movsd (%r12), %xmm1
ucomisd 0x8d2c2(%rip), %xmm1    # 0xf5bb8
jbe 0x688fc
movq %rcx, (%r12)
ucomiss 0xa00c5(%rip), %xmm0    # 0x1089c8
jbe 0x68908
movq %rcx, (%rax)
orb $0x17, (%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: get_ebolt_health1()
void get_ebolt_health1()
{
u08 sv_fix;
u08 antenna_fault;

   log_packet_id("Packet 0x46 (Tbolt-E health)");

   sv_fix = tsip_byte();
   antenna_fault = tsip_byte();
   check_tsip_end(1);
   if(tsip_error) return;

   saw_version |= 0x04;
   saw_ebolt();
   tbolt_e |= 0x01;

   if(SV6_FAMILY) {
      have_critical_alarms = 33;
//    if(antenna_fault & 0x01) critical_alarms |= CRIT_RAM;      // alarm could be no backup battery
//    else                     critical_alarms &= (~CRIT_RAM);
      if(antenna_fault & 0x02) critical_alarms |= CRIT_FPGA;
      else                     critical_alarms &= (~CRIT_FPGA);
      if(antenna_fault & 0x0C) critical_alarms |= CRIT_GPS;
      else                     critical_alarms &= (~CRIT_GPS);
      if(antenna_fault & 0x20) critical_alarms |= CRIT_OCXO;
      else                     critical_alarms &= (~CRIT_OCXO);

      if(antenna_fault & 0x10) minor_alarms |= MINOR_ANT_NO_PWR;
      else                     minor_alarms &= (~MINOR_ANT_NO_PWR);
      have_antenna = 33;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0xa2c91(%rip), %rdi     # 0x10ba8d
callq 0x520bf
callq 0x51c47
callq 0x51c47
movl %eax, %ebx
xorl %edi, %edi
callq 0x52194
leaq 0x1c0155(%rip), %rax    # 0x228f70
cmpl $0x0, (%rax)
jne 0x68ebd
leaq 0x28e5dd(%rip), %rax    # 0x2f7408
orb $0x4, (%rax)
callq 0x56b98
leaq 0x199ac6(%rip), %rax    # 0x202900
orb $0x1, (%rax)
leaq 0x199a8c(%rip), %rax    # 0x2028d0
cmpq $0x1, (%rax)
jne 0x68ebd
leaq 0x19c183(%rip), %rax    # 0x204fd4
movl (%rax), %eax
addl $-0x33, %eax
cmpl $0x1d, %eax
ja 0x68ebd
movl $0x20004009, %ecx       # imm = 0x20004009
btl %eax, %ecx
jae 0x68ebd
leaq 0x28e43c(%rip), %rcx    # 0x2f72a8
pushq $0x21
popq %rax
movl %eax, (%rcx)
movzbl %bl, %ecx
leaq 0x28e355(%rip), %rdx    # 0x2f71d0
movl (%rdx), %esi
andl $-0x19, %esi
xorl %edi, %edi
testb $0xc, %bl
setne %dil
movl %ecx, %r8d
shrl %r8d
andl $0x10, %r8d
leal (%r8,%rdi,8), %edi
orl %esi, %edi
movl %edi, (%rdx)
shll $0x1b, %ecx
sarl $0x1f, %ecx
leaq 0x28e330(%rip), %rdx    # 0x2f71d8
movl (%rdx), %esi
andl $-0x7, %esi
andl $0x6, %ecx
orl %esi, %ecx
movl %ecx, (%rdx)
leaq 0x28e371(%rip), %rcx    # 0x2f722c
movl %eax, (%rcx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: get_system_msg()
void get_system_msg()
{
int i;

// response to 0x28 GPS system message request
   log_packet_id("Packet 0x48 (GPS system message)");

   for(i=0; i<22; i++) msg_field[i] = tsip_byte();
   msg_field[22] = 0;
//strcpy(debug_text, msg_field);
if(debug_file) fprintf(debug_file, "# GPS system message:%s\n", msg_field);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
leaq 0xa29f4(%rip), %rdi     # 0x10bac6
callq 0x520bf
xorl %ebx, %ebx
leaq 0x2bc960(%rip), %r14    # 0x325a40
cmpq $0x16, %rbx
je 0x690f4
callq 0x51c47
movb %al, (%r14,%rbx)
incq %rbx
jmp 0x690e0
movb $0x0, 0x16(%r14)
leaq 0x1bf290(%rip), %rax    # 0x228390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x69121
leaq 0xa29d8(%rip), %rsi     # 0x10bae7
leaq 0x2bc92a(%rip), %rdx    # 0x325a40
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x9560
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: get_alm_health()
void get_alm_health()
{
int i;

   log_packet_id("Packet 0x49 (Almanac health page)");
   for(i=1; i<=32; i++) {
//    sat[i].health_flag = tsip_byte();
      if(tsip_byte()) sat[i].health_flag = 1;  // unhealthy
      else            sat[i].health_flag = 0;  // healthy
   }
   check_tsip_end(1);
   if(tsip_error) return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
leaq 0xa29cc(%rip), %rdi     # 0x10bb00
callq 0x520bf
movl $0x348, %ebx            # imm = 0x348
leaq 0x1bfe6b(%rip), %r14    # 0x228fb0
cmpq $0x6c48, %rbx           # imm = 0x6C48
je 0x69163
callq 0x51c47
testb %al, %al
setne (%r14,%rbx)
addq $0x348, %rbx            # imm = 0x348
jmp 0x69145
xorl %edi, %edi
popq %rbx
popq %r14
popq %rbp
jmp 0x52194
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: get_ebolt_health2()
void get_ebolt_health2()
{
u08 id;
u08 rtc;
u08 superpackets;

   log_packet_id("Packet 0x4B (Tbolt-E health)");

   id = tsip_byte();           // sv6=1B
   rtc = tsip_byte();
   superpackets = tsip_byte();
   check_tsip_end(1);
   if(tsip_error) return;

   saw_version |= 0x08;
   saw_ebolt();
   tbolt_e |= 0x02;

   if(SV6_FAMILY) {
      if(rtc & 0x08) minor_alarms |= MINOR_ALMANAC;
      else           minor_alarms &= (~MINOR_ALMANAC);

//    if(rtc & 0x02) minor_alarms |= MINOR_ALMANAC;      // no time at power-up
//    else           minor_alarms &= (~MINOR_ALMANAC);

      if(rtc & 0x05) critical_alarms |= CRIT_FPGA;
      else           critical_alarms &= (~CRIT_FPGA);
      have_critical_alarms = 34;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0xa298c(%rip), %rdi     # 0x10bb38
callq 0x520bf
callq 0x51c47
callq 0x51c47
movl %eax, %ebx
callq 0x51c47
xorl %edi, %edi
callq 0x52194
leaq 0x1bfda0(%rip), %rax    # 0x228f70
cmpl $0x0, (%rax)
jne 0x6925b
leaq 0x28e228(%rip), %rax    # 0x2f7408
orb $0x8, (%rax)
callq 0x56b98
leaq 0x199711(%rip), %rax    # 0x202900
orb $0x2, (%rax)
leaq 0x1996d7(%rip), %rax    # 0x2028d0
cmpq $0x1, (%rax)
jne 0x6925b
leaq 0x19bdce(%rip), %rax    # 0x204fd4
movl (%rax), %eax
addl $-0x33, %eax
cmpl $0x1d, %eax
ja 0x6925b
movl $0x20004009, %ecx       # imm = 0x20004009
btl %eax, %ecx
jae 0x6925b
movzbl %bl, %eax
leaq 0x28dfb4(%rip), %rcx    # 0x2f71d8
movl $0xfffff7ff, %edx       # imm = 0xFFFFF7FF
andl (%rcx), %edx
andl $0x8, %eax
shll $0x8, %eax
orl %edx, %eax
movl %eax, (%rcx)
xorl %eax, %eax
testb $0x5, %bl
setne %al
leaq 0x28df8c(%rip), %rcx    # 0x2f71d0
movl (%rcx), %edx
andl $-0x9, %edx
leal (%rdx,%rax,8), %eax
movl %eax, (%rcx)
leaq 0x28e053(%rip), %rax    # 0x2f72a8
movl $0x22, (%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: get_sv6_config()
void get_sv6_config()
{
float el_val;
float amu_val;

   log_packet_id("Packet 0x4C (SV6_FAMILY receiver config)");

   dynamics_code = tsip_byte();
   el_val = tsip_single();
   amu_val = tsip_single();
   pdop_mask = tsip_single();
   have_pdop_mask |= 0x01;
   pdop_switch = tsip_single();
   have_pdop_mask |= 0x02;
   check_tsip_end(1);
   if(tsip_error) return;
//sprintf(debug_text, "got dyn:%d el:%f amu:%f pmask:%f sw:%f  aflag:%d  amode:%d", dynamics_code,el_val,amu_val,pdop_mask,pdop_switch, amu_flag, amu_mode);

   // stupid filtering required for STARLOC II devices
   el_val = (float) (int) ((el_val*RAD_TO_DEG) + 0.50F);
   if((el_val >= 0.0) && (el_val <= 90.0)) {
      el_mask = el_val;
      have_el_mask = 1;
   }

   if((amu_val >= 0.0) && (amu_val < 60.0)) {
      amu_mask = amu_val;
      have_amu = 1;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0xa28e6(%rip), %rdi     # 0x10bb55
callq 0x520bf
callq 0x51c47
leaq 0x28de45(%rip), %rcx    # 0x2f70c5
movb %al, (%rcx)
callq 0x51dc3
movss %xmm0, -0xc(%rbp)
callq 0x51dc3
movss %xmm0, -0x10(%rbp)
callq 0x51dc3
leaq 0x28de1a(%rip), %rax    # 0x2f70bc
movss %xmm0, (%rax)
leaq 0x28de1f(%rip), %rbx    # 0x2f70cc
orb $0x1, (%rbx)
callq 0x51dc3
leaq 0x28de04(%rip), %rax    # 0x2f70c0
movss %xmm0, (%rax)
orb $0x2, (%rbx)
xorl %edi, %edi
callq 0x52194
movss -0x10(%rbp), %xmm1
leaq 0x1bfc9a(%rip), %rax    # 0x228f70
cmpl $0x0, (%rax)
jne 0x69343
cvtss2sd -0xc(%rbp), %xmm0
mulsd 0x89e78(%rip), %xmm0    # 0xf3160
addsd 0x89d78(%rip), %xmm0    # 0xf3068
cvttsd2si %xmm0, %eax
cmpl $0x5a, %eax
ja 0x69315
cvtsi2ss %eax, %xmm0
leaq 0x28ddb0(%rip), %rax    # 0x2f70b4
movss %xmm0, (%rax)
leaq 0x28e0ed(%rip), %rax    # 0x2f73fc
movl $0x1, (%rax)
xorpd %xmm0, %xmm0
ucomiss %xmm0, %xmm1
jb 0x69343
movss 0x8ddd6(%rip), %xmm0    # 0xf70fc
ucomiss %xmm1, %xmm0
jbe 0x69343
leaq 0x28dd86(%rip), %rax    # 0x2f70b8
movss %xmm1, (%rax)
leaq 0x28e0bb(%rip), %rax    # 0x2f73f8
movl $0x1, (%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: get_sv6_osc_offset()
void get_sv6_osc_offset()
{
float ofs;

   log_packet_id("Packet 0x4D (SV6_FAMILY osc offset)");
   ofs = tsip_single();
   check_tsip_end(1);

   osc_offset = (double)ofs/1000.0;
   have_osc_offset = 666;
   have_rcvr_osc = 666;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
leaq 0xa2825(%rip), %rdi     # 0x10bb7e
callq 0x520bf
callq 0x51dc3
movss %xmm0, -0x4(%rbp)
xorl %edi, %edi
callq 0x52194
cvtss2sd -0x4(%rbp), %xmm0
divsd 0x89cbc(%rip), %xmm0    # 0xf3038
leaq 0x28d43d(%rip), %rax    # 0x2f67c0
movsd %xmm0, (%rax)
leaq 0x28dea6(%rip), %rax    # 0x2f7234
movl $0x29a, %ecx            # imm = 0x29A
movl %ecx, (%rax)
leaq 0x28deac(%rip), %rax    # 0x2f7248
movl %ecx, (%rax)
addq $0x10, %rsp
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: get_sv6_utc_info()
void get_sv6_utc_info()
{
double a0;
float a1;
short delta_ls;
float tot;
double wn_lsf;
unsigned short wnt;
unsigned short dn;
short delta_lsf;
int wraps;

   log_packet_id("Packet 0x4F (UTC leapsecond info)");

   a0 = tsip_double();
   a1 = tsip_single();
   delta_ls = tsip_word();
   tot = tsip_single();
   wnt = tsip_word();
   wn_lsf = (double) (short) tsip_word();
   wraps = gps_week / 1024;
   wn_lsf += (wraps * 1024);
// while(wn_lsf < (double) gps_week) {  // adjust for week rollovers
//    wn_lsf += 1024.0;
// }
   dn = tsip_word();
   delta_lsf = tsip_word();

   minor_alarms &= (~MINOR_LEAP_PEND);
   if(delta_ls != delta_lsf) {
      minor_alarms |= MINOR_LEAP_PEND;
   }
   calc_leap_days(wn_lsf, dn, 10);
   have_leap_info = 33;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
leaq 0xa27ef(%rip), %rdi     # 0x10bbc2
callq 0x520bf
callq 0x51e6f
callq 0x51dc3
callq 0x51c63
movl %eax, %ebx
callq 0x51dc3
callq 0x51c63
callq 0x51c63
movl %eax, %r14d
leaq 0x28e336(%rip), %rax    # 0x2f7738
movzwl (%rax), %r12d
callq 0x51c63
movl %eax, %r15d
callq 0x51c63
xorl %ecx, %ecx
cmpw %ax, %bx
setne %cl
leaq 0x28ddb6(%rip), %rax    # 0x2f71d8
movl $0xffffff7f, %edx       # imm = 0xFFFFFF7F
andl (%rax), %edx
shll $0x7, %ecx
orl %edx, %ecx
movl %ecx, (%rax)
movswl %r14w, %eax
cvtsi2sd %eax, %xmm1
andl $0xfc00, %r12d          # imm = 0xFC00
cvtsi2sd %r12d, %xmm0
addsd %xmm1, %xmm0
movzwl %r15w, %edi
callq 0x55822
leaq 0x28de40(%rip), %rax    # 0x2f7298
movl $0x21, (%rax)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: get_clock_bias()
void get_clock_bias()
{
float bias;
float bias_rate;
float time_of_fix;
static int last_tof = (-1);

   log_packet_id("Packet 0x54 (single sat clock bias)");

   bias = tsip_single();
   bias_rate = tsip_single();
   time_of_fix = tsip_single();
   check_tsip_end(1);
   if(tsip_error) return;

   if(last_tof != (int) time_of_fix) {
      if(SV6_FAMILY || PALISADE || (have_pri_time == 0)) {
         sv6_time_code(time_of_fix);
         sat_count = 1;
      }
      last_tof = (int) time_of_fix;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0xa2558(%rip), %rdi     # 0x10bbe4
callq 0x520bf
callq 0x51dc3
callq 0x51dc3
callq 0x51dc3
movss %xmm0, -0xc(%rbp)
xorl %edi, %edi
callq 0x52194
leaq 0x1bf8bd(%rip), %rax    # 0x228f70
cmpl $0x0, (%rax)
jne 0x6972a
cvttss2si -0xc(%rbp), %ebx
cmpl %ebx, 0xeaec1(%rip)     # 0x154584
je 0x6972a
movss -0xc(%rbp), %xmm0
leaq 0x1991ff(%rip), %rax    # 0x2028d0
movq (%rax), %rax
leaq 0x19b8f9(%rip), %rcx    # 0x204fd4
movl (%rcx), %ecx
cmpq $0x1, %rax
jne 0x696f5
leal -0x33(%rcx), %edx
cmpl $0x1d, %edx
ja 0x696f5
movl $0x20004009, %esi       # imm = 0x20004009
btl %edx, %esi
jb 0x69712
cmpq $0x1, %rax
sete %al
cmpl $0x50, %ecx
sete %cl
testb %cl, %al
jne 0x69712
leaq 0x1bf7cb(%rip), %rax    # 0x228ed8
cmpl $0x0, (%rax)
jne 0x69724
callq 0x69467
leaq 0x1bf7ee(%rip), %rax    # 0x228f0c
movl $0x1, (%rax)
movl %ebx, 0xeae5a(%rip)     # 0x154584
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: get_io_options()
void get_io_options()
{
u08 posn;
u08 vel;
u08 timing;
u08 aux;

   log_packet_id("Packet 0x55 (I/O options)");

   posn = tsip_byte();
   vel = tsip_byte();
   timing = tsip_byte();
   aux = tsip_byte();
//sprintf(debug_text, "posn:%02X  vel:%02X  timing:%02X  aux:%02X", posn,vel,timing,aux);

   if(ACU_GG || ACU_360) {  // aux not supported on these devices
      aux = amu_flag;
   }
   else if(SV6_FAMILY || ACUTIME | PALISADE) {
      aux ^= amu_flag;  // set polarity to match what a tbolt does

      if(timing & 0x01) {  // UTC time
         time_flags |= (TFLAGS_UTC);
         timing_mode = TMODE_UTC;
         have_timing_mode = 1;
      }
      else {  // GPS time
         time_flags &= (~TFLAGS_UTC);
         timing_mode = TMODE_GPS;
         have_timing_mode = 1;
      }
//sprintf(debug_text2, "tflags:%04X  tmode:%02X", time_flags, timing_mode);
      have_rcvr_tmode = 1;
   }

   if(aux & 0x08) {  // dbc mode
      level_type = "dBc";
      amu_mode = 0;
   }
   else { // amu mode
      level_type = "AMU";
      amu_mode = 1;
   }
   check_tsip_end(1);
   if(tsip_error) return;

   have_io_options = 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0xa24ca(%rip), %rdi     # 0x10bc08
callq 0x520bf
callq 0x51c47
callq 0x51c47
callq 0x51c47
movl %eax, %ebx
callq 0x51c47
leaq 0x199170(%rip), %rcx    # 0x2028d0
movq (%rcx), %rdx
cmpq $0x1, %rdx
sete %sil
leaq 0x19b862(%rip), %rcx    # 0x204fd4
movl (%rcx), %ecx
cmpl $0x41, %ecx
sete %dil
andb %sil, %dil
leaq 0x199173(%rip), %rsi    # 0x2028f8
movl (%rsi), %esi
cmpl $0x47, %esi
sete %r8b
testb %r8b, %dil
je 0x6979e
leaq 0x1bf75a(%rip), %rax    # 0x228ef4
movb (%rax), %al
jmp 0x69809
testb %dil, %dil
je 0x697af
cmpl $0x47, %esi
je 0x69793
cmpl $0x33, %esi
je 0x69793
jmp 0x697c7
cmpq $0x1, %rdx
jne 0x69809
addl $-0x33, %ecx
cmpl $0x1d, %ecx
ja 0x69809
movl $0x20004009, %edx       # imm = 0x20004009
btl %ecx, %edx
jae 0x69809
leaq 0x1bf726(%rip), %rcx    # 0x228ef4
xorb (%rcx), %al
andb $0x1, %bl
leaq 0x28dcca(%rip), %rcx    # 0x2f74a4
movl (%rcx), %edx
andl $-0x2, %edx
movzbl %bl, %esi
negb %bl
orl %edx, %esi
andb $0x3, %bl
movl %esi, (%rcx)
leaq 0x28dccb(%rip), %rcx    # 0x2f74bd
movb %bl, (%rcx)
leaq 0x28dbd1(%rip), %rcx    # 0x2f73cc
pushq $0x1
popq %rdx
movl %edx, (%rcx)
leaq 0x28dbc9(%rip), %rcx    # 0x2f73d0
movl %edx, (%rcx)
andb $0x8, %al
leaq 0xa2414(%rip), %rcx     # 0x10bc26
leaq 0xa2409(%rip), %rdx     # 0x10bc22
cmoveq %rcx, %rdx
shrb $0x3, %al
xorb $0x1, %al
leaq 0x1bf6cf(%rip), %rcx    # 0x228ef8
movq %rdx, (%rcx)
leaq 0x1bf6bd(%rip), %rcx    # 0x228ef0
movb %al, (%rcx)
xorl %edi, %edi
callq 0x52194
leaq 0x1bf72d(%rip), %rax    # 0x228f70
cmpl $0x0, (%rax)
jne 0x69855
leaq 0x28dbf5(%rip), %rax    # 0x2f7444
movl $0x1, (%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: get_sat_health()
void get_sat_health()
{
u08 op;
u08 vals[1+32];
u08 i;
u32 val;

   log_packet_id("Packet 0x59 (Sat disable/health)");

   op = tsip_byte();
   if(op == 3) {  // sat selection enabled / disabled
      val = 0;
      for(i=1; i<=32; i++) {
         sat[i].disabled = tsip_byte();
         if(!sat[i].disabled) val |= 1 << (i-1);
      }
      sats_enabled = val;
   }
   else if(op == 6) {  // sat health enabled / disabled
      for(i=1; i<=32; i++) sat[i].forced_healthy = tsip_byte();
   }
   else if((op == 0) && (tsip_type == STARLOC_TYPE)) { // bogus packet!
      for(i=1; i<=31; i++) vals[i] = tsip_byte();  // note: 00 op plus 31 bytes of zeroes
   }
   else {  // unknown type field
      for(i=1; i<=32; i++) vals[i] = tsip_byte();
   }
   check_tsip_end(1);
   if(tsip_error) return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0xa197c(%rip), %rdi     # 0x10bc7f
callq 0x520bf
callq 0x51c47
cmpb $0x3, %al
je 0x6a344
movzbl %al, %ecx
cmpl $0x6, %ecx
jne 0x6a3a6
movl $0x34a, %ebx            # imm = 0x34A
leaq 0x1bec87(%rip), %r14    # 0x228fb0
cmpq $0x6c4a, %rbx           # imm = 0x6C4A
je 0x6a391
callq 0x51c47
movb %al, (%r14,%rbx)
addq $0x348, %rbx            # imm = 0x348
jmp 0x6a329
movl $0x349, %r14d           # imm = 0x349
addq 0xcfbf7(%rip), %r14     # 0x139f48
xorl %r15d, %r15d
pushq $0x1
popq %r12
xorl %ebx, %ebx
xorl %r13d, %r13d
cmpq $0x20, %rbx
je 0x6a387
callq 0x51c47
movl %r12d, %edx
movl %ebx, %ecx
shll %cl, %edx
testb %al, %al
cmovnel %r15d, %edx
movb %al, (%r14)
orl %edx, %r13d
incq %rbx
addq $0x348, %r14            # imm = 0x348
jmp 0x6a35d
leaq 0x28cd56(%rip), %rax    # 0x2f70e4
movl %r13d, (%rax)
xorl %edi, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x52194
testb %al, %al
jne 0x6a3c4
leaq 0x19ac23(%rip), %rax    # 0x204fd4
cmpl $0x53, (%rax)
jne 0x6a3c4
movb $0x1f, %bl
subb $0x1, %bl
jb 0x6a391
callq 0x51c47
jmp 0x6a3b8
movb $0x20, %bl
subb $0x1, %bl
jb 0x6a391
callq 0x51c47
jmp 0x6a3c6
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: get_eph_status()
void get_eph_status()
{
int prn;

   log_packet_id("Packet 0x5B (Sat ephemeris status)");

   prn = tsip_byte();
if(0 && debug_file) fprintf(debug_file, "\neph status %02d\n", prn);  //rnx3
   if((prn == 0) && (tsip_type == STARLOC_TYPE)) {  // bogus message
      for(prn=1; prn<=15; prn++) tsip_byte();
   }
   else {
      if(prn > MAX_PRN) prn = 0;  // !!!! max_sat_check - put any bogus data in unused entry in array
      if(prn < 1) prn = 0;  // !!!! max_sat_check - put any bogus data in unused entry in array

      sat[prn].eph_time = tsip_single();
      sat[prn].eph_health = tsip_byte();
      sat[prn].iode = (u08) tsip_byte();
      sat[prn].toe = tsip_single();
      sat[prn].fit_flag = tsip_byte();
      sat[prn].sv_accuracy = tsip_single();
      check_tsip_end(1);

      if(have_accu == 0) need_redraw = 2004;
      have_accu = 1;
if(0 && debug_file) {
   gregorian(0, jd_utc);
   fprintf(debug_file, "got eph status %d: %02d/%02d/%02d\n", prn, g_hours,g_minutes,g_seconds);
}
   }
   if(tsip_error) return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
leaq 0xa1741(%rip), %rdi     # 0x10bcc3
callq 0x520bf
callq 0x51c47
movl %eax, %ebx
testb %al, %al
jne 0x6a5b1
leaq 0x19aa3b(%rip), %rax    # 0x204fd4
cmpl $0x53, (%rax)
jne 0x6a5b1
pushq $0xf
popq %rbx
subl $0x1, %ebx
jb 0x6a63c
callq 0x51c47
jmp 0x6a5a1
callq 0x51dc3
movzbl %bl, %eax
imulq $0x348, %rax, %rbx      # imm = 0x348
leaq 0x1be9e9(%rip), %r14    # 0x228fb0
movss %xmm0, 0x1ec(%r14,%rbx)
callq 0x51c47
movb %al, 0x1f0(%r14,%rbx)
callq 0x51c47
movb %al, 0x1f1(%r14,%rbx)
callq 0x51dc3
movss %xmm0, 0x1f4(%r14,%rbx)
callq 0x51c47
movb %al, 0x1f8(%r14,%rbx)
callq 0x51dc3
movss %xmm0, 0x1fc(%r14,%rbx)
xorl %edi, %edi
callq 0x52194
leaq 0x28cd9c(%rip), %rax    # 0x2f73c0
cmpl $0x0, (%rax)
jne 0x6a636
leaq 0x198214(%rip), %rcx    # 0x202844
movl $0x7d4, (%rcx)          # imm = 0x7D4
movl $0x1, (%rax)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: get_filter_config()
void get_filter_config()
{
   log_packet_id("Packet 0x70 (Filter config)");

   pv_filter = tsip_byte();
   static_filter = tsip_byte();
   alt_filter = tsip_byte();
   kalman_filter = tsip_byte();
   have_filter = (PV_FILTER | STATIC_FILTER | ALT_FILTER | KALMAN_FILTER);
   // Note: the ACUTIME and PALISADE return this value, but is not
   //       documented.  Can we set the filters?  !!!!!
   check_tsip_end(1);
   if(tsip_error) return;

   saw_version |= 0x80;
if(just_read) return;

   saw_kalman_on |= kalman_filter;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0xa12f4(%rip), %rdi     # 0x10bd80
callq 0x520bf
callq 0x51c47
leaq 0x28c5fb(%rip), %rcx    # 0x2f7098
movb %al, (%rcx)
callq 0x51c47
leaq 0x28c5ee(%rip), %rcx    # 0x2f7099
movb %al, (%rcx)
callq 0x51c47
leaq 0x28c5e1(%rip), %rcx    # 0x2f709a
movb %al, (%rcx)
callq 0x51c47
leaq 0x28c5d4(%rip), %rbx    # 0x2f709b
movb %al, (%rbx)
leaq 0x28c5c0(%rip), %rax    # 0x2f7090
movl $0xf, (%rax)
xorl %edi, %edi
callq 0x52194
leaq 0x1be48c(%rip), %rax    # 0x228f70
cmpl $0x0, (%rax)
jne 0x6ab0a
leaq 0x28c918(%rip), %rax    # 0x2f7408
orb $-0x80, (%rax)
leaq 0x2b651e(%rip), %rax    # 0x321018
cmpb $0x0, (%rax)
jne 0x6ab0a
movb (%rbx), %al
leaq 0x28c91c(%rip), %rcx    # 0x2f7424
orb %al, (%rcx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: get_posn_filter()
void get_posn_filter()
{
int mode;
float f1,f2,f3,f4,f5;
int i1,i2,i3,i4,i5;

   log_packet_id("Packet 0x72 (SV6_FAMILY position filter)");

   mode = tsip_word();
   f1 = tsip_single();
   i1 = tsip_word();
   i2 = tsip_word();
   i3 = tsip_word();
   i4 = tsip_word();
   f2 = tsip_single();
   f3 = tsip_single();
   f4 = tsip_single();
   f5 = tsip_single();
   i5 = tsip_word();
   check_tsip_end(1);
//sprintf(debug_text3, "i: %f %f %f %f %f", f1,f2,f3,f4,f5);
//sprintf(debug_text2, "i: %d %d %d %d %d", i1,i2,i3,i4,i5);
//sprintf(debug_text, "posn:%d  err:%04X", mode, tsip_error);
   if(i5 == 65535) static_filter = 0;
   else            static_filter = 1;
   have_filter |= STATIC_FILTER;

   if(f1 == 1.0) pv_filter = 0;
   else          pv_filter = 1;
   have_filter |= PV_FILTER;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0xa127e(%rip), %rdi     # 0x10bd9c
callq 0x520bf
callq 0x51c63
callq 0x51dc3
movss %xmm0, -0xc(%rbp)
callq 0x51c63
callq 0x51c63
callq 0x51c63
callq 0x51c63
callq 0x51dc3
callq 0x51dc3
callq 0x51dc3
callq 0x51dc3
callq 0x51c63
movl %eax, %ebx
xorl %edi, %edi
callq 0x52194
cmpw $-0x1, %bx
leaq 0x28c526(%rip), %rax    # 0x2f7099
setne (%rax)
leaq 0x28c513(%rip), %rax    # 0x2f7090
movss -0xc(%rbp), %xmm0
ucomiss 0x8c563(%rip), %xmm0    # 0xf70ec
setp %cl
setne %dl
orb %cl, %dl
leaq 0x28c500(%rip), %rcx    # 0x2f7098
movb %dl, (%rcx)
orb $0x3, (%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: get_alt_filter()
void get_alt_filter()
{
float mode;

   log_packet_id("Packet 0x74 (High-8 mode)");

   mode = tsip_single();
   check_tsip_end(1);

   if(tsip_error) return;
   if(mode > 1) alt_filter = 1;
   else         alt_filter = 0;
   have_filter |= ALT_FILTER;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
leaq 0xa1212(%rip), %rdi     # 0x10bdc5
callq 0x520bf
callq 0x51dc3
movss %xmm0, -0x4(%rbp)
xorl %edi, %edi
callq 0x52194
leaq 0x1be3a0(%rip), %rax    # 0x228f70
cmpl $0x0, (%rax)
jne 0x6abf5
movss -0x4(%rbp), %xmm0
ucomiss 0x8c50b(%rip), %xmm0    # 0xf70ec
leaq 0x28c4b2(%rip), %rax    # 0x2f709a
seta (%rax)
leaq 0x28c49e(%rip), %rax    # 0x2f7090
orb $0x4, (%rax)
addq $0x10, %rsp
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: get_lla_fix()
void get_lla_fix()
{
double xlat, xlon, xalt;
double clock_bias;
float time_of_fix;

   log_packet_id("Packet 0x84 (LLA fix)");

   xlat = tsip_double();
   xlon = tsip_double();
   xalt = tsip_double();
   clock_bias = tsip_double();
   time_of_fix = tsip_single();
   check_tsip_end(1);
   if(tsip_error) return;

   if(SV6_FAMILY || PALISADE || (have_pri_time == 0)) {
      sv6_time_code(time_of_fix);

      lat = xlat;
      lon = xlon;
      alt = xalt;
      #ifdef PRECISE_STUFF
         precise_check();
      #endif
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
leaq 0xa11c6(%rip), %rdi     # 0x10be87
callq 0x520bf
callq 0x51e6f
movsd %xmm0, -0x20(%rbp)
callq 0x51e6f
movsd %xmm0, -0x18(%rbp)
callq 0x51e6f
movsd %xmm0, -0x10(%rbp)
callq 0x51e6f
callq 0x51dc3
movss %xmm0, -0x4(%rbp)
xorl %edi, %edi
callq 0x52194
leaq 0x1be26f(%rip), %rax    # 0x228f70
cmpl $0x0, (%rax)
je 0x6ad0c
addq $0x20, %rsp
popq %rbp
retq
leaq 0x197bbd(%rip), %rax    # 0x2028d0
movq (%rax), %rax
leaq 0x19a2b7(%rip), %rcx    # 0x204fd4
movl (%rcx), %ecx
cmpq $0x1, %rax
jne 0x6ad37
leal -0x33(%rcx), %edx
cmpl $0x1d, %edx
ja 0x6ad37
movl $0x20004009, %esi       # imm = 0x20004009
btl %edx, %esi
jb 0x6ad54
cmpq $0x1, %rax
sete %al
cmpl $0x50, %ecx
sete %cl
testb %cl, %al
jne 0x6ad54
leaq 0x1be189(%rip), %rax    # 0x228ed8
cmpl $0x0, (%rax)
jne 0x6ad06
movss -0x4(%rbp), %xmm0
callq 0x69467
leaq 0x28c26b(%rip), %rax    # 0x2f6fd0
movsd -0x20(%rbp), %xmm0
movsd %xmm0, (%rax)
leaq 0x28c263(%rip), %rax    # 0x2f6fd8
movsd -0x18(%rbp), %xmm0
movsd %xmm0, (%rax)
leaq 0x28c25b(%rip), %rax    # 0x2f6fe0
movsd -0x10(%rbp), %xmm0
movsd %xmm0, (%rax)
addq $0x20, %rsp
popq %rbp
jmp 0xe58f8
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: fix_manuf_params()
void fix_manuf_params()
{
   if(luxor) return;
   if(rcvr_type != TSIP_RCVR) return;
   if(SV6_FAMILY) return;

   send_tsip_start(0x8E);
   send_byte(0x41);
   send_word(0x1234);           //prefix
   send_dword(0x56789ABCL);     // sn
   send_byte(10);               // yr
   send_byte(1);    // mo
   send_byte(2);    //day
   send_byte(3);    // hr
   send_single(0.0F);    // build offset
   send_word(0);    // test code
   send_tsip_end();

   save_segment(0xFF, 27);
}

// Assembly:
leaq 0x1be169(%rip), %rax    # 0x228f3e
cmpb $0x0, (%rax)
jne 0x6ae02
leaq 0x197aef(%rip), %rax    # 0x2028d0
cmpq $0x1, (%rax)
jne 0x6ae02
leaq 0x19a1e6(%rip), %rax    # 0x204fd4
movl (%rax), %eax
addl $-0x33, %eax
cmpl $0x1d, %eax
ja 0x6ae03
movl $0x20004009, %ecx       # imm = 0x20004009
btl %eax, %ecx
jae 0x6ae03
retq
pushq %rbp
movq %rsp, %rbp
movl $0x8e, %edi
callq 0x5707f
pushq $0x41
popq %rdi
callq 0x523f2
movl $0x1234, %edi           # imm = 0x1234
callq 0x52599
movl $0x56789abc, %edi       # imm = 0x56789ABC
callq 0x525e2
pushq $0xa
popq %rdi
callq 0x523f2
pushq $0x1
popq %rdi
callq 0x523f2
pushq $0x2
popq %rdi
callq 0x523f2
pushq $0x3
popq %rdi
callq 0x523f2
xorps %xmm0, %xmm0
callq 0x52673
xorl %edi, %edi
callq 0x52599
callq 0x570f8
movl $0xff, %edi
popq %rbp
jmp 0x6166c
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: get_manuf_params()
void get_manuf_params()
{
u16 test_code;
int sum;

   log_packet_id("Packet 0x8F.41 (Manufacturing Params)");

   sn_prefix = tsip_word();
   serial_num = tsip_dword();
   build_year = sum = tsip_byte();
   if(build_year > TRUNC_YEAR) build_year += 1900;
   else                        build_year += 2000;
   build_month = tsip_byte();
   build_day = tsip_byte();
   build_hour = tsip_byte();
   build_offset = tsip_single();
   test_code = tsip_word();
   check_tsip_end(1);
   if(tsip_error) return;

   if(build_month > 12) build_month = 0;

   sum += sn_prefix + serial_num + test_code + build_month + build_day + build_hour;  // check for zeroed build params
   build_ok = ((build_month <= 12) && (build_month != 0) && 
               (build_day <= 31) && (build_day != 0) &&
               (build_year >= 1980) && (build_year <= 2080) &&
               (build_hour <= 24));

   have_build |= 0x01;
   if(build_ok) have_build |= 0x02;


   if((sum == 0) || build_ok) {
      show_manuf_params();
   }

   if(text_mode && first_key) return;
   if(zoom_screen) return;
   if(luxor) return;
   if(just_read) return;

////show_serial_info();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0xa103d(%rip), %rdi     # 0x10becf
callq 0x520bf
callq 0x51c63
leaq 0x28cadd(%rip), %rcx    # 0x2f7980
movw %ax, (%rcx)
callq 0x51cf3
leaq 0x28cad2(%rip), %rcx    # 0x2f7984
movl %eax, (%rcx)
callq 0x51c47
movzbl %al, %r14d
leal 0x7d0(%r14), %eax
leal 0x76c(%r14), %ecx
cmpb $0x51, %r14b
cmovbl %eax, %ecx
leaq 0x28caaf(%rip), %rax    # 0x2f7988
movw %cx, (%rax)
callq 0x51c47
leaq 0x28caa2(%rip), %r12    # 0x2f798a
movb %al, (%r12)
callq 0x51c47
leaq 0x28ca93(%rip), %r13    # 0x2f798b
movb %al, (%r13)
callq 0x51c47
leaq 0x28ca84(%rip), %r15    # 0x2f798c
movb %al, (%r15)
callq 0x51dc3
leaq 0x28ca79(%rip), %rax    # 0x2f7990
movss %xmm0, (%rax)
callq 0x51c63
movl %eax, %ebx
xorl %edi, %edi
callq 0x52194
leaq 0x1be040(%rip), %rax    # 0x228f70
cmpl $0x0, (%rax)
jne 0x6afd6
leaq 0x28ca40(%rip), %rcx    # 0x2f7980
leaq 0x28ca3d(%rip), %r9     # 0x2f7984
leaq 0x28ca3a(%rip), %r10    # 0x2f7988
movb (%r12), %al
cmpb $0xd, %al
jb 0x6af5d
movb $0x0, (%r12)
xorl %eax, %eax
movzwl (%rcx), %ecx
movzwl %bx, %esi
movzbl %al, %edx
movzbl (%r13), %edi
movzbl (%r15), %r8d
cmpl $0x19, %r8d
setb %al
addl %ecx, %esi
addl (%r9), %esi
leal -0x1(%rdi), %r9d
movl %edi, %ecx
addl %edx, %ecx
addl %r8d, %ecx
addl %esi, %ecx
decb %dl
cmpb $0xc, %dl
setb %dl
cmpb $0x1f, %r9b
setb %sil
andb %dl, %sil
movzwl (%r10), %edx
addl $0xfffff844, %edx       # imm = 0xFFFFF844
cmpw $0x65, %dx
setb %dl
andb %al, %dl
andb %sil, %dl
movzbl %dl, %eax
leaq 0x28c439(%rip), %rsi    # 0x2f73f4
movl %eax, (%rsi)
leaq 0x28c42c(%rip), %rsi    # 0x2f73f0
addl %eax, %eax
orl (%rsi), %eax
orl $0x1, %eax
movl %eax, (%rsi)
addl %r14d, %ecx
je 0x6afe5
testb %dl, %dl
jne 0x6afe5
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6aff8
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: show_manuf_params()
void show_manuf_params()
{
   if(rcvr_type != TSIP_RCVR) return;

   have_info |= MANUF_PARAMS;

   if(text_mode && first_key) return;
   if(zoom_screen) return;
   if(luxor) return;
   if(just_read) return;

   show_build_info(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x1978cd(%rip), %rax    # 0x2028d0
cmpq $0x1, (%rax)
jne 0x6b05d
leaq 0x28c964(%rip), %rax    # 0x2f7974
orb $0x1, (%rax)
leaq 0x1977be(%rip), %rax    # 0x2027d8
cmpl $0x0, (%rax)
setne %al
leaq 0x1bdf31(%rip), %rcx    # 0x228f58
cmpl $0x0, (%rcx)
setne %cl
testb %cl, %al
jne 0x6b05d
leaq 0x28b770(%rip), %rax    # 0x2f67a8
cmpb $0x0, (%rax)
jne 0x6b05d
leaq 0x1bdefa(%rip), %rax    # 0x228f3e
cmpb $0x0, (%rax)
jne 0x6b05d
leaq 0x2b5fc8(%rip), %rax    # 0x321018
cmpb $0x0, (%rax)
jne 0x6b05d
xorl %edi, %edi
popq %rbp
jmp 0xa8e38
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: get_prodn_params()
void get_prodn_params()
{
u16 rsvd2;
u16 rsvd1;

   log_packet_id("Packet 0x8F.42 (Production Params)");

   prodn_options = tsip_byte();
   prodn_extn = tsip_byte();
   case_prefix = tsip_word();
   case_sn = tsip_dword();
   prodn_num = tsip_dword();
   rsvd1 = tsip_word();
   machine_id = tsip_word();
   rsvd2 = tsip_word();
   check_tsip_end(1);
   if(tsip_error) return;

   have_info |= PRODN_PARAMS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0xa0e8b(%rip), %rdi     # 0x10bef5
callq 0x520bf
callq 0x51c47
leaq 0x28c919(%rip), %rcx    # 0x2f7994
movb %al, (%rcx)
callq 0x51c47
leaq 0x28c90c(%rip), %rcx    # 0x2f7995
movb %al, (%rcx)
callq 0x51c63
leaq 0x28c8ff(%rip), %rcx    # 0x2f7996
movw %ax, (%rcx)
callq 0x51cf3
leaq 0x28c8f2(%rip), %rcx    # 0x2f7998
movl %eax, (%rcx)
callq 0x51cf3
leaq 0x28c8e8(%rip), %rcx    # 0x2f799c
movl %eax, (%rcx)
callq 0x51c63
callq 0x51c63
leaq 0x28c8d9(%rip), %rcx    # 0x2f79a0
movw %ax, (%rcx)
callq 0x51c63
xorl %edi, %edi
callq 0x52194
leaq 0x1bde93(%rip), %rax    # 0x228f70
cmpl $0x0, (%rax)
jne 0x6b0ec
leaq 0x28c88b(%rip), %rax    # 0x2f7974
orb $0x2, (%rax)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: get_segment_info()
void get_segment_info()
{
u08 seg_info;

   log_packet_id("Packet 0x8F.45 (EEPROM Segment Info)");

   seg_info = tsip_byte();
   check_tsip_end(1);
   if(tsip_error) return;
   have_seg_info = 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0xa0e1f(%rip), %rdi     # 0x10bf18
callq 0x520bf
callq 0x51c47
xorl %edi, %edi
callq 0x52194
leaq 0x1bde5f(%rip), %rax    # 0x228f70
cmpl $0x0, (%rax)
jne 0x6b123
leaq 0x28c85f(%rip), %rax    # 0x2f797c
movl $0x1, (%rax)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: get_pps_settings()
void get_pps_settings()
{
u08 pps_rsvd;
float bias_threshold;

   log_packet_id("Packet 0x8F.4A (PPS settings)");

   pps_enabled = tsip_byte();
   have_pps_enable = 1;
   pps_rsvd = tsip_byte();
   pps_polarity = tsip_byte();
   have_pps_polarity = 1;
   cable_delay = tsip_double();
   bias_threshold = tsip_single();
   check_tsip_end(1);

// if(have_cable_delay == 0) need_redraw = 2005;
   have_cable_delay = 1;
   if(tsip_error) return;

   if(text_mode && first_key) return;
   if(zoom_screen) return;
   if(luxor) return;
if(just_read) return;

   saw_version |= 0x40;
   show_cable_delay();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0xa0e0b(%rip), %rdi     # 0x10bf3d
callq 0x520bf
callq 0x51c47
leaq 0x28cbdd(%rip), %rcx    # 0x2f7d20
movb %al, (%rcx)
leaq 0x28c190(%rip), %rax    # 0x2f72dc
pushq $0x1
popq %rbx
movl %ebx, (%rax)
callq 0x51c47
callq 0x51c47
movzbl %al, %eax
leaq 0x28cbb3(%rip), %rcx    # 0x2f7d18
movl %eax, (%rcx)
leaq 0x28c172(%rip), %rax    # 0x2f72e0
movl %ebx, (%rax)
callq 0x51e6f
leaq 0x28cc4c(%rip), %rax    # 0x2f7dc8
movsd %xmm0, (%rax)
callq 0x51dc3
xorl %edi, %edi
callq 0x52194
leaq 0x28c121(%rip), %rax    # 0x2f72b4
movl %ebx, (%rax)
leaq 0x1bddd4(%rip), %rax    # 0x228f70
cmpl $0x0, (%rax)
je 0x6b1a8
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x197629(%rip), %rax    # 0x2027d8
cmpl $0x0, (%rax)
sete %al
leaq 0x1bdd9c(%rip), %rcx    # 0x228f58
cmpl $0x0, (%rcx)
sete %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x6b1a1
leaq 0x28b5d8(%rip), %rax    # 0x2f67a8
cmpb $0x0, (%rax)
jne 0x6b1a1
leaq 0x1bdd62(%rip), %rax    # 0x228f3e
cmpb $0x0, (%rax)
jne 0x6b1a1
leaq 0x2b5e30(%rip), %rax    # 0x321018
cmpb $0x0, (%rax)
jne 0x6b1a1
leaq 0x28c214(%rip), %rax    # 0x2f7408
orb $0x40, (%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x6b202
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: show_cable_delay()
void show_cable_delay()
{
double val;
char *s;

   if(zoom_screen) return;
   if(text_mode && first_key) return;
   if(!have_cable_delay) return;

   if(0 && (rcvr_type == RFTG_RCVR)) {
      s = "ft";
      val = cable_delay;
   }
   else {
      s = "ns";
      val = cable_delay*1.0E9;
   }

   if     (val >= 100000000.0) sprintf(out, "Dly:%11.0f %s", val, s);
   else if(val >= 10000000.0)  sprintf(out, "Dly:%11.1f %s", val, s);
   else if(val >= 1000000.0)   sprintf(out, "Dly:%11.2f %s", val, s);
   else if(val >= 100000.0)    sprintf(out, "Dly:%11.3f %s", val, s);
   else if(val >= 10000.0)     sprintf(out, "Dly:%11.4f %s", val, s);
   else if(val >= 1000.0)      sprintf(out, "Dly:%11.5f %s", val, s);
   else                        sprintf(out, "Dly:%11.6f %s", val, s);
   vidstr(VAL_ROW+5, VAL_COL, WHITE, out);
}

// Assembly:
leaq 0x28b59f(%rip), %rax    # 0x2f67a8
cmpb $0x0, (%rax)
je 0x6b20f
retq
leaq 0x1975c2(%rip), %rax    # 0x2027d8
cmpl $0x0, (%rax)
setne %al
leaq 0x1bdd35(%rip), %rcx    # 0x228f58
cmpl $0x0, (%rcx)
setne %cl
testb %cl, %al
jne 0x6b20e
leaq 0x28c080(%rip), %rax    # 0x2f72b4
cmpl $0x0, (%rax)
je 0x6b20e
leaq 0x28cb88(%rip), %rax    # 0x2f7dc8
movsd (%rax), %xmm0
mulsd 0x87ddc(%rip), %xmm0    # 0xf3028
ucomisd 0x9cfec(%rip), %xmm0    # 0x108240
jae 0x6b29a
ucomisd 0x8a6f2(%rip), %xmm0    # 0xf5950
jae 0x6b2a3
ucomisd 0x87de8(%rip), %xmm0    # 0xf3050
jae 0x6b2ac
ucomisd 0x87e56(%rip), %xmm0    # 0xf30c8
jae 0x6b2b5
ucomisd 0x87e5c(%rip), %xmm0    # 0xf30d8
jae 0x6b2be
ucomisd 0x87db2(%rip), %xmm0    # 0xf3038
leaq 0xa51db(%rip), %rax     # 0x110468
leaq 0xa51c6(%rip), %rsi     # 0x11045a
cmovbq %rax, %rsi
jmp 0x6b2c5
leaq 0xa5173(%rip), %rsi     # 0x110414
jmp 0x6b2c5
leaq 0xa5178(%rip), %rsi     # 0x110422
jmp 0x6b2c5
leaq 0xa517d(%rip), %rsi     # 0x110430
jmp 0x6b2c5
leaq 0xa5182(%rip), %rsi     # 0x11043e
jmp 0x6b2c5
leaq 0xa5187(%rip), %rsi     # 0x11044c
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0x2baf4e(%rip), %rbx    # 0x326220
leaq 0x943f1(%rip), %rdx     # 0xff6ca
movq %rbx, %rdi
movb $0x1, %al
callq 0x9060
pushq $0x5
popq %rdi
pushq $0xf
popq %rdx
movl %edx, %esi
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xe2d2
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: get_pps_mode()
void get_pps_mode()
{
   log_packet_id("Packet 0x8F.4E (pps rate)");

   pps_rate = tsip_byte();
   have_pps_rate = 2;
   check_tsip_end(1);
   if(tsip_error) return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0xa0c57(%rip), %rdi     # 0x10bf5b
callq 0x520bf
callq 0x51c47
leaq 0x28ca0e(%rip), %rcx    # 0x2f7d23
movb %al, (%rcx)
leaq 0x28bfb2(%rip), %rax    # 0x2f72d0
movl $0x2, (%rax)
xorl %edi, %edi
popq %rbp
jmp 0x52194
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: get_osc_sense()
void get_osc_sense()
{
   log_packet_id("Packet 0x8F.A1 (10 MHz sense)");
// not avilable on ThunderBolt-E or early ThunderBolts

   osc_polarity = tsip_byte();
   have_osc_polarity = 1;
   check_tsip_end(1);
   if(tsip_error) return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0xa0c24(%rip), %rdi     # 0x10bf91
callq 0x520bf
callq 0x51c47
leaq 0x28c994(%rip), %rcx    # 0x2f7d12
movb %al, (%rcx)
leaq 0x28bf61(%rip), %rax    # 0x2f72e8
movl $0x1, (%rax)
xorl %edi, %edi
popq %rbp
jmp 0x52194
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: get_timing_mode()
void get_timing_mode()
{
   log_packet_id("Packet 0x8F.A2 (Timing mode)");
   if(STARLOC) { // receiver randomly changes reported timing mode
      return;
   }

   timing_mode = tsip_byte();
timing_mode &= (TMODE_UTC);
if(timing_mode != TMODE_GPS) timing_mode = TMODE_UTC;
   have_rcvr_tmode = 1;
   have_timing_mode = 1;
   check_tsip_end(1);
   if(tsip_error) return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0xa0c0f(%rip), %rdi     # 0x10bfaf
callq 0x520bf
leaq 0x197524(%rip), %rax    # 0x2028d0
cmpq $0x1, (%rax)
jne 0x6b3c0
leaq 0x199c1b(%rip), %rax    # 0x204fd4
cmpl $0x53, (%rax)
jne 0x6b3c0
popq %rbp
retq
callq 0x51c47
xorl %ecx, %ecx
testb $0x3, %al
setne %cl
leal (%rcx,%rcx,2), %eax
leaq 0x28c0e7(%rip), %rcx    # 0x2f74bd
movb %al, (%rcx)
leaq 0x28bff1(%rip), %rax    # 0x2f73d0
pushq $0x1
popq %rcx
movl %ecx, (%rax)
leaq 0x28bfe1(%rip), %rax    # 0x2f73cc
movl %ecx, (%rax)
xorl %edi, %edi
popq %rbp
jmp 0x52194
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: get_sat_solutions()
void get_sat_solutions()
{   //not available on ThunderBolt-E
u08 format;
u32 time_of_week;
float clock_bias;
float clock_bias_rate;
float sat_bias;
int prn;
int i;

   log_packet_id("Packet 0x8F.A7 (Satellite solutions)");

   if(tsip_type == STARLOC_TYPE) {  // !!!! who knows what garbage this device craps out?
      // some of these are 9 bytes long, some are 13... we just ignore this message
      return;
   }

   format = tsip_byte();
   time_of_week = tsip_dword();

   if(format == 0) {     // floating point
      clock_bias = tsip_single();
      clock_bias_rate = tsip_single();
   }
   else if(format == 1) {   // integer values
      clock_bias = (float) (int) tsip_word();
      clock_bias *= 100.0e-12F;
      clock_bias_rate = (float) (int) tsip_word();
      clock_bias_rate *= 1.0e-12F;
   }
   else {  // invalid format
      check_tsip_end(1);
      if(tsip_error) return;
      return;
   }

   for(i=1; i<=MAX_PRN; i++) {  // reset current bias flags
      sat[i].last_bias_msg = 0;
   }

   for(i=0; i<8; i++) {  // get bias info from all satellites
      prn = tsip_byte();
      if(prn > MAX_PRN) prn = 0;  // put any bogus data in unused entry in array
      if(format == 0) {
         sat_bias = tsip_single();
      }
      else {
         sat_bias = (float) (int) tsip_word();
         sat_bias *= 100.0e-12F;
      }

      sat[prn].time_of_fix = (float) time_of_week;
      sat[prn].sat_bias = sat_bias;
      sat[prn].last_bias_msg = 1;

      if(have_bias == 0) need_redraw = 2006;
      have_bias = 1;
   }
   check_tsip_end(1);
   if(tsip_error) return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0xa0bbd(%rip), %rdi     # 0x10bfe9
callq 0x520bf
leaq 0x199b9c(%rip), %rax    # 0x204fd4
cmpl $0x53, (%rax)
jne 0x6b44c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x51c47
movl %eax, %ebx
callq 0x51cf3
movl %eax, %r14d
testb %bl, %bl
je 0x6b474
cmpb $0x1, %bl
jne 0x6b52f
callq 0x51c63
callq 0x51c63
jmp 0x6b47e
callq 0x51dc3
callq 0x51dc3
movl $0x588, %eax            # imm = 0x588
leaq 0x1bdb26(%rip), %r15    # 0x228fb0
cmpq $0xcd380, %rax          # imm = 0xCD380
je 0x6b49f
movb $0x0, (%r15,%rax)
addq $0x348, %rax            # imm = 0x348
jmp 0x6b48a
movl %r14d, %eax
cvtsi2ss %rax, %xmm0
movss %xmm0, -0x2c(%rbp)
pushq $0x8
popq %r12
leaq 0x28bf05(%rip), %r13    # 0x2f73bc
subl $0x1, %r12d
jb 0x6b52f
callq 0x51c47
movl %eax, %r14d
testb %bl, %bl
je 0x6b4df
callq 0x51c63
movzwl %ax, %eax
cvtsi2ss %eax, %xmm0
mulss 0x9d4ef(%rip), %xmm0    # 0x1089cc
jmp 0x6b4e4
callq 0x51dc3
movzbl %r14b, %eax
imulq $0x348, %rax, %rax      # imm = 0x348
movss -0x2c(%rbp), %xmm1
movss %xmm1, 0x23c(%r15,%rax)
movss %xmm0, 0x238(%r15,%rax)
movb $0x1, 0x240(%r15,%rax)
cmpl $0x0, (%r13)
jne 0x6b525
leaq 0x197325(%rip), %rax    # 0x202844
movl $0x7d6, (%rax)          # imm = 0x7D6
movl $0x1, (%r13)
jmp 0x6b4b7
xorl %edi, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x52194
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: get_survey_params()
void get_survey_params()
{
u08 survey_flag;
u32 rsvd;

   log_packet_id("Packet 0x8F.A9 (Survey params)");

   survey_flag = tsip_byte();
   survey_save = tsip_byte();
   survey_length = tsip_dword();
   rsvd = tsip_dword();
   check_tsip_end(1);
   if(tsip_error) return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0xa051c(%rip), %rdi     # 0x10c031
callq 0x520bf
callq 0x51c47
callq 0x51c47
leaq 0x28c349(%rip), %rcx    # 0x2f7e74
movb %al, (%rcx)
callq 0x51cf3
leaq 0x28c337(%rip), %rcx    # 0x2f7e70
movl %eax, (%rcx)
callq 0x51cf3
xorl %edi, %edi
popq %rbp
jmp 0x52194
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: check_for_leapsecond()
void check_for_leapsecond()
{
   // see if the receiver time code could be a leapsecond

   leap_time = 0;   // see if the time could be a leap second, if so do a screen grab and a log entry
   leap_sixty = 0;
   if(time_flags & TFLAGS_NO_UTC_OFS) return;  // time is not valid
   if(time_flags & TFLAGS_INVALID) return;
   if(rcvr_type == THERMO_RCVR) return;
   if(rcvr_type == TICC_RCVR) return;
   if((rcvr_type == TSIP_RCVR) && (tsip_type == STARLOC_TYPE)) return;  // STARLOC has too many bogus time stamps

if(0 && (pri_minutes == 00) && (pri_seconds == 0)) {  // simulate leap second time code
   pri_seconds = 60;
   pri_minutes = 59;
   if(--pri_hours < 0) pri_hours = 23;
}

   if((pri_minutes == 59) && (pri_seconds == 60)) {  // xx:59:60 leapsecond
      leap_sixty = 1;  // used to restore xx:59:60 leapsecond value from jd value
   }

   if((nav_rate != 1.0) && (raw_frac != 0.0)) ;
   else if((pri_minutes == 59) && (pri_seconds == 60)) {
      leap_time = 1;  // xx:59:60
   }
   else if((pri_minutes == 0) && (pri_seconds == 0) && (last_second == 0)) {
      leap_time = 2;  // repeated xx:00:00 second
   }
   else if((pri_minutes == 59) && (pri_seconds == 59) && (last_second == 59)) {
      leap_time = 3;  // repeated xx:59:59 second
   }

   if(leap_file && leap_time) {
      leaped = leap_time;
   }

   last_second = pri_seconds;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x28b8fd(%rip), %rax    # 0x2f7450
leaq 0x28b6ce(%rip), %rsi    # 0x2f7228
andl $0x0, (%rsi)
movb $0x0, (%rax)
leaq 0x28b93d(%rip), %rcx    # 0x2f74a4
movl (%rcx), %ecx
testb $0x8, %cl
jne 0x6bc61
testb $0x4, %cl
jne 0x6bc61
leaq 0x196d4e(%rip), %rcx    # 0x2028d0
movq (%rcx), %rcx
cmpq $0x10000, %rcx          # imm = 0x10000
je 0x6bc61
cmpq $0x80000, %rcx          # imm = 0x80000
je 0x6bc61
cmpq $0x1, %rcx
jne 0x6bbb5
leaq 0x199428(%rip), %rcx    # 0x204fd4
cmpl $0x53, (%rcx)
je 0x6bc61
leaq 0x28b948(%rip), %rcx    # 0x2f7504
movl (%rcx), %edi
movl %edi, %edx
xorl $0x3b, %edx
leaq 0x28b936(%rip), %rcx    # 0x2f7500
movl (%rcx), %ecx
movl %ecx, %r8d
xorl $0x3c, %r8d
orl %edx, %r8d
sete %r8b
jne 0x6bbe2
movl $0x1, (%rsi)
leaq 0x19976f(%rip), %rsi    # 0x205358
movsd (%rsi), %xmm0
ucomisd 0x8747b(%rip), %xmm0    # 0xf3070
jne 0x6bbf9
jnp 0x6bc10
leaq 0x28b8e0(%rip), %rsi    # 0x2f74e0
movsd (%rsi), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x6bc58
jp 0x6bc58
movb $0x1, %sil
testb %r8b, %r8b
jne 0x6bc3f
orl %ecx, %edi
leaq 0x28bae7(%rip), %rsi    # 0x2f7708
movl (%rsi), %r8d
movb $0x2, %sil
orl %r8d, %edi
je 0x6bc3f
movl %ecx, %esi
xorl $0x3b, %esi
orl %esi, %edx
xorl $0x3b, %r8d
movb $0x3, %sil
orl %edx, %r8d
jne 0x6bc58
movb %sil, (%rax)
leaq 0x28c67b(%rip), %rax    # 0x2f82c4
cmpb $0x0, (%rax)
je 0x6bc58
leaq 0x28b594(%rip), %rax    # 0x2f71e9
movb %sil, (%rax)
leaq 0x28baa9(%rip), %rax    # 0x2f7708
movl %ecx, (%rax)
popq %rbp
retq