// File: /workspace/github_cpp_makefile_star2_O1/mouda[P]LTE_random_access-simulate/ap.cpp
// Function: alglib_impl::ae_str2double(char const*, alglib_impl::ae_state*, char const**)
double ae_str2double(const char *buf, ae_state *state, const char **pasttheend)
{
    const char *emsg = "ALGLIB: unable to read double value from stream";
    ae_int_t sixbits[12];
    ae_int_t sixbitsread, i;
    union _u
    {
        double dval;
        unsigned char bytes[9];
    } u;
    
    
     /* 
      * skip leading spaces
      */
    while( *buf==' ' || *buf=='\t' || *buf=='\n' || *buf=='\r' )
        buf++;
      
    /*
     * Handle special cases
     */
    if( *buf=='.' )
    {
        const char *s_nan =    ".nan_______";
        const char *s_posinf = ".posinf____";
        const char *s_neginf = ".neginf____";
        if( strncmp(buf, s_nan, strlen(s_nan))==0 )
        {
            *pasttheend = buf+strlen(s_nan);
            return state->v_nan;
        }
        if( strncmp(buf, s_posinf, strlen(s_posinf))==0 )
        {
            *pasttheend = buf+strlen(s_posinf);
            return state->v_posinf;
        }
        if( strncmp(buf, s_neginf, strlen(s_neginf))==0 )
        {
            *pasttheend = buf+strlen(s_neginf);
            return state->v_neginf;
        }
        ae_break(state, ERR_ASSERTION_FAILED, emsg);
    }
    
    /* 
     * General case:
     * 1. read and decode six-bit digits
     * 2. check that all 11 digits were read
     * 3. set last 12th digit to zero (needed for simplicity of conversion)
     * 4. convert to 8 bytes
     * 5. convert to big endian representation, if needed
     */
    sixbitsread = 0;
    while( *buf!=' ' && *buf!='\t' && *buf!='\n' && *buf!='\r' && *buf!=0 )
    {
        ae_int_t d;
        d = ae_char2sixbits(*buf);
        if( d<0 || sixbitsread>=AE_SER_ENTRY_LENGTH )
            ae_break(state, ERR_ASSERTION_FAILED, emsg);
        sixbits[sixbitsread] = d;
        sixbitsread++;
        buf++;
    }
    *pasttheend = buf;
    if( sixbitsread!=AE_SER_ENTRY_LENGTH )
        ae_break(state, ERR_ASSERTION_FAILED, emsg);
    sixbits[AE_SER_ENTRY_LENGTH] = 0;
    ae_foursixbits2threebytes(sixbits+0, u.bytes+0);
    ae_foursixbits2threebytes(sixbits+4, u.bytes+3);
    ae_foursixbits2threebytes(sixbits+8, u.bytes+6);
    if( state->endianness==AE_BIG_ENDIAN )
    {
        for(i=0; i<sizeof(double)/2; i++)
        {
            unsigned char tc;
            tc = u.bytes[i];
            u.bytes[i] = u.bytes[sizeof(double)-1-i];
            u.bytes[sizeof(double)-1-i] = tc;
        }
    }
    return u.dval;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x70, %rsp
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
movabsq $0x100002600, %rax      # imm = 0x100002600
movzbl (%r15), %ecx
cmpq $0x2e, %rcx
ja 0x27915
btq %rcx, %rax
jae 0x278b1
incq %r15
jmp 0x2789c
cmpq $0x2e, %rcx
jne 0x27915
leaq 0xfed8(%rip), %rsi      # 0x37796
movl $0xb, %edx
movq %r15, %rdi
callq 0x3120
testl %eax, %eax
je 0x27a41
leaq 0xfec8(%rip), %rsi      # 0x377a2
movl $0xb, %edx
movq %r15, %rdi
callq 0x3120
testl %eax, %eax
je 0x27a48
leaq 0xfeb8(%rip), %rsi      # 0x377ae
movl $0xb, %edx
movq %r15, %rdi
callq 0x3120
movl $0x18, %ecx
testl %eax, %eax
je 0x27a4d
jmp 0x27a68
xorl %eax, %eax
leaq 0xf802(%rip), %rcx      # 0x37120
movabsq $0x100002601, %rdx      # imm = 0x100002601
movzbl (%r15,%rax), %edi
cmpq $0x20, %rdi
ja 0x27939
btq %rdi, %rdx
jb 0x27967
movq $-0x1, %rsi
cmpb $0x7e, %dil
ja 0x2794a
movq (%rcx,%rdi,8), %rsi
testq %rsi, %rsi
js 0x27a68
cmpq $0xb, %rax
jae 0x27a68
movq %rsi, 0x10(%rsp,%rax,8)
incq %rax
jmp 0x27928
addq %rax, %r15
movq %r15, (%r14)
cmpq $0xb, %rax
jne 0x27a68
movq $0x0, 0x68(%rsp)
movl 0x18(%rsp), %ecx
movl 0x20(%rsp), %edx
movl %ecx, %esi
shll $0x6, %esi
orl 0x10(%rsp), %esi
movq %rsp, %rax
movb %sil, (%rax)
shrl $0x2, %ecx
movl %edx, %esi
shll $0x4, %esi
orl %ecx, %esi
movb %sil, 0x1(%rax)
shrl $0x4, %edx
movl 0x28(%rsp), %ecx
shll $0x2, %ecx
orl %edx, %ecx
movl 0x38(%rsp), %edx
movl %edx, %esi
shll $0x6, %esi
orl 0x30(%rsp), %esi
movb %cl, 0x2(%rax)
movb %sil, 0x3(%rax)
shrl $0x2, %edx
movl 0x40(%rsp), %ecx
movl %ecx, %esi
shll $0x4, %esi
orl %edx, %esi
movb %sil, 0x4(%rax)
shrl $0x4, %ecx
movl 0x48(%rsp), %edx
shll $0x2, %edx
orl %ecx, %edx
movb %dl, 0x5(%rax)
movl 0x58(%rsp), %ecx
movl %ecx, %edx
shll $0x6, %edx
orl 0x50(%rsp), %edx
movb %dl, 0x6(%rax)
shrl $0x2, %ecx
movl 0x60(%rsp), %edx
movl 0x68(%rsp), %esi
movl %edx, %edi
shll $0x4, %edi
orl %ecx, %edi
movb %dil, 0x7(%rax)
shrl $0x4, %edx
shll $0x2, %esi
orl %edx, %esi
movb %sil, 0x8(%rax)
cmpq $0x2, (%rbx)
jne 0x27a5a
leaq 0x7(%rsp), %rcx
xorl %edx, %edx
movb (%rsp,%rdx), %sil
movb (%rcx), %dil
movb %dil, (%rsp,%rdx)
movb %sil, (%rcx)
incq %rdx
decq %rcx
cmpq $0x4, %rdx
jne 0x27a25
jmp 0x27a5a
movl $0x8, %ecx
jmp 0x27a4d
movl $0x10, %ecx
addq $0xb, %r15
movq %r15, (%r14)
addq %rcx, %rbx
movq %rbx, %rax
movsd (%rax), %xmm0
addq $0x70, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0xfd4b(%rip), %rdx      # 0x377ba
movq %rbx, %rdi
movl $0x3, %esi
callq 0x25507