// File: quiath[P]fast-atoi/main.cpp
// Function: fastatoiaddunr(char const*)
myint fastatoiaddunr(const char *b)
{
    myint res = 0; // Initialize result

    // Skip whitespace
    for (; isspace_fast(*b); ++b);

    if (*b == '-')
    {
        ++b;
        unsigned d = static_cast<unsigned>(*b) - '0';
        if (d > 9) 
        {
            return 0;
        }
        res = -static_cast<myint>(d);
        ++b;
        
        // Iterate through all characters of input string and update result
        for (; ; ++b)
        {
            unsigned d = static_cast<unsigned>(*b) - '0';
            if (d > 9) 
            {
                return res;
            }
            res = res * 10 - d;
        }

    } 
    else if (*b == '+')
    {
        ++b;
    }
    
    unsigned d = static_cast<unsigned>(*b) - '0';
    if (d > 9) 
    {
        return 0;
    }
    res = d;
    ++b;
    
    // Iterate through all characters of input string and update result
    for (; ; ++b)
    {
        unsigned d = static_cast<unsigned>(*b) - '0';
        if (d > 9) 
        {
            return res;
        }
        res = res * 10 + d;
    }

    //  unreachable
    return res;
}

// Assembly:
movq %rdi, -0x10(%rsp)
movq $0x0, -0x18(%rsp)
movq -0x10(%rsp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0x20, %ecx
movb %al, -0x29(%rsp)
je 0x299f
movq -0x10(%rsp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0x9, %ecx
movb %al, -0x29(%rsp)
je 0x299f
movq -0x10(%rsp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0xa, %ecx
movb %al, -0x29(%rsp)
je 0x299f
movq -0x10(%rsp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0xb, %ecx
movb %al, -0x29(%rsp)
je 0x299f
movq -0x10(%rsp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0xc, %ecx
movb %al, -0x29(%rsp)
je 0x299f
movq -0x10(%rsp), %rax
movsbl (%rax), %eax
cmpl $0xd, %eax
sete %al
movb %al, -0x29(%rsp)
movb -0x29(%rsp), %al
testb $0x1, %al
jne 0x29a9
jmp 0x29be
jmp 0x29ab
movq -0x10(%rsp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rsp)
jmp 0x292e
movq -0x10(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x2a66
movq -0x10(%rsp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rsp)
movq -0x10(%rsp), %rax
movsbl (%rax), %eax
subl $0x30, %eax
movl %eax, -0x1c(%rsp)
cmpl $0x9, -0x1c(%rsp)
jbe 0x2a01
movq $0x0, -0x8(%rsp)
jmp 0x2aff
movl -0x1c(%rsp), %eax
movl %eax, %ecx
xorl %eax, %eax
subq %rcx, %rax
movq %rax, -0x18(%rsp)
movq -0x10(%rsp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rsp)
movq -0x10(%rsp), %rax
movsbl (%rax), %eax
subl $0x30, %eax
movl %eax, -0x20(%rsp)
cmpl $0x9, -0x20(%rsp)
jbe 0x2a44
movq -0x18(%rsp), %rax
movq %rax, -0x8(%rsp)
jmp 0x2aff
imulq $0xa, -0x18(%rsp), %rax
movl -0x20(%rsp), %ecx
subq %rcx, %rax
movq %rax, -0x18(%rsp)
movq -0x10(%rsp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rsp)
jmp 0x2a1f
movq -0x10(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x2b, %eax
jne 0x2a81
movq -0x10(%rsp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rsp)
jmp 0x2a83
movq -0x10(%rsp), %rax
movsbl (%rax), %eax
subl $0x30, %eax
movl %eax, -0x24(%rsp)
cmpl $0x9, -0x24(%rsp)
jbe 0x2aa4
movq $0x0, -0x8(%rsp)
jmp 0x2aff
movl -0x24(%rsp), %eax
movq %rax, -0x18(%rsp)
movq -0x10(%rsp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rsp)
movq -0x10(%rsp), %rax
movsbl (%rax), %eax
subl $0x30, %eax
movl %eax, -0x28(%rsp)
cmpl $0x9, -0x28(%rsp)
jbe 0x2add
movq -0x18(%rsp), %rax
movq %rax, -0x8(%rsp)
jmp 0x2aff
imulq $0xa, -0x18(%rsp), %rax
movl -0x28(%rsp), %ecx
addq %rcx, %rax
movq %rax, -0x18(%rsp)
movq -0x10(%rsp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rsp)
jmp 0x2abb
movq -0x8(%rsp), %rax
retq
nopw %cs:(%rax,%rax)