// File: quiath[P]fast-atoi/main.cpp
// Function: unit_test()
void unit_test()
{
    std::vector<myint (*)(const char *)> v = { atoisimple, fastatoi, fastatoiadd, fastatoiaddunr };
    std::vector<std::string> sv = { "0", " 1", " 2", "\t 3", "4x", "5%", 
                                    "  10  ", " 99.", "100", "12345", "999999",
                                    "-1", " -2x", "   +123456+", " -345", "\n\v8I",
                                    " fake", "values", " +", "    zero  "};
    for (auto pf : v)
    {
       for (const auto s: sv)
       {
           assert((*pf)(s.c_str()) == atoi(s.c_str()));
       }
    }
}

// Assembly:
subq $0x528, %rsp            # imm = 0x528
vmovdqu 0xb229(%rip), %ymm0     # 0xdd78
vmovdqu %ymm0, 0x4e0(%rsp)
leaq 0x4e0(%rsp), %rax
movq %rax, 0x500(%rsp)
movq $0x4, 0x508(%rsp)
leaq 0x4df(%rsp), %rdi
movq %rdi, 0x1a0(%rsp)
vzeroupper
callq 0x5330
movq 0x1a0(%rsp), %rcx
movq 0x500(%rsp), %rsi
movq 0x508(%rsp), %rdx
leaq 0x510(%rsp), %rdi
callq 0x5340
jmp 0x2bb3
leaq 0x4df(%rsp), %rdi
callq 0x53d0
movb $0x1, 0x203(%rsp)
leaq 0x220(%rsp), %rax
movq %rax, 0x190(%rsp)
movq %rax, 0x218(%rsp)
leaq 0x217(%rsp), %rdi
movq %rdi, 0x198(%rsp)
callq 0x2350
movq 0x190(%rsp), %rdi
movq 0x198(%rsp), %rdx
leaq 0x742b(%rip), %rsi      # 0xa037
callq 0x2290
jmp 0x2c13
leaq 0x240(%rsp), %rax
movq %rax, 0x180(%rsp)
movq %rax, 0x218(%rsp)
leaq 0x216(%rsp), %rdi
movq %rdi, 0x188(%rsp)
callq 0x2350
movq 0x180(%rsp), %rdi
movq 0x188(%rsp), %rdx
leaq 0x73c2(%rip), %rsi      # 0xa019
callq 0x2290
jmp 0x2c5e
leaq 0x260(%rsp), %rax
movq %rax, 0x170(%rsp)
movq %rax, 0x218(%rsp)
leaq 0x215(%rsp), %rdi
movq %rdi, 0x178(%rsp)
callq 0x2350
movq 0x170(%rsp), %rdi
movq 0x178(%rsp), %rdx
leaq 0x737a(%rip), %rsi      # 0xa01c
callq 0x2290
jmp 0x2ca9
leaq 0x280(%rsp), %rax
movq %rax, 0x160(%rsp)
movq %rax, 0x218(%rsp)
leaq 0x214(%rsp), %rdi
movq %rdi, 0x168(%rsp)
callq 0x2350
movq 0x160(%rsp), %rdi
movq 0x168(%rsp), %rdx
leaq 0x7332(%rip), %rsi      # 0xa01f
callq 0x2290
jmp 0x2cf4
leaq 0x2a0(%rsp), %rax
movq %rax, 0x150(%rsp)
movq %rax, 0x218(%rsp)
leaq 0x213(%rsp), %rdi
movq %rdi, 0x158(%rsp)
callq 0x2350
movq 0x150(%rsp), %rdi
movq 0x158(%rsp), %rdx
leaq 0x72eb(%rip), %rsi      # 0xa023
callq 0x2290
jmp 0x2d3f
leaq 0x2c0(%rsp), %rax
movq %rax, 0x140(%rsp)
movq %rax, 0x218(%rsp)
leaq 0x212(%rsp), %rdi
movq %rdi, 0x148(%rsp)
callq 0x2350
movq 0x140(%rsp), %rdi
movq 0x148(%rsp), %rdx
leaq 0x72a3(%rip), %rsi      # 0xa026
callq 0x2290
jmp 0x2d8a
leaq 0x2e0(%rsp), %rax
movq %rax, 0x130(%rsp)
movq %rax, 0x218(%rsp)
leaq 0x211(%rsp), %rdi
movq %rdi, 0x138(%rsp)
callq 0x2350
movq 0x130(%rsp), %rdi
movq 0x138(%rsp), %rdx
leaq 0x725b(%rip), %rsi      # 0xa029
callq 0x2290
jmp 0x2dd5
leaq 0x300(%rsp), %rax
movq %rax, 0x120(%rsp)
movq %rax, 0x218(%rsp)
leaq 0x210(%rsp), %rdi
movq %rdi, 0x128(%rsp)
callq 0x2350
movq 0x120(%rsp), %rdi
movq 0x128(%rsp), %rdx
leaq 0x7217(%rip), %rsi      # 0xa030
callq 0x2290
jmp 0x2e20
leaq 0x320(%rsp), %rax
movq %rax, 0x110(%rsp)
movq %rax, 0x218(%rsp)
leaq 0x20f(%rsp), %rdi
movq %rdi, 0x118(%rsp)
callq 0x2350
movq 0x110(%rsp), %rdi
movq 0x118(%rsp), %rdx
leaq 0x71d1(%rip), %rsi      # 0xa035
callq 0x2290
jmp 0x2e6b
leaq 0x340(%rsp), %rax
movq %rax, 0x100(%rsp)
movq %rax, 0x218(%rsp)
leaq 0x20e(%rsp), %rdi
movq %rdi, 0x108(%rsp)
callq 0x2350
movq 0x100(%rsp), %rdi
movq 0x108(%rsp), %rdx
leaq 0x718a(%rip), %rsi      # 0xa039
callq 0x2290
jmp 0x2eb6
leaq 0x360(%rsp), %rax
movq %rax, 0xf0(%rsp)
movq %rax, 0x218(%rsp)
leaq 0x20d(%rsp), %rdi
movq %rdi, 0xf8(%rsp)
callq 0x2350
movq 0xf0(%rsp), %rdi
movq 0xf8(%rsp), %rdx
leaq 0x7145(%rip), %rsi      # 0xa03f
callq 0x2290
jmp 0x2f01
leaq 0x380(%rsp), %rax
movq %rax, 0xe0(%rsp)
movq %rax, 0x218(%rsp)
leaq 0x20c(%rsp), %rdi
movq %rdi, 0xe8(%rsp)
callq 0x2350
movq 0xe0(%rsp), %rdi
movq 0xe8(%rsp), %rdx
leaq 0x7101(%rip), %rsi      # 0xa046
callq 0x2290
jmp 0x2f4c
leaq 0x3a0(%rsp), %rax
movq %rax, 0xd0(%rsp)
movq %rax, 0x218(%rsp)
leaq 0x20b(%rsp), %rdi
movq %rdi, 0xd8(%rsp)
callq 0x2350
movq 0xd0(%rsp), %rdi
movq 0xd8(%rsp), %rdx
leaq 0x70b9(%rip), %rsi      # 0xa049
callq 0x2290
jmp 0x2f97
leaq 0x3c0(%rsp), %rax
movq %rax, 0xc0(%rsp)
movq %rax, 0x218(%rsp)
leaq 0x20a(%rsp), %rdi
movq %rdi, 0xc8(%rsp)
callq 0x2350
movq 0xc0(%rsp), %rdi
movq 0xc8(%rsp), %rdx
leaq 0x7073(%rip), %rsi      # 0xa04e
callq 0x2290
jmp 0x2fe2
leaq 0x3e0(%rsp), %rax
movq %rax, 0xb0(%rsp)
movq %rax, 0x218(%rsp)
leaq 0x209(%rsp), %rdi
movq %rdi, 0xb8(%rsp)
callq 0x2350
movq 0xb0(%rsp), %rdi
movq 0xb8(%rsp), %rdx
leaq 0x7034(%rip), %rsi      # 0xa05a
callq 0x2290
jmp 0x302d
leaq 0x400(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq %rax, 0x218(%rsp)
leaq 0x208(%rsp), %rdi
movq %rdi, 0xa8(%rsp)
callq 0x2350
movq 0xa0(%rsp), %rdi
movq 0xa8(%rsp), %rdx
leaq 0x6fef(%rip), %rsi      # 0xa060
callq 0x2290
jmp 0x3078
leaq 0x420(%rsp), %rax
movq %rax, 0x90(%rsp)
movq %rax, 0x218(%rsp)
leaq 0x207(%rsp), %rdi
movq %rdi, 0x98(%rsp)
callq 0x2350
movq 0x90(%rsp), %rdi
movq 0x98(%rsp), %rdx
leaq 0x6fa9(%rip), %rsi      # 0xa065
callq 0x2290
jmp 0x30c3
leaq 0x440(%rsp), %rax
movq %rax, 0x80(%rsp)
movq %rax, 0x218(%rsp)
leaq 0x206(%rsp), %rdi
movq %rdi, 0x88(%rsp)
callq 0x2350
movq 0x80(%rsp), %rdi
movq 0x88(%rsp), %rdx
leaq 0x6f64(%rip), %rsi      # 0xa06b
callq 0x2290
jmp 0x310e
leaq 0x460(%rsp), %rax
movq %rax, 0x70(%rsp)
movq %rax, 0x218(%rsp)
leaq 0x205(%rsp), %rdi
movq %rdi, 0x78(%rsp)
callq 0x2350
movq 0x70(%rsp), %rdi
movq 0x78(%rsp), %rdx
leaq 0x6f82(%rip), %rsi      # 0xa0c8
callq 0x2290
jmp 0x314d
leaq 0x480(%rsp), %rax
movq %rax, 0x60(%rsp)
movq %rax, 0x218(%rsp)
leaq 0x204(%rsp), %rdi
movq %rdi, 0x68(%rsp)
callq 0x2350
movq 0x60(%rsp), %rdi
movq 0x68(%rsp), %rdx
leaq 0x6eed(%rip), %rsi      # 0xa072
callq 0x2290
jmp 0x318c
movb $0x0, 0x203(%rsp)
leaq 0x220(%rsp), %rax
movq %rax, 0x4a0(%rsp)
movq $0x14, 0x4a8(%rsp)
leaq 0x202(%rsp), %rdi
movq %rdi, 0x58(%rsp)
callq 0x53e0
movq 0x58(%rsp), %rcx
movq 0x4a0(%rsp), %rsi
movq 0x4a8(%rsp), %rdx
leaq 0x4b0(%rsp), %rdi
callq 0x53f0
jmp 0x31e6
leaq 0x202(%rsp), %rdi
callq 0x5480
leaq 0x220(%rsp), %rax
movq %rax, 0x48(%rsp)
addq $0x280, %rax            # imm = 0x280
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rdi
addq $-0x20, %rdi
movq %rdi, 0x40(%rsp)
callq 0x2150
movq 0x48(%rsp), %rcx
movq 0x40(%rsp), %rax
cmpq %rcx, %rax
movq %rax, 0x50(%rsp)
jne 0x320b
leaq 0x204(%rsp), %rdi
callq 0x2250
leaq 0x205(%rsp), %rdi
callq 0x2250
leaq 0x206(%rsp), %rdi
callq 0x2250
leaq 0x207(%rsp), %rdi
callq 0x2250
leaq 0x208(%rsp), %rdi
callq 0x2250
leaq 0x209(%rsp), %rdi
callq 0x2250
leaq 0x20a(%rsp), %rdi
callq 0x2250
leaq 0x20b(%rsp), %rdi
callq 0x2250
leaq 0x20c(%rsp), %rdi
callq 0x2250
leaq 0x20d(%rsp), %rdi
callq 0x2250
leaq 0x20e(%rsp), %rdi
callq 0x2250
leaq 0x20f(%rsp), %rdi
callq 0x2250
leaq 0x210(%rsp), %rdi
callq 0x2250
leaq 0x211(%rsp), %rdi
callq 0x2250
leaq 0x212(%rsp), %rdi
callq 0x2250
leaq 0x213(%rsp), %rdi
callq 0x2250
leaq 0x214(%rsp), %rdi
callq 0x2250
leaq 0x215(%rsp), %rdi
callq 0x2250
leaq 0x216(%rsp), %rdi
callq 0x2250
leaq 0x217(%rsp), %rdi
callq 0x2250
leaq 0x510(%rsp), %rax
movq %rax, 0x1f8(%rsp)
movq 0x1f8(%rsp), %rdi
callq 0x5490
movq %rax, 0x1f0(%rsp)
movq 0x1f8(%rsp), %rdi
callq 0x54c0
movq %rax, 0x1e8(%rsp)
leaq 0x1f0(%rsp), %rdi
leaq 0x1e8(%rsp), %rsi
callq 0x54f0
testb $0x1, %al
jne 0x338e
jmp 0x38d0
leaq 0x1f0(%rsp), %rdi
callq 0x5530
movq (%rax), %rax
movq %rax, 0x1e0(%rsp)
leaq 0x4b0(%rsp), %rax
movq %rax, 0x1d8(%rsp)
movq 0x1d8(%rsp), %rdi
callq 0x5540
movq %rax, 0x1d0(%rsp)
movq 0x1d8(%rsp), %rdi
callq 0x5570
movq %rax, 0x1c8(%rsp)
leaq 0x1d0(%rsp), %rdi
leaq 0x1c8(%rsp), %rsi
callq 0x55a0
testb $0x1, %al
jne 0x33fe
jmp 0x38bc
leaq 0x1d0(%rsp), %rdi
callq 0x55e0
movq %rax, %rsi
leaq 0x1a8(%rsp), %rdi
callq 0x2100
jmp 0x341d
movq 0x1e0(%rsp), %rax
movq %rax, 0x30(%rsp)
leaq 0x1a8(%rsp), %rdi
callq 0x20f0
movq %rax, %rdi
movq 0x30(%rsp), %rax
callq *%rax
movq %rax, 0x38(%rsp)
jmp 0x3448
leaq 0x1a8(%rsp), %rdi
callq 0x20f0
movq %rax, %rdi
callq 0x23a0
movl %eax, %ecx
movq 0x38(%rsp), %rax
movslq %ecx, %rcx
cmpq %rcx, %rax
jne 0x3471
jmp 0x389d
leaq 0x6c05(%rip), %rdi      # 0xa07d
leaq 0x6c22(%rip), %rsi      # 0xa0a1
movl $0xfc, %edx
leaq 0x6c1f(%rip), %rcx      # 0xa0aa
callq 0x2170
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d0(%rsp)
movl %eax, 0x4cc(%rsp)
leaq 0x4df(%rsp), %rdi
callq 0x53d0
jmp 0x390c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d0(%rsp)
movl %eax, 0x4cc(%rsp)
jmp 0x3800
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d0(%rsp)
movl %eax, 0x4cc(%rsp)
jmp 0x37f3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d0(%rsp)
movl %eax, 0x4cc(%rsp)
jmp 0x37e6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d0(%rsp)
movl %eax, 0x4cc(%rsp)
jmp 0x37d9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d0(%rsp)
movl %eax, 0x4cc(%rsp)
jmp 0x37cc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d0(%rsp)
movl %eax, 0x4cc(%rsp)
jmp 0x37bf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d0(%rsp)
movl %eax, 0x4cc(%rsp)
jmp 0x37b2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d0(%rsp)
movl %eax, 0x4cc(%rsp)
jmp 0x37a5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d0(%rsp)
movl %eax, 0x4cc(%rsp)
jmp 0x3798
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d0(%rsp)
movl %eax, 0x4cc(%rsp)
jmp 0x378b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d0(%rsp)
movl %eax, 0x4cc(%rsp)
jmp 0x377e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d0(%rsp)
movl %eax, 0x4cc(%rsp)
jmp 0x3771
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d0(%rsp)
movl %eax, 0x4cc(%rsp)
jmp 0x3764
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d0(%rsp)
movl %eax, 0x4cc(%rsp)
jmp 0x3757
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d0(%rsp)
movl %eax, 0x4cc(%rsp)
jmp 0x374a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d0(%rsp)
movl %eax, 0x4cc(%rsp)
jmp 0x373d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d0(%rsp)
movl %eax, 0x4cc(%rsp)
jmp 0x3730
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d0(%rsp)
movl %eax, 0x4cc(%rsp)
jmp 0x3723
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d0(%rsp)
movl %eax, 0x4cc(%rsp)
jmp 0x3716
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d0(%rsp)
movl %eax, 0x4cc(%rsp)
jmp 0x3709
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d0(%rsp)
movl %eax, 0x4cc(%rsp)
leaq 0x202(%rsp), %rdi
callq 0x5480
leaq 0x220(%rsp), %rax
movq %rax, 0x20(%rsp)
addq $0x280, %rax            # imm = 0x280
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rdi
addq $-0x20, %rdi
movq %rdi, 0x18(%rsp)
callq 0x2150
movq 0x20(%rsp), %rcx
movq 0x18(%rsp), %rax
cmpq %rcx, %rax
movq %rax, 0x28(%rsp)
jne 0x36e0
jmp 0x3709
leaq 0x204(%rsp), %rdi
callq 0x2250
leaq 0x205(%rsp), %rdi
callq 0x2250
leaq 0x206(%rsp), %rdi
callq 0x2250
leaq 0x207(%rsp), %rdi
callq 0x2250
leaq 0x208(%rsp), %rdi
callq 0x2250
leaq 0x209(%rsp), %rdi
callq 0x2250
leaq 0x20a(%rsp), %rdi
callq 0x2250
leaq 0x20b(%rsp), %rdi
callq 0x2250
leaq 0x20c(%rsp), %rdi
callq 0x2250
leaq 0x20d(%rsp), %rdi
callq 0x2250
leaq 0x20e(%rsp), %rdi
callq 0x2250
leaq 0x20f(%rsp), %rdi
callq 0x2250
leaq 0x210(%rsp), %rdi
callq 0x2250
leaq 0x211(%rsp), %rdi
callq 0x2250
leaq 0x212(%rsp), %rdi
callq 0x2250
leaq 0x213(%rsp), %rdi
callq 0x2250
leaq 0x214(%rsp), %rdi
callq 0x2250
leaq 0x215(%rsp), %rdi
callq 0x2250
leaq 0x216(%rsp), %rdi
callq 0x2250
leaq 0x217(%rsp), %rdi
callq 0x2250
testb $0x1, 0x203(%rsp)
jne 0x3819
jmp 0x385f
movq 0x218(%rsp), %rax
leaq 0x220(%rsp), %rcx
cmpq %rax, %rcx
movq %rax, 0x10(%rsp)
je 0x385d
movq 0x10(%rsp), %rdi
addq $-0x20, %rdi
movq %rdi, 0x8(%rsp)
callq 0x2150
movq 0x8(%rsp), %rax
leaq 0x220(%rsp), %rcx
cmpq %rcx, %rax
movq %rax, 0x10(%rsp)
jne 0x3833
jmp 0x385f
jmp 0x38ff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d0(%rsp)
movl %eax, 0x4cc(%rsp)
jmp 0x38f2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4d0(%rsp)
movl %eax, 0x4cc(%rsp)
leaq 0x1a8(%rsp), %rdi
callq 0x2150
jmp 0x38f2
leaq 0x1a8(%rsp), %rdi
callq 0x2150
leaq 0x1d0(%rsp), %rdi
callq 0x55f0
jmp 0x33e0
jmp 0x38be
leaq 0x1f0(%rsp), %rdi
callq 0x5610
jmp 0x3370
leaq 0x4b0(%rsp), %rdi
callq 0x5630
leaq 0x510(%rsp), %rdi
callq 0x5690
addq $0x528, %rsp            # imm = 0x528
retq
leaq 0x4b0(%rsp), %rdi
callq 0x5630
leaq 0x510(%rsp), %rdi
callq 0x5690
movq 0x4d0(%rsp), %rdi
callq 0x2340
nopl (%rax)