// File: /workspace/github_cpp_makefile_star2_O3/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 $0x28, %rsp
movq %rdi, %rbx
leaq 0x266dce(%rip), %rax    # 0x30d4dc
movl (%rax), %r12d
leaq 0x266dc0(%rip), %rax    # 0x30d4d8
movl (%rax), %r15d
leaq 0x266db2(%rip), %rax    # 0x30d4d4
movl (%rax), %r14d
leaq 0x266da4(%rip), %rax    # 0x30d4d0
movl (%rax), %r11d
leaq 0x266d96(%rip), %rax    # 0x30d4cc
movl (%rax), %r10d
leaq 0x266d88(%rip), %rax    # 0x30d4c8
movl (%rax), %r9d
movl %r9d, %eax
movl %r10d, %ecx
movl %r11d, %edx
movl %r14d, %esi
movl %r15d, %edi
movl %r12d, %r8d
testq %rbx, %rbx
je 0xa6ce3
movl %r12d, -0x2c(%rbp)
movl %r15d, -0x30(%rbp)
movl %r14d, -0x34(%rbp)
movl %r11d, -0x38(%rbp)
movl %r10d, -0x3c(%rbp)
movl %r9d, -0x40(%rbp)
leaq 0x2cb893(%rip), %r14    # 0x372010
leaq 0x2952bc(%rip), %r15    # 0x33ba40
movl $0x4d495422, %r13d      # imm = 0x4D495422
leaq 0x2cba8f(%rip), %r12    # 0x372220
movq %rbx, %rdi
callq 0xa6568
movq %rax, %rbx
movq %r14, %rdi
movq %r15, %rsi
callq 0x9340
cmpb $0x0, 0x2cb862(%rip)    # 0x372010
je 0xa6bf9
movq %rbx, %rdi
callq 0xa6568
movq %rax, %rbx
callq 0xa6663
movl 0x2cb846(%rip), %eax    # 0x372010
xorl %r13d, %eax
movl 0x2cb840(%rip), %ecx    # 0x372013
movl $0x22454d, %edx         # imm = 0x22454D
xorl %edx, %ecx
orl %eax, %ecx
je 0xa688b
movl 0x2cb828(%rip), %eax    # 0x372010
movl $0x54414c22, %ecx       # imm = 0x54414C22
xorl %ecx, %eax
movzwl 0x2cb81e(%rip), %ecx    # 0x372014
xorl $0x22, %ecx
orl %eax, %ecx
je 0xa6ba4
movl 0x2cb809(%rip), %eax    # 0x372010
movl $0x4e4f4c22, %ecx       # imm = 0x4E4F4C22
xorl %ecx, %eax
movzwl 0x2cb7ff(%rip), %ecx    # 0x372014
xorl $0x22, %ecx
orl %eax, %ecx
je 0xa6bc5
movl 0x2cb7ea(%rip), %eax    # 0x372010
movl $0x544c4122, %ecx       # imm = 0x544C4122
xorl %ecx, %eax
movzwl 0x2cb7e0(%rip), %ecx    # 0x372014
xorl $0x22, %ecx
orl %eax, %ecx
je 0xa6be6
movq 0x2cb7ca(%rip), %rax    # 0x372010
movabsq $0x22444545505322, %rcx # imm = 0x22444545505322
cmpq %rcx, %rax
je 0xa6c07
movabsq $0x224b4341525422, %rcx # imm = 0x224B4341525422
cmpq %rcx, %rax
jne 0xa6c29
movq %r15, %rdi
callq 0x9470
leaq 0x2667ad(%rip), %rax    # 0x30d028
movsd %xmm0, (%rax)
leaq 0x266aae(%rip), %rax    # 0x30d334
jmp 0xa6c21
xorl %eax, %eax
movb 0x1(%r15,%rax), %cl
movb %cl, (%rax,%r12)
movb $0x0, 0x1(%rax,%r12)
leaq 0x1(%rax), %rcx
movq %rcx, %rax
cmpl $0x4, %ecx
jne 0xa688d
movl $0x5, 0x2cb98e(%rip)    # 0x372240
movq %r12, %rdi
callq 0x95e0
movl %eax, %ecx
leaq 0x266c19(%rip), %rax    # 0x30d4dc
movl %ecx, -0x50(%rbp)
movl %ecx, (%rax)
movb 0x5(%r15), %al
movb %al, 0x2cb94e(%rip)     # 0x372220
movb $0x0, 0x2cb948(%rip)    # 0x372221
xorl %eax, %eax
movb 0x6(%r15,%rax), %cl
movb %cl, (%rax,%r12)
movb $0x0, 0x1(%rax,%r12)
leaq 0x1(%rax), %rcx
movq %rcx, %rax
cmpl $0x2, %ecx
jne 0xa68db
movl $0x8, 0x2cb940(%rip)    # 0x372240
movq %r12, %rdi
callq 0x95e0
movl %eax, %ecx
leaq 0x266bc7(%rip), %rax    # 0x30d4d8
movl %ecx, -0x4c(%rbp)
movl %ecx, (%rax)
movb 0x8(%r15), %al
movb %al, 0x2cb900(%rip)     # 0x372220
movb $0x0, 0x2cb8fa(%rip)    # 0x372221
xorl %eax, %eax
movb 0x9(%r15,%rax), %cl
movb %cl, (%rax,%r12)
movb $0x0, 0x1(%rax,%r12)
leaq 0x1(%rax), %rcx
movq %rcx, %rax
cmpl $0x2, %ecx
jne 0xa6929
movl $0xb, 0x2cb8f2(%rip)    # 0x372240
movq %r12, %rdi
callq 0x95e0
movl %eax, %ecx
leaq 0x266b75(%rip), %rax    # 0x30d4d4
movl %ecx, -0x48(%rbp)
movl %ecx, (%rax)
movb 0xb(%r15), %al
movb %al, 0x2cb8b2(%rip)     # 0x372220
movb $0x0, 0x2cb8ac(%rip)    # 0x372221
xorl %eax, %eax
movb 0xc(%r15,%rax), %cl
movb %cl, (%rax,%r12)
movb $0x0, 0x1(%rax,%r12)
leaq 0x1(%rax), %rcx
movq %rcx, %rax
cmpl $0x2, %ecx
jne 0xa6977
movl $0xe, 0x2cb8a4(%rip)    # 0x372240
movq %r12, %rdi
callq 0x95e0
movl %eax, %ecx
leaq 0x266b23(%rip), %rax    # 0x30d4d0
movl %ecx, -0x44(%rbp)
movl %ecx, (%rax)
movb 0xe(%r15), %al
movb %al, 0x2cb864(%rip)     # 0x372220
movb $0x0, 0x2cb85e(%rip)    # 0x372221
xorl %eax, %eax
movb 0xf(%r15,%rax), %cl
movb %cl, (%rax,%r12)
movb $0x0, 0x1(%rax,%r12)
leaq 0x1(%rax), %rcx
movq %rcx, %rax
cmpl $0x2, %ecx
jne 0xa69c5
movl $0x11, 0x2cb856(%rip)   # 0x372240
movq %r12, %rdi
callq 0x95e0
movl %eax, %r13d
leaq 0x266ad0(%rip), %rax    # 0x30d4cc
movl %r13d, (%rax)
movb 0x11(%r15), %al
movb %al, 0x2cb817(%rip)     # 0x372220
movb $0x0, 0x2cb811(%rip)    # 0x372221
xorl %eax, %eax
movb 0x12(%r15,%rax), %cl
movb %cl, (%rax,%r12)
movb $0x0, 0x1(%rax,%r12)
leaq 0x1(%rax), %rcx
movq %rcx, %rax
cmpl $0x2, %ecx
jne 0xa6a12
movl $0x14, 0x2cb809(%rip)   # 0x372240
movq %r12, %rdi
callq 0x95e0
movl %eax, %r14d
leaq 0x266a7f(%rip), %rax    # 0x30d4c8
movl %r14d, (%rax)
movb 0x14(%r15), %al
movb %al, 0x2cb7ca(%rip)     # 0x372220
movb $0x0, 0x2cb7c4(%rip)    # 0x372221
xorl %eax, %eax
movb 0x15(%r15,%rax), %cl
movb %cl, (%rax,%r12)
movb $0x0, 0x1(%rax,%r12)
leaq 0x1(%rax), %rcx
movq %rcx, %rax
cmpl $0x4, %ecx
jne 0xa6a5f
movl $0x19, 0x2cb7bc(%rip)   # 0x372240
movq %r12, %rdi
callq 0x9470
leaq 0x266a81(%rip), %rax    # 0x30d514
movl -0x50(%rbp), %ecx
movl %ecx, (%rax)
leaq 0x266a71(%rip), %rax    # 0x30d510
movl -0x4c(%rbp), %ecx
movl %ecx, (%rax)
leaq 0x266a61(%rip), %rax    # 0x30d50c
movl -0x48(%rbp), %ecx
movl %ecx, (%rax)
leaq 0x266a51(%rip), %rax    # 0x30d508
movl -0x44(%rbp), %ecx
movl %ecx, (%rax)
leaq 0x266a41(%rip), %rax    # 0x30d504
movl %r13d, (%rax)
movb 0x19(%r15), %al
movb %al, 0x2cb750(%rip)     # 0x372220
leaq 0x266a09(%rip), %rax    # 0x30d4e0
movsd %xmm0, (%rax)
movb $0x0, 0x2cb73f(%rip)    # 0x372221
movl $0x1a, 0x2cb754(%rip)   # 0x372240
leaq 0x266a0d(%rip), %rax    # 0x30d500
movl %r14d, (%rax)
leaq 0x266a1b(%rip), %rax    # 0x30d518
movsd %xmm0, (%rax)
leaq 0x197888(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0xa6b8b
leaq 0x7f25b(%rip), %rsi     # 0x125d72
movq %r15, %rdx
xorl %eax, %eax
callq 0x9560
leaq 0x197868(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0xa6b8b
leaq 0x2669a5(%rip), %rax    # 0x30d4dc
movl (%rax), %edx
leaq 0x266998(%rip), %rax    # 0x30d4d8
movl (%rax), %ecx
leaq 0x26698b(%rip), %rax    # 0x30d4d4
movl (%rax), %r8d
leaq 0x26697d(%rip), %rax    # 0x30d4d0
movl (%rax), %r9d
leaq 0x26696f(%rip), %rax    # 0x30d4cc
movl (%rax), %r10d
leaq 0x266961(%rip), %rax    # 0x30d4c8
movl (%rax), %r11d
leaq 0x26696f(%rip), %rax    # 0x30d4e0
movsd (%rax), %xmm0
leaq 0x7f205(%rip), %rsi     # 0x125d81
movb $0x1, %al
pushq %r11
pushq %r10
callq 0x9560
addq $0x10, %rsp
leaq 0x266912(%rip), %rax    # 0x30d4a4
orb $0x1, (%rax)
leaq 0x2cb474(%rip), %r14    # 0x372010
movl $0x4d495422, %r13d      # imm = 0x4D495422
jmp 0xa6bf9
movq %r15, %rdi
callq 0x9470
mulsd 0x64c74(%rip), %xmm0    # 0x10b828
divsd 0x64c74(%rip), %xmm0    # 0x10b830
leaq 0x26640d(%rip), %rax    # 0x30cfd0
jmp 0xa6bf5
movq %r15, %rdi
callq 0x9470
mulsd 0x64c53(%rip), %xmm0    # 0x10b828
divsd 0x64c53(%rip), %xmm0    # 0x10b830
leaq 0x2663f4(%rip), %rax    # 0x30cfd8
jmp 0xa6bf5
movq %r15, %rdi
callq 0x9470
leaq 0x2663eb(%rip), %rax    # 0x30cfe0
movsd %xmm0, (%rax)
testq %rbx, %rbx
jne 0xa6791
jmp 0xa6c94
movq %r15, %rdi
callq 0x9470
leaq 0x26640a(%rip), %rax    # 0x30d020
movsd %xmm0, (%rax)
leaq 0x266717(%rip), %rax    # 0x30d338
movl $0x14, (%rax)
jmp 0xa6bf9
movl 0x2cb3e1(%rip), %eax    # 0x372010
movl $0x444f4d22, %ecx       # imm = 0x444F4D22
xorl %ecx, %eax
movl 0x2cb3d7(%rip), %ecx    # 0x372013
movl $0x224544, %edx         # imm = 0x224544
xorl %edx, %ecx
orl %eax, %ecx
jne 0xa6bf9
movq %r15, %rdi
callq 0x95e0
cmpl $0x1, %eax
je 0xa6c76
cmpl $0x2, %eax
je 0xa6c6a
cmpl $0x3, %eax
jne 0xa6c85
leaq 0x26646b(%rip), %rax    # 0x30d0d0
movb $0x4, (%rax)
jmp 0xa6bf9
leaq 0x26645f(%rip), %rax    # 0x30d0d0
movb $0x3, (%rax)
jmp 0xa6bf9
leaq 0x266453(%rip), %rax    # 0x30d0d0
movb $0x9, (%rax)
jmp 0xa6bf9
leaq 0x266444(%rip), %rax    # 0x30d0d0
movb $0x63, (%rax)
jmp 0xa6bf9
leaq 0x266841(%rip), %rax    # 0x30d4dc
movl (%rax), %r8d
leaq 0x266833(%rip), %rax    # 0x30d4d8
movl (%rax), %edi
leaq 0x266826(%rip), %rax    # 0x30d4d4
movl (%rax), %esi
leaq 0x266819(%rip), %rax    # 0x30d4d0
movl (%rax), %edx
leaq 0x26680c(%rip), %rax    # 0x30d4cc
movl (%rax), %ecx
leaq 0x2667ff(%rip), %rax    # 0x30d4c8
movl (%rax), %eax
movl -0x40(%rbp), %r9d
movl -0x3c(%rbp), %r10d
movl -0x38(%rbp), %r11d
movl -0x34(%rbp), %r14d
movl -0x30(%rbp), %r15d
movl -0x2c(%rbp), %r12d
cmpl %r8d, %r12d
jne 0xa6d10
cmpl %edi, %r15d
jne 0xa6d10
cmpl %esi, %r14d
jne 0xa6d10
cmpl %edx, %r11d
jne 0xa6d10
cmpl %ecx, %r10d
jne 0xa6d10
cmpl %eax, %r9d
jne 0xa6d10
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x730e8