// File: mouda[P]LTE_random_access-simulate/ap.cpp
// Function: alglib::_parse_real_delim(char const*, char const*, double*, char const**)
bool alglib::_parse_real_delim(const char *s, const char *delim, double *result, const char **new_s)
{
    const char *p;
    char *t;
    bool has_digits;
    char buf[64];
    int  isign;
    lconv *loc;

    p = s;
    
    //
    // check string structure and decide what to do
    //
    isign = 1;
    if( *s=='-' || *s=='+' )
    {
        isign = *s=='-' ? -1 : +1;
        s++;
    }
    memset(buf, 0, sizeof(buf));
    strncpy(buf, s, 3);
    if( my_stricmp(buf,"nan")!=0 && my_stricmp(buf,"inf")!=0 )
    {
        //
        // [sign] [ddd] [.] [ddd] [e|E[sign]ddd]
        //
        has_digits = false;
        if( *s!=0 && strchr("1234567890",*s)!=NULL )
        {
            has_digits = true;
            while( *s!=0 && strchr("1234567890",*s)!=NULL )
                s++;
        }
        if( *s=='.' )
            s++;
        if( *s!=0 && strchr("1234567890",*s)!=NULL )
        {
            has_digits = true;
            while( *s!=0 && strchr("1234567890",*s)!=NULL )
                s++;
        }
        if (!has_digits )
            return false;
        if( *s=='e' || *s=='E' )
        {
            s++;
            if( *s=='-' || *s=='+' )
                s++;
            if( *s==0 || strchr("1234567890",*s)==NULL )
                return false;
            while( *s!=0 && strchr("1234567890",*s)!=NULL )
                s++;
        }   
        if( *s==0 || strchr(delim,*s)==NULL )
            return false;
        *new_s = s;

        //
        // finite value conversion
        //
        if( *new_s-p>=(int)sizeof(buf) )
            return false;
        strncpy(buf, p, (size_t)(*new_s-p));
        buf[*new_s-p] = 0;
        loc = localeconv();
        t = strchr(buf,'.');
        if( t!=NULL )
            *t = *loc->decimal_point;
        *result = atof(buf);
        return true;
    }
    else
    {
        //
        // check delimiter and update *new_s
        //
        s += 3;
        if( *s==0 || strchr(delim,*s)==NULL )
            return false;
        *new_s = s;

        //
        // NAN, INF conversion
        //
        if( my_stricmp(buf,"nan")==0 )
            *result = fp_nan;
        if( my_stricmp(buf,"inf")==0 )
            *result = isign>0 ? fp_posinf : fp_neginf;
        return true;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movl $0x1, -0x84(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
je 0x4c265
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2b, %eax
jne 0x4c28e
movq -0x10(%rbp), %rax
movsbl (%rax), %edx
movl $0x1, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpl $0x2d, %edx
cmovel %ecx, %eax
movl %eax, -0x84(%rbp)
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
leaq -0x80(%rbp), %rdi
xorl %esi, %esi
movl $0x40, %edx
callq 0x3160
leaq -0x80(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl $0x3, %edx
callq 0x3140
leaq -0x80(%rbp), %rdi
leaq 0xc255(%rip), %rsi      # 0x58510
callq 0x4c100
cmpq $0x0, %rax
je 0x4c59f
leaq -0x80(%rbp), %rdi
leaq 0xc23f(%rip), %rsi      # 0x58514
callq 0x4c100
cmpq $0x0, %rax
je 0x4c59f
movb $0x0, -0x39(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x4c361
movq -0x10(%rbp), %rax
movsbl (%rax), %esi
leaq 0xc203(%rip), %rdi      # 0x58505
callq 0x30e0
cmpq $0x0, %rax
je 0x4c361
movb $0x1, -0x39(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x91(%rbp)
je 0x4c345
movq -0x10(%rbp), %rax
movsbl (%rax), %esi
leaq 0xc1d2(%rip), %rdi      # 0x58505
callq 0x30e0
cmpq $0x0, %rax
setne %al
movb %al, -0x91(%rbp)
movb -0x91(%rbp), %al
testb $0x1, %al
jne 0x4c351
jmp 0x4c35f
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x4c311
jmp 0x4c361
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2e, %eax
jne 0x4c379
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x4c3f2
movq -0x10(%rbp), %rax
movsbl (%rax), %esi
leaq 0xc172(%rip), %rdi      # 0x58505
callq 0x30e0
cmpq $0x0, %rax
je 0x4c3f2
movb $0x1, -0x39(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x92(%rbp)
je 0x4c3d6
movq -0x10(%rbp), %rax
movsbl (%rax), %esi
leaq 0xc141(%rip), %rdi      # 0x58505
callq 0x30e0
cmpq $0x0, %rax
setne %al
movb %al, -0x92(%rbp)
movb -0x92(%rbp), %al
testb $0x1, %al
jne 0x4c3e2
jmp 0x4c3f0
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x4c3a2
jmp 0x4c3f2
testb $0x1, -0x39(%rbp)
jne 0x4c401
movb $0x0, -0x1(%rbp)
jmp 0x4c65c
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x65, %eax
je 0x4c41d
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x45, %eax
jne 0x4c4cd
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
je 0x4c441
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2b, %eax
jne 0x4c44d
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x4c472
movq -0x10(%rbp), %rax
movsbl (%rax), %esi
leaq 0xc09e(%rip), %rdi      # 0x58505
callq 0x30e0
cmpq $0x0, %rax
jne 0x4c47b
movb $0x0, -0x1(%rbp)
jmp 0x4c65c
jmp 0x4c47d
movq -0x10(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x93(%rbp)
je 0x4c4b1
movq -0x10(%rbp), %rax
movsbl (%rax), %esi
leaq 0xc066(%rip), %rdi      # 0x58505
callq 0x30e0
cmpq $0x0, %rax
setne %al
movb %al, -0x93(%rbp)
movb -0x93(%rbp), %al
testb $0x1, %al
jne 0x4c4bd
jmp 0x4c4cb
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x4c47d
jmp 0x4c4cd
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x4c4ef
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movsbl (%rax), %esi
callq 0x30e0
cmpq $0x0, %rax
jne 0x4c4f8
movb $0x0, -0x1(%rbp)
jmp 0x4c65c
movq -0x10(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rcx
subq %rcx, %rax
cmpq $0x40, %rax
jl 0x4c520
movb $0x0, -0x1(%rbp)
jmp 0x4c65c
leaq -0x80(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x28(%rbp), %rax
movq (%rax), %rdx
movq -0x30(%rbp), %rax
subq %rax, %rdx
callq 0x3140
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rcx
subq %rcx, %rax
movb $0x0, -0x80(%rbp,%rax)
callq 0x3540
movq %rax, -0x90(%rbp)
leaq -0x80(%rbp), %rdi
movl $0x2e, %esi
callq 0x30e0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x4c585
movq -0x90(%rbp), %rax
movq (%rax), %rax
movb (%rax), %cl
movq -0x38(%rbp), %rax
movb %cl, (%rax)
leaq -0x80(%rbp), %rdi
callq 0x33a0
movq -0x20(%rbp), %rax
movsd %xmm0, (%rax)
movb $0x1, -0x1(%rbp)
jmp 0x4c65c
movq -0x10(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x4c5cd
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movsbl (%rax), %esi
callq 0x30e0
cmpq $0x0, %rax
jne 0x4c5d6
movb $0x0, -0x1(%rbp)
jmp 0x4c65c
movq -0x10(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
leaq -0x80(%rbp), %rdi
leaq 0xbf24(%rip), %rsi      # 0x58510
callq 0x4c100
cmpq $0x0, %rax
jne 0x4c607
movsd 0x19239(%rip), %xmm0    # 0x65838
movq -0x20(%rbp), %rax
movsd %xmm0, (%rax)
leaq -0x80(%rbp), %rdi
leaq 0xbf02(%rip), %rsi      # 0x58514
callq 0x4c100
cmpq $0x0, %rax
jne 0x4c658
cmpl $0x0, -0x84(%rbp)
jle 0x4c638
movsd 0x19212(%rip), %xmm0    # 0x65840
movsd %xmm0, -0xa0(%rbp)
jmp 0x4c648
movsd 0x19208(%rip), %xmm0    # 0x65848
movsd %xmm0, -0xa0(%rbp)
movsd -0xa0(%rbp), %xmm0
movq -0x20(%rbp), %rax
movsd %xmm0, (%rax)
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xa0, %rsp
popq %rbp
retq
nopw (%rax,%rax)