// File: 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
subq $0x20, %rsp
movl %edi, -0x4(%rbp)
leaq 0xa8b66(%rip), %rdi     # 0x187e78
callq 0x7add0
cmpl $0x0, -0x4(%rbp)
je 0xdf32c
leaq 0x2bbe20(%rip), %rax    # 0x39b144
movl $0x1, (%rax)
jmp 0xdf33f
leaq 0x2bbe11(%rip), %rax    # 0x39b144
cmpl $0x0, (%rax)
je 0xdf33d
jmp 0xdf715
jmp 0xdf33f
xorps %xmm0, %xmm0
movsd %xmm0, -0x10(%rbp)
movsd 0x8fd19(%rip), %xmm0    # 0x16f068
movsd %xmm0, -0x18(%rbp)
callq 0xb0bd0
cmpl $0x0, %eax
je 0xdf36f
leaq 0x2bb8bb(%rip), %rdi    # 0x39ac20
callq 0x9480
movsd %xmm0, -0x10(%rbp)
callq 0xb0bd0
cmpl $0x0, %eax
je 0xdf46b
leaq 0x2bb89c(%rip), %rax    # 0x39ac20
movsbl (%rax), %eax
cmpl $0x53, %eax
jne 0xdf399
movsd 0x8fd84(%rip), %xmm0    # 0x16f118
movsd %xmm0, -0x18(%rbp)
cvttsd2si -0x10(%rbp), %eax
cvtsi2sd %eax, %xmm0
movsd 0x8fca6(%rip), %xmm1    # 0x16f050
divsd %xmm1, %xmm0
leaq 0x28cdfb(%rip), %rax    # 0x36c1b0
movsd %xmm0, (%rax)
movsd -0x10(%rbp), %xmm1
leaq 0x28cdeb(%rip), %rax    # 0x36c1b0
movsd (%rax), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd 0x8fc68(%rip), %xmm2    # 0x16f050
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x10(%rbp)
movsd -0x10(%rbp), %xmm0
movsd 0x8fc16(%rip), %xmm1    # 0x16f018
divsd %xmm1, %xmm0
movsd %xmm0, -0x10(%rbp)
movsd -0x10(%rbp), %xmm0
leaq 0x28cd99(%rip), %rax    # 0x36c1b0
addsd (%rax), %xmm0
leaq 0x28cd8e(%rip), %rax    # 0x36c1b0
movsd %xmm0, (%rax)
movsd -0x18(%rbp), %xmm0
leaq 0x28cd7e(%rip), %rax    # 0x36c1b0
mulsd (%rax), %xmm0
leaq 0x28cd73(%rip), %rax    # 0x36c1b0
movsd %xmm0, (%rax)
movsd 0x9217f(%rip), %xmm0    # 0x1715c8
leaq 0x28cd60(%rip), %rax    # 0x36c1b0
mulsd (%rax), %xmm0
movsd 0x8fc1c(%rip), %xmm1    # 0x16f078
divsd %xmm1, %xmm0
leaq 0x28cd49(%rip), %rax    # 0x36c1b0
movsd %xmm0, (%rax)
xorps %xmm0, %xmm0
movsd %xmm0, -0x10(%rbp)
movsd 0x8fbed(%rip), %xmm0    # 0x16f068
movsd %xmm0, -0x18(%rbp)
callq 0xb0bd0
cmpl $0x0, %eax
je 0xdf49b
leaq 0x2bb78f(%rip), %rdi    # 0x39ac20
callq 0x9480
movsd %xmm0, -0x10(%rbp)
callq 0xb0bd0
cmpl $0x0, %eax
je 0xdf597
leaq 0x2bb770(%rip), %rax    # 0x39ac20
movsbl (%rax), %eax
cmpl $0x57, %eax
jne 0xdf4c5
movsd 0x8fc58(%rip), %xmm0    # 0x16f118
movsd %xmm0, -0x18(%rbp)
cvttsd2si -0x10(%rbp), %eax
cvtsi2sd %eax, %xmm0
movsd 0x8fb7a(%rip), %xmm1    # 0x16f050
divsd %xmm1, %xmm0
leaq 0x28ccd7(%rip), %rax    # 0x36c1b8
movsd %xmm0, (%rax)
movsd -0x10(%rbp), %xmm1
leaq 0x28ccbf(%rip), %rax    # 0x36c1b0
movsd (%rax), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd 0x8fb3c(%rip), %xmm2    # 0x16f050
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x10(%rbp)
movsd -0x10(%rbp), %xmm0
movsd 0x8faea(%rip), %xmm1    # 0x16f018
divsd %xmm1, %xmm0
movsd %xmm0, -0x10(%rbp)
movsd -0x10(%rbp), %xmm0
leaq 0x28cc75(%rip), %rax    # 0x36c1b8
addsd (%rax), %xmm0
leaq 0x28cc6a(%rip), %rax    # 0x36c1b8
movsd %xmm0, (%rax)
movsd -0x18(%rbp), %xmm0
leaq 0x28cc5a(%rip), %rax    # 0x36c1b8
mulsd (%rax), %xmm0
leaq 0x28cc4f(%rip), %rax    # 0x36c1b8
movsd %xmm0, (%rax)
movsd 0x92053(%rip), %xmm0    # 0x1715c8
leaq 0x28cc3c(%rip), %rax    # 0x36c1b8
mulsd (%rax), %xmm0
movsd 0x8faf0(%rip), %xmm1    # 0x16f078
divsd %xmm1, %xmm0
leaq 0x28cc25(%rip), %rax    # 0x36c1b8
movsd %xmm0, (%rax)
cmpl $0x0, -0x4(%rbp)
je 0xdf5c3
callq 0xb0bd0
cmpl $0x0, %eax
je 0xdf5be
leaq 0x2bb672(%rip), %rdi    # 0x39ac20
callq 0x9480
leaq 0x28cc06(%rip), %rax    # 0x36c1c0
movsd %xmm0, (%rax)
callq 0xb0bd0
callq 0xb0bd0
cmpl $0x0, %eax
je 0xdf5df
leaq 0x2bb64c(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, 0x2f1c25(%rip)    # 0x3d1204
callq 0xb0bd0
cmpl $0x0, %eax
je 0xdf66f
leaq 0x2bb62c(%rip), %rax    # 0x39ac20
movsbl (%rax), %eax
cmpl $0x43, %eax
jne 0xdf605
movl $0xc, -0x1c(%rbp)
jmp 0xdf648
leaq 0x2bb614(%rip), %rax    # 0x39ac20
movsbl (%rax), %eax
cmpl $0x42, %eax
jne 0xdf61d
movl $0xb, -0x1c(%rbp)
jmp 0xdf646
leaq 0x2bb5fc(%rip), %rax    # 0x39ac20
movsbl (%rax), %eax
cmpl $0x41, %eax
jne 0xdf635
movl $0xa, -0x1c(%rbp)
jmp 0xdf644
leaq 0x2bb5e4(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, -0x1c(%rbp)
jmp 0xdf646
jmp 0xdf648
movl -0x1c(%rbp), %ecx
leaq 0x1bea9a(%rip), %rax    # 0x29e0ec
movl %ecx, (%rax)
leaq 0x1bea91(%rip), %rax    # 0x29e0ec
movl (%rax), %edi
callq 0x82080
leaq 0x28ce8f(%rip), %rax    # 0x36c4f8
movl $0x1bc, (%rax)          # imm = 0x1BC
cmpl $0x0, -0x4(%rbp)
je 0xdf715
callq 0xb0bd0
cmpl $0x0, %eax
je 0xdf6b7
leaq 0x2bb596(%rip), %rdi    # 0x39ac20
callq 0x9480
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x1a3032(%rip), %rax    # 0x2826d0
movsd %xmm0, (%rax)
leaq 0x1a301b(%rip), %rax    # 0x2826c4
movl (%rax), %ecx
orl $0x2, %ecx
leaq 0x1a300f(%rip), %rax    # 0x2826c4
movl %ecx, (%rax)
callq 0xb0bd0
cmpl $0x0, %eax
je 0xdf6e5
leaq 0x2bb558(%rip), %rdi    # 0x39ac20
callq 0x9480
leaq 0x28cb2c(%rip), %rax    # 0x36c200
movsd %xmm0, (%rax)
leaq 0x28ce39(%rip), %rax    # 0x36c518
movl $0x1bc, (%rax)          # imm = 0x1BC
callq 0xb0bd0
cmpl $0x0, %eax
je 0xdf713
leaq 0x2bb52a(%rip), %rdi    # 0x39ac20
callq 0x9480
leaq 0x28cb06(%rip), %rax    # 0x36c208
movsd %xmm0, (%rax)
leaq 0x28ce07(%rip), %rax    # 0x36c514
movl $0x1bc, (%rax)          # imm = 0x1BC
jmp 0xdf715
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)