// File: /workspace/github_cpp_makefile_star2_O1/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
movsbl (%rbx), %edi
callq 0x2060
incq %rbx
testl %eax, %eax
jne 0x3ac1
leaq 0x20(%rsp), %r14
movq %r14, 0x8(%rsp)
movb -0x1(%rbx), %bpl
movsbl %bpl, %edi
callq 0x22a0
movq %r14, %rcx
testl %eax, %eax
je 0x3b18
xorl %r15d, %r15d
cmpl $0x3f, %r15d
je 0x3b10
movb %bpl, 0x20(%rsp,%r15)
movb (%rbx,%r15), %bpl
movsbl %bpl, %edi
callq 0x22a0
incq %r15
testl %eax, %eax
jne 0x3af1
leaq (%rsp,%r15), %rcx
addq $0x20, %rcx
movq %rcx, 0x8(%rsp)
movb $0x0, (%rcx)
movq %r14, 0x8(%rsp)
movzbl 0x20(%rsp), %eax
cmpl $0x2d, %eax
je 0x3b39
movl $0x2b, %ebp
cmpl $0x2b, %eax
jne 0x3b46
movsbl %al, %ebp
leaq 0x21(%rsp), %rax
movq %rax, 0x8(%rsp)
xorl %r15d, %r15d
xorpd %xmm0, %xmm0
movsd %xmm0, 0x10(%rsp)
leaq 0x8(%rsp), %rbx
leaq 0xc991(%rip), %r14      # 0x104f0
movq 0x8(%rsp), %rdi
movsbl (%rdi), %r12d
cmpl $0x2e, %r12d
setne %al
leal -0x30(%r12), %ecx
cmpl $0xa, %ecx
setae %cl
testb %cl, %al
jne 0x3c61
testb %r12b, %r12b
je 0x3b9f
movq %rdi, %r13
movl %r12d, %eax
andb $-0x21, %al
cmpb $0x44, %al
je 0x3ba9
movb 0x1(%r13), %r12b
incq %r13
testb %r12b, %r12b
jne 0x3b8a
movq %rbx, %rsi
callq 0x2210
jmp 0x3bba
movb $0x0, (%r13)
movq %rbx, %rsi
callq 0x2210
movb %r12b, (%r13)
ucomisd 0xc65e(%rip), %xmm0     # 0x10220
jae 0x3cc1
movq 0x8(%rsp), %rax
movzbl (%rax), %edx
xorl %ecx, %ecx
cmpl $0x51, %edx
jg 0x3be8
cmpl $0x22, %edx
je 0x3c06
cmpl $0x27, %edx
je 0x3c24
cmpl $0x44, %edx
je 0x3c29
jmp 0x3c0d
cmpl $0x52, %edx
je 0x3bf7
cmpl $0x64, %edx
je 0x3c29
cmpl $0x72, %edx
jne 0x3c0d
testl %r15d, %r15d
jne 0x3c5b
incq %rax
movq %rax, 0x8(%rsp)
jmp 0x3c1c
movl $0x2, %ecx
jmp 0x3c29
movl %r15d, %eax
mulsd (%r14,%rax,8), %xmm0
addsd 0x10(%rsp), %xmm0
movl $0x5, %r15d
jmp 0x3c49
movl $0x1, %ecx
cmpl %r15d, %ecx
jb 0x3c5b
movl %ecx, %edx
mulsd (%r14,%rdx,8), %xmm0
addsd 0x10(%rsp), %xmm0
incq %rax
movq %rax, 0x8(%rsp)
incl %ecx
movl %ecx, %r15d
movsd %xmm0, 0x10(%rsp)
cmpl $0x3, %r15d
jl 0x3b5f
jmp 0x3c67
xorpd %xmm0, %xmm0
jmp 0x3cc1
movsd 0x10(%rsp), %xmm0
movq 0x8(%rsp), %r14
movsbl (%r14), %esi
testl %esi, %esi
je 0x3cb4
leaq 0xc868(%rip), %rbx      # 0x104e3
movl $0x9, %edx
movq %rbx, %rdi
movapd %xmm0, 0x10(%rsp)
callq 0x2320
movapd 0x10(%rsp), %xmm0
testq %rax, %rax
je 0x3cb4
subq %rbx, %rax
xorl %ecx, %ecx
cmpq $0x4, %rax
setge %cl
leal 0x2b(,%rcx,2), %ebp
incq %r14
movq %r14, 0x8(%rsp)
cmpl $0x2d, %ebp
jne 0x3cc1
xorpd 0xc59f(%rip), %xmm0     # 0x10260
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq