LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: decode_acron_msg()
void decode_acron_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;
   }

   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 %c:[%s]\n", this_acron_cmd, nmea_msg);

   if     (this_acron_cmd == 'O') parse_acron_time();   // parse answer to last command we sent
   else if(this_acron_cmd == 'G') parse_acron_status(); // status
   else if(this_acron_cmd == 'I') parse_acron_atime();  // asynchronous time request (has time zone setting)

   poll_next_acron();

   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 %rbx
pushq %rax
xorl %ebx, %ebx
xorl %edi, %edi
callq 0x73dcb
leaq 0x28ea41(%rip), %r15    # 0x325830
movb $0x0, (%r15)
leaq 0x28b458(%rip), %r14    # 0x322252
movzwl (%r14), %eax
cmpq %rax, %rbx
jae 0x96e1e
callq 0x51c47
movb %al, (%rbx,%r15)
movb $0x0, 0x1(%rbx,%r15)
incq %rbx
cmpq $0x1f6, %rbx            # imm = 0x1F6
jne 0x96dfa
leaq 0x28b42f(%rip), %rax    # 0x322254
andw $0x0, (%rax)
andw $0x0, (%r14)
leaq 0x28b421(%rip), %rax    # 0x322256
andw $0x0, (%rax)
leaq 0x28e9f0(%rip), %rdi    # 0x325830
callq 0x988f
leaq 0x191544(%rip), %rax    # 0x228390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x96e70
movsbl 0x2bfdd1(%rip), %edx    # 0x356c2c
leaq 0x78dcc(%rip), %rsi     # 0x10fc2e
leaq 0x28e9c7(%rip), %rcx    # 0x325830
xorl %eax, %eax
callq 0x9560
movzbl 0x2bfdb5(%rip), %eax    # 0x356c2c
cmpl $0x47, %eax
je 0x96e94
cmpl $0x49, %eax
je 0x96e8d
cmpl $0x4f, %eax
jne 0x96e99
callq 0x9677f
jmp 0x96e99
callq 0x969c0
jmp 0x96e99
callq 0x96ba0
callq 0x96d60
leaq 0x19151b(%rip), %rax    # 0x2283c0
cmpq $0x0, (%rax)
setne %al
leaq 0x17674d(%rip), %rcx    # 0x20d600
movq (%rcx), %rdi
testq %rdi, %rdi
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x96ec8
callq 0xae83
leaq 0x1920d1(%rip), %rax    # 0x228fa0
movl $0x1, (%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: get_acron_message()
void get_acron_message()
{
u08 c;

   // This routine buffers up an incoming ACRON ZEIT message.  When the end of the
   // message is seen, the message is parsed and decoded with decode_acron_msg()

   if(SERIAL_DATA_AVAILABLE(RCVR_PORT) == 0) {
      check_com_timer(RCVR_PORT);
      return;
   }
   else {
      reset_com_timer(RCVR_PORT);
   }

   c = get_com_char();
   c &= 0x7F;           // remove parity bit

   if(com[RCVR_PORT].rcv_error) {      // parity/framing/overrun errors
      com[RCVR_PORT].rcv_error = 0;
//!!!!!qqqq    goto rst_msg;
   }

   if(tsip_sync == 0) {    // syncing to start of message
      tsip_sync = 1;
      get_sync_time();
      tsip_wptr = 0;
      tsip_rptr = 0;
      goto get_acron;
   }
   else if(tsip_sync == 1) { // '$' has been seen, now build the message
      get_acron:
      if(c == 0x0D) goto acron_end;  // message has no checksum

      if(tsip_wptr < MAX_TSIP) {   // add char to the message buffer
         tsip_buf[tsip_wptr++] = c;
      }
      else {
         tsip_error |= OVFL_ERROR;
         goto rst_msg;
      }
   }
   else if(tsip_sync == 3) {  // end of message
      acron_end:
      decode_acron_msg(); // process the message
      packet_end = 1;
      tsip_wptr = 0;      // prepare for next message
      tsip_sync = 0;
   }
   else {     // should never happen, prepare for next message
      rst_msg:
      tsip_wptr = 0;
      tsip_sync = 0;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
pushq $0xa
popq %rdi
callq 0xb771
pushq $0xa
popq %rdi
testl %eax, %eax
je 0x96f81
callq 0x1d93f
callq 0x51891
movl %eax, %ebx
leaq 0x2613d3(%rip), %rax    # 0x2f82e0
cmpb $0x0, 0x17a12(%rax)
je 0x96f1d
movb $0x0, 0x17a12(%rax)
leaq 0x28b332(%rip), %r14    # 0x322256
movzwl (%r14), %eax
cmpl $0x3, %eax
je 0x96f65
cmpl $0x1, %eax
je 0x96f5b
testl %eax, %eax
jne 0x96fbc
movw $0x1, (%r14)
callq 0x51a2f
leaq 0x28b306(%rip), %rax    # 0x322252
andw $0x0, (%rax)
leaq 0x28b2fd(%rip), %rax    # 0x322254
andw $0x0, (%rax)
movl %ebx, %eax
andl $0x7f, %eax
cmpl $0xd, %eax
jne 0x96f8a
callq 0x96dd5
leaq 0x28b2e1(%rip), %rax    # 0x322252
andw $0x0, (%rax)
movl $0x1, 0x2bed15(%rip)    # 0x355c94
jmp 0x96fc7
popq %rbx
popq %r14
popq %rbp
jmp 0x1d61b
leaq 0x28b2c1(%rip), %rcx    # 0x322252
movzwl (%rcx), %eax
cmpq $0xfff, %rax            # imm = 0xFFF
ja 0x96fb1
andb $0x7f, %bl
leal 0x1(%rax), %edx
movw %dx, (%rcx)
leaq 0x28a2a4(%rip), %rcx    # 0x321250
movb %bl, (%rcx,%rax)
jmp 0x96fcc
leaq 0x191fb8(%rip), %rax    # 0x228f70
orb $-0x80, 0x1(%rax)
leaq 0x28b28f(%rip), %rax    # 0x322252
andw $0x0, (%rax)
andw $0x0, (%r14)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: get_time_field(int)
void get_time_field(int n)
{
int i;

   // get a fixed length sub-field from a sting - used to decode the date/time
   // string.

   i = 0;
   while(n--) {
      time_field[i++] = msg_field[time_ptr++];
      time_field[i] = 0;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movslq 0x2c5123(%rip), %rcx    # 0x35c240
movq %rcx, %rax
addq 0xa2d71(%rip), %rax     # 0x139e98
incl %ecx
movl %edi, %edx
xorl %esi, %esi
leaq 0x2c50ec(%rip), %rdi    # 0x35c220
cmpl %esi, %edx
je 0x97155
leal (%rcx,%rsi), %r8d
movl %r8d, 0x2c50fd(%rip)    # 0x35c240
movb (%rax,%rsi), %r8b
movb %r8b, (%rsi,%rdi)
movb $0x0, 0x1(%rsi,%rdi)
incq %rsi
jmp 0x97134
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: show_gpsd_msg(char*)
void show_gpsd_msg(char *s)
{
   // used for debug logging
   while(s) {
      s = get_json_field(s);
      strcpy(gpsd_cmd, msg_field);
      if(gpsd_cmd[0] == 0) continue; 

      s = get_json_field(s);
log_gpsd_cmd();
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r15
leaq 0x2c44e5(%rip), %rbx    # 0x35c010
leaq 0x28df0e(%rip), %r14    # 0x325a40
testq %r15, %r15
je 0x97b68
movq %r15, %rdi
callq 0x96fd1
movq %rax, %r15
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9330
cmpb $0x0, 0x2c44bc(%rip)    # 0x35c010
je 0x97b32
movq %r15, %rdi
callq 0x96fd1
movq %rax, %r15
callq 0x970c3
jmp 0x97b32
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_gpsd_version(char*)
void parse_gpsd_version(char *s)
{
int i;

   // decode the VERSION message - used to display the version info

   saw_version |= 0x0200;
   while(s) {
      s = get_json_field(s);
      strcpy(gpsd_cmd, msg_field);
      if(gpsd_cmd[0] == 0) continue; 

      s = get_json_field(s);
log_gpsd_cmd();

      if(!strcmp(gpsd_cmd, "\"PROTO_MAJOR\"")) {
         gpsd_major = atoi(msg_field);
      }
      else if(!strcmp(gpsd_cmd, "\"PROTO_MINOR\"")) {
         gpsd_minor = atoi(msg_field);
      }
      else if(!strcmp(gpsd_cmd, "\"RELEASE\"")) {
         msg_field[17] = 0;
         gpsd_release[0] = 0;
         i = strlen(msg_field);
         if(i) {
            strcpy(gpsd_release, &msg_field[1]);
            i = strlen(gpsd_release);
            if(i) gpsd_release[i-1] = 0;
         }
         have_info |= (PRODN_PARAMS | MANUF_PARAMS);
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r13
leaq 0x25f4a0(%rip), %rax    # 0x2f7408
orb $0x2, 0x1(%rax)
leaq 0x2c409d(%rip), %rbx    # 0x35c010
leaq 0x28dac6(%rip), %r14    # 0x325a40
leaq 0x77e64(%rip), %r15     # 0x10fde5
pushq $0xe
popq %r12
leaq 0x1(%r14), %rax
movq %rax, -0x30(%rbp)
testq %r13, %r13
je 0x98082
movq %r13, %rdi
callq 0x96fd1
movq %rax, %r13
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9330
cmpb $0x0, 0x2c405d(%rip)    # 0x35c010
je 0x97f8d
movq %r13, %rdi
callq 0x96fd1
movq %rax, %r13
callq 0x970c3
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x9380
testl %eax, %eax
je 0x98056
movq %rbx, %rdi
leaq 0x77e12(%rip), %rsi     # 0x10fdf3
movq %r12, %rdx
callq 0x9380
testl %eax, %eax
je 0x9806c
movq %rbx, %rdi
leaq 0x77e0a(%rip), %rsi     # 0x10fe01
pushq $0xa
popq %rdx
callq 0x9380
testl %eax, %eax
jne 0x97f8d
xorl %eax, %eax
movb %al, 0x11(%r14)
leaq 0x16d070(%rip), %r15    # 0x205080
movb %al, (%r15)
movq %r14, %rdi
callq 0x9120
testl %eax, %eax
je 0x98040
movq %r15, %rdi
movq -0x30(%rbp), %rsi
callq 0x9330
movq %r15, %rdi
callq 0x9120
testl %eax, %eax
je 0x98040
decl %eax
cltq
movb $0x0, (%r15,%rax)
leaq 0x25f92d(%rip), %rax    # 0x2f7974
orb $0x3, (%rax)
leaq 0x77d94(%rip), %r15     # 0x10fde5
jmp 0x97f8d
movq %r14, %rdi
callq 0x95e0
leaq 0x16d03f(%rip), %rcx    # 0x2050a4
movl %eax, (%rcx)
jmp 0x97f8d
movq %r14, %rdi
callq 0x95e0
leaq 0x16d02d(%rip), %rcx    # 0x2050a8
movl %eax, (%rcx)
jmp 0x97f8d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_gpsd_devices(char*)
void parse_gpsd_devices(char *s)
{
int i;

   // decode the DEVICES message - we just use the driver name field

   saw_version |= 0x0400;
   while(s) {
      s = get_json_field(s);
      strcpy(gpsd_cmd, msg_field);
      if(gpsd_cmd[0] == 0) continue; 

      s = get_json_field(s);
log_gpsd_cmd();

      if(!strcmp(gpsd_cmd, "\"DRIVER\"")) {
         i = strlen(msg_field);
if(debug_file) fprintf(debug_file, "driver:%s -> ", msg_field);
         if(i) msg_field[i-1] = 0;
if(debug_file) fprintf(debug_file, "%s\n", msg_field);
         show_gpsd_driver();
         have_info |= VERSION_INFO;
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r13
movl $0x400, %ecx            # imm = 0x400
leaq 0x25f35a(%rip), %rax    # 0x2f7408
leaq 0x2c3f5b(%rip), %rbx    # 0x35c010
leaq 0x28d984(%rip), %r14    # 0x325a40
leaq 0x77d48(%rip), %r15     # 0x10fe0b
pushq $0x9
popq %r12
orl %ecx, (%rax)
testq %r13, %r13
je 0x98188
movq %r13, %rdi
callq 0x96fd1
movq %rax, %r13
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9330
cmpb $0x0, 0x2c3f21(%rip)    # 0x35c010
je 0x980c9
movq %r13, %rdi
callq 0x96fd1
movq %rax, %r13
callq 0x970c3
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x9380
testl %eax, %eax
jne 0x980c9
movq %r14, %rdi
callq 0x9120
movq %rax, %rcx
leaq 0x19026b(%rip), %rax    # 0x228390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x98146
leaq 0x77ce0(%rip), %rsi     # 0x10fe14
movq %r14, %rdx
xorl %eax, %eax
movq %rcx, -0x30(%rbp)
callq 0x9560
movq -0x30(%rbp), %rcx
testl %ecx, %ecx
je 0x98154
decl %ecx
movslq %ecx, %rax
movb $0x0, (%r14,%rax)
leaq 0x190235(%rip), %rax    # 0x228390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x98174
leaq 0x778b5(%rip), %rsi     # 0x10fa1f
movq %r14, %rdx
xorl %eax, %eax
callq 0x9560
callq 0x98197
leaq 0x25f7f4(%rip), %rax    # 0x2f7974
pushq $0x4
popq %rcx
jmp 0x980c7
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: show_gpsd_driver()
void show_gpsd_driver()
{
   if(zoom_screen) return;

   msg_field[17] = 0;
   sprintf(gpsd_driver, "Drv:  %s", &msg_field[1]);
   vidstr(VER_ROW+2, VER_COL, WHITE, gpsd_driver);
}

// Assembly:
leaq 0x25e60a(%rip), %rax    # 0x2f67a8
cmpb $0x0, (%rax)
je 0x981a4
retq
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0x28d88f(%rip), %rdx    # 0x325a40
movb $0x0, 0x11(%rdx)
incq %rdx
leaq 0x16ce91(%rip), %rbx    # 0x205050
leaq 0x79daf(%rip), %rsi     # 0x111f75
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
leaq 0x16a5bd(%rip), %rax    # 0x202794
movl (%rax), %edi
addl $0x2, %edi
leaq 0x16a5b5(%rip), %rax    # 0x202798
movl (%rax), %esi
pushq $0xf
popq %rdx
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: parse_gpsd_att(char*)
void parse_gpsd_att(char *s)
{
   // decode the ATT message - we just use the temperature field

   while(s) {
      s = get_json_field(s);
      strcpy(gpsd_cmd, msg_field);
      if(gpsd_cmd[0] == 0) continue; 

      s = get_json_field(s);
log_gpsd_cmd();

      if(!strcmp(gpsd_cmd, "\"TEMPERATURE\"")) {
         temperature = (float) atof(msg_field);
         have_temperature = 114;
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r13
leaq 0x2c3e02(%rip), %rbx    # 0x35c010
leaq 0x28d82b(%rip), %r14    # 0x325a40
leaq 0x77c06(%rip), %r15     # 0x10fe22
pushq $0xe
popq %r12
testq %r13, %r13
je 0x98290
movq %r13, %rdi
callq 0x96fd1
movq %rax, %r13
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9330
cmpb $0x0, 0x2c3dce(%rip)    # 0x35c010
je 0x98220
movq %r13, %rdi
callq 0x96fd1
movq %rax, %r13
callq 0x970c3
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x9380
testl %eax, %eax
jne 0x98220
movq %r14, %rdi
callq 0x9470
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x25e79b(%rip), %rax    # 0x2f6a18
movsd %xmm0, (%rax)
leaq 0x25efc4(%rip), %rax    # 0x2f724c
movl $0x72, (%rax)
jmp 0x98220
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_gpsd_rtcm2(char*)
void parse_gpsd_rtcm2(char *s)
{
   // decode the RTCM2 message - we just use the leapsecs field

   while(s) {
      s = get_json_field(s);
      strcpy(gpsd_cmd, msg_field);
      if(gpsd_cmd[0] == 0) continue; 

      s = get_json_field(s);
log_gpsd_cmd();

      if(!user_set_utc_ofs && !strcmp(gpsd_cmd, "\"LEAPSECS\"")) {
         utc_offset = atoi(msg_field);
         check_utc_ofs(11);
      }
      else if(!strcmp(gpsd_cmd, "\"WEEK\"")) {
         gps_week = atoi(msg_field); 
         faked_tow = 0;
         if(have_week == 0) need_redraw = 2056;
         have_week = 10;
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r13
leaq 0x2c3d59(%rip), %rbx    # 0x35c010
leaq 0x28d782(%rip), %r14    # 0x325a40
leaq 0x25f46f(%rip), %r15    # 0x2f7734
pushq $0x7
popq %r12
testq %r13, %r13
je 0x98391
movq %r13, %rdi
callq 0x96fd1
movq %rax, %r13
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9330
cmpb $0x0, 0x2c3d21(%rip)    # 0x35c010
je 0x982c9
movq %r13, %rdi
callq 0x96fd1
movq %rax, %r13
callq 0x970c3
cmpl $0x0, (%r15)
jne 0x9831d
movq %rbx, %rdi
leaq 0x77b1f(%rip), %rsi     # 0x10fe30
pushq $0xb
popq %rdx
callq 0x9380
testl %eax, %eax
je 0x98373
movq %rbx, %rdi
leaq 0x77b14(%rip), %rsi     # 0x10fe3b
movq %r12, %rdx
callq 0x9380
testl %eax, %eax
jne 0x982c9
movq %r14, %rdi
callq 0x95e0
leaq 0x25f406(%rip), %rcx    # 0x2f7748
andl $0x0, (%rcx)
leaq 0x25f3ec(%rip), %rcx    # 0x2f7738
movw %ax, (%rcx)
leaq 0x25efd6(%rip), %rax    # 0x2f732c
cmpl $0x0, (%rax)
jne 0x98368
leaq 0x16a4e2(%rip), %rcx    # 0x202844
movl $0x808, (%rcx)          # imm = 0x808
movl $0xa, (%rax)
jmp 0x982c9
movq %r14, %rdi
callq 0x95e0
leaq 0x25f3a6(%rip), %rcx    # 0x2f7728
movl %eax, (%rcx)
pushq $0xb
popq %rdi
callq 0x51a91
jmp 0x982c9
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_gpsd_watch(char*)
void parse_gpsd_watch(char *s)
{
   // decode the WATCH message - we just thow it away
   while(s) {
      s = get_json_field(s);
      strcpy(gpsd_cmd, msg_field);
      if(gpsd_cmd[0] == 0) continue; 

      s = get_json_field(s);
log_gpsd_cmd();
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r15
leaq 0x2c3c5c(%rip), %rbx    # 0x35c010
leaq 0x28d685(%rip), %r14    # 0x325a40
testq %r15, %r15
je 0x983f1
movq %r15, %rdi
callq 0x96fd1
movq %rax, %r15
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9330
cmpb $0x0, 0x2c3c33(%rip)    # 0x35c010
je 0x983bb
movq %r15, %rdi
callq 0x96fd1
movq %rax, %r15
callq 0x970c3
jmp 0x983bb
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_nvs_speed()
void parse_nvs_speed()
{
   log_packet_id("nvs_speed");

   heading = tsip_single();
   speed = tsip_single() * 0.2777778; // km/hr -> m/sec
   tsip_dword();  // time stamp

   have_heading = 12;
   have_speed = 12;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x77690(%rip), %rdi     # 0x10fea2
callq 0x520bf
callq 0x51dc3
cvtss2sd %xmm0, %xmm0
leaq 0x25e801(%rip), %rax    # 0x2f7028
movsd %xmm0, (%rax)
callq 0x51dc3
cvtss2sd %xmm0, %xmm0
mulsd 0x6ff1c(%rip), %xmm0    # 0x108758
leaq 0x25e7dd(%rip), %rax    # 0x2f7020
movsd %xmm0, (%rax)
callq 0x51cf3
leaq 0x25eae1(%rip), %rax    # 0x2f7334
pushq $0xc
popq %rcx
movl %ecx, (%rax)
leaq 0x25ead9(%rip), %rax    # 0x2f7338
movl %ecx, (%rax)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_nvs_test()
void parse_nvs_test()
{
u08 subcode;
   // 0x43 packet

   log_packet_id("nvs_test");
   subcode = tsip_byte();
   if(subcode == 2) {
      nvs_test = tsip_byte();
      tsip_dword();

      minor_alarms &= (~MINOR_ANT_NO_PWR);
      if((nvs_test & 0xC0) == 0xC0) minor_alarms |= MINOR_ANT_SHORT; // short
      else if((nvs_test & 0xC0) == 0x80) minor_alarms |= MINOR_ANT_OPEN; // open
      else if((nvs_test & 0xC0) == 0x00) ; // OK
      else minor_alarms |= MINOR_ANT_NO_PWR; // unknown
      have_antenna = 1;

      if(!have_critical_alarms) need_redraw = 7709;
      have_critical_alarms = 9;

      if(nvs_test & 0x30) {  // gps(0x10) / glonass(0x20) failure
         critical_alarms |= CRIT_GPS;
      }
      else {
         critical_alarms &= (~CRIT_GPS);
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x7763e(%rip), %rdi     # 0x10feac
callq 0x520bf
callq 0x51c47
cmpb $0x2, %al
jne 0x98916
callq 0x51c47
movzbl %al, %eax
movl %eax, 0x2be27a(%rip)    # 0x356b08
callq 0x51cf3
leaq 0x25e93e(%rip), %rcx    # 0x2f71d8
movl (%rcx), %esi
movl %esi, %edx
andl $-0x7, %edx
movl %edx, (%rcx)
movl 0x2be25f(%rip), %eax    # 0x356b08
movl %eax, %edi
shrl $0x6, %edi
andl $0x3, %edi
leaq 0x711cc(%rip), %r8      # 0x109a84
movslq (%r8,%rdi,4), %rdi
addq %r8, %rdi
jmpq *%rdi
orl $0x6, %esi
movl %esi, %edx
jmp 0x988d0
orl $0x2, %edx
jmp 0x988d0
orl $0x4, %edx
movl %edx, (%rcx)
leaq 0x25e953(%rip), %rcx    # 0x2f722c
movl $0x1, (%rcx)
leaq 0x25e9c2(%rip), %rcx    # 0x2f72a8
cmpl $0x0, (%rcx)
jne 0x988f8
leaq 0x169f52(%rip), %rdx    # 0x202844
movl $0x1e1d, (%rdx)         # imm = 0x1E1D
movl $0x9, (%rcx)
xorl %ecx, %ecx
testb $0x30, %al
setne %cl
leaq 0x25e8c4(%rip), %rax    # 0x2f71d0
movl (%rax), %edx
andl $-0x9, %edx
leal (%rdx,%rcx,8), %ecx
movl %ecx, (%rax)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_nvs_disable()
void parse_nvs_disable()
{
int i;
u08 sys;
int prn;
u08 flag;

   // 0x47 packet
   log_packet_id("nvs_disable");

   for(i=0; i<32+24; i++) {
      sys = tsip_byte();
      prn = tsip_byte();
      flag = tsip_byte();

      if(sys == 1) ;
      else if(sys == 2) prn += NVS_GLONASS_PRN;
      else continue;

      if(flag == 1) ;     // enabled
      else if(flag == 2); // disabled
      else continue;

      if((prn >= 1) && (prn <= MAX_PRN)) {
         flag -= 1;
         sat[prn].disabled = flag;
         if(prn <= 32) {  // gps sats
            if(flag) sats_enabled &= (~(1 << (prn-1)));
            else     sats_enabled |= (1 << (prn-1));
         }
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x77562(%rip), %rdi     # 0x10febe
callq 0x520bf
pushq $0x38
popq %r15
leaq 0x190644(%rip), %r12    # 0x228fb0
leaq 0x25e771(%rip), %r13    # 0x2f70e4
subl $0x1, %r15d
jb 0x989e5
callq 0x51c47
movl %eax, %r14d
callq 0x51c47
movzbl %al, %ebx
callq 0x51c47
cmpb $0x1, %r14b
je 0x989a0
movzbl %r14b, %ecx
cmpl $0x2, %ecx
jne 0x98973
addl $0x40, %ebx
decb %al
cmpb $0x2, %al
setb %cl
testl %ebx, %ebx
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x98973
movl %ebx, %ecx
imulq $0x348, %rcx, %rcx      # imm = 0x348
movb %al, 0x1(%r12,%rcx)
cmpl $0x20, %ebx
ja 0x98973
decb %bl
pushq $0x1
popq %rdx
movl %ebx, %ecx
shll %cl, %edx
testb %al, %al
je 0x989db
notl %edx
andl (%r13), %edx
jmp 0x989df
orl (%r13), %edx
movl %edx, (%r13)
jmp 0x98973
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_nvs_gnss_timescale()
void parse_nvs_gnss_timescale()
{
double a0, a1;
int tow;
int wnt;
int ls;
int wnf;
int dn;
int lsf;
int this_dn;
int wraps;

   log_packet_id("nvs_timescale");

   // 0x4B packet - calculate pending leapsecond info
   a1 = tsip_double();
   a0 = tsip_double();
   tow = tsip_dword();

   wnt = tsip_word();
   ls = (int) (s16) tsip_word();
   wnf = tsip_word();  // gps week
   dn = tsip_word();
   lsf = (int) (s16) tsip_word();

   this_dn = tow / (24*60*60);
   wraps = gps_week / 1024;
///sprintf(debug_text, "gps_week:%d wraps:%d wnt:%d ls:%d wnf:%d dn:%d lsf:%d this_dn:%d", 
///gps_week, wraps, wnt, ls, wnf, dn, lsf, this_dn);
// wnf += (wraps * 1024);

   // we ignore the rest of this message

   minor_alarms &= (~MINOR_LEAP_PEND);
   leap_days = (-1);
   have_leap_days = 0;
   if(ls != lsf) {
      minor_alarms |= MINOR_LEAP_PEND;
      calc_leap_days(wnf+(gps_week/256)*256, dn, 555);
      have_leap_info = 22;
   }
   have_leap_info = 22;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
leaq 0x77490(%rip), %rdi     # 0x10fed3
callq 0x520bf
callq 0x51e6f
callq 0x51e6f
callq 0x51cf3
callq 0x51c63
callq 0x51c63
movl %eax, %r15d
callq 0x51c63
movl %eax, %r14d
callq 0x51c63
movl %eax, %ebx
callq 0x51c63
leaq 0x25e759(%rip), %rcx    # 0x2f71d8
movl (%rcx), %edx
movl %edx, %esi
andl $0xffffff7f, %esi       # imm = 0xFFFFFF7F
movl %esi, (%rcx)
leaq 0x25e75a(%rip), %rsi    # 0x2f71ec
orl $-0x1, (%rsi)
leaq 0x25e754(%rip), %rsi    # 0x2f71f0
andl $0x0, (%rsi)
cmpw %ax, %r15w
je 0x98acd
movzwl %r14w, %eax
orl $0x80, %edx
movl %edx, (%rcx)
leaq 0x25ec80(%rip), %rcx    # 0x2f7738
movzbl 0x1(%rcx), %ecx
shll $0x8, %ecx
addl %eax, %ecx
cvtsi2sd %ecx, %xmm0
movzwl %bx, %edi
callq 0x55822
leaq 0x25e7c4(%rip), %rax    # 0x2f7298
movl $0x16, (%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_nvs_config()
void parse_nvs_config()
{
u08 nav_sys;

   // 0x51 packet
   log_packet_id("nvs_config");

   nav_sys = tsip_byte();
   tsip_byte();    // rsvd
   tsip_byte();    // coord sys
   el_mask = (float) (s08) tsip_byte();
   amu_mask = (float) tsip_byte();
   tsip_word();    // max rms error
   nvs_filter = tsip_single();  // filtration degree

   have_el_mask = 1;
   have_amu = 1;

   // nav system:
   //  0=GPS+GLONASS
   //  1=GPS
   //  2=GLONASS
   //  3=Galileo
   // 10=GPS+GLONASS+SBAS
   // 11=GPS+SBAS
   // 12=GLONASS+SBAS
   have_gnss_mask = 3;
   if     (nav_sys == 0)  gnss_mask = (GPS | GLONASS);
   else if(nav_sys == 1)  gnss_mask = (GPS);
   else if(nav_sys == 2)  gnss_mask = (GLONASS);
   else if(nav_sys == 3)  gnss_mask = (GALILEO);
   else if(nav_sys == 10) gnss_mask = (GPS | GLONASS | SBAS);
   else if(nav_sys == 11) gnss_mask = (GPS | SBAS);
   else if(nav_sys == 12) gnss_mask = (GLONASS | SBAS);
   else if(nav_sys == 13) gnss_mask = (GALILEO | SBAS);
   else have_gnss_mask = 0;
// sprintf(plot_title, "nav sys:%d", nav_sys); //qqqqqqqqq
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0x773ef(%rip), %rdi     # 0x10fee1
callq 0x520bf
callq 0x51c47
movl %eax, %ebx
callq 0x51c47
callq 0x51c47
callq 0x51c47
movsbl %al, %eax
cvtsi2ss %eax, %xmm0
leaq 0x25e599(%rip), %rax    # 0x2f70b4
movss %xmm0, (%rax)
callq 0x51c47
movzbl %al, %eax
cvtsi2ss %eax, %xmm0
leaq 0x25e586(%rip), %rax    # 0x2f70b8
movss %xmm0, (%rax)
callq 0x51c63
callq 0x51dc3
cvtss2sd %xmm0, %xmm0
leaq 0x25e555(%rip), %rax    # 0x2f70a0
movsd %xmm0, (%rax)
leaq 0x25e8a6(%rip), %rax    # 0x2f73fc
pushq $0x1
popq %rcx
movl %ecx, (%rax)
leaq 0x25e896(%rip), %rax    # 0x2f73f8
movl %ecx, (%rax)
leaq 0xc210d(%rip), %rax     # 0x15ac78
movl $0x3, (%rax)
cmpb $0xd, %bl
ja 0x98b98
movzbl %bl, %ecx
leaq 0x70f14(%rip), %rdx     # 0x109a94
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
leaq 0xc20e4(%rip), %rax     # 0x15ac74
movl $0x3, (%rax)
jmp 0x98c04
andl $0x0, (%rax)
jmp 0x98c04
leaq 0xc20d0(%rip), %rax     # 0x15ac74
movl $0x8001, (%rax)         # imm = 0x8001
jmp 0x98c04
leaq 0xc20c1(%rip), %rax     # 0x15ac74
movl $0x1, (%rax)
jmp 0x98c04
leaq 0xc20b2(%rip), %rax     # 0x15ac74
movl $0x8002, (%rax)         # imm = 0x8002
jmp 0x98c04
leaq 0xc20a3(%rip), %rax     # 0x15ac74
movl $0x8004, (%rax)         # imm = 0x8004
jmp 0x98c04
leaq 0xc2094(%rip), %rax     # 0x15ac74
movl $0x2, (%rax)
jmp 0x98c04
leaq 0xc2085(%rip), %rax     # 0x15ac74
movl $0x4, (%rax)
jmp 0x98c04
leaq 0xc2076(%rip), %rax     # 0x15ac74
movl $0x8003, (%rax)         # imm = 0x8003
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_nvs_sats()
void parse_nvs_sats()
{
u08 sat_sys;
int prn;
u08 slot;
u08 el;
s16 az;
u08 snr;

   // 0x52 packet
   log_packet_id("nvs_sats");

   for(prn=1; prn<=MAX_PRN; prn++) {  // reset tracking info
      sat[prn].level_msg = 0;
      sat[prn].tracking = 0;
   }

   sat_count = 0;
   while(tsip_rptr < (tsip_wptr-0)) {
      sat_sys = tsip_byte();
      prn = (int) tsip_byte();
      slot = tsip_byte();
      el = tsip_byte();
      az = (s16) tsip_word();
      snr = tsip_byte();

      if(sat_sys == 2) prn += NVS_GLONASS_PRN;

      if((prn >= 1) && (prn <= MAX_PRN)) {
         sat[prn].level_msg = 77;
         if(snr) sat[prn].tracking = 1;
         else    sat[prn].tracking = (-1);
         sat[prn].sig_level = (float) snr;
         set_sat_azel(prn, (float) az, (float) el);
         have_snr |= rinex_gnss(prn);
         record_sig_levels(prn);
         ++sat_count;
         have_count = 222;
      }
   }

   level_type = "SNR";
   config_sat_count(sat_count); 
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x772cc(%rip), %rdi     # 0x10feec
callq 0x520bf
movl $0x560, %eax            # imm = 0x560
leaq 0x19037f(%rip), %rcx    # 0x228fb0
cmpq $0xcd358, %rax          # imm = 0xCD358
je 0x98c4d
andl $0x0, -0x1fc(%rcx,%rax)
andl $0x0, (%rcx,%rax)
addq $0x348, %rax            # imm = 0x348
jmp 0x98c31
leaq 0x1902b8(%rip), %rax    # 0x228f0c
andl $0x0, (%rax)
leaq 0x2895f6(%rip), %rax    # 0x322254
movzwl (%rax), %eax
leaq 0x2895ea(%rip), %rcx    # 0x322252
cmpw (%rcx), %ax
jae 0x98d2d
callq 0x51c47
movl %eax, %r12d
callq 0x51c47
movzbl %al, %r13d
callq 0x51c47
callq 0x51c47
movl %eax, %r14d
callq 0x51c63
movl %eax, %r15d
callq 0x51c47
leal 0x40(%r13), %ebx
cmpb $0x2, %r12b
cmovnel %r13d, %ebx
testl %ebx, %ebx
je 0x98c57
movl %ebx, %ecx
imulq $0x348, %rcx, %rcx      # imm = 0x348
cmpb $0x1, %al
movl $0x0, %edx
sbbl %edx, %edx
leaq 0x1902eb(%rip), %rsi    # 0x228fb0
movl $0x4d, 0x1c(%rsi,%rcx)
orl $0x1, %edx
movl %edx, 0x218(%rsi,%rcx)
movzbl %al, %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, 0x20(%rsi,%rcx)
movswl %r15w, %eax
cvtsi2ss %eax, %xmm0
movzbl %r14b, %eax
cvtsi2ss %eax, %xmm1
movl %ebx, %edi
callq 0x53b74
movl %ebx, %edi
callq 0xca4da
leaq 0x25e643(%rip), %rcx    # 0x2f734c
orl %eax, (%rcx)
movl %ebx, %edi
callq 0x559ba
leaq 0x1901f3(%rip), %rax    # 0x228f0c
incl (%rax)
leaq 0x25e5f6(%rip), %rax    # 0x2f7318
movl $0xde, (%rax)
jmp 0x98c57
leaq 0x6f342(%rip), %rax     # 0x108076
leaq 0x1901bd(%rip), %rcx    # 0x228ef8
movq %rax, (%rcx)
leaq 0x1901c7(%rip), %rax    # 0x228f0c
movl (%rax), %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x56d93
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_nvs_mode()
void parse_nvs_mode()
{
u08 mode;
double delay;
int avg_time;

   // 0x55 packet
   log_packet_id("nvs_mode");

   mode = tsip_byte();
   delay = tsip_double();
   avg_time = (int) tsip_word();

   if(mode == 0) {
      if(nvs_traim & 0x04) rcvr_mode = RCVR_MODE_3D;
      else                 rcvr_mode = RCVR_MODE_2D_3D;
   }
   else if(mode == 1) rcvr_mode = RCVR_MODE_HOLD;
   else if(mode == 2) rcvr_mode = RCVR_MODE_SURVEY;
   else               rcvr_mode = RCVR_MODE_UNKNOWN;

   if(mode == 2) {
      minor_alarms |= MINOR_SURVEY;
      do_survey = avg_time;
      survey_why = 33;
   }
   else {
      minor_alarms &= (~MINOR_SURVEY);
      if(precision_survey == 0) {
         do_survey = 0;
         survey_why = (-333);
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0x7718e(%rip), %rdi     # 0x10fef5
callq 0x520bf
callq 0x51c47
movl %eax, %ebx
callq 0x51e6f
callq 0x51c63
cmpb $0x2, %bl
je 0x98d9f
movzbl %bl, %eax
cmpl $0x1, %eax
je 0x98d9b
testl %eax, %eax
jne 0x98dbb
leaq 0x16c337(%rip), %rax    # 0x2050cc
movb (%rax), %al
andb $0x4, %al
jmp 0x98dbd
movb $0x7, %al
jmp 0x98dbd
leaq 0x25e432(%rip), %rcx    # 0x2f71d8
orb $0x20, (%rcx)
leaq 0x25e320(%rip), %rcx    # 0x2f70d0
movb $0xb, (%rcx)
movzwl %ax, %ecx
pushq $0x21
popq %rax
jmp 0x98de3
movb $0x63, %al
leaq 0x25e30c(%rip), %rcx    # 0x2f70d0
leaq 0x25e40d(%rip), %rdx    # 0x2f71d8
andb $-0x21, (%rdx)
movb %al, (%rcx)
leaq 0x25f0c1(%rip), %rax    # 0x2f7e98
cmpb $0x0, (%rax)
jne 0x98df6
movl $0xfffffeb3, %eax       # imm = 0xFFFFFEB3
xorl %ecx, %ecx
leaq 0x25f08e(%rip), %rdx    # 0x2f7e78
movq %rcx, (%rdx)
leaq 0x25f094(%rip), %rcx    # 0x2f7e88
movl %eax, (%rcx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_nvs_dops()
void parse_nvs_dops()
{
int gps_count;
int glonass_count;

   // 0x60 packet
   log_packet_id("nvs_dops");

   gps_count = tsip_byte();
   glonass_count = tsip_byte();
   hdop = tsip_single();
   vdop = tsip_single();
   have_dops |= (HDOP | VDOP);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x770f6(%rip), %rdi     # 0x10fefe
callq 0x520bf
callq 0x51c47
callq 0x51c47
callq 0x51dc3
cvtss2sd %xmm0, %xmm0
leaq 0x1746c9(%rip), %rax    # 0x20d4f0
movsd %xmm0, (%rax)
callq 0x51dc3
cvtss2sd %xmm0, %xmm0
leaq 0x1746bd(%rip), %rax    # 0x20d4f8
movsd %xmm0, (%rax)
leaq 0x17469e(%rip), %rax    # 0x20d4e4
orb $0x6, (%rax)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_nvs_pvtdops()
void parse_nvs_pvtdops()
{
   // 0x61 packet
   log_packet_id("nvs_pvtdops");

   hdop = tsip_single();
   vdop = tsip_single();
   tdop = tsip_single();
   // we ignore the rest of this message
   have_dops |= (HDOP | VDOP | TDOP);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x770b1(%rip), %rdi     # 0x10ff07
callq 0x520bf
callq 0x51dc3
cvtss2sd %xmm0, %xmm0
leaq 0x174685(%rip), %rax    # 0x20d4f0
movsd %xmm0, (%rax)
callq 0x51dc3
cvtss2sd %xmm0, %xmm0
leaq 0x174679(%rip), %rax    # 0x20d4f8
movsd %xmm0, (%rax)
callq 0x51dc3
cvtss2sd %xmm0, %xmm0
leaq 0x174675(%rip), %rax    # 0x20d508
movsd %xmm0, (%rax)
leaq 0x174646(%rip), %rax    # 0x20d4e4
orb $0x16, (%rax)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_nvs_version()
void parse_nvs_version()
{
int i;

   // 0x70 packet
   log_packet_id("nvs_version");

   nvs_chans = tsip_byte();
   for(i=0; i<21; i++) {  // version string
      nvs_id[i] = tsip_byte();
      nvs_id[i+1] = 0;
   }
   nvs_sn = tsip_dword();

   for(i=0; i<21; i++) {  // version string
      nvs_id2[i] = tsip_byte();
      nvs_id2[i+1] = 0;
   }
   nvs_sn2 = tsip_dword();

   for(i=0; i<21; i++) {  // version string
      nvs_id3[i] = tsip_byte();
      nvs_id3[i+1] = 0;
   }
   nvs_sn3 = tsip_dword();

   saw_version |= 0x2000;
   have_info |= ALL_ID_INFO;

   // we ignore the rest of this message
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
leaq 0x77062(%rip), %rdi     # 0x10ff13
callq 0x520bf
callq 0x51c47
movzbl %al, %eax
leaq 0x16c0ff(%rip), %rcx    # 0x204fc4
movl %eax, (%rcx)
pushq $0x1
popq %rbx
leaq 0x16c06f(%rip), %r14    # 0x204f40
cmpq $0x16, %rbx
je 0x98eeb
callq 0x51c47
movb %al, -0x1(%r14,%rbx)
movb $0x0, (%r14,%rbx)
incq %rbx
jmp 0x98ed1
callq 0x51cf3
leaq 0x16c069(%rip), %rcx    # 0x204f60
movl %eax, (%rcx)
pushq $0x1
popq %rbx
leaq 0x16c06d(%rip), %r14    # 0x204f70
cmpq $0x16, %rbx
je 0x98f1d
callq 0x51c47
movb %al, -0x1(%r14,%rbx)
movb $0x0, (%r14,%rbx)
incq %rbx
jmp 0x98f03
callq 0x51cf3
leaq 0x16c067(%rip), %rcx    # 0x204f90
movl %eax, (%rcx)
pushq $0x1
popq %rbx
leaq 0x16c06b(%rip), %r14    # 0x204fa0
cmpq $0x16, %rbx
je 0x98f4f
callq 0x51c47
movb %al, -0x1(%r14,%rbx)
movb $0x0, (%r14,%rbx)
incq %rbx
jmp 0x98f35
callq 0x51cf3
leaq 0x16c065(%rip), %rcx    # 0x204fc0
movl %eax, (%rcx)
leaq 0x25e4a4(%rip), %rax    # 0x2f7408
orb $0x20, 0x1(%rax)
leaq 0x25ea05(%rip), %rax    # 0x2f7974
orb $0xf, (%rax)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_nvs_time()
void parse_nvs_time()
{
double msecs;
u08 scale;
int week;
int i;
double gen_dev;
double time_dev;

   // 0x72 packet
   log_packet_id("nvs_time");

   nvs_msecs = msecs = tsip_fp80(); //  - 67108864.0;  // qqqqqqqqqqqqqq - 67....
   week = (int) (s16) tsip_word();
   scale = tsip_byte();
   gen_dev = tsip_double();   // ref gen deviation
   time_dev = tsip_double();  // sawtooth
   i = (int) (s16) tsip_word();
   if(!user_set_utc_ofs) {
      utc_offset = i;
      check_utc_ofs(12);
   }

   tsip_byte();
   tsip_word();

   dac_voltage = (float) time_dev;
   have_sawtooth = 6666;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
leaq 0x76f99(%rip), %rdi     # 0x10ff1f
callq 0x520bf
callq 0x51ed6
movsd %xmm0, 0x2bdb78(%rip)   # 0x356b10
callq 0x51c63
callq 0x51c47
callq 0x51e6f
callq 0x51e6f
movsd %xmm0, -0x8(%rbp)
callq 0x51c63
leaq 0x25e777(%rip), %rcx    # 0x2f7734
cmpl $0x0, (%rcx)
jne 0x98fd4
cwtl
leaq 0x25e75e(%rip), %rcx    # 0x2f7728
movl %eax, (%rcx)
pushq $0xc
popq %rdi
callq 0x51a91
callq 0x51c47
callq 0x51c63
cvtsd2ss -0x8(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x25da12(%rip), %rax    # 0x2f6a00
movsd %xmm0, (%rax)
leaq 0x25e3cb(%rip), %rax    # 0x2f73c4
movl $0x1a0a, (%rax)         # imm = 0x1A0A
addq $0x10, %rsp
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_nvs_survey()
void parse_nvs_survey()
{
u08 mode;
double delay;
int avg_time;

   // 0x73 packet
   log_packet_id("nvs_survey");

   mode = tsip_byte();
   delay = tsip_double();
   avg_time = (int) tsip_word();

   if(mode == 0) {
      if(nvs_traim & 0x04) rcvr_mode = RCVR_MODE_3D;
      else                 rcvr_mode = RCVR_MODE_2D_3D;
   }
   else if(mode == 1) rcvr_mode = RCVR_MODE_HOLD;
   else if(mode == 2) rcvr_mode = RCVR_MODE_SURVEY;
   else               rcvr_mode = RCVR_MODE_UNKNOWN;

   if(mode == 2) {
      minor_alarms |= MINOR_SURVEY;
      do_survey = avg_time;
      survey_why = 33;
   }
   else {
      minor_alarms &= (~MINOR_SURVEY);
      if(precision_survey == 0) {
         do_survey = 0;
         survey_why = (-334);
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0x76f16(%rip), %rdi     # 0x10ff28
callq 0x520bf
callq 0x51c47
movl %eax, %ebx
callq 0x51e6f
callq 0x51c63
cmpb $0x2, %bl
je 0x9904a
movzbl %bl, %eax
cmpl $0x1, %eax
je 0x99046
testl %eax, %eax
jne 0x99066
leaq 0x16c08c(%rip), %rax    # 0x2050cc
movb (%rax), %al
andb $0x4, %al
jmp 0x99068
movb $0x7, %al
jmp 0x99068
leaq 0x25e187(%rip), %rcx    # 0x2f71d8
orb $0x20, (%rcx)
leaq 0x25e075(%rip), %rcx    # 0x2f70d0
movb $0xb, (%rcx)
movzwl %ax, %ecx
pushq $0x21
popq %rax
jmp 0x9908e
movb $0x63, %al
leaq 0x25e061(%rip), %rcx    # 0x2f70d0
leaq 0x25e162(%rip), %rdx    # 0x2f71d8
andb $-0x21, (%rdx)
movb %al, (%rcx)
leaq 0x25ee16(%rip), %rax    # 0x2f7e98
cmpb $0x0, (%rax)
jne 0x990a1
movl $0xfffffeb2, %eax       # imm = 0xFFFFFEB2
xorl %ecx, %ecx
leaq 0x25ede3(%rip), %rdx    # 0x2f7e78
movq %rcx, (%rdx)
leaq 0x25ede9(%rip), %rcx    # 0x2f7e88
movl %eax, (%rcx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_nvs_timescale()
void parse_nvs_timescale()
{
double scale_shift;
u08 flags;
int gps_flags;
int glo_flags;

   // !!!! qqqqq do we need anything from here?
   // 0x74 packet
   log_packet_id("nvs_timescale");

   scale_shift = tsip_fp80();
   tsip_fp80();
   tsip_fp80();
   tsip_fp80();
   tsip_fp80();
   flags = tsip_byte();

   gps_flags = glo_flags = TFLAGS_NULL;
   if(!have_gnss_mask) {
      gps_flags |= TFLAGS_INVALID;
      glo_flags |= TFLAGS_INVALID;
   }

   if(time_flags & TFLAGS_UTC) {  // UTC time
      if(gnss_mask & GPS) {
         if((flags & 0x04) == 0) gps_flags |= TFLAGS_INVALID;
      }
      if(gnss_mask & GLONASS) {
         if((flags & 0x08) == 0) glo_flags |= TFLAGS_INVALID;
      }
   }
   else { // GPS time
      if(gnss_mask & GPS) {
         if((flags & 0x01) == 0) gps_flags |= TFLAGS_INVALID;
      }
      if(gnss_mask & GLONASS) {
         if((flags & 0x02) == 0) glo_flags |= TFLAGS_INVALID;
      }
   }
   if((gnss_mask & GPS) && (gnss_mask & GLONASS)) {  // see if we have valid time from at least one system
      if(gps_flags == 0) glo_flags = TFLAGS_NULL;  // we have GPS time
      if(glo_flags == 0) gps_flags = TFLAGS_NULL;  // we have GLONASS time
   }


   time_flags &= (~TFLAGS_INVALID);
   time_flags |= (gps_flags | glo_flags);
//sprintf(plot_title, "shift:%.10f  flags:%02X  tflags:%04X  gnss:%04X  have_utc:%d", 
//scale_shift, flags, time_flags, gnss_mask, have_utc_ofs);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x76e20(%rip), %rdi     # 0x10fed3
callq 0x520bf
callq 0x51ed6
callq 0x51ed6
callq 0x51ed6
callq 0x51ed6
callq 0x51ed6
callq 0x51c47
leaq 0xc1b9b(%rip), %rcx     # 0x15ac78
xorl %esi, %esi
cmpl $0x0, (%rcx)
sete %sil
shll $0x2, %esi
leaq 0x25e3b4(%rip), %rcx    # 0x2f74a4
movl (%rcx), %edx
xorl %r8d, %r8d
testb $0x1, %dl
leaq 0xc1b75(%rip), %rdi     # 0x15ac74
movl (%rdi), %edi
setne %r8b
pushq $0x2
popq %r9
pushq $0x8
popq %r10
cmovel %r9d, %r10d
testb $0x1, %dil
pushq $0x4
popq %r9
movl %esi, %r11d
cmovnel %r9d, %r11d
leal (%r8,%r8,2), %r8d
incl %r8d
testb %r8b, %al
cmovnel %esi, %r11d
testb $0x2, %dil
cmovel %esi, %r9d
testb %r10b, %al
cmovnel %esi, %r9d
notl %edi
andl $0x3, %edi
testl %r11d, %r11d
movl %r9d, %eax
cmovel %r11d, %eax
xorl %esi, %esi
movl %edi, %r8d
orl %eax, %r8d
cmovnel %r11d, %esi
testl %edi, %edi
cmovnel %r9d, %eax
andl $-0x5, %edx
orl %eax, %edx
orl %esi, %edx
movl %edx, (%rcx)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: fix_nvs_week(int)
int fix_nvs_week(int week)
{
   // adjust week for rollover

   week += 1024;
   if(year > 2019) week += 1024;
   else if(year == 2019) {
      if(month > 4) week += 1024;
      else if((month == 4) && (day >= 6)) week += 1024;
   }

   return week;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x25e368(%rip), %rax    # 0x2f74dc
movl (%rax), %ecx
cmpl $0x7e4, %ecx            # imm = 0x7E4
jl 0x99188
addl $0x800, %edi            # imm = 0x800
movl %edi, %eax
jmp 0x991bf
leal 0x400(%rdi), %eax
cmpl $0x7e3, %ecx            # imm = 0x7E3
jne 0x991bf
leaq 0x25e33b(%rip), %rcx    # 0x2f74d8
movl (%rcx), %ecx
cmpl $0x5, %ecx
jge 0x9917e
leaq 0x25e329(%rip), %rdx    # 0x2f74d4
addl $0x800, %edi            # imm = 0x800
cmpl $0x6, (%rdx)
cmovll %eax, %edi
cmpl $0x4, %ecx
cmovnel %eax, %edi
jmp 0x99184
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_zy_antd()
void parse_zy_antd()
{
   // cable delay
   log_packet_id("cable delay");

   if(get_msg_field()) {
      cable_delay = atof(msg_field) / 1.0E9;
      have_cable_delay = 62;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x75019(%rip), %rdi     # 0x10ebc0
callq 0x520bf
callq 0x75767
testl %eax, %eax
je 0x99be1
leaq 0x28be84(%rip), %rdi    # 0x325a40
callq 0x9470
divsd 0x5945f(%rip), %xmm0    # 0xf3028
leaq 0x25e1f8(%rip), %rax    # 0x2f7dc8
movsd %xmm0, (%rax)
leaq 0x25d6d9(%rip), %rax    # 0x2f72b4
movl $0x3e, (%rax)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_zy_alrm()
void parse_zy_alrm()
{
int val;
int survey;

   // alarms
   log_packet_id("alarms");

   if(get_msg_field()) {
      val = atohex(msg_field);
      survey = (minor_alarms & (~MINOR_SURVEY));
      minor_alarms = 0x0000;
      critical_alarms = 0x0000;

      if(val & 0x0100) minor_alarms |= MINOR_OSC_AGE;
      if(val & 0x0200) critical_alarms |= CRIT_OCXO;
      if(val & 0x0010) critical_alarms |= CRIT_FPGA;
      if(val & 0x0020) minor_alarms |= MINOR_EEPROM;
      if(val & 0x0040) critical_alarms |= CRIT_GPS;
      if(val & 0x0080) minor_alarms |= MINOR_OSC_AGE;
      if(val & 0x0001) minor_alarms |= MINOR_NO_TRACK;
      if(val & 0x0002) minor_alarms |= (MINOR_ANT_NO_PWR);
      if(val & 0x0004) minor_alarms |= MINOR_OSC_CTRL;   // !!!!! TFOM
      if(val & 0x0008) critical_alarms |= CRIT_RAM;
      minor_alarms |= survey;
      have_antenna = 1;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x751de(%rip), %rdi     # 0x10edcc
callq 0x520bf
callq 0x75767
testl %eax, %eax
je 0x99cb0
leaq 0x28be39(%rip), %rdi    # 0x325a40
callq 0x98b2
leaq 0x25d5c5(%rip), %rcx    # 0x2f71d8
leaq 0x25d5b6(%rip), %rsi    # 0x2f71d0
andl $0x0, (%rsi)
movl (%rcx), %edx
xorl %r8d, %r8d
btl $0x8, %eax
pushq $0x1
popq %rdi
jae 0x99c34
movl $0x1, (%rcx)
movl %edi, %r8d
andl $-0x21, %edx
movl %eax, %r9d
andl $0x20, %r9d
shll $0x5, %r9d
testb %al, %al
cmovnsl %r8d, %edi
orl %r9d, %edi
movl %eax, %r8d
andl $0x1, %r8d
leal (%rdi,%r8,8), %r9d
testb $0x2, %al
leal 0x6(%rdi,%r8,8), %edi
cmovel %r9d, %edi
movl %eax, %r8d
andl $0x4, %r8d
leal (%rdi,%r8,4), %edi
testw $0x258, %ax             # imm = 0x258
je 0x99c9f
movl %eax, %r8d
shrl $0x5, %r8d
andl $0x10, %r8d
movl %eax, %r9d
shrl %r9d
andl $0x8, %r9d
testb $0x40, %al
pushq $0x8
popq %r10
cmovel %r9d, %r10d
orl %r8d, %r10d
shrl $0x2, %eax
andl $0x2, %eax
orl %r10d, %eax
movl %eax, (%rsi)
orl %edx, %edi
movl %edi, (%rcx)
leaq 0x25d582(%rip), %rax    # 0x2f722c
movl $0x1, (%rax)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_zy_azel()
void parse_zy_azel()
{
int prn;
double az,el;

   // satellite positions
   log_packet_id("sat info");

   reset_sat_tracking();

   while(1) {
      if(get_msg_field()) prn = atoi(msg_field);
      else break;

      if(get_msg_field()) el = atof(msg_field);
      else break;

      if(get_msg_field()) az = atof(msg_field);
      else break;

      if((prn >= 1) && (prn <= 32)) { 
         set_sat_azel(prn, (float) az, (float) el);
         if(az && el && sat[prn].sig_level) {
            sat[prn].level_msg = 52;
            sat[prn].visible = 1;
            have_snr |= rinex_gnss(prn);
         }
         else sat[prn].visible = 0;

         if(az && el) sat[prn].tracking = prn;
         else         sat[prn].tracking = (-1);
         have_sat_azel = 2;
         level_type = "dBc";
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq 0x74f4d(%rip), %rdi     # 0x10ec17
callq 0x520bf
callq 0x56b1c
leaq 0x28bd65(%rip), %rbx    # 0x325a40
leaq 0x18f2ce(%rip), %r15    # 0x228fb0
leaq 0x18f20f(%rip), %r13    # 0x228ef8
callq 0x75767
testl %eax, %eax
je 0x99dfc
movq %rbx, %rdi
callq 0x95e0
movl %eax, %r14d
callq 0x75767
testl %eax, %eax
je 0x99dfc
movq %rbx, %rdi
callq 0x9470
movsd %xmm0, -0x30(%rbp)
callq 0x75767
testl %eax, %eax
je 0x99dfc
leal -0x1(%r14), %eax
cmpl $0x1f, %eax
ja 0x99ce9
movq %rbx, %rdi
callq 0x9470
movsd %xmm0, -0x38(%rbp)
cvtsd2ss %xmm0, %xmm0
cvtsd2ss -0x30(%rbp), %xmm1
movl %r14d, %edi
callq 0x53b74
xorps %xmm0, %xmm0
movsd -0x38(%rbp), %xmm1
ucomisd %xmm0, %xmm1
movl %r14d, %r12d
jne 0x99d62
jnp 0x99daf
movsd -0x30(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jne 0x99d6f
jnp 0x99daf
imulq $0x348, %r12, %rax      # imm = 0x348
movss 0x20(%r15,%rax), %xmm0
ucomiss 0x5d38c(%rip), %xmm0    # 0xf7110
jne 0x99d88
jnp 0x99dc7
addq %r15, %rax
movl $0x34, 0x1c(%rax)
movl $0x1, 0x21c(%rax)
movl %r14d, %edi
callq 0xca4da
leaq 0x25d5a1(%rip), %rcx    # 0x2f734c
orl %eax, (%rcx)
jmp 0x99dd0
imulq $0x348, %r12, %rax      # imm = 0x348
andl $0x0, 0x21c(%r15,%rax)
pushq $-0x1
popq %rax
movl %eax, %r14d
jmp 0x99dd0
andl $0x0, 0x21c(%r15,%rax)
imulq $0x348, %r12, %rax      # imm = 0x348
movl %r14d, 0x218(%r15,%rax)
leaq 0x25d4ae(%rip), %rax    # 0x2f7294
movl $0x2, (%rax)
leaq 0x71e2f(%rip), %rax     # 0x10bc22
movq %rax, (%r13)
jmp 0x99ce9
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_zy_sigq()
void parse_zy_sigq()
{
int prn;
double snr;
int mode;

   // signal quality
   log_packet_id("signal quality");

   while(1) {
      if(get_msg_field()) prn = atoi(msg_field);
      else break;

      if(get_msg_field()) snr = (atof(msg_field) * 2.500) + 25.0;
      else break;

      if(get_msg_field()) mode = atoi(msg_field);
      else break;

      if((prn >= 1) && (prn <= 32)) { 
         sat[prn].sig_level = (float) snr;
         record_sig_levels(prn);
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
leaq 0x76186(%rip), %rdi     # 0x10ffa2
callq 0x520bf
leaq 0x28bc18(%rip), %rbx    # 0x325a40
leaq 0x18f181(%rip), %r15    # 0x228fb0
callq 0x75767
testl %eax, %eax
je 0x99e9b
movq %rbx, %rdi
callq 0x95e0
movl %eax, %r14d
callq 0x75767
testl %eax, %eax
je 0x99e9b
movq %rbx, %rdi
callq 0x9470
mulsd 0x592dc(%rip), %xmm0    # 0xf3138
addsd 0x6e8fc(%rip), %xmm0    # 0x108760
movsd %xmm0, -0x20(%rbp)
callq 0x75767
testl %eax, %eax
je 0x99e9b
leal -0x1(%r14), %eax
cmpl $0x1f, %eax
ja 0x99e2f
cvtsd2ss -0x20(%rbp), %xmm0
movl %r14d, %eax
imulq $0x348, %rax, %rax      # imm = 0x348
movss %xmm0, 0x20(%r15,%rax)
movl %r14d, %edi
callq 0x559ba
jmp 0x99e2f
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_zy_dacv()
void parse_zy_dacv()
{
double val;

   // dac voltage
   log_packet_id("dac voltage");

   if(get_msg_field()) {
      val = atof(msg_field);
      dac_voltage = (DATA_SIZE) (((val - 32768.0) / 32768.0) * 100.0);
      have_dac = 62;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x76100(%rip), %rdi     # 0x10ffb1
callq 0x520bf
callq 0x75767
testl %eax, %eax
je 0x99efb
leaq 0x28bb7a(%rip), %rdi    # 0x325a40
callq 0x9470
addsd 0x6e7f5(%rip), %xmm0    # 0x1086c8
mulsd 0x6e44d(%rip), %xmm0    # 0x108328
mulsd 0x5917d(%rip), %xmm0    # 0xf3060
leaq 0x25cb16(%rip), %rax    # 0x2f6a00
movsd %xmm0, (%rax)
leaq 0x25d407(%rip), %rax    # 0x2f72fc
movl $0x3e, (%rax)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_zy_drft()
void parse_zy_drft()
{
   // osc drift
   log_packet_id("osc drift");

   if(get_msg_field()) {
      zyfer_drift = (DATA_SIZE) (atof(msg_field)*1.0E9);
      have_zyfer_drift = 1;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x760b5(%rip), %rdi     # 0x10ffbd
callq 0x520bf
callq 0x75767
testl %eax, %eax
je 0x99f42
leaq 0x28bb23(%rip), %rdi    # 0x325a40
callq 0x9470
mulsd 0x590fe(%rip), %xmm0    # 0xf3028
leaq 0x28d717(%rip), %rax    # 0x327648
movsd %xmm0, (%rax)
leaq 0x28d714(%rip), %rax    # 0x327650
movl $0x1, (%rax)
popq %rbp
retq