// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_tm4_lla(int)
void parse_tm4_lla(int enhanced)
{
double val;
double sign;
int i;

   log_packet_id("position");
   if(enhanced) have_tm4_enhanced = 1; 
   else if(have_tm4_enhanced) return;  // ignore low res stuff

   val = 0.0;
   sign = 1.0;
   if(get_msg_field()) {  // lat
      val = atof(msg_field);
   }
   if(get_msg_field()) {
      if(msg_field[0] == 'S') sign = (-1.0);
      lat = ((double) (int) val) / 100.0;   // degrees
      val = val - (lat * 100.0);            // minutes
      val /= 60.0;
      lat += val;
      lat *= sign;
      lat = lat * PI / 180.0;
   }

   val = 0.0;
   sign = 1.0;
   if(get_msg_field()) {  // lon
      val = atof(msg_field);
   }
   if(get_msg_field()) {
      if(msg_field[0] == 'W') sign = (-1.0);
      lon = ((double) (int) val) / 100.0;   // degrees
      val = val - (lat * 100.0);            // minutes
      val /= 60.0;
      lon += val;
      lon *= sign;
      lon = lon * PI / 180.0;
   }

   if(enhanced) {
      if(get_msg_field()) {
         alt = atof(msg_field);
      }
      get_msg_field(); // 'M' for meters
   }

   if(get_msg_field()) { // 0=no gps   1=gps avail;
      tm4_gps = atoi(msg_field);
   }

   if(get_msg_field()) { // sat count
      if(msg_field[0] == 'C') i = 12;
      else if(msg_field[0] == 'B') i = 11;
      else if(msg_field[0] == 'A') i = 10;
      else i = atoi(msg_field);
      sat_count = i;
      config_sat_count(sat_count);
      have_count = 444;
   }

   if(enhanced) {
      if(get_msg_field()) {
         hdop = (float) atof(msg_field);
         have_dops |= HDOP;
      }

      if(get_msg_field()) {
         speed = atof(msg_field);
         have_speed = 444;
      }

      if(get_msg_field()) {
         heading = atof(msg_field);
         have_heading = 444;
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x18, %rsp
movl %edi, %ebx
leaq 0x8030d(%rip), %rdi     # 0x124b8c
callq 0x58dc2
leaq 0x2976d9(%rip), %rax    # 0x33bf64
testl %ebx, %ebx
je 0xa48ac
movl $0x1, (%rax)
callq 0x810b1
testl %eax, %eax
je 0xa48b7
leaq 0x29719b(%rip), %rdi    # 0x33ba40
callq 0x9470
jmp 0xa48bb
cmpl $0x0, (%rax)
jne 0xa4ad3
jmp 0xa4895
xorpd %xmm0, %xmm0
movapd %xmm0, -0x20(%rbp)
callq 0x810b1
testl %eax, %eax
je 0xa4925
leaq 0x297170(%rip), %rax    # 0x33ba40
cmpb $0x53, (%rax)
movapd -0x20(%rbp), %xmm2
cvttpd2dq %xmm2, %xmm0
cvtdq2pd %xmm0, %xmm0
movsd 0x64778(%rip), %xmm1    # 0x109060
divsd %xmm1, %xmm0
mulsd %xmm0, %xmm1
subsd %xmm1, %xmm2
divsd 0x6470c(%rip), %xmm2    # 0x109008
addsd %xmm0, %xmm2
jne 0xa490a
xorpd 0x648a6(%rip), %xmm2    # 0x1091b0
mulsd 0x66f16(%rip), %xmm2    # 0x10b828
divsd 0x66f16(%rip), %xmm2    # 0x10b830
leaq 0x2686af(%rip), %rax    # 0x30cfd0
movsd %xmm2, (%rax)
callq 0x810b1
testl %eax, %eax
je 0xa493c
leaq 0x29710b(%rip), %rdi    # 0x33ba40
callq 0x9470
jmp 0xa4940
xorpd %xmm0, %xmm0
movapd %xmm0, -0x20(%rbp)
callq 0x810b1
testl %eax, %eax
je 0xa49b1
leaq 0x2970eb(%rip), %rax    # 0x33ba40
cmpb $0x57, (%rax)
movapd -0x20(%rbp), %xmm2
cvttpd2dq %xmm2, %xmm0
cvtdq2pd %xmm0, %xmm0
movsd 0x646f3(%rip), %xmm1    # 0x109060
divsd %xmm1, %xmm0
leaq 0x268658(%rip), %rax    # 0x30cfd0
mulsd (%rax), %xmm1
subsd %xmm1, %xmm2
divsd 0x64680(%rip), %xmm2    # 0x109008
addsd %xmm0, %xmm2
jne 0xa4996
xorpd 0x6481a(%rip), %xmm2    # 0x1091b0
mulsd 0x66e8a(%rip), %xmm2    # 0x10b828
divsd 0x66e8a(%rip), %xmm2    # 0x10b830
leaq 0x26862b(%rip), %rax    # 0x30cfd8
movsd %xmm2, (%rax)
testl %ebx, %ebx
je 0xa49da
callq 0x810b1
testl %eax, %eax
je 0xa49d5
leaq 0x29707b(%rip), %rdi    # 0x33ba40
callq 0x9470
leaq 0x26860f(%rip), %rax    # 0x30cfe0
movsd %xmm0, (%rax)
callq 0x810b1
callq 0x810b1
testl %eax, %eax
je 0xa49f5
leaq 0x297056(%rip), %rdi    # 0x33ba40
callq 0x95e0
movl %eax, 0x2cd607(%rip)    # 0x371ffc
callq 0x810b1
testl %eax, %eax
je 0xa4a3f
leaq 0x29703b(%rip), %rax    # 0x33ba40
movb (%rax), %al
leal -0x41(%rax), %ecx
cmpb $0x3, %cl
jae 0xa4a16
addb $-0x37, %al
movzbl %al, %edi
jmp 0xa4a24
leaq 0x297023(%rip), %rdi    # 0x33ba40
callq 0x95e0
movl %eax, %edi
leaq 0x19a4e1(%rip), %rax    # 0x23ef0c
movl %edi, (%rax)
callq 0x5e390
leaq 0x2688df(%rip), %rax    # 0x30d318
movl $0x1bc, (%rax)          # imm = 0x1BC
testl %ebx, %ebx
je 0xa4ad3
callq 0x810b1
testl %eax, %eax
je 0xa4a79
leaq 0x296fe9(%rip), %rdi    # 0x33ba40
callq 0x9470
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x17ea85(%rip), %rax    # 0x2234f0
movsd %xmm0, (%rax)
leaq 0x17ea6e(%rip), %rax    # 0x2234e4
orb $0x2, (%rax)
callq 0x810b1
testl %eax, %eax
je 0xa4aa6
leaq 0x296fb7(%rip), %rdi    # 0x33ba40
callq 0x9470
leaq 0x26858b(%rip), %rax    # 0x30d020
movsd %xmm0, (%rax)
leaq 0x268898(%rip), %rax    # 0x30d338
movl $0x1bc, (%rax)          # imm = 0x1BC
callq 0x810b1
testl %eax, %eax
je 0xa4ad3
leaq 0x296f8a(%rip), %rdi    # 0x33ba40
callq 0x9470
leaq 0x268566(%rip), %rax    # 0x30d028
movsd %xmm0, (%rax)
leaq 0x268867(%rip), %rax    # 0x30d334
movl $0x1bc, (%rax)          # imm = 0x1BC
addq $0x18, %rsp
popq %rbx
popq %rbp
retq