// File: /workspace/github_cpp_makefile_star2_O3/rurban[P]dgnlib/cpl_conv.cpp
// Function: CPLDMSToDec
double CPLDMSToDec( const char *is )

{
    int sign, n, nl;
    char *p, *s, work[64];
    double v, tv;

    /* copy sting into work space */
    while (isspace(sign = *is)) ++is;
    for (n = sizeof(work), s = work, p = (char *)is; isgraph(*p) && --n ; )
        *s++ = *p++;
    *s = '\0';
    /* it is possible that a really odd input (like lots of leading
       zeros) could be truncated in copying into work.  But ... */
    sign = *(s = work);
    if (sign == '+' || sign == '-') s++;
    else sign = '+';
    for (v = 0., nl = 0 ; nl < 3 ; nl = n + 1 ) {
        if (!(isdigit(*s) || *s == '.')) break;
        if ((tv = proj_strtod(s, &s)) == HUGE_VAL)
            return tv;
        switch (*s) {
          case 'D': case 'd':
            n = 0; break;
          case '\'':
            n = 1; break;
          case '"':
            n = 2; break;
          case 'r': case 'R':
            if (nl) {
                return 0.0;
            }
            ++s;
            v = tv;
            goto skip;
          default:
            v += tv * vm[nl];
          skip: n = 4;
            continue;
        }
        if (n < nl) {
            return 0.0;
        }
        v += tv * vm[n];
        ++s;
    }
    /* postfix sign */
    if (*s && (p = (char *) strchr(sym, *s))) {
        sign = (p - sym) >= 4 ? '-' : '+';
        ++s;
    }
    if (sign == '-')
        v = -v;

    return v;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %r14
movb (%r14), %bpl
movsbl %bpl, %ebx
movl %ebx, %edi
callq 0x2060
incq %r14
testl %eax, %eax
jne 0x3a4c
movl %ebx, %edi
callq 0x2290
leaq 0x20(%rsp), %r12
movq %r12, %rcx
testl %eax, %eax
je 0x3a9e
xorl %r15d, %r15d
cmpl $0x3f, %r15d
je 0x3a96
movb %bpl, 0x20(%rsp,%r15)
movb (%r14,%r15), %bpl
movsbl %bpl, %edi
callq 0x2290
incq %r15
testl %eax, %eax
jne 0x3a77
leaq (%rsp,%r15), %rcx
addq $0x20, %rcx
movb $0x0, (%rcx)
movq %r12, 0x8(%rsp)
movzbl 0x20(%rsp), %eax
cmpl $0x2d, %eax
je 0x3aba
movl $0x2b, %ecx
cmpl $0x2b, %eax
jne 0x3ac6
leaq 0x21(%rsp), %r12
movq %r12, 0x8(%rsp)
movl %eax, %ecx
movl %ecx, 0x4(%rsp)
xorl %ebp, %ebp
xorpd %xmm1, %xmm1
leaq 0x8(%rsp), %r14
leaq 0xba34(%rip), %r15      # 0xf510
movsbl (%r12), %r13d
cmpl $0x2e, %r13d
setne %al
movl %r13d, %ecx
addl $-0x30, %ecx
cmpl $0xa, %ecx
setae %cl
testb %cl, %al
jne 0x3bf3
testb %r13b, %r13b
movapd %xmm1, 0x10(%rsp)
je 0x3b1f
movq %r12, %rbx
movl %r13d, %eax
andb $-0x21, %al
cmpb $0x44, %al
je 0x3b2c
movb 0x1(%rbx), %r13b
incq %rbx
testb %r13b, %r13b
jne 0x3b0a
movq %r12, %rdi
movq %r14, %rsi
callq 0x2200
jmp 0x3b3d
movb $0x0, (%rbx)
movq %r12, %rdi
movq %r14, %rsi
callq 0x2200
movb %r13b, (%rbx)
movsd 0xb6d3(%rip), %xmm1     # 0xf218
ucomisd %xmm1, %xmm0
jae 0x3c4b
movq 0x8(%rsp), %r12
movzbl (%r12), %edx
movb $0x1, %al
cmpl $0x43, %edx
jle 0x3b6e
xorl %ecx, %ecx
cmpl $0x63, %edx
jg 0x3b7f
cmpl $0x44, %edx
je 0x3b8d
jmp 0x3bc2
cmpl $0x22, %edx
je 0x3b86
cmpl $0x27, %edx
jne 0x3bdd
movl $0x1, %ecx
jmp 0x3b8d
cmpl $0x64, %edx
je 0x3b8d
jmp 0x3bd8
movl $0x2, %ecx
xorl %eax, %eax
cmpl %ebp, %ecx
jb 0x3bb9
movl %ecx, %edx
mulsd (%r15,%rdx,8), %xmm0
movapd 0x10(%rsp), %xmm1
addsd %xmm0, %xmm1
incq %r12
movq %r12, 0x8(%rsp)
incl %ecx
movl %ecx, %ebp
testb %al, %al
jne 0x3adc
jmp 0x3bef
xorpd %xmm1, %xmm1
jmp 0x3c4b
cmpl $0x52, %edx
jne 0x3bdd
xorpd %xmm1, %xmm1
testl %ebp, %ebp
jne 0x3c4b
incq %r12
movapd %xmm0, %xmm1
jmp 0x3bef
cmpl $0x72, %edx
je 0x3bc7
movl %ebp, %eax
mulsd (%r15,%rax,8), %xmm0
movapd 0x10(%rsp), %xmm1
addsd %xmm0, %xmm1
movb (%r12), %r13b
testb %r13b, %r13b
je 0x3c3a
movsbl %r13b, %esi
leaq 0xb900(%rip), %rbx      # 0xf503
movl $0x9, %edx
movq %rbx, %rdi
movapd %xmm1, 0x10(%rsp)
callq 0x2310
movapd 0x10(%rsp), %xmm1
testq %rax, %rax
movl 0x4(%rsp), %ecx
je 0x3c3e
subq %rbx, %rax
xorl %ecx, %ecx
cmpq $0x4, %rax
setge %cl
leal 0x2b(,%rcx,2), %ecx
jmp 0x3c3e
movl 0x4(%rsp), %ecx
cmpl $0x2d, %ecx
jne 0x3c4b
xorpd 0xb605(%rip), %xmm1     # 0xf250
movapd %xmm1, %xmm0
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq