// File: quiath[P]fast-atoi/main.cpp
// Function: void test<int (*)(char const*)>(unsigned long, int (*)(char const*), std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned long long, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, unsigned long long>>>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void test(unsigned long rep, 
          F f, 
          const std::vector<std::string>& v, 
          Name2Time& best, 
          const std::string& name)
{
    try
    {
        const char* b = 0;

        myint r = 0;
        auto et0 = std::chrono::system_clock::now();
        std::clock_t t0 = std::clock();
        for (unsigned int i = 0; i < rep; ++i)
        {
            unsigned int ii = i % v.size();
            b = v[ii].c_str();
            r += f(b);
        }
        std::clock_t t = std::clock();
        auto et = std::chrono::system_clock::now() - et0;
        
        std::cout << name << ":" << std::setw(18) << r << "," <<
                     std::setw(10) << t - t0 << ", " << 
                     std::setw(10) << et.count() << std::endl;
        if (name.length() > 0)
        {
            std::string ename = "e." + name;
            std::string cname = "c." + name;
            auto bt = best[ename];
            if (bt == 0 || bt > et.count()) { best[ename] = et.count(); }
            bt = best[cname];
            if (bt == 0 || bt > t - t0) { best[cname] = t - t0; }
        }
    }
    catch(std::exception& exc)
    {
        std::cout << "ERROR" << std::endl;
    }
}

// Assembly:
subq $0x198, %rsp            # imm = 0x198
movq %rdi, 0x190(%rsp)
movq %rsi, 0x188(%rsp)
movq %rdx, 0x180(%rsp)
movq %rcx, 0x178(%rsp)
movq %r8, 0x170(%rsp)
movq $0x0, 0x168(%rsp)
movq $0x0, 0x160(%rsp)
callq 0x2060
movq %rax, 0x158(%rsp)
callq 0x2180
movq %rax, 0x150(%rsp)
movl $0x0, 0x14c(%rsp)
movl 0x14c(%rsp), %eax
cmpq 0x190(%rsp), %rax
jae 0x5c8f
movl 0x14c(%rsp), %eax
movq %rax, 0xb0(%rsp)
movq 0x180(%rsp), %rdi
callq 0x5ac0
movq %rax, %rcx
movq 0xb0(%rsp), %rax
xorl %edx, %edx
divq %rcx
movl %edx, %eax
movl %eax, 0x148(%rsp)
movq 0x180(%rsp), %rdi
movl 0x148(%rsp), %eax
movl %eax, %esi
callq 0x8890
movq %rax, %rdi
callq 0x20f0
movq %rax, 0x168(%rsp)
movq 0x188(%rsp), %rax
movq 0x168(%rsp), %rdi
callq *%rax
movl %eax, 0xbc(%rsp)
jmp 0x5c47
movl 0xbc(%rsp), %eax
cltq
addq 0x160(%rsp), %rax
movq %rax, 0x160(%rsp)
movl 0x14c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14c(%rsp)
jmp 0x5bbc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
jmp 0x6044
callq 0x2180
movq %rax, 0x130(%rsp)
callq 0x2060
movq %rax, 0x120(%rsp)
leaq 0x120(%rsp), %rdi
leaq 0x158(%rsp), %rsi
callq 0x88b0
movq %rax, 0xa8(%rsp)
jmp 0x5cc8
movq 0xa8(%rsp), %rax
movq %rax, 0x128(%rsp)
movq 0x170(%rsp), %rsi
movq 0x82e1(%rip), %rdi      # 0xdfc8
callq 0x21d0
movq %rax, 0xa0(%rsp)
jmp 0x5cf6
movq 0xa0(%rsp), %rdi
leaq 0x44d0(%rip), %rsi      # 0xa1d5
callq 0x2200
movq %rax, 0x98(%rsp)
jmp 0x5d14
movl $0x12, %edi
callq 0x66f0
movq 0x98(%rsp), %rdi
movl %eax, 0x11c(%rsp)
movl 0x11c(%rsp), %esi
callq 0x2270
movq %rax, 0x90(%rsp)
jmp 0x5d43
movq 0x90(%rsp), %rdi
movq 0x160(%rsp), %rsi
callq 0x2360
movq %rax, 0x88(%rsp)
jmp 0x5d62
movq 0x88(%rsp), %rdi
leaq 0x44f4(%rip), %rsi      # 0xa265
callq 0x2200
movq %rax, 0x80(%rsp)
jmp 0x5d80
movl $0xa, %edi
callq 0x66f0
movq 0x80(%rsp), %rdi
movl %eax, 0x118(%rsp)
movl 0x118(%rsp), %esi
callq 0x2270
movq %rax, 0x78(%rsp)
jmp 0x5dac
movq 0x78(%rsp), %rdi
movq 0x130(%rsp), %rsi
movq 0x150(%rsp), %rax
subq %rax, %rsi
callq 0x2360
movq %rax, 0x70(%rsp)
jmp 0x5dd0
movq 0x70(%rsp), %rdi
leaq 0x44eb(%rip), %rsi      # 0xa2c7
callq 0x2200
movq %rax, 0x68(%rsp)
jmp 0x5de8
movl $0xa, %edi
callq 0x66f0
movq 0x68(%rsp), %rdi
movl %eax, 0x114(%rsp)
movl 0x114(%rsp), %esi
callq 0x2270
movq %rax, 0x60(%rsp)
jmp 0x5e11
leaq 0x128(%rsp), %rdi
callq 0x8900
movq %rax, 0x58(%rsp)
jmp 0x5e25
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdi
callq 0x2360
movq %rax, 0x50(%rsp)
jmp 0x5e3b
movq 0x50(%rsp), %rdi
movq 0x8169(%rip), %rsi      # 0xdfb0
callq 0x2230
jmp 0x5e4e
movq 0x170(%rsp), %rdi
callq 0x22d0
cmpq $0x0, %rax
jbe 0x60a3
movq 0x170(%rsp), %rdx
leaq 0x4456(%rip), %rsi      # 0xa2ca
leaq 0xf0(%rsp), %rdi
callq 0x5900
jmp 0x5e83
movq 0x170(%rsp), %rdx
leaq 0x443b(%rip), %rsi      # 0xa2cd
leaq 0xd0(%rsp), %rdi
callq 0x5900
jmp 0x5ea1
movq 0x178(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x8910
movq %rax, 0x48(%rsp)
jmp 0x5ebd
movq 0x48(%rsp), %rax
movq (%rax), %rax
movq %rax, 0xc8(%rsp)
cmpq $0x0, 0xc8(%rsp)
je 0x5f08
movq 0xc8(%rsp), %rax
movq %rax, 0x38(%rsp)
leaq 0x128(%rsp), %rdi
callq 0x8900
movq %rax, 0x40(%rsp)
jmp 0x5ef9
movq 0x38(%rsp), %rax
movq 0x40(%rsp), %rcx
cmpq %rcx, %rax
jbe 0x5f86
leaq 0x128(%rsp), %rdi
callq 0x8900
movq %rax, 0x30(%rsp)
jmp 0x5f1c
movq 0x178(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x8910
movq %rax, 0x28(%rsp)
jmp 0x5f38
movq 0x28(%rsp), %rax
movq 0x30(%rsp), %rcx
movq %rcx, (%rax)
jmp 0x5f86
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
jmp 0x6037
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0x2150
jmp 0x6037
movq 0x178(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
callq 0x8910
movq %rax, 0x20(%rsp)
jmp 0x5fa2
movq 0x20(%rsp), %rax
movq (%rax), %rax
movq %rax, 0xc8(%rsp)
cmpq $0x0, 0xc8(%rsp)
je 0x5fda
movq 0xc8(%rsp), %rax
movq 0x130(%rsp), %rcx
subq 0x150(%rsp), %rcx
cmpq %rcx, %rax
jbe 0x601b
movq 0x130(%rsp), %rax
movq 0x150(%rsp), %rcx
subq %rcx, %rax
movq %rax, 0x10(%rsp)
movq 0x178(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
callq 0x8910
movq %rax, 0x18(%rsp)
jmp 0x600e
movq 0x18(%rsp), %rax
movq 0x10(%rsp), %rcx
movq %rcx, (%rax)
leaq 0xd0(%rsp), %rdi
callq 0x2150
leaq 0xf0(%rsp), %rdi
callq 0x2150
jmp 0x60a3
leaq 0xf0(%rsp), %rdi
callq 0x2150
movl 0x13c(%rsp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x60c2
movq 0x140(%rsp), %rdi
callq 0x20e0
movq %rax, 0xc0(%rsp)
movq 0x7f58(%rip), %rdi      # 0xdfc8
leaq 0x4259(%rip), %rsi      # 0xa2d0
callq 0x2200
movq %rax, 0x8(%rsp)
jmp 0x6083
movq 0x8(%rsp), %rdi
movq 0x7f21(%rip), %rsi      # 0xdfb0
callq 0x2230
jmp 0x6096
callq 0x2310
addq $0x198, %rsp            # imm = 0x198
retq
jmp 0x609b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
callq 0x2310
jmp 0x60c0
jmp 0x60c2
movq 0x140(%rsp), %rdi
callq 0x2340
movq %rax, %rdi
callq 0x6840
nopw (%rax,%rax)