// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathui.cpp
// Function: parse_coord(int, char*)
double parse_coord(int lon_flag, char *s)
{
double val;
int adj_flag;

   // convert a lat/lon string to decimal degrees.  The string can either be
   // a decimal number or a string in the format 11d12m30s (no embeded spaces).
   // If a part of the dms format string is not given, it is assumed to be 0.

   if(s == 0) return 0.0;

   strlwr(s);
   if(s[0] == '*') {
      adj_flag = 1;
      s = "0";
   }
   else if((s[0] == '+') && (s[1] == '+')) {
      adj_flag = 1;
      ++s;
   }
   else if((s[0] == '-') && (s[1] == '-')) {
      adj_flag = (-1);
      ++s;
   }
   else adj_flag = 0;

   if( (strchr(s, 'a') || strchr(s, 'A')) && have_lla_queue && plot[ONE].stat_count && plot[TWO].stat_count) {
      precise_lat = plot[ONE].sum_y / plot[ONE].stat_count;
      if(lon_flag) val = plot[TWO].sum_y / plot[TWO].stat_count;
      else         val = plot[ONE].sum_y / plot[ONE].stat_count;
   }
   else if(strchr(s, 'a') || strchr(s, 'A')) {
      if(lon_flag) val = lon * 180.0 / PI;
      else         val = lat * 180.0 / PI;
   }
   else if(strchr(s, 'd') || strchr(s, 'm') || strchr(s, 's')) {  // convert feet to meters
      val = deg_min_sec(s);
   }
   else if(strchr(s, 'D') || strchr(s, 'M') || strchr(s, 'S')) {  // convert feet to meters
      val = deg_min_sec(s);
   }
   else {
      val = atof(s);
   }

   if(adj_flag) {  // add +/- offset in feet or meters to current position
      if(lon_flag) {
         if(cos_factor) val /= cos_factor;
         val = precise_lon + (val * ANGLE_SCALE * DEG_TO_RAD);
      }
      else {
         val = precise_lat + (val * ANGLE_SCALE * DEG_TO_RAD);
      }
      val = val * 180.0 / PI;
   }

   return val;
}

// Assembly:
testq %rsi, %rsi
je 0x313d7
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movl %edi, %ebx
movq %rsi, %rdi
callq 0x986c
movzbl (%r14), %eax
cmpl $0x2a, %eax
je 0x313ea
cmpl $0x2d, %eax
je 0x313db
cmpl $0x2b, %eax
jne 0x313d2
cmpb $0x2b, 0x1(%r14)
je 0x313e2
movb $0x1, %r12b
jmp 0x313f4
xorps %xmm0, %xmm0
retq
cmpb $0x2d, 0x1(%r14)
jne 0x313d2
incq %r14
xorl %r12d, %r12d
jmp 0x313f4
xorl %r12d, %r12d
leaq 0xf001c(%rip), %r14     # 0x121410
movq %r14, %rdi
movl $0x61, %esi
callq 0x9100
movq %rax, %r15
testq %rax, %rax
je 0x3141a
leaq 0x2dbeb0(%rip), %rax    # 0x30d2c0
cmpl $0x0, (%rax)
jne 0x31438
jmp 0x314a7
movq %r14, %rdi
movl $0x41, %esi
callq 0x9100
testq %rax, %rax
je 0x31491
leaq 0x2dbe8d(%rip), %rax    # 0x30d2c0
cmpl $0x0, (%rax)
je 0x31491
leaq 0x12c8f1(%rip), %rax    # 0x15dd30
movsd 0x428(%rax), %xmm2
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm2
jne 0x31453
jnp 0x3148c
movsd 0x510(%rax), %xmm1
ucomisd %xmm0, %xmm1
jne 0x31463
jnp 0x3148c
movsd 0x408(%rax), %xmm0
divsd %xmm2, %xmm0
leaq 0x309e7a(%rip), %rcx    # 0x33b2f0
movsd %xmm0, (%rcx)
testl %ebx, %ebx
je 0x314cf
movsd 0x4f0(%rax), %xmm0
divsd %xmm1, %xmm0
jmp 0x314cf
testq %r15, %r15
jne 0x314a7
movq %r14, %rdi
movl $0x41, %esi
callq 0x9100
testq %rax, %rax
je 0x31544
testl %ebx, %ebx
je 0x314b4
leaq 0x2dbb26(%rip), %rax    # 0x30cfd8
jmp 0x314bb
leaq 0x2dbb15(%rip), %rax    # 0x30cfd0
movsd (%rax), %xmm0
mulsd 0xda369(%rip), %xmm0    # 0x10b830
divsd 0xda359(%rip), %xmm0    # 0x10b828
testb %r12b, %r12b
jne 0x3153b
testl %ebx, %ebx
je 0x3150d
leaq 0x2dbae9(%rip), %rax    # 0x30cfc8
movsd (%rax), %xmm1
movapd %xmm0, %xmm2
divsd %xmm1, %xmm2
xorpd %xmm3, %xmm3
cmpneqsd %xmm1, %xmm3
andpd %xmm3, %xmm2
andnpd %xmm0, %xmm3
orpd %xmm2, %xmm3
leaq 0x309df1(%rip), %rax    # 0x33b2f8
movapd %xmm3, %xmm0
jmp 0x31514
leaq 0x309ddc(%rip), %rax    # 0x33b2f0
leaq 0x2dba9d(%rip), %rcx    # 0x30cfb8
mulsd (%rcx), %xmm0
mulsd 0xda3e9(%rip), %xmm0    # 0x10b910
addsd (%rax), %xmm0
mulsd 0xda2fd(%rip), %xmm0    # 0x10b830
divsd 0xda2ed(%rip), %xmm0    # 0x10b828
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
movl $0x64, %esi
callq 0x9100
testq %rax, %rax
jne 0x315b0
movq %r14, %rdi
movl $0x6d, %esi
callq 0x9100
testq %rax, %rax
jne 0x315b0
movq %r14, %rdi
movl $0x73, %esi
callq 0x9100
testq %rax, %rax
jne 0x315b0
movq %r14, %rdi
movl $0x44, %esi
callq 0x9100
testq %rax, %rax
jne 0x315b0
movq %r14, %rdi
movl $0x4d, %esi
callq 0x9100
testq %rax, %rax
jne 0x315b0
movq %r14, %rdi
movl $0x53, %esi
callq 0x9100
testq %rax, %rax
je 0x315bd
movq %r14, %rdi
callq 0x31269
jmp 0x314cf
movq %r14, %rdi
callq 0x9470
jmp 0x314cf