LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: decode_sa35_msg()
void decode_sa35_msg()
{
char c;
int i;

   start_msg_decode(0);

   nmea_msg[0] = 0;
   for(i=0; i<tsip_wptr; i++) {  // copy message from tsip buffer to nmea buffer
      c = tsip_byte();
      nmea_msg[i] = c;
      nmea_msg[i+1] = 0;
      if(i >= ((int)sizeof(nmea_msg)-12)) break;
   }
   msg_col = 0;     // index of next char to get from nmea buffer

   tsip_wptr = tsip_rptr = 0;
   tsip_sync = 0;

   // get the response from the reciver and pass it to (HOPEFULLY) the routine
   // that expects it...

   strupr(nmea_msg);

if(debug_file) fprintf(debug_file, "Decode msg %d:[%s]\n", polled_msg_id, nmea_msg);
//sprintf(debug_text, "Decode msg %d:[%s]", polled_msg_id, nmea_msg);


   sa35_msg_id = polled_msg_id;

   // !!!!! decode here

   i = get_norcvr_message();   // returns true if seconds just ticked
   poll_next_sa35();

   sa35_msg_id = 0;

   if(sim_file && sim_delay) {  // throttle sim file messages
      Sleep(sim_delay);
   }

   saw_rcvr_msg = 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
xorl %r14d, %r14d
xorl %edi, %edi
callq 0x7f2b8
leaq 0x2af305(%rip), %r15    # 0x33b830
movb $0x0, (%r15)
leaq 0x2abd1c(%rip), %rbx    # 0x338252
leaq 0x1b2a33(%rip), %r12    # 0x23ef70
movzwl (%rbx), %eax
cmpq %rax, %r14
jae 0x8c56c
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x8c556
orb $0x8, (%r12)
movb %al, (%r14,%r15)
movb $0x0, 0x1(%r14,%r15)
incq %r14
cmpq $0x1f6, %r14            # imm = 0x1F6
jne 0x8c53d
leaq 0x2af6d1(%rip), %rax    # 0x33bc44
movl $0x0, (%rax)
leaq 0x2abcd4(%rip), %rax    # 0x338254
xorl %ecx, %ecx
movw %cx, (%rax)
movw %cx, (%rbx)
leaq 0x2abcc7(%rip), %rax    # 0x338256
movw %cx, (%rax)
leaq 0x2af297(%rip), %rdi    # 0x33b830
callq 0x9899
leaq 0x1b1deb(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x8c5c8
movl 0x2e064d(%rip), %edx    # 0x36cc00
leaq 0x9744c(%rip), %rsi     # 0x123a06
leaq 0x2af26f(%rip), %rcx    # 0x33b830
xorl %eax, %eax
callq 0x9560
movl 0x2e0632(%rip), %eax    # 0x36cc00
movl %eax, 0x2e063c(%rip)    # 0x36cc10
callq 0x8247a
leaq 0x7d9eb(%rip), %rdi     # 0x109fcb
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x6e2d1
leaq 0x1b1dcf(%rip), %rax    # 0x23e3c0
cmpq $0x0, (%rax)
movl $0x0, 0x2e0611(%rip)    # 0x36cc10
setne %al
leaq 0x196ff7(%rip), %rcx    # 0x223600
movq (%rcx), %rdi
testq %rdi, %rdi
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x8c61e
callq 0xafe8
leaq 0x1b297b(%rip), %rax    # 0x23efa0
movl $0x1, (%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: parse_lpfrs_m()
void parse_lpfrs_m()
{
int hh;   // photocell voltage
int gg;   // Rb signal peak voltage
int ff;   // reserved
int ee;   // varactor voltage
int dd;   // EFC input voltage
int cc;   // lamp current
int bb;   // cell current
int aa;   // 90 MHz agc voltage
int i;

   log_packet_id("paramters");

   i = sscanf(nmea_msg, "%x %x %x %x %x %x %x %x", &hh,&gg,&ff,&ee,&dd,&cc,&bb,&aa);
   if(i != 8) {  // expected 8 values.  Loss of message sync?
      restart_prs_polling();
      return;
   }

   lpfrs_hh = ((double) (255-hh)) / 255.0 * 5.0;
   lpfrs_gg = ((double) gg) / 255.0 * 5.0;
   lpfrs_ff = ((double) ff);
   lpfrs_ee = ((double) ee) / 255.0 * 5.0;
   lpfrs_dd = ((double) dd) / 255.0 * 5.0;
   lpfrs_cc = ((double) (255-cc)) / 255.0 * 500.0;  // ma
   lpfrs_bb = ((double) (255-bb)) / 255.0 * 500.0;  // ma
   lpfrs_aa = ((double) gg) / 255.0 * 5.0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
leaq 0x973f6(%rip), %rdi     # 0x123a3c
callq 0x58dc2
leaq -0x30(%rbp), %r10
leaq -0x14(%rbp), %r11
leaq -0x18(%rbp), %rbx
leaq -0x1c(%rbp), %r14
leaq 0x2af1ce(%rip), %rdi    # 0x33b830
leaq 0x971dc(%rip), %rsi     # 0x123845
leaq -0x2c(%rbp), %rdx
leaq -0x28(%rbp), %rcx
leaq -0x24(%rbp), %r8
leaq -0x20(%rbp), %r9
xorl %eax, %eax
pushq %r10
pushq %r11
pushq %rbx
pushq %r14
callq 0x9360
addq $0x20, %rsp
cmpl $0x8, %eax
jne 0x8c77d
movl $0xff, %eax
movl $0xff, %ecx
subl -0x2c(%rbp), %ecx
cvtsi2sd %ecx, %xmm1
movsd 0x92093(%rip), %xmm0    # 0x11e740
divsd %xmm0, %xmm1
movsd 0x7ca7f(%rip), %xmm2    # 0x109138
mulsd %xmm2, %xmm1
leaq 0x281604(%rip), %rcx    # 0x30dcc8
movsd %xmm1, (%rcx)
xorps %xmm1, %xmm1
cvtsi2sdl -0x28(%rbp), %xmm1
divsd %xmm0, %xmm1
mulsd %xmm2, %xmm1
leaq 0x2815f1(%rip), %rcx    # 0x30dcd0
movsd %xmm1, (%rcx)
cvtsi2sdl -0x24(%rbp), %xmm3
leaq 0x2815e9(%rip), %rcx    # 0x30dcd8
movsd %xmm3, (%rcx)
xorps %xmm3, %xmm3
cvtsi2sdl -0x20(%rbp), %xmm3
divsd %xmm0, %xmm3
mulsd %xmm2, %xmm3
leaq 0x2815d6(%rip), %rcx    # 0x30dce0
movsd %xmm3, (%rcx)
xorps %xmm3, %xmm3
cvtsi2sdl -0x1c(%rbp), %xmm3
divsd %xmm0, %xmm3
movl $0xff, %ecx
subl -0x18(%rbp), %ecx
mulsd %xmm2, %xmm3
xorps %xmm2, %xmm2
cvtsi2sd %ecx, %xmm2
leaq 0x2815b4(%rip), %rcx    # 0x30dce8
movsd %xmm3, (%rcx)
divsd %xmm0, %xmm2
movsd 0x7f204(%rip), %xmm3    # 0x10b948
mulsd %xmm3, %xmm2
leaq 0x2815a1(%rip), %rcx    # 0x30dcf0
movsd %xmm2, (%rcx)
subl -0x14(%rbp), %eax
xorps %xmm2, %xmm2
cvtsi2sd %eax, %xmm2
divsd %xmm0, %xmm2
mulsd %xmm3, %xmm2
leaq 0x28158c(%rip), %rax    # 0x30dcf8
movsd %xmm2, (%rax)
leaq 0x281589(%rip), %rax    # 0x30dd00
movsd %xmm1, (%rax)
jmp 0x8c782
callq 0x8b1d2
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_lpfrs_id()
void parse_lpfrs_id()
{
   log_packet_id("id info");

   if(valid_sro_status()) {
      restart_prs_polling();
      return;
   }
   nmea_msg[14] = 0;
   strcpy(lpfrs_id, nmea_msg);

   nmea_msg[36] = 0;
   strcpy(lpfrs_fw, &nmea_msg[16]);

   nmea_msg[57] = 0;
   strcpy(lpfrs_ck, &nmea_msg[37]);

   if(lpfrs_id[0] && lpfrs_fw[0] && lpfrs_ck[0]) have_info |= (ALL_ID_INFO);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x970c6(%rip), %rdi     # 0x123866
callq 0x58dc2
callq 0x8b015
testl %eax, %eax
je 0x8c7c1
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x8b1d2
leaq 0x2af068(%rip), %r15    # 0x33b830
xorl %r13d, %r13d
movb %r13b, 0xe(%r15)
leaq 0x28145a(%rip), %r12    # 0x30dc30
movq %r12, %rdi
movq %r15, %rsi
callq 0x9340
movb %r13b, 0x24(%r15)
leaq 0x10(%r15), %rsi
leaq 0x281470(%rip), %rbx    # 0x30dc60
movq %rbx, %rdi
callq 0x9340
movb %r13b, 0x39(%r15)
addq $0x25, %r15
leaq 0x281489(%rip), %r14    # 0x30dc90
movq %r14, %rdi
movq %r15, %rsi
callq 0x9340
cmpb %r13b, (%r12)
je 0x8c82d
cmpb $0x0, (%rbx)
je 0x8c82d
cmpb $0x0, (%r14)
je 0x8c82d
leaq 0x28114a(%rip), %rax    # 0x30d974
orb $0xf, (%rax)
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: parse_lpfrs_c_read()
void parse_lpfrs_c_read()
{
   log_packet_id("coarse tune word");

   if(valid_sro_status()) {
      restart_prs_polling();
      return;
   }
   lpfrs_c_rval = atohex(nmea_msg);
   lpfrs_c_rval &= 0xFF;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x971ff(%rip), %rdi     # 0x123a46
callq 0x58dc2
callq 0x8b015
testl %eax, %eax
je 0x8c85b
popq %rbp
jmp 0x8b1d2
leaq 0x2aefce(%rip), %rdi    # 0x33b830
callq 0x98c6
movzbl %al, %eax
leaq 0x281447(%rip), %rcx    # 0x30dcb8
movl %eax, (%rcx)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_lpfrs_f_read()
void parse_lpfrs_f_read()
{
int i, j;

   log_packet_id("fine tune word");

   if(valid_sro_status()) {
      restart_prs_polling();
      return;
   }

   lpfrs_f_rval = atohex(nmea_msg);
   lpfrs_f_rval &= 0xFF;

   if(lpfrs_c_rval & 0x80) i = lpfrs_c_rval - 256;
   else                    i = lpfrs_c_rval;

   if(lpfrs_f_rval & 0x80) j = lpfrs_f_rval - 256;
   else                    j = lpfrs_f_rval;

   lpfrs_freq = 1.0E-9 * (double) i;
   lpfrs_freq += (1.0E-11 * (double) j);

   osc_offset = lpfrs_freq * 1.0E9;
   have_osc_offset = 78;
//sprintf(debug_text, "fread i:%d j:%d freq:%g ofs:%g", i,j,lpfrs_freq,osc_offset);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x971d7(%rip), %rdi     # 0x123a57
callq 0x58dc2
callq 0x8b015
testl %eax, %eax
je 0x8c894
popq %rbp
jmp 0x8b1d2
leaq 0x2aef95(%rip), %rdi    # 0x33b830
callq 0x98c6
movzbl %al, %eax
leaq 0x28140e(%rip), %rcx    # 0x30dcb8
movl (%rcx), %ecx
movl $0xffffff00, %edx       # imm = 0xFFFFFF00
leal (%rcx,%rdx), %esi
testb %cl, %cl
cmovnsl %ecx, %esi
movsbl %al, %ecx
andl %edx, %ecx
leaq 0x2813f7(%rip), %rdx    # 0x30dcbc
orl %eax, %ecx
cvtsi2sd %esi, %xmm0
mulsd 0x7c875(%rip), %xmm0    # 0x109148
cvtsi2sd %ecx, %xmm1
movl %eax, (%rdx)
mulsd 0x91e7f(%rip), %xmm1    # 0x11e760
addsd %xmm0, %xmm1
leaq 0x2813d4(%rip), %rax    # 0x30dcc0
movsd %xmm1, (%rax)
mulsd 0x7c730(%rip), %xmm1    # 0x109028
leaq 0x27fec1(%rip), %rax    # 0x30c7c0
movsd %xmm1, (%rax)
leaq 0x28092a(%rip), %rax    # 0x30d234
movl $0x4e, (%rax)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: set_lpfrs_freq(double)
void set_lpfrs_freq(double freq)
{
int high, low;
double val;

   if(read_only) return;

   if(freq > 1.27E-7) freq = 1.27E-7;
   if(freq < -1.28E-7) freq = -1.28E-7;

   high = (int) (freq / 1.0E-9);
   val = freq - ((double) high * 1.0E-9);
   low = (int) (val / 1.0E-11);

   sprintf(out, "C%02X", high & 0xFF);
   queue_lpfrs_cmd(out, LPFRS_C_WRITE_MSG);
   sprintf(out, "F%02X", low & 0xFF);
   queue_lpfrs_cmd(out, LPFRS_F_WRITE_MSG);

   BEEP(505);  // signal EEPROM write
//sprintf(debug_text2, "set freq %g:  val:%g  high:%d low:%d", freq,val,high,low);
}

// Assembly:
leaq 0x2aa6bf(%rip), %rax    # 0x33701a
cmpb $0x0, (%rax)
je 0x8c961
retq
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movsd 0x7f085(%rip), %xmm1    # 0x10b9f8
minsd %xmm0, %xmm1
movsd 0x7f071(%rip), %xmm0    # 0x10b9f0
maxsd %xmm1, %xmm0
movsd 0x7c7bd(%rip), %xmm1    # 0x109148
movapd %xmm0, %xmm2
divsd %xmm1, %xmm2
cvttsd2si %xmm2, %edx
cvttpd2dq %xmm2, %xmm2
cvtdq2pd %xmm2, %xmm2
mulsd %xmm1, %xmm2
subsd %xmm2, %xmm0
divsd 0x91db1(%rip), %xmm0    # 0x11e760
cvttsd2si %xmm0, %ebx
movl $0xff, %r15d
andl %r15d, %edx
leaq 0x2af85d(%rip), %r14    # 0x33c220
leaq 0x970be(%rip), %rsi     # 0x123a88
movq %r14, %rdi
xorl %eax, %eax
callq 0x9060
movq %r14, %rdi
movl $0x389, %esi            # imm = 0x389
callq 0x5edda
andl %r15d, %ebx
leaq 0x970a3(%rip), %rsi     # 0x123a8e
movq %r14, %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0x9060
movq %r14, %rdi
movl $0x38a, %esi            # imm = 0x38A
callq 0x5edda
movl $0x1f9, %edi            # imm = 0x1F9
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x9d78
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_prs_id()
void parse_prs_id()
{
char *s;
   
   log_packet_id("");
   log_packet_id("id info");
   prs_fw[0] = 0;
   prs_sn[0] = 0;

   s = strstr(nmea_msg, "_SN_");
   if(s == 0) return;

   *s = 0;
   strcpy(prs_fw, nmea_msg);

   if(s[1]) strcpy(prs_sn, s+1);
   if(all_polled) have_info |= ALL_ID_INFO;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0xa4e91(%rip), %rdi     # 0x131a96
callq 0x58dc2
leaq 0x96c55(%rip), %rdi     # 0x123866
callq 0x58dc2
leaq 0x280e93(%rip), %rax    # 0x30dab0
xorl %ecx, %ecx
movb %cl, (%rax)
leaq 0x280eb8(%rip), %rax    # 0x30dae0
movb %cl, (%rax)
leaq 0x2aebff(%rip), %rdi    # 0x33b830
leaq 0x96f2b(%rip), %rsi     # 0x123b63
callq 0x9090
testq %rax, %rax
je 0x8cc86
movq %rax, %rbx
movb $0x0, (%rax)
leaq 0x280e61(%rip), %rdi    # 0x30dab0
leaq 0x2aebda(%rip), %rsi    # 0x33b830
callq 0x9340
cmpb $0x0, 0x1(%rbx)
je 0x8cc73
incq %rbx
leaq 0x280e75(%rip), %rdi    # 0x30dae0
movq %rbx, %rsi
callq 0x9340
cmpl $0x0, 0x2df14e(%rip)    # 0x36bdc8
je 0x8cc86
leaq 0x280cf1(%rip), %rax    # 0x30d974
orb $0xf, (%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_prs_st()
void parse_prs_st()
{
int i;

   // status
   log_packet_id("status");

   for(i=0; i<6; i++) {
      if(get_msg_field()) {
         prs_st[i] = atoi(msg_field);
         have_prs_st |= (1 << i);

         if(prs_st[0] & 0x0F) critical_alarms |= CRIT_PWR;
         else                 critical_alarms &= (~CRIT_PWR);

         if(prs_st[3] & 0x0C) critical_alarms |= CRIT_OCXO;
         else                 critical_alarms &= (~CRIT_OCXO);

         if(prs_st[5] & 0x06) critical_alarms |= CRIT_FPGA;  // bad interrupt or watchdog
         else                 critical_alarms &= (~CRIT_FPGA);
//       have_critical_alarms = 1;

         if(prs_st[5] & 0x18) minor_alarms |= MINOR_EEPROM;
         else                 minor_alarms &= (~MINOR_EEPROM);
         have_eeprom = 1;
      }
      else ++bad_prs_val;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x98e7b(%rip), %rdi     # 0x125b1d
callq 0x58dc2
xorl %ebx, %ebx
leaq 0x18de40(%rip), %r15    # 0x21aaf0
leaq 0x280519(%rip), %r13    # 0x30d1d0
leaq 0x28051a(%rip), %r14    # 0x30d1d8
leaq 0x2805e7(%rip), %r12    # 0x30d2ac
callq 0x810b1
testl %eax, %eax
je 0x8cd47
leaq 0x2aed6b(%rip), %rdi    # 0x33ba40
callq 0x95e0
movl $0x1, %edx
movl %ebx, %ecx
shll %cl, %edx
movl %eax, (%r15,%rbx,4)
leaq 0x18dd9a(%rip), %rax    # 0x21aa88
orl %edx, (%rax)
xorl %eax, %eax
testb $0xf, (%r15)
setne %al
movl (%r13), %ecx
andl $-0x1d, %ecx
leal (%rcx,%rax,4), %eax
xorl %ecx, %ecx
testb $0xc, 0xc(%r15)
setne %cl
shll $0x4, %ecx
orl %eax, %ecx
movl 0x14(%r15), %eax
xorl %edx, %edx
testb $0x6, %al
setne %dl
leal (%rcx,%rdx,8), %ecx
movl %ecx, (%r13)
xorl %ecx, %ecx
testb $0x18, %al
setne %cl
movl (%r14), %eax
movl $0xfffffbff, %edx       # imm = 0xFFFFFBFF
andl %edx, %eax
shll $0xa, %ecx
orl %eax, %ecx
movl %ecx, (%r14)
movl $0x1, (%r12)
jmp 0x8cd4d
incl 0x2dfee7(%rip)          # 0x36cc34
incq %rbx
cmpq $0x6, %rbx
jne 0x8ccc5
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: parse_prs_lm()
void parse_prs_lm()
{
   // lock mode
   log_packet_id("lock mode");

   if(get_msg_field()) {
      prs_lm = atoi(msg_field);
      have_prs_lm = 1;
      if(prs_lm & 0x0C) pps_enabled = 0;
      else pps_enabled = 1;
      have_pps_enable = 1;

      if(prs_lm == 3) pps_polarity = 1;
      else            pps_polarity = 0;
   }
   else ++bad_prs_val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x96df4(%rip), %rdi     # 0x123b68
callq 0x58dc2
callq 0x810b1
testl %eax, %eax
je 0x8cdce
leaq 0x2aecb7(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x18dd73(%rip), %rcx    # 0x21ab08
movl %eax, (%rcx)
leaq 0x18dcee(%rip), %rcx    # 0x21aa8c
testb $0xc, %al
leaq 0x280f79(%rip), %rdx    # 0x30dd20
sete (%rdx)
movl $0x1, %edx
movl %edx, (%rcx)
leaq 0x280524(%rip), %rcx    # 0x30d2dc
movl %edx, (%rcx)
cmpl $0x3, %eax
jne 0x8cdd6
leaq 0x280f52(%rip), %rax    # 0x30dd18
movl $0x1, (%rax)
jmp 0x8cde3
incl 0x2dfe60(%rip)          # 0x36cc34
jmp 0x8cde3
leaq 0x280f3b(%rip), %rax    # 0x30dd18
movl $0x0, (%rax)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_prs_lo()
void parse_prs_lo()
{
   // lock loop enable
   log_packet_id("loop lock enable");

   if(get_msg_field()) {
      prs_lo = atoi(msg_field);

      if     (prs_lo == 0) discipline_mode = DIS_MODE_DISABLED; // DIS_MODE_MANUAL_HOLD;
      else if(prs_lo == 1) discipline_mode = DIS_MODE_NORMAL;
      else                 discipline_mode = DIS_MODE_UNKNOWN;
      have_prs_lo = 1;
   }
   else ++bad_prs_val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x96d82(%rip), %rdi     # 0x123b72
callq 0x58dc2
callq 0x810b1
testl %eax, %eax
je 0x8ce40
leaq 0x2aec3b(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x18dcfb(%rip), %rcx    # 0x21ab0c
movl %eax, (%rcx)
cmpl $0x1, %eax
setne %cl
negb %cl
testl %eax, %eax
movzbl %cl, %eax
movl $0x6, %ecx
cmovnel %eax, %ecx
leaq 0x280668(%rip), %rax    # 0x30d497
movb %cl, (%rax)
leaq 0x18dc58(%rip), %rax    # 0x21aa90
movl $0x1, (%rax)
jmp 0x8ce46
incl 0x2dfdee(%rip)          # 0x36cc34
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_prs_ep()
void parse_prs_ep()
{
   // enable power
   log_packet_id("enable power");

   if(get_msg_field()) {
      prs_ep = atoi(msg_field);
      have_prs_ep = 1;
   }
   else ++bad_prs_val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x96d30(%rip), %rdi     # 0x123b83
callq 0x58dc2
callq 0x810b1
testl %eax, %eax
je 0x8ce85
leaq 0x2aebd8(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x18dd04(%rip), %rcx    # 0x21ab78
movl %eax, (%rcx)
leaq 0x18dc63(%rip), %rax    # 0x21aae0
movl $0x1, (%rax)
jmp 0x8ce8b
incl 0x2dfda9(%rip)          # 0x36cc34
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_prs_fc()
void parse_prs_fc()
{
double val;

   // frequecny control 
   log_packet_id("frequency control");

   if(get_msg_field()) {
      prs_fc1 = atoi(msg_field);
      have_prs_fc |= 0x01;
   }
   else ++bad_prs_val;

   if(get_msg_field()) {
      prs_fc2 = atoi(msg_field);
      have_prs_fc |= 0x02;
   }
   else ++bad_prs_val;

   val = (double) (prs_fc1 - 2048) * 1000.0;
   val += (double) (prs_fc2 - 2048); // freq DAC control word
   val *= 1.5;
   prs_fc_ppt = (val * 1.0E-12);
   val /= 1000.0;      // convert to ppt
   osc_offset = (val - prs_fc_ref);  // remove reference value to get current steering change
//sprintf(debug_text3, "fc:%d %d -> %g %g   (%g .. %g)  %g", prs_fc1,prs_fc2, 
//val, osc_offset, plot[OSC].min_disp_val,plot[OSC].max_disp_val,(plot[OSC].max_disp_val-plot[OSC].min_disp_val)*1.0E6);
   have_osc_offset = 32;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x96cf8(%rip), %rdi     # 0x123b90
callq 0x58dc2
callq 0x810b1
testl %eax, %eax
je 0x8cec7
leaq 0x2aeb93(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x18dc57(%rip), %rcx    # 0x21ab10
movl %eax, (%rcx)
leaq 0x18dbd2(%rip), %rax    # 0x21aa94
orb $0x1, (%rax)
jmp 0x8cecd
incl 0x2dfd67(%rip)          # 0x36cc34
callq 0x810b1
testl %eax, %eax
je 0x8cef7
leaq 0x2aeb63(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x18dc2b(%rip), %rcx    # 0x21ab14
movl %eax, (%rcx)
leaq 0x18dba2(%rip), %rcx    # 0x21aa94
orb $0x2, (%rcx)
jmp 0x8cf06
incl 0x2dfd37(%rip)          # 0x36cc34
leaq 0x18dc10(%rip), %rax    # 0x21ab14
movl (%rax), %eax
leaq 0x18dc03(%rip), %rcx    # 0x21ab10
movl $0xfffff800, %edx       # imm = 0xFFFFF800
addl %edx, %eax
addl (%rcx), %edx
cvtsi2sd %edx, %xmm0
movsd 0x7c116(%rip), %xmm1    # 0x109038
cvtsi2sd %eax, %xmm2
mulsd %xmm1, %xmm0
addsd %xmm0, %xmm2
mulsd 0x7c182(%rip), %xmm2    # 0x1090b8
movsd 0x912ba(%rip), %xmm0    # 0x11e1f8
mulsd %xmm2, %xmm0
leaq 0x18dcff(%rip), %rax    # 0x21ac48
movsd %xmm0, (%rax)
divsd %xmm1, %xmm2
subsd 0x2e4f3f(%rip), %xmm2   # 0x371e98
leaq 0x27f860(%rip), %rax    # 0x30c7c0
movsd %xmm2, (%rax)
leaq 0x2802c9(%rip), %rax    # 0x30d234
movl $0x20, (%rax)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_prs_fc2()
void parse_prs_fc2()
{
int life;
double val;

   // frequency control eeprom settings
   log_packet_id("frequency control eeprom");

   if(get_msg_field()) {  // power cycles
      prs_pwr_cycles = atoi(msg_field);
      have_prs_fc2 |= 0x01;
   }
   else ++bad_prs_val;

   if(get_msg_field()) {
      prs_fc_writes = atoi(msg_field);
      have_prs_fc2 |= 0x02;

      life = prs_fc_writes;  // updated around twice a day (manual says daily)
      if(prs_fc_writes > prs_pwr_cycles) life -= prs_pwr_cycles;
      scpi_life = (life * 12);  // updated around twice a day (manual says daily)
      have_lifetime = 1;
   }
   else ++bad_prs_val;

   if(get_msg_field()) {
      prs_ee_fc1 = atoi(msg_field);
   }
   else ++bad_prs_val;

   if(get_msg_field()) {
      prs_ee_fc2 = atoi(msg_field);
   }
   else ++bad_prs_val;

   val = (double) (prs_ee_fc1 - 2048) * 1000.0;
   val += (double) (prs_ee_fc2 - 2048); // DAC reference setting
   val *= 1.5;
   prs_ee_fc_ppt = (val * 1.0E-12);
   val /= 1000.0;
   prs_fc_ref = val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x96c24(%rip), %rdi     # 0x123ba2
callq 0x58dc2
callq 0x810b1
testl %eax, %eax
je 0x8cfad
leaq 0x2aeaad(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x18db81(%rip), %rcx    # 0x21ab20
movl %eax, (%rcx)
leaq 0x18daf0(%rip), %rax    # 0x21aa98
orb $0x1, (%rax)
jmp 0x8cfb3
incl 0x2dfc81(%rip)          # 0x36cc34
callq 0x810b1
testl %eax, %eax
je 0x8d00b
leaq 0x2aea7d(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x18dac9(%rip), %rcx    # 0x21aa98
orb $0x2, (%rcx)
leaq 0x18db47(%rip), %rcx    # 0x21ab20
movl (%rcx), %ecx
xorl %edx, %edx
cmpl %ecx, %eax
cmovgl %ecx, %edx
leaq 0x18db3b(%rip), %rcx    # 0x21ab24
movl %eax, (%rcx)
subl %edx, %eax
shll $0x2, %eax
leal (%rax,%rax,2), %eax
leaq 0x280462(%rip), %rcx    # 0x30d45c
movl %eax, (%rcx)
leaq 0x2802c5(%rip), %rax    # 0x30d2c8
movl $0x1, (%rax)
jmp 0x8d011
incl 0x2dfc23(%rip)          # 0x36cc34
callq 0x810b1
testl %eax, %eax
je 0x8d031
leaq 0x2aea1f(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x18daeb(%rip), %rcx    # 0x21ab18
movl %eax, (%rcx)
jmp 0x8d037
incl 0x2dfbfd(%rip)          # 0x36cc34
callq 0x810b1
testl %eax, %eax
je 0x8d057
leaq 0x2ae9f9(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x18dac9(%rip), %rcx    # 0x21ab1c
movl %eax, (%rcx)
jmp 0x8d066
incl 0x2dfbd7(%rip)          # 0x36cc34
leaq 0x18dab8(%rip), %rax    # 0x21ab1c
movl (%rax), %eax
leaq 0x18daab(%rip), %rcx    # 0x21ab18
movl $0xfffff800, %edx       # imm = 0xFFFFF800
addl %edx, %eax
addl (%rcx), %edx
cvtsi2sd %edx, %xmm0
movsd 0x7bfb6(%rip), %xmm1    # 0x109038
mulsd %xmm1, %xmm0
cvtsi2sd %eax, %xmm2
addsd %xmm0, %xmm2
mulsd 0x7c022(%rip), %xmm2    # 0x1090b8
movsd 0x9115a(%rip), %xmm0    # 0x11e1f8
mulsd %xmm2, %xmm0
leaq 0x18dba7(%rip), %rax    # 0x21ac50
movsd %xmm0, (%rax)
divsd %xmm1, %xmm2
movsd %xmm2, 0x2e4ddf(%rip)   # 0x371e98
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_prs_ds()
void parse_prs_ds()
{
   // detected signals 
   log_packet_id("detected signals");

   if(get_msg_field()) {
      prs_ds1 = atoi(msg_field);
      have_prs_ds |= 0x01;
   }
   else ++bad_prs_val;

   if(get_msg_field()) {
      prs_ds2 = atoi(msg_field);
      have_prs_ds |= 0x02;
   }
   else ++bad_prs_val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x96af5(%rip), %rdi     # 0x123bbb
callq 0x58dc2
callq 0x810b1
testl %eax, %eax
je 0x8d0f5
leaq 0x2ae965(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x18da41(%rip), %rcx    # 0x21ab28
movl %eax, (%rcx)
leaq 0x18d9ac(%rip), %rax    # 0x21aa9c
orb $0x1, (%rax)
jmp 0x8d0fb
incl 0x2dfb39(%rip)          # 0x36cc34
callq 0x810b1
testl %eax, %eax
je 0x8d125
leaq 0x2ae935(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x18da15(%rip), %rcx    # 0x21ab2c
movl %eax, (%rcx)
leaq 0x18d97c(%rip), %rax    # 0x21aa9c
orb $0x2, (%rax)
jmp 0x8d12b
incl 0x2dfb09(%rip)          # 0x36cc34
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_prs_sf()
void parse_prs_sf()
{
   // set frequency
   log_packet_id("set frequency");

   if(get_msg_field()) {
      prs_sf = atoi(msg_field);
      have_prs_sf = 1;
   }
   else ++bad_prs_val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x96a94(%rip), %rdi     # 0x123bcc
callq 0x58dc2
callq 0x810b1
testl %eax, %eax
je 0x8d16a
leaq 0x2ae8f3(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x18d9d7(%rip), %rcx    # 0x21ab30
movl %eax, (%rcx)
leaq 0x18d93e(%rip), %rax    # 0x21aaa0
movl $0x1, (%rax)
jmp 0x8d170
incl 0x2dfac4(%rip)          # 0x36cc34
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_prs_ss()
void parse_prs_ss()
{
   // set slope
   log_packet_id("set slope");

   if(get_msg_field()) {
      prs_ss = atoi(msg_field);
      have_prs_ss = 1;
   }
   else ++bad_prs_val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x96a5d(%rip), %rdi     # 0x123bda
callq 0x58dc2
callq 0x810b1
testl %eax, %eax
je 0x8d1af
leaq 0x2ae8ae(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x18d996(%rip), %rcx    # 0x21ab34
movl %eax, (%rcx)
leaq 0x18d8fd(%rip), %rax    # 0x21aaa4
movl $0x1, (%rax)
jmp 0x8d1b5
incl 0x2dfa7f(%rip)          # 0x36cc34
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_prs_ga()
void parse_prs_ga()
{
   // gain
   log_packet_id("gain");

   if(get_msg_field()) {
      prs_ga = atoi(msg_field);
      have_prs_ga = 1;
   }
   else ++bad_prs_val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x80794(%rip), %rdi     # 0x10d956
callq 0x58dc2
callq 0x810b1
testl %eax, %eax
je 0x8d1f4
leaq 0x2ae869(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x18d955(%rip), %rcx    # 0x21ab38
movl %eax, (%rcx)
leaq 0x18d8bc(%rip), %rax    # 0x21aaa8
movl $0x1, (%rax)
jmp 0x8d1fa
incl 0x2dfa3a(%rip)          # 0x36cc34
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_prs_ph()
void parse_prs_ph()
{
   // phase
   log_packet_id("phase");

   if(get_msg_field()) {
      prs_ph = atoi(msg_field);
      have_prs_ph = 1;
   }
   else ++bad_prs_val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x82759(%rip), %rdi     # 0x10f960
callq 0x58dc2
callq 0x810b1
testl %eax, %eax
je 0x8d239
leaq 0x2ae824(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x18d914(%rip), %rcx    # 0x21ab3c
movl %eax, (%rcx)
leaq 0x18d87b(%rip), %rax    # 0x21aaac
movl $0x1, (%rax)
jmp 0x8d23f
incl 0x2df9f5(%rip)          # 0x36cc34
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_prs_sp()
void parse_prs_sp()
{
int i;

   // set parameters
   log_packet_id("set parameters");

   for(i=0; i<3; i++) {
      if(get_msg_field()) {
         prs_sp[i] = atoi(msg_field);
         have_prs_sp |= (1 << i);
      }
      else ++bad_prs_val;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
leaq 0x96991(%rip), %rdi     # 0x123be4
callq 0x58dc2
xorl %ebx, %ebx
leaq 0x2ae7df(%rip), %r14    # 0x33ba40
leaq 0x18d8d8(%rip), %r15    # 0x21ab40
leaq 0x18d841(%rip), %r12    # 0x21aab0
callq 0x810b1
testl %eax, %eax
je 0x8d293
movq %r14, %rdi
callq 0x95e0
movl $0x1, %edx
movl %ebx, %ecx
shll %cl, %edx
movl %eax, (%r15,%rbx,4)
orl %edx, (%r12)
jmp 0x8d299
incl 0x2df99b(%rip)          # 0x36cc34
incq %rbx
cmpq $0x3, %rbx
jne 0x8d26f
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_prs_ms()
void parse_prs_ms()
{
   // magnetic switching
   log_packet_id("magnetic switching");

   if(get_msg_field()) {
      prs_ms = atoi(msg_field);
      have_prs_ms = 1;
   }
   else ++bad_prs_val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x9693d(%rip), %rdi     # 0x123bf3
callq 0x58dc2
callq 0x810b1
testl %eax, %eax
je 0x8d2e8
leaq 0x2ae775(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x18d875(%rip), %rcx    # 0x21ab4c
movl %eax, (%rcx)
leaq 0x18d7d4(%rip), %rax    # 0x21aab4
movl $0x1, (%rax)
jmp 0x8d2ee
incl 0x2df946(%rip)          # 0x36cc34
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_prs_mo()
void parse_prs_mo()
{
   // magnetic offset
   log_packet_id("magnetic offset");

   if(get_msg_field()) {
      prs_mo = atoi(msg_field);
      have_prs_mo = 1;
   }
   else ++bad_prs_val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x9690b(%rip), %rdi     # 0x123c06
callq 0x58dc2
callq 0x810b1
testl %eax, %eax
je 0x8d32d
leaq 0x2ae730(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x18d834(%rip), %rcx    # 0x21ab50
movl %eax, (%rcx)
leaq 0x18d793(%rip), %rax    # 0x21aab8
movl $0x1, (%rax)
jmp 0x8d333
incl 0x2df901(%rip)          # 0x36cc34
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_prs_mr()
void parse_prs_mr()
{
   // magnetic read
   log_packet_id("magnetic read");

   if(get_msg_field()) {
      prs_mr = atoi(msg_field);
      have_prs_mr = 1;
   }
   else ++bad_prs_val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x968d6(%rip), %rdi     # 0x123c16
callq 0x58dc2
callq 0x810b1
testl %eax, %eax
je 0x8d372
leaq 0x2ae6eb(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x18d7f3(%rip), %rcx    # 0x21ab54
movl %eax, (%rcx)
leaq 0x18d752(%rip), %rax    # 0x21aabc
movl $0x1, (%rax)
jmp 0x8d378
incl 0x2df8bc(%rip)          # 0x36cc34
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_prs_tt()
void parse_prs_tt()
{
   // time tag
   log_packet_id("time tag");

   if(get_msg_field()) {
      prs_tt = atoi(msg_field);
      have_prs_tt = 1;
      if(prs_tt >= 0) {
         if(prs_tt >= 500000000) pps_offset = (OFS_SIZE) (prs_tt - 1000000000);
         else                    pps_offset = (OFS_SIZE) prs_tt;
         have_pps_offset = 1;
      }
   }
   else ++bad_prs_val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x9689f(%rip), %rdi     # 0x123c24
callq 0x58dc2
callq 0x810b1
testl %eax, %eax
je 0x8d3e3
leaq 0x2ae6a6(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x18d7b2(%rip), %rcx    # 0x21ab58
movl %eax, (%rcx)
leaq 0x18d711(%rip), %rcx    # 0x21aac0
movl $0x1, (%rcx)
testl %eax, %eax
js 0x8d3e9
cmpl $0x1dcd6500, %eax       # imm = 0x1DCD6500
jb 0x8d3c5
addl $0xc4653600, %eax       # imm = 0xC4653600
cvtsi2sd %eax, %xmm0
leaq 0x27f3e8(%rip), %rax    # 0x30c7b8
movsd %xmm0, (%rax)
leaq 0x27fe5d(%rip), %rax    # 0x30d238
movl $0x1, (%rax)
jmp 0x8d3e9
incl 0x2df84b(%rip)          # 0x36cc34
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_prs_ts()
void parse_prs_ts()
{
   // time slope
   log_packet_id("time slope");

   if(get_msg_field()) {
      prs_ts = atoi(msg_field);
      have_prs_ts = 1;
   }
   else ++bad_prs_val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x96837(%rip), %rdi     # 0x123c2d
callq 0x58dc2
callq 0x810b1
testl %eax, %eax
je 0x8d428
leaq 0x2ae635(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x18d745(%rip), %rcx    # 0x21ab5c
movl %eax, (%rcx)
leaq 0x18d6a4(%rip), %rax    # 0x21aac4
movl $0x1, (%rax)
jmp 0x8d42e
incl 0x2df806(%rip)          # 0x36cc34
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_prs_to()
void parse_prs_to()
{
   // time offset
   log_packet_id("time offset");

   if(get_msg_field()) {
      prs_to = atoi(msg_field);
      have_prs_to = 1;
   }
   else ++bad_prs_val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x967fd(%rip), %rdi     # 0x123c38
callq 0x58dc2
callq 0x810b1
testl %eax, %eax
je 0x8d46d
leaq 0x2ae5f0(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x18d704(%rip), %rcx    # 0x21ab60
movl %eax, (%rcx)
leaq 0x18d663(%rip), %rax    # 0x21aac8
movl $0x1, (%rax)
jmp 0x8d473
incl 0x2df7c1(%rip)          # 0x36cc34
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_prs_ps()
void parse_prs_ps()
{
   // pulse slope
   log_packet_id("pulse slope");

   if(get_msg_field()) {
      prs_ps = atoi(msg_field);
      have_prs_ps = 1;
   }
   else ++bad_prs_val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x967c4(%rip), %rdi     # 0x123c44
callq 0x58dc2
callq 0x810b1
testl %eax, %eax
je 0x8d4b2
leaq 0x2ae5ab(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x18d6c3(%rip), %rcx    # 0x21ab64
movl %eax, (%rcx)
leaq 0x18d622(%rip), %rax    # 0x21aacc
movl $0x1, (%rax)
jmp 0x8d4b8
incl 0x2df77c(%rip)          # 0x36cc34
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_prs_pl()
void parse_prs_pl()
{
   // phase lock
   log_packet_id("phase lock");

   if(get_msg_field()) {
      prs_pl = atoi(msg_field);
      have_prs_pl = 1;
   }
   else ++bad_prs_val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x9678b(%rip), %rdi     # 0x123c50
callq 0x58dc2
callq 0x810b1
testl %eax, %eax
je 0x8d4f7
leaq 0x2ae566(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x18d682(%rip), %rcx    # 0x21ab68
movl %eax, (%rcx)
leaq 0x18d5e1(%rip), %rax    # 0x21aad0
movl $0x1, (%rax)
jmp 0x8d4fd
incl 0x2df737(%rip)          # 0x36cc34
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_prs_pt()
void parse_prs_pt()
{
   // phase lock time constant
   log_packet_id("PLL time constant");

   if(get_msg_field()) {
      prs_pt = atoi(msg_field);
      have_prs_pt = 1;
   }
   else ++bad_prs_val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x96751(%rip), %rdi     # 0x123c5b
callq 0x58dc2
callq 0x810b1
testl %eax, %eax
je 0x8d53c
leaq 0x2ae521(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x18d641(%rip), %rcx    # 0x21ab6c
movl %eax, (%rcx)
leaq 0x18d5a0(%rip), %rax    # 0x21aad4
movl $0x1, (%rax)
jmp 0x8d542
incl 0x2df6f2(%rip)          # 0x36cc34
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_prs_pf()
void parse_prs_pf()
{
   // phase lock freq stability
   log_packet_id("PLL freq stability");

   if(get_msg_field()) {
      prs_pf = atoi(msg_field);
      have_prs_pf = 1;
   }
   else ++bad_prs_val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x9671e(%rip), %rdi     # 0x123c6d
callq 0x58dc2
callq 0x810b1
testl %eax, %eax
je 0x8d581
leaq 0x2ae4dc(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x18d600(%rip), %rcx    # 0x21ab70
movl %eax, (%rcx)
leaq 0x18d55f(%rip), %rax    # 0x21aad8
movl $0x1, (%rax)
jmp 0x8d587
incl 0x2df6ad(%rip)          # 0x36cc34
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_prs_pi()
void parse_prs_pi()
{
   // phase lock integrator
   log_packet_id("PLL integrator");

   if(get_msg_field()) {
      prs_pi = atoi(msg_field);
      have_prs_pi = 1;
   }
   else ++bad_prs_val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x966ec(%rip), %rdi     # 0x123c80
callq 0x58dc2
callq 0x810b1
testl %eax, %eax
je 0x8d5c6
leaq 0x2ae497(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x18d5bf(%rip), %rcx    # 0x21ab74
movl %eax, (%rcx)
leaq 0x18d51e(%rip), %rax    # 0x21aadc
movl $0x1, (%rax)
jmp 0x8d5cc
incl 0x2df668(%rip)          # 0x36cc34
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_prs_sd(int)
void parse_prs_sd(int i)
{
   // dac data
   log_packet_id("dac data");

   if(i < 0) return;
   if(i > 7) return;

   if(get_msg_field()) {
      prs_sd[i] = atoi(msg_field);
      have_prs_sd |= (1 << i);
   }
   else ++bad_prs_val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, %ebx
leaq 0x966b2(%rip), %rdi     # 0x123c8f
callq 0x58dc2
cmpl $0x7, %ebx
ja 0x8d622
callq 0x810b1
testl %eax, %eax
je 0x8d61c
leaq 0x2ae449(%rip), %rdi    # 0x33ba40
callq 0x95e0
movl %ebx, %ecx
leaq 0x18d57b(%rip), %rdx    # 0x21ab80
movl %eax, (%rdx,%rcx,4)
movl $0x1, %eax
movl %ebx, %ecx
shll %cl, %eax
leaq 0x18d4cc(%rip), %rcx    # 0x21aae4
orl %eax, (%rcx)
jmp 0x8d622
incl 0x2df612(%rip)          # 0x36cc34
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_prs_ad(int)
void parse_prs_ad(int i)
{
double val;

   // analog data
   log_packet_id("analog data");

   if(i < 0) return;
   if(i > 19) return;

   if(get_msg_field()) {
      if(!strchr(msg_field, '.')) ++bad_prs_val;

      val = atof(msg_field);
      if     (i == 1) val *= 10.0;    // scale readings to actual values
      else if(i == 2) val *= 10.0;
      else if(i == 3) val *= 10.0;
      else if(i == 4) val *= 10.0;
      else if(i == 9) val *= 4.0;
      else if(i == 10) val *= 100.0;
      else if(i == 16) val *= 4.0;
      else if(i == 17) val *= 4.0;
      else if(i == 18) val *= 4.0;

      prs_ad[i] = val;
      have_prs_ad |= (1 << i);

      if((i == 1) || (i == 2)) {  // average of power readings
         prs_ad_pwr = ((prs_ad[1]+prs_ad[2])/2.0);  
      }
      else if(i == 10) {  // case temperature
         temperature = (DATA_SIZE) prs_ad[i];
         have_temperature = 104;
      }
      else if((i == 11) || (i == 12) || (i == 13)) { // average of thermistor readings
         prs_ad_therm = ((prs_ad[11]+prs_ad[12]+prs_ad[13])/3.0);  
      }
   }
   else ++bad_prs_val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, %ebx
leaq 0x96660(%rip), %rdi     # 0x123c98
callq 0x58dc2
cmpl $0x13, %ebx
ja 0x8d737
callq 0x810b1
testl %eax, %eax
je 0x8d699
leaq 0x2ae3ea(%rip), %rdi    # 0x33ba40
movl $0x2e, %esi
callq 0x9100
testq %rax, %rax
jne 0x8d66b
incl 0x2df5c9(%rip)          # 0x36cc34
leaq 0x2ae3ce(%rip), %rdi    # 0x33ba40
callq 0x9470
leal -0x1(%rbx), %eax
cmpl $0x11, %eax
ja 0x8d6ac
leaq 0x91d8a(%rip), %rcx     # 0x11f410
movslq (%rcx,%rax,4), %rdx
addq %rcx, %rdx
jmpq *%rdx
mulsd 0x7ba11(%rip), %xmm0    # 0x1090a8
jmp 0x8d6ac
incl 0x2df595(%rip)          # 0x36cc34
jmp 0x8d737
mulsd 0x7e2c4(%rip), %xmm0    # 0x10b970
movl %ebx, %ecx
leaq 0x18d4eb(%rip), %rdx    # 0x21aba0
movsd %xmm0, (%rdx,%rcx,8)
movl $0x1, %esi
movl %ebx, %ecx
shll %cl, %esi
leaq 0x18d41e(%rip), %rcx    # 0x21aae8
orl %esi, (%rcx)
cmpl $0x1, %eax
ja 0x8d6f0
movsd 0x8(%rdx), %xmm0
addsd 0x10(%rdx), %xmm0
mulsd 0x7b985(%rip), %xmm0    # 0x109068
leaq 0x18d56e(%rip), %rax    # 0x21ac58
movsd %xmm0, (%rax)
jmp 0x8d737
cmpl $0xa, %ebx
jne 0x8d70f
leaq 0x27f31c(%rip), %rax    # 0x30ca18
movsd %xmm0, (%rax)
leaq 0x27fb45(%rip), %rax    # 0x30d24c
movl $0x68, (%rax)
jmp 0x8d737
addl $-0xb, %ebx
cmpl $0x2, %ebx
ja 0x8d737
movsd 0x58(%rdx), %xmm0
addsd 0x60(%rdx), %xmm0
addsd 0x68(%rdx), %xmm0
divsd 0x7e2da(%rip), %xmm0    # 0x10ba08
leaq 0x18d52b(%rip), %rax    # 0x21ac60
jmp 0x8d6ea
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
mulsd 0x7b91a(%rip), %xmm0    # 0x109060
jmp 0x8d6ac
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_prs_vb()
void parse_prs_vb()
{
   // verbose mode
   log_packet_id("verbose mode");

   if(get_msg_field()) {
      prs_vb = atoi(msg_field);
      have_prs_vb = 1;
   }
   else ++bad_prs_val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x9654e(%rip), %rdi     # 0x123ca4
callq 0x58dc2
callq 0x810b1
testl %eax, %eax
je 0x8d788
leaq 0x2ae2d5(%rip), %rdi    # 0x33ba40
callq 0x95e0
leaq 0x18d375(%rip), %rcx    # 0x21aaec
movl %eax, (%rcx)
leaq 0x18d304(%rip), %rax    # 0x21aa84
movl $0x1, (%rax)
jmp 0x8d78e
incl 0x2df4a6(%rip)          # 0x36cc34
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: set_prs_ep(int)
void set_prs_ep(int val)
{
   if(read_only) return;

   sprintf(out, "EP%d", val);
   queue_prs_cmd(out, PRS_EP_MSG);
   queue_prs_cmd("EP?", PRS_EP_MSG);
}

// Assembly:
leaq 0x2a9883(%rip), %rax    # 0x33701a
cmpb $0x0, (%rax)
je 0x8d79d
retq
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, %edx
leaq 0x2aea74(%rip), %rbx    # 0x33c220
leaq 0x964fe(%rip), %rsi     # 0x123cb1
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
movl $0x210, %esi            # imm = 0x210
callq 0x5edda
leaq 0x962d1(%rip), %rdi     # 0x123aa2
movl $0x210, %esi            # imm = 0x210
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x5edda
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: set_prs_mo(int)
void set_prs_mo(int val)
{
   if(read_only) return;

   sprintf(out, "MO%d", val);
   queue_prs_cmd(out, PRS_MO_MSG);
   queue_prs_cmd("MO?", PRS_MO_MSG);
}

// Assembly:
leaq 0x2a9832(%rip), %rax    # 0x33701a
cmpb $0x0, (%rax)
je 0x8d7ee
retq
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, %edx
leaq 0x2aea23(%rip), %rbx    # 0x33c220
leaq 0x964b2(%rip), %rsi     # 0x123cb6
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
movl $0x204, %esi            # imm = 0x204
callq 0x5edda
leaq 0x96298(%rip), %rdi     # 0x123aba
movl $0x204, %esi            # imm = 0x204
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x5edda
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: set_prs_ms(int)
void set_prs_ms(int val)
{
   if(read_only) return;

   sprintf(out, "MS%d", val);
   queue_prs_cmd(out, PRS_MS_MSG);
   queue_prs_cmd("MS?", PRS_MS_MSG);
}

// Assembly:
leaq 0x2a97e1(%rip), %rax    # 0x33701a
cmpb $0x0, (%rax)
je 0x8d83f
retq
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, %edx
leaq 0x2ae9d2(%rip), %rbx    # 0x33c220
leaq 0x96466(%rip), %rsi     # 0x123cbb
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
movl $0x203, %esi            # imm = 0x203
callq 0x5edda
leaq 0x96243(%rip), %rdi     # 0x123ab6
movl $0x203, %esi            # imm = 0x203
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x5edda
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: set_prs_sf(int)
void set_prs_sf(int val)
{
   if(read_only) return;

   sprintf(out, "SF%d", val);
   queue_prs_cmd(out, PRS_SF_MSG);
   queue_prs_cmd("SF?", PRS_SF_MSG);
}

// Assembly:
leaq 0x2a9750(%rip), %rax    # 0x33701a
cmpb $0x0, (%rax)
je 0x8d8d0
retq
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, %edx
leaq 0x2ae941(%rip), %rbx    # 0x33c220
leaq 0x963ee(%rip), %rsi     # 0x123cd4
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
movl $0x1fe, %esi            # imm = 0x1FE
callq 0x5edda
leaq 0x961aa(%rip), %rdi     # 0x123aae
movl $0x1fe, %esi            # imm = 0x1FE
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x5edda
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: set_prs_sp(int, int, int)
void set_prs_sp(int r, int n, int a)
{
   if(read_only) return;

   sprintf(out, "SP%d,%d,%d", r,n,a);
   queue_prs_cmd(out, PRS_SP_MSG);
   queue_prs_cmd("SP?", PRS_SP_MSG);
}

// Assembly:
leaq 0x2a96ff(%rip), %rax    # 0x33701a
cmpb $0x0, (%rax)
je 0x8d921
retq
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edx, %r8d
movl %esi, %ecx
movl %edi, %edx
leaq 0x2ae8eb(%rip), %rbx    # 0x33c220
leaq 0x9639d(%rip), %rsi     # 0x123cd9
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
movl $0x202, %esi            # imm = 0x202
callq 0x5edda
leaq 0x97f52(%rip), %rdi     # 0x1258ac
movl $0x202, %esi            # imm = 0x202
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x5edda
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: set_prs_to(int)
void set_prs_to(int val)
{
   if(read_only) return;

   sprintf(out, "TO%d", val);
   queue_prs_cmd(out, PRS_TO_MSG);
   queue_prs_cmd("TO?", PRS_TO_MSG);
   queue_prs_cmd("TT?", PRS_TT_MSG);
}

// Assembly:
leaq 0x2a96a9(%rip), %rax    # 0x33701a
cmpb $0x0, (%rax)
je 0x8d977
retq
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, %edx
leaq 0x2ae89a(%rip), %rbx    # 0x33c220
leaq 0x96357(%rip), %rsi     # 0x123ce4
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
movl $0x208, %esi            # imm = 0x208
callq 0x5edda
leaq 0x9611c(%rip), %rdi     # 0x123ac7
movl $0x208, %esi            # imm = 0x208
callq 0x5edda
leaq 0x960dc(%rip), %rdi     # 0x123a98
movl $0x206, %esi            # imm = 0x206
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x5edda
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: update_x72_screen()
void update_x72_screen()
{
int i;

   // update the screen every second.  When the seconds tick, request the
   // high priority messages.

   i = get_norcvr_message();   // returns true if seconds just ticked
   if(i && (prs_poll_tick == 0)) prs_poll_tick = 1;  // trigger high priority message polls

   if(i) {
      if(x72_tic_timer > 0) {  // tic reg changed, wait for it to take effect
         --x72_tic_timer;
         return;
      }
      else x72_tic_timer = 0;

      if(have_x72_pps && x72_state_set && x72_user_dis) {
         x72_sw_discipline();  // do disciplining
      }
      else if(x72_fw_discipline()) {
      }
      else {
         discipline_mode = DIS_MODE_NORMAL;
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
callq 0x8247a
testl %eax, %eax
je 0x8df8a
cmpl $0x0, 0x2dec7c(%rip)    # 0x36cbf8
jne 0x8df8a
movl $0x1, 0x2dec70(%rip)    # 0x36cbf8
jmp 0x8df8e
testl %eax, %eax
je 0x8df9f
leaq 0x18cfa3(%rip), %rax    # 0x21af38
movl (%rax), %ecx
testl %ecx, %ecx
jle 0x8dfa1
decl %ecx
movl %ecx, (%rax)
popq %rbp
retq
movl $0x0, (%rax)
leaq 0x18cd22(%rip), %rax    # 0x21acd0
cmpl $0x0, (%rax)
je 0x8dfd1
leaq 0x18cd56(%rip), %rax    # 0x21ad10
cmpl $0x0, (%rax)
je 0x8dfd1
leaq 0x18cf2a(%rip), %rax    # 0x21aef0
cmpl $0x0, (%rax)
je 0x8dfd1
popq %rbp
jmp 0x8dfe6
callq 0x6cbe4
testl %eax, %eax
jne 0x8df9f
leaq 0x27f4b6(%rip), %rax    # 0x30d497
movb $0x0, (%rax)
jmp 0x8df9f
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: x72_sw_discipline()
void x72_sw_discipline()
{
   // X72 software discipline algorithm state dispatcher

   if(x72_restore_timeout > 0) {  // message sync lost, pause disciplining
      --x72_restore_timeout;
      return;
   }

   if(x72_user_dis == 0) {
//    x72_user_state = x72_state = X72_STATE_DISCIPLINE;
      return;  // not doing software disciplning
   }


//sprintf(debug_text, "X72 state: %d  disci:%d  rblock:%04X  have_pps:%d  x72_pps:%d  dds:%g", x72_user_state, x72_user_dis, x72_creg & 0x0002, have_x72_pps, x72_pps, last_x72_dds);
   discipline_mode = DIS_MODE_AUTO_HOLD;
   if(x72_creg & 0x0002) {
      return;  // Rb not locked
   }
   if(x72_creg & 0x0008) {
      discipline_mode = DIS_MODE_NORMAL;
      return;  // PPS output not enabled
   }

   x72_state = x72_user_state;  // so firmware diciplining state display code works with software disciplining
   have_x72_state = 1;

   // dispatch to X72 sw discipline state handler
   if     (x72_user_state == X72_STATE_START0)     x72_init_state0();
   else if(x72_user_state == X72_STATE_START1)     x72_init_state1();
   else if(x72_user_state == X72_STATE_START2)     ;  // not used
   else if(x72_user_state == X72_STATE_HOLDOVER)   x72_holdover_state();  // not used
   else if(x72_user_state == X72_STATE_JAM1)       x72_jam1_state();      // not used
   else if(x72_user_state == X72_STATE_JAM2) {
      discipline_mode = DIS_MODE_NORMAL;  // !!! comment out to show TIC updates as holdover marks at the top of the plot
      x72_jam2_state();
   }
   else if(x72_user_state == X72_STATE_DISCIPLINE) {
      discipline_mode = DIS_MODE_NORMAL;
      x72_discipline_state();
   }
   else if(x72_user_state == X72_STATE_PIDCALC)    ;  // not used
   else if(x72_user_state == X72_STATE_PIDUPDATE)  ;  // not used
   else if(x72_user_state == X72_STATE_SLOPECALC)  x72_slopecalc_state();  // not used
   else x72_init_state0();

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl 0x2debe4(%rip), %eax    # 0x36cbd4
testl %eax, %eax
jle 0x8dffe
decl %eax
movl %eax, 0x2debd8(%rip)    # 0x36cbd4
popq %rbp
retq
leaq 0x18ceeb(%rip), %rax    # 0x21aef0
cmpl $0x0, (%rax)
je 0x8dffc
leaq 0x27f486(%rip), %rax    # 0x30d497
movb $0x2, (%rax)
leaq 0x18cdbd(%rip), %rcx    # 0x21add8
movl (%rcx), %ecx
testb $0x2, %cl
jne 0x8dffc
testb $0x8, %cl
jne 0x8e05f
movl 0x2debb7(%rip), %ecx    # 0x36cbe4
leaq 0x18cdcc(%rip), %rdx    # 0x21ae00
movl %ecx, (%rdx)
leaq 0x18cc97(%rip), %rdx    # 0x21acd4
movl $0x1, (%rdx)
cmpq $0x6, %rcx
ja 0x8e076
leaq 0x915e0(%rip), %rdx     # 0x11f630
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
popq %rbp
jmp 0xc178e
movb $0x0, (%rax)
jmp 0x8dffc
popq %rbp
jmp 0xc1a11
popq %rbp
jmp 0xc1834
popq %rbp
jmp 0xc1874
leal -0x7(%rcx), %eax
cmpl $0x2, %eax
jb 0x8dffc
cmpl $0x9, %ecx
jne 0x8e059
popq %rbp
jmp 0xc193a
movb $0x0, (%rax)
popq %rbp
jmp 0xc1a75
movb $0x0, (%rax)
popq %rbp
jmp 0xc1abd