// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_gpsd_tpv(char*)
void parse_gpsd_tpv(char *s)
{
int i;
int old_yy;
int old_mm;
int old_dd;
int old_hh;
int old_min;
int old_sec;
double old_frac;

   // decode the TPV message - used to get the time, lat, lon, and altitude
   // info.  This message is used to drive the display... without it nothing
   // gets done.


   old_yy = year;      // used to skip duplicate time stamps
   old_mm = month;
   old_dd = day;
   old_hh = hours;
   old_min = minutes;
   old_sec = seconds;
   old_frac = raw_frac;

   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, "\"TIME\"")) {
         time_ptr = 1;

         get_time_field(4);
         year = atoi(time_field);
         get_time_field(1);

         get_time_field(2);
         month = atoi(time_field);
         get_time_field(1);

         get_time_field(2);
         day = atoi(time_field);
         get_time_field(1);        // eat the 'T'

         get_time_field(2);
         hours = atoi(time_field);
         get_time_field(1);        // eat the ':'

         get_time_field(2);
         minutes = atoi(time_field);
         get_time_field(1);        // eat the ':'

         get_time_field(2);
         seconds = atoi(time_field);
         get_time_field(1);        // eat the 'Z'

         get_time_field(4);
         raw_frac = atof(time_field);
         get_time_field(1);        // eat the ':'

         pri_year = year;
         pri_month = month;
         pri_day = day;
         pri_hours = hours;
         pri_minutes = minutes;
         pri_seconds = seconds;
         pri_frac = raw_frac;

//gggg
if(debug_file) fprintf(debug_file, "nema_field:%s\n", msg_field);
if(debug_file) fprintf(debug_file, "time:%04d-%02d-%02d  %02d:%02d:%02d %f\n", 
year,month,day, hours,minutes,seconds,raw_frac);

         time_flags |= TFLAGS_UTC;  // UTC based time
      }
      else if(!strcmp(gpsd_cmd, "\"LAT\"")) {
         lat = atof(msg_field) * PI / 180.0;
      }
      else if(!strcmp(gpsd_cmd, "\"LON\"")) {
         lon = atof(msg_field) * PI / 180.0;
      }
      else if(!strcmp(gpsd_cmd, "\"ALT\"")) {
         alt = atof(msg_field);
      }
      else if(!strcmp(gpsd_cmd, "\"TRACK\"")) {
         heading = atof(msg_field);
         have_heading = 20;
      }
      else if(!strcmp(gpsd_cmd, "\"SPEED\"")) {
         speed = atof(msg_field);
         have_speed = 20;
      }
      else if(!strcmp(gpsd_cmd, "\"MODE\"")) {
         i = atoi(msg_field);
         if     (i == 3) rcvr_mode = RCVR_MODE_3D;
         else if(i == 2) rcvr_mode = RCVR_MODE_2D;
         else if(i == 1) rcvr_mode = RCVR_MODE_ACQUIRE;
         else            rcvr_mode = RCVR_MODE_UNKNOWN;
      }
   }


   if(old_yy != year) ;            // gpsd can generate duplicate time stamps
   else if(old_mm != month) ;
   else if(old_dd != day) ;
   else if(old_hh != hours) ;
   else if(old_min != minutes) ;
   else if(old_sec != seconds) ;
   else return;

   update_gps_screen(1008);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x26036a(%rip), %rax    # 0x2f74dc
movl (%rax), %eax
movl %eax, -0x40(%rbp)
leaq 0x26035a(%rip), %rax    # 0x2f74d8
movl (%rax), %eax
movl %eax, -0x3c(%rbp)
leaq 0x26034a(%rip), %rax    # 0x2f74d4
movl (%rax), %eax
movl %eax, -0x38(%rbp)
leaq 0x26033a(%rip), %rax    # 0x2f74d0
movl (%rax), %eax
movl %eax, -0x34(%rbp)
leaq 0x26032a(%rip), %rax    # 0x2f74cc
movl (%rax), %eax
movl %eax, -0x30(%rbp)
leaq 0x26031a(%rip), %rax    # 0x2f74c8
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
leaq 0x2c4e56(%rip), %r14    # 0x35c010
leaq 0x78aef(%rip), %r12     # 0x10fcb0
pushq $0x7
popq %r13
pushq $0x6
popq %r15
testq %rbx, %rbx
je 0x975eb
movq %rbx, %rdi
callq 0x96fd1
movq %rax, %rbx
movq %r14, %rdi
leaq 0x28e859(%rip), %rsi    # 0x325a40
callq 0x9330
cmpb $0x0, 0x2c4e1d(%rip)    # 0x35c010
je 0x971c9
movq %rbx, %rdi
callq 0x96fd1
movq %rax, %rbx
callq 0x970c3
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x9380
testl %eax, %eax
je 0x973cd
movq %r14, %rdi
leaq 0x78ac9(%rip), %rsi     # 0x10fcee
movq %r15, %rdx
callq 0x9380
testl %eax, %eax
je 0x972bf
movq %r14, %rdi
leaq 0x78ab5(%rip), %rsi     # 0x10fcf4
movq %r15, %rdx
callq 0x9380
testl %eax, %eax
je 0x972eb
movq %r14, %rdi
leaq 0x78aa1(%rip), %rsi     # 0x10fcfa
movq %r15, %rdx
callq 0x9380
testl %eax, %eax
je 0x97317
movq 0x2c4da0(%rip), %rax    # 0x35c010
movabsq $0x22444545505322, %rcx # imm = 0x22444545505322
cmpq %rcx, %rax
je 0x97333
movabsq $0x224b4341525422, %rcx # imm = 0x224B4341525422
cmpq %rcx, %rax
jne 0x9735c
leaq 0x28e7a3(%rip), %rdi    # 0x325a40
callq 0x9470
leaq 0x25fd7f(%rip), %rax    # 0x2f7028
movsd %xmm0, (%rax)
leaq 0x260080(%rip), %rax    # 0x2f7334
movl $0x14, (%rax)
jmp 0x971c9
leaq 0x28e77a(%rip), %rdi    # 0x325a40
callq 0x9470
mulsd 0x5e5cd(%rip), %xmm0    # 0xf58a0
divsd 0x5e5cd(%rip), %xmm0    # 0xf58a8
leaq 0x25fcee(%rip), %rax    # 0x2f6fd0
movsd %xmm0, (%rax)
jmp 0x971c9
leaq 0x28e74e(%rip), %rdi    # 0x325a40
callq 0x9470
mulsd 0x5e5a1(%rip), %xmm0    # 0xf58a0
divsd 0x5e5a1(%rip), %xmm0    # 0xf58a8
leaq 0x25fcca(%rip), %rax    # 0x2f6fd8
movsd %xmm0, (%rax)
jmp 0x971c9
leaq 0x28e722(%rip), %rdi    # 0x325a40
callq 0x9470
leaq 0x25fcb6(%rip), %rax    # 0x2f6fe0
movsd %xmm0, (%rax)
jmp 0x971c9
leaq 0x28e706(%rip), %rdi    # 0x325a40
callq 0x9470
leaq 0x25fcda(%rip), %rax    # 0x2f7020
movsd %xmm0, (%rax)
leaq 0x25ffe7(%rip), %rax    # 0x2f7338
movl $0x14, (%rax)
jmp 0x971c9
movq %r14, %rdi
leaq 0x7899a(%rip), %rsi     # 0x10fd00
movq %r13, %rdx
callq 0x9380
testl %eax, %eax
jne 0x971c9
leaq 0x28e6c3(%rip), %rdi    # 0x325a40
callq 0x95e0
cmpl $0x1, %eax
je 0x973af
cmpl $0x2, %eax
je 0x973a0
cmpl $0x3, %eax
jne 0x973be
leaq 0x25fd38(%rip), %rax    # 0x2f70d0
movb $0x4, (%rax)
jmp 0x971c9
leaq 0x25fd29(%rip), %rax    # 0x2f70d0
movb $0x3, (%rax)
jmp 0x971c9
leaq 0x25fd1a(%rip), %rax    # 0x2f70d0
movb $0x9, (%rax)
jmp 0x971c9
leaq 0x25fd0b(%rip), %rax    # 0x2f70d0
movb $0x63, (%rax)
jmp 0x971c9
movl $0x1, 0x2c4e69(%rip)    # 0x35c240
pushq $0x4
popq %rdi
callq 0x97112
leaq 0x2c4e3a(%rip), %r12    # 0x35c220
movq %r12, %rdi
callq 0x95e0
leaq 0x2600e7(%rip), %rcx    # 0x2f74dc
movl %eax, (%rcx)
pushq $0x1
popq %r13
movl %r13d, %edi
callq 0x97112
pushq $0x2
popq %r15
movl %r15d, %edi
callq 0x97112
movq %r12, %rdi
callq 0x95e0
leaq 0x2600ba(%rip), %rcx    # 0x2f74d8
movl %eax, (%rcx)
movl %r13d, %edi
callq 0x97112
movl %r15d, %edi
callq 0x97112
movq %r12, %rdi
callq 0x95e0
leaq 0x260095(%rip), %r14    # 0x2f74d4
movl %eax, (%r14)
movl %r13d, %r14d
movl %r13d, %edi
callq 0x97112
movl %r15d, %edi
callq 0x97112
movq %r12, %rdi
callq 0x95e0
leaq 0x26006c(%rip), %r13    # 0x2f74d0
movl %eax, (%r13)
movl %r14d, %edi
movl %r14d, %r13d
callq 0x97112
movl %r15d, %edi
callq 0x97112
movq %r12, %rdi
movq %r12, %r14
callq 0x95e0
leaq 0x26003f(%rip), %r12    # 0x2f74cc
movl %eax, (%r12)
movl %r13d, %edi
callq 0x97112
movl %r15d, %edi
callq 0x97112
movq %r14, %rdi
callq 0x95e0
leaq 0x260018(%rip), %r15    # 0x2f74c8
movl %eax, (%r15)
movl %r13d, %edi
callq 0x97112
pushq $0x4
popq %rdi
callq 0x97112
movq %r14, %rdi
callq 0x9470
leaq 0x26000e(%rip), %r14    # 0x2f74e0
movsd %xmm0, (%r14)
movl %r13d, %edi
callq 0x97112
leaq 0x25fff6(%rip), %rax    # 0x2f74dc
movl (%rax), %eax
leaq 0x260025(%rip), %rcx    # 0x2f7514
movl %eax, (%rcx)
leaq 0x25ffe0(%rip), %rax    # 0x2f74d8
movl (%rax), %eax
leaq 0x26000f(%rip), %rcx    # 0x2f7510
movl %eax, (%rcx)
leaq 0x25ffca(%rip), %rax    # 0x2f74d4
movl (%rax), %eax
leaq 0x25fff9(%rip), %rcx    # 0x2f750c
movl %eax, (%rcx)
leaq 0x25ffb4(%rip), %rax    # 0x2f74d0
movl (%rax), %eax
leaq 0x25ffe3(%rip), %rcx    # 0x2f7508
movl %eax, (%rcx)
movl (%r12), %eax
leaq 0x25ffd2(%rip), %rcx    # 0x2f7504
movl %eax, (%rcx)
movl (%r15), %eax
leaq 0x25ffc2(%rip), %rcx    # 0x2f7500
movl %eax, (%rcx)
movsd (%r14), %xmm0
leaq 0x25ffcc(%rip), %rax    # 0x2f7518
movsd %xmm0, (%rax)
leaq 0x190e39(%rip), %rax    # 0x228390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x975dc
leaq 0x78751(%rip), %rsi     # 0x10fcb7
leaq 0x28e4d3(%rip), %rdx    # 0x325a40
xorl %eax, %eax
callq 0x9560
leaq 0x190e15(%rip), %rax    # 0x228390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x975dc
leaq 0x25ff52(%rip), %rax    # 0x2f74dc
movl (%rax), %edx
leaq 0x25ff45(%rip), %rax    # 0x2f74d8
movl (%rax), %ecx
leaq 0x25ff38(%rip), %rax    # 0x2f74d4
movl (%rax), %r8d
leaq 0x25ff2a(%rip), %rax    # 0x2f74d0
movl (%rax), %r9d
leaq 0x25ff1c(%rip), %rax    # 0x2f74cc
movl (%rax), %r10d
leaq 0x25ff0e(%rip), %rax    # 0x2f74c8
movl (%rax), %r11d
leaq 0x25ff1c(%rip), %rax    # 0x2f74e0
movsd (%rax), %xmm0
leaq 0x786f7(%rip), %rsi     # 0x10fcc6
movb $0x1, %al
pushq %r11
pushq %r10
callq 0x9560
popq %rcx
popq %rdx
leaq 0x25fec1(%rip), %rax    # 0x2f74a4
orb $0x1, (%rax)
jmp 0x971b3
leaq 0x25feea(%rip), %rax    # 0x2f74dc
movl -0x40(%rbp), %ecx
cmpl (%rax), %ecx
jne 0x9764e
leaq 0x25fed8(%rip), %rax    # 0x2f74d8
movl -0x3c(%rbp), %ecx
cmpl (%rax), %ecx
jne 0x9764e
leaq 0x25fec6(%rip), %rax    # 0x2f74d4
movl -0x38(%rbp), %ecx
cmpl (%rax), %ecx
jne 0x9764e
leaq 0x25feb4(%rip), %rax    # 0x2f74d0
movl -0x34(%rbp), %ecx
cmpl (%rax), %ecx
jne 0x9764e
leaq 0x25fea2(%rip), %rax    # 0x2f74cc
movl -0x30(%rbp), %ecx
cmpl (%rax), %ecx
jne 0x9764e
leaq 0x25fe90(%rip), %rax    # 0x2f74c8
movl -0x2c(%rbp), %ecx
cmpl (%rax), %ecx
jne 0x9764e
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x694f6