// File: /workspace/github_cpp_makefile_star2_O1/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
leaq 0x266fca(%rip), %rax    # 0x30d4dc
movl (%rax), %eax
movl %eax, -0x40(%rbp)
leaq 0x266fba(%rip), %rax    # 0x30d4d8
movl (%rax), %eax
movl %eax, -0x3c(%rbp)
leaq 0x266faa(%rip), %rax    # 0x30d4d4
movl (%rax), %eax
movl %eax, -0x38(%rbp)
leaq 0x266f9a(%rip), %r13    # 0x30d4d0
movl (%r13), %eax
movl %eax, -0x34(%rbp)
leaq 0x266f88(%rip), %r14    # 0x30d4cc
movl (%r14), %eax
movl %eax, -0x30(%rbp)
leaq 0x266f77(%rip), %rax    # 0x30d4c8
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
testq %rdi, %rdi
je 0xa6aa7
movq %rdi, %rbx
leaq 0x2954d7(%rip), %r15    # 0x33ba40
leaq 0x2cbcb0(%rip), %r12    # 0x372220
movq %rbx, %rdi
callq 0xa637e
movq %rax, %rbx
leaq 0x2cba8e(%rip), %rdi    # 0x372010
movq %r15, %rsi
callq 0x9340
cmpb $0x0, 0x2cba7f(%rip)    # 0x372010
je 0xa6a0c
movq %rbx, %rdi
callq 0xa637e
movq %rax, %rbx
callq 0xa646a
movl 0x2cba63(%rip), %eax    # 0x372010
movl $0x4d495422, %ecx       # imm = 0x4D495422
xorl %ecx, %eax
movl 0x2cba59(%rip), %ecx    # 0x372013
movl $0x22454d, %edx         # imm = 0x22454D
xorl %edx, %ecx
orl %eax, %ecx
je 0xa6672
movl 0x2cba41(%rip), %eax    # 0x372010
movl $0x54414c22, %ecx       # imm = 0x54414C22
xorl %ecx, %eax
movzwl 0x2cba37(%rip), %ecx    # 0x372014
xorl $0x22, %ecx
orl %eax, %ecx
je 0xa69b7
movl 0x2cba22(%rip), %eax    # 0x372010
movl $0x4e4f4c22, %ecx       # imm = 0x4E4F4C22
xorl %ecx, %eax
movzwl 0x2cba18(%rip), %ecx    # 0x372014
xorl $0x22, %ecx
orl %eax, %ecx
je 0xa69d8
movl 0x2cba03(%rip), %eax    # 0x372010
movl $0x544c4122, %ecx       # imm = 0x544C4122
xorl %ecx, %eax
movzwl 0x2cb9f9(%rip), %ecx    # 0x372014
xorl $0x22, %ecx
orl %eax, %ecx
je 0xa69f9
movq 0x2cb9e3(%rip), %rax    # 0x372010
movabsq $0x22444545505322, %rcx # imm = 0x22444545505322
cmpq %rcx, %rax
je 0xa6a1a
movabsq $0x224b4341525422, %rcx # imm = 0x224B4341525422
cmpq %rcx, %rax
jne 0xa6a3c
movq %r15, %rdi
callq 0x9470
leaq 0x2669c6(%rip), %rax    # 0x30d028
movsd %xmm0, (%rax)
leaq 0x266cc7(%rip), %rax    # 0x30d334
jmp 0xa6a34
movl $0x1, 0x2cbbc4(%rip)    # 0x372240
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 0xa667e
movl $0x5, 0x2cbb9d(%rip)    # 0x372240
movq %r12, %rdi
callq 0x95e0
movl %eax, %ecx
leaq 0x266e28(%rip), %rax    # 0x30d4dc
movl %ecx, -0x50(%rbp)
movl %ecx, (%rax)
movb 0x5(%r15), %al
movb %al, 0x2cbb5d(%rip)     # 0x372220
movb $0x0, 0x2cbb57(%rip)    # 0x372221
movl $0x6, 0x2cbb6c(%rip)    # 0x372240
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 0xa66d6
movl $0x8, 0x2cbb45(%rip)    # 0x372240
movq %r12, %rdi
callq 0x95e0
movl %eax, %ecx
leaq 0x266dcc(%rip), %rax    # 0x30d4d8
movl %ecx, -0x4c(%rbp)
movl %ecx, (%rax)
movb 0x8(%r15), %al
movb %al, 0x2cbb05(%rip)     # 0x372220
movb $0x0, 0x2cbaff(%rip)    # 0x372221
movl $0x9, 0x2cbb14(%rip)    # 0x372240
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 0xa672e
movl $0xb, 0x2cbaed(%rip)    # 0x372240
movq %r12, %rdi
callq 0x95e0
movl %eax, %ecx
leaq 0x266d70(%rip), %rax    # 0x30d4d4
movl %ecx, -0x48(%rbp)
movl %ecx, (%rax)
movb 0xb(%r15), %al
movb %al, 0x2cbaad(%rip)     # 0x372220
movb $0x0, 0x2cbaa7(%rip)    # 0x372221
movl $0xc, 0x2cbabc(%rip)    # 0x372240
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 0xa6786
movl $0xe, 0x2cba95(%rip)    # 0x372240
movq %r12, %rdi
callq 0x95e0
movl %eax, -0x44(%rbp)
movl %eax, (%r13)
movb 0xe(%r15), %al
movb %al, 0x2cba5c(%rip)     # 0x372220
movb $0x0, 0x2cba56(%rip)    # 0x372221
movl $0xf, 0x2cba6b(%rip)    # 0x372240
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 0xa67d7
movl $0x11, 0x2cba44(%rip)   # 0x372240
movq %r12, %rdi
callq 0x95e0
movl %eax, %r13d
movl %eax, (%r14)
movb 0x11(%r15), %al
movb %al, 0x2cba0c(%rip)     # 0x372220
movb $0x0, 0x2cba06(%rip)    # 0x372221
movl $0x12, 0x2cba1b(%rip)   # 0x372240
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 0xa6827
movl $0x14, 0x2cb9f4(%rip)   # 0x372240
movq %r12, %rdi
callq 0x95e0
movl %eax, %r14d
leaq 0x266c6a(%rip), %rax    # 0x30d4c8
movl %r14d, (%rax)
movb 0x14(%r15), %al
movb %al, 0x2cb9b5(%rip)     # 0x372220
movb $0x0, 0x2cb9af(%rip)    # 0x372221
movl $0x15, 0x2cb9c4(%rip)   # 0x372240
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 0xa687e
movl $0x19, 0x2cb99d(%rip)   # 0x372240
movq %r12, %rdi
callq 0x9470
leaq 0x266c62(%rip), %rax    # 0x30d514
movl -0x50(%rbp), %ecx
movl %ecx, (%rax)
leaq 0x266c52(%rip), %rax    # 0x30d510
movl -0x4c(%rbp), %ecx
movl %ecx, (%rax)
leaq 0x266c42(%rip), %rax    # 0x30d50c
movl -0x48(%rbp), %ecx
movl %ecx, (%rax)
leaq 0x266c32(%rip), %rax    # 0x30d508
movl -0x44(%rbp), %ecx
movl %ecx, (%rax)
leaq 0x266c22(%rip), %rax    # 0x30d504
movl %r13d, (%rax)
movb 0x19(%r15), %al
movb %al, 0x2cb931(%rip)     # 0x372220
leaq 0x266bea(%rip), %rax    # 0x30d4e0
movsd %xmm0, (%rax)
movb $0x0, 0x2cb920(%rip)    # 0x372221
movl $0x1a, 0x2cb935(%rip)   # 0x372240
leaq 0x266bee(%rip), %rax    # 0x30d500
movl %r14d, (%rax)
leaq 0x266bfc(%rip), %rax    # 0x30d518
movsd %xmm0, (%rax)
leaq 0x197a69(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0xa6940
leaq 0x7f35c(%rip), %rsi     # 0x125c92
movq %r15, %rdx
xorl %eax, %eax
callq 0x9560
leaq 0x197a49(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
leaq 0x266b78(%rip), %r14    # 0x30d4cc
leaq 0x266b75(%rip), %r13    # 0x30d4d0
je 0xa69ab
leaq 0x266b78(%rip), %rax    # 0x30d4dc
movl (%rax), %edx
leaq 0x266b6b(%rip), %rax    # 0x30d4d8
movl (%rax), %ecx
leaq 0x266b5e(%rip), %rax    # 0x30d4d4
movl (%rax), %r8d
movl (%r13), %r9d
movl (%r14), %r10d
leaq 0x266b41(%rip), %rax    # 0x30d4c8
movl (%rax), %r11d
leaq 0x266b4f(%rip), %rax    # 0x30d4e0
movsd (%rax), %xmm0
leaq 0x7f305(%rip), %rsi     # 0x125ca1
movb $0x1, %al
pushq %r11
pushq %r10
callq 0x9560
addq $0x10, %rsp
leaq 0x266af2(%rip), %rax    # 0x30d4a4
orb $0x1, (%rax)
jmp 0xa6a0c
movq %r15, %rdi
callq 0x9470
mulsd 0x64e51(%rip), %xmm0    # 0x10b818
divsd 0x64e51(%rip), %xmm0    # 0x10b820
leaq 0x2665fa(%rip), %rax    # 0x30cfd0
jmp 0xa6a08
movq %r15, %rdi
callq 0x9470
mulsd 0x64e30(%rip), %xmm0    # 0x10b818
divsd 0x64e30(%rip), %xmm0    # 0x10b820
leaq 0x2665e1(%rip), %rax    # 0x30cfd8
jmp 0xa6a08
movq %r15, %rdi
callq 0x9470
leaq 0x2665d8(%rip), %rax    # 0x30cfe0
movsd %xmm0, (%rax)
testq %rbx, %rbx
jne 0xa6570
jmp 0xa6aa7
movq %r15, %rdi
callq 0x9470
leaq 0x2665f7(%rip), %rax    # 0x30d020
movsd %xmm0, (%rax)
leaq 0x266904(%rip), %rax    # 0x30d338
movl $0x14, (%rax)
jmp 0xa6a0c
movl 0x2cb5ce(%rip), %eax    # 0x372010
movl $0x444f4d22, %ecx       # imm = 0x444F4D22
xorl %ecx, %eax
movl 0x2cb5c4(%rip), %ecx    # 0x372013
movl $0x224544, %edx         # imm = 0x224544
xorl %edx, %ecx
orl %eax, %ecx
jne 0xa6a0c
movq %r15, %rdi
callq 0x95e0
cmpl $0x1, %eax
je 0xa6a89
cmpl $0x2, %eax
je 0xa6a7d
cmpl $0x3, %eax
jne 0xa6a98
leaq 0x266658(%rip), %rax    # 0x30d0d0
movb $0x4, (%rax)
jmp 0xa6a0c
leaq 0x26664c(%rip), %rax    # 0x30d0d0
movb $0x3, (%rax)
jmp 0xa6a0c
leaq 0x266640(%rip), %rax    # 0x30d0d0
movb $0x9, (%rax)
jmp 0xa6a0c
leaq 0x266631(%rip), %rax    # 0x30d0d0
movb $0x63, (%rax)
jmp 0xa6a0c
leaq 0x266a2e(%rip), %rax    # 0x30d4dc
movl -0x40(%rbp), %ecx
cmpl (%rax), %ecx
jne 0xa6aff
leaq 0x266a1c(%rip), %rax    # 0x30d4d8
movl -0x3c(%rbp), %ecx
cmpl (%rax), %ecx
jne 0xa6aff
leaq 0x266a0a(%rip), %rax    # 0x30d4d4
movl -0x38(%rbp), %ecx
cmpl (%rax), %ecx
jne 0xa6aff
movl -0x34(%rbp), %eax
cmpl (%r13), %eax
jne 0xa6aff
movl -0x30(%rbp), %eax
cmpl (%r14), %eax
jne 0xa6aff
leaq 0x2669df(%rip), %rax    # 0x30d4c8
movl -0x2c(%rbp), %ecx
cmpl (%rax), %ecx
jne 0xa6aff
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 0x7327e