// File: 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
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %edi
movl %edi, -0x14(%rbp)
callq 0x2060
cmpl $0x0, %eax
je 0x4331
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x430f
movl $0x40, -0x18(%rbp)
leaq -0x70(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movsbl (%rax), %edi
callq 0x22b0
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x81(%rbp)
je 0x4378
movl -0x18(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x18(%rbp)
cmpl $0x0, %eax
setne %al
movb %al, -0x81(%rbp)
movb -0x81(%rbp), %al
testb $0x1, %al
jne 0x4384
jmp 0x43a8
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x28(%rbp)
movb (%rax), %cl
movq -0x30(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x30(%rbp)
movb %cl, (%rax)
jmp 0x4348
movq -0x30(%rbp), %rax
movb $0x0, (%rax)
leaq -0x70(%rbp), %rax
movq %rax, -0x30(%rbp)
movsbl -0x70(%rbp), %eax
movl %eax, -0x14(%rbp)
cmpl $0x2b, -0x14(%rbp)
je 0x43ca
cmpl $0x2d, -0x14(%rbp)
jne 0x43d8
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x43df
movl $0x2b, -0x14(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x78(%rbp)
movl $0x0, -0x1c(%rbp)
cmpl $0x3, -0x1c(%rbp)
jge 0x456c
movq -0x30(%rbp), %rax
movsbl (%rax), %edi
callq 0x2270
cmpl $0x0, %eax
jne 0x441a
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2e, %eax
je 0x441a
jmp 0x456c
movq -0x30(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x4620
movsd %xmm0, -0x80(%rbp)
movsd 0x14df4(%rip), %xmm1    # 0x19228
ucomisd %xmm1, %xmm0
jne 0x444b
jp 0x444b
movsd -0x80(%rbp), %xmm0
movsd %xmm0, -0x8(%rbp)
jmp 0x460b
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x88(%rbp)
subl $0x22, %eax
je 0x44b2
jmp 0x445f
movl -0x88(%rbp), %eax
subl $0x27, %eax
je 0x44a9
jmp 0x446c
movl -0x88(%rbp), %eax
subl $0x44, %eax
je 0x44a0
jmp 0x4479
movl -0x88(%rbp), %eax
subl $0x52, %eax
je 0x44bb
jmp 0x4486
movl -0x88(%rbp), %eax
subl $0x64, %eax
je 0x44a0
jmp 0x4493
movl -0x88(%rbp), %eax
subl $0x72, %eax
je 0x44bb
jmp 0x44e6
movl $0x0, -0x18(%rbp)
jmp 0x4516
movl $0x1, -0x18(%rbp)
jmp 0x4516
movl $0x2, -0x18(%rbp)
jmp 0x4516
cmpl $0x0, -0x1c(%rbp)
je 0x44ce
xorps %xmm0, %xmm0
movsd %xmm0, -0x8(%rbp)
jmp 0x460b
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movsd -0x80(%rbp), %xmm0
movsd %xmm0, -0x78(%rbp)
jmp 0x450d
movsd -0x80(%rbp), %xmm0
movslq -0x1c(%rbp), %rcx
leaq 0x1501a(%rip), %rax     # 0x19510
movsd (%rax,%rcx,8), %xmm2
movsd -0x78(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x78(%rbp)
movl $0x4, -0x18(%rbp)
jmp 0x455e
movl -0x18(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x452b
xorps %xmm0, %xmm0
movsd %xmm0, -0x8(%rbp)
jmp 0x460b
movsd -0x80(%rbp), %xmm0
movslq -0x18(%rbp), %rcx
leaq 0x14fd5(%rip), %rax     # 0x19510
movsd (%rax,%rcx,8), %xmm2
movsd -0x78(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x78(%rbp)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x43ee
movq -0x30(%rbp), %rax
cmpb $0x0, (%rax)
je 0x45da
movq 0x1ad44(%rip), %rdi     # 0x1f2c0
movq -0x30(%rbp), %rax
movsbl (%rax), %esi
callq 0x20e0
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
je 0x45da
movq -0x28(%rbp), %rcx
movq 0x1ad23(%rip), %rax     # 0x1f2c0
subq %rax, %rcx
movb $0x2d, %al
movb $0x2b, %dl
movb %dl, -0x8a(%rbp)
cmpq $0x4, %rcx
movb %al, -0x89(%rbp)
jge 0x45c2
movb -0x8a(%rbp), %al
movb %al, -0x89(%rbp)
movb -0x89(%rbp), %al
movsbl %al, %eax
movl %eax, -0x14(%rbp)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
cmpl $0x2d, -0x14(%rbp)
jne 0x4601
movsd -0x78(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x78(%rbp)
movsd -0x78(%rbp), %xmm0
movsd %xmm0, -0x8(%rbp)
movsd -0x8(%rbp), %xmm0
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax)