// File: mouda[P]LTE_random_access-simulate/ap.cpp
// Function: alglib_impl::ae_str2int(char const*, alglib_impl::ae_state*, char const**)
ae_int_t ae_str2int(const char *buf, ae_state *state, const char **pasttheend)
{
    const char *emsg = "ALGLIB: unable to read integer value from stream";
    ae_int_t sixbits[12];
    ae_int_t sixbitsread, i;
    union _u
    {
        ae_int_t ival;
        unsigned char bytes[9];
    } u;
    /* 
     * 1. skip leading spaces
     * 2. read and decode six-bit digits
     * 3. set trailing digits to zeros
     * 4. convert to little endian 64-bit integer representation
     * 5. convert to big endian representation, if needed
     */
    while( *buf==' ' || *buf=='\t' || *buf=='\n' || *buf=='\r' )
        buf++;
    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==0 )
        ae_break(state, ERR_ASSERTION_FAILED, emsg);
    for(i=sixbitsread; i<12; i++)
        sixbits[i] = 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(ae_int_t)/2; i++)
        {
            unsigned char tc;
            tc = u.bytes[i];
            u.bytes[i] = u.bytes[sizeof(ae_int_t)-1-i];
            u.bytes[sizeof(ae_int_t)-1-i] = tc;
        }
    }
    return u.ival;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
leaq 0x1a05b(%rip), %rax     # 0x581e9
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0x20, %ecx
movb %al, -0xaa(%rbp)
je 0x3e1e1
movq -0x8(%rbp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0x9, %ecx
movb %al, -0xaa(%rbp)
je 0x3e1e1
movq -0x8(%rbp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0xa, %ecx
movb %al, -0xaa(%rbp)
je 0x3e1e1
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xd, %eax
sete %al
movb %al, -0xaa(%rbp)
movb -0xaa(%rbp), %al
testb $0x1, %al
jne 0x3e1ed
jmp 0x3e1fb
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x3e192
movq $0x0, -0x88(%rbp)
movq -0x8(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x20, %ecx
movb %al, -0xab(%rbp)
je 0x3e269
movq -0x8(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x9, %ecx
movb %al, -0xab(%rbp)
je 0x3e269
movq -0x8(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0xa, %ecx
movb %al, -0xab(%rbp)
je 0x3e269
movq -0x8(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0xd, %ecx
movb %al, -0xab(%rbp)
je 0x3e269
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0xab(%rbp)
movb -0xab(%rbp), %al
testb $0x1, %al
jne 0x3e275
jmp 0x3e2e4
movq -0x8(%rbp), %rax
movsbl (%rax), %edi
callq 0x3dca0
movq %rax, -0xa8(%rbp)
cmpq $0x0, -0xa8(%rbp)
jl 0x3e29c
cmpq $0xb, -0x88(%rbp)
jl 0x3e2ae
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rdx
movl $0x3, %esi
callq 0x3ab10
movq -0xa8(%rbp), %rcx
movq -0x88(%rbp), %rax
movq %rcx, -0x80(%rbp,%rax,8)
movq -0x88(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x88(%rbp)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x3e206
movq -0x8(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
cmpq $0x0, -0x88(%rbp)
jne 0x3e30b
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rdx
movl $0x3, %esi
callq 0x3ab10
movq -0x88(%rbp), %rax
movq %rax, -0x90(%rbp)
cmpq $0xc, -0x90(%rbp)
jge 0x3e347
movq -0x90(%rbp), %rax
movq $0x0, -0x80(%rbp,%rax,8)
movq -0x90(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x90(%rbp)
jmp 0x3e319
leaq -0x80(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x3dd80
leaq -0x80(%rbp), %rdi
addq $0x20, %rdi
leaq -0xa0(%rbp), %rsi
addq $0x3, %rsi
callq 0x3dd80
leaq -0x80(%rbp), %rdi
addq $0x40, %rdi
leaq -0xa0(%rbp), %rsi
addq $0x6, %rsi
callq 0x3dd80
movq -0x10(%rbp), %rax
cmpq $0x2, (%rax)
jne 0x3e40a
movq $0x0, -0x90(%rbp)
cmpq $0x4, -0x90(%rbp)
jae 0x3e408
movq -0x90(%rbp), %rax
movb -0xa0(%rbp,%rax), %al
movb %al, -0xa9(%rbp)
movl $0x7, %eax
subq -0x90(%rbp), %rax
movb -0xa0(%rbp,%rax), %cl
movq -0x90(%rbp), %rax
movb %cl, -0xa0(%rbp,%rax)
movb -0xa9(%rbp), %cl
movl $0x7, %eax
subq -0x90(%rbp), %rax
movb %cl, -0xa0(%rbp,%rax)
movq -0x90(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x90(%rbp)
jmp 0x3e39c
jmp 0x3e40a
movq -0xa0(%rbp), %rax
addq $0xb0, %rsp
popq %rbp
retq
nopw (%rax,%rax)