// File: /workspace/github_cpp_makefile_star2_O2/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, %rbx
movb (%rbx), %bpl
movsbl %bpl, %edi
callq 0x2060
incq %rbx
testl %eax, %eax
jne 0x3854
xorl %r14d, %r14d
movsbl %bpl, %edi
callq 0x2290
testl %eax, %eax
je 0x388b
cmpl $0x3f, %r14d
je 0x388b
movb %bpl, 0x20(%rsp,%r14)
movb (%rbx,%r14), %bpl
incq %r14
jmp 0x386a
movb $0x0, 0x20(%rsp,%r14)
leaq 0x20(%rsp), %rdi
movq %rdi, 0x8(%rsp)
movzbl (%rdi), %ebp
cmpl $0x2b, %ebp
je 0x38a8
cmpl $0x2d, %ebp
jne 0x38b4
leaq 0x21(%rsp), %rdi
movq %rdi, 0x8(%rsp)
jmp 0x38b7
pushq $0x2b
popq %rbp
xorpd %xmm1, %xmm1
xorl %r12d, %r12d
leaq 0x8(%rsp), %rbx
leaq 0xac46(%rip), %r15      # 0xe510
movb (%rdi), %r13b
movsbl %r13b, %esi
cmpl $0x2, %r12d
movapd %xmm1, 0x10(%rsp)
ja 0x39d0
leal -0x30(%rsi), %eax
cmpl $0xa, %eax
setae %al
cmpb $0x2e, %sil
setne %cl
testb %al, %cl
jne 0x39d0
movq %rdi, %r14
testb %r13b, %r13b
je 0x3913
movl %r13d, %eax
andb $-0x21, %al
cmpb $0x44, %al
je 0x391d
movb 0x1(%r14), %r13b
incq %r14
jmp 0x38fc
movq %rbx, %rsi
callq 0x2200
jmp 0x392c
movb $0x0, (%r14)
movq %rbx, %rsi
callq 0x2200
movb %r13b, (%r14)
movsd 0xa8e4(%rip), %xmm1     # 0xe218
ucomisd %xmm1, %xmm0
jae 0x3a18
movq 0x8(%rsp), %rdi
movzbl (%rdi), %ecx
cmpl $0x22, %ecx
je 0x39a4
cmpl $0x72, %ecx
je 0x396a
xorl %eax, %eax
cmpl $0x44, %ecx
je 0x39a7
cmpl $0x52, %ecx
je 0x396a
cmpl $0x64, %ecx
je 0x39a7
cmpl $0x27, %ecx
jne 0x3988
pushq $0x1
jmp 0x39a6
testl %r12d, %r12d
jne 0x3a14
incq %rdi
movq %rdi, 0x8(%rsp)
pushq $0x5
popq %r12
movapd %xmm0, %xmm1
jmp 0x38ca
movl %r12d, %eax
mulsd (%r15,%rax,8), %xmm0
movapd 0x10(%rsp), %xmm1
addsd %xmm0, %xmm1
pushq $0x5
popq %r12
jmp 0x38ca
pushq $0x2
popq %rax
cmpl %r12d, %eax
jb 0x3a14
movl %eax, %ecx
mulsd (%r15,%rcx,8), %xmm0
movapd 0x10(%rsp), %xmm1
addsd %xmm0, %xmm1
incq %rdi
movq %rdi, 0x8(%rsp)
incl %eax
movl %eax, %r12d
jmp 0x38ca
testb %r13b, %r13b
je 0x3a05
leaq 0xab27(%rip), %rbx      # 0xe503
pushq $0x9
popq %rdx
movq %rbx, %rdi
callq 0x2310
movapd 0x10(%rsp), %xmm1
testq %rax, %rax
je 0x3a05
subq %rbx, %rax
xorl %ecx, %ecx
cmpq $0x4, %rax
setge %cl
leal 0x2b(,%rcx,2), %ebp
cmpl $0x2d, %ebp
jne 0x3a18
xorpd 0xa83e(%rip), %xmm1     # 0xe250
jmp 0x3a18
xorpd %xmm1, %xmm1
movapd %xmm1, %xmm0
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq