// File: sunpihai-up[P]MulThreadsWordsCounter/WordsCounter-v3.cpp
// Function: main
int main()
{
    size_t cores = std::thread::hardware_concurrency();
    cout << cores << " concurrent threads are supported.\n";

    string path;
    cout << instruct << endl;
    while (cin >> path)
    {
        if (path == "exit" || path == "quit")
        {
            return 0;
        }

        auto start = high_resolution_clock::now();

        // launch threads to process
        std::vector<pthread_t *> threadGroup;
        threadLauncher(threadGroup, cores, path);

        auto stop = high_resolution_clock::now();
        auto duration = duration_cast<milliseconds>(stop - start);
        cout << "Time taken by function: "
             << duration.count() << " milliseconds" << endl;

        cout << endl
             << instruct << endl;
        initVariable();
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movl $0x0, -0x4(%rbp)
callq 0x32e0
movl %eax, %eax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rsi
movq 0xca88(%rip), %rdi      # 0x10fc0
movq %rdi, -0x88(%rbp)
callq 0x30b0
movq %rax, %rdi
leaq 0x6b82(%rip), %rsi      # 0xb0d0
callq 0x3220
leaq -0x30(%rbp), %rdi
callq 0x32f0
movq -0x88(%rbp), %rdi
leaq 0xcde6(%rip), %rsi      # 0x11350
callq 0x31e0
movq %rax, -0x80(%rbp)
jmp 0x4575
movq -0x80(%rbp), %rdi
movq 0xca28(%rip), %rsi      # 0x10fa8
callq 0x3240
jmp 0x4587
jmp 0x4589
movq 0xca48(%rip), %rdi      # 0x10fd8
leaq -0x30(%rbp), %rsi
callq 0x32a0
movq %rax, -0x90(%rbp)
jmp 0x45a2
movq -0x90(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x3290
movb %al, -0x91(%rbp)
jmp 0x45c0
movb -0x91(%rbp), %al
testb $0x1, %al
jne 0x45cf
jmp 0x47a4
leaq 0x6b1e(%rip), %rsi      # 0xb0f4
leaq -0x30(%rbp), %rdi
callq 0x5090
movb %al, -0x92(%rbp)
jmp 0x45e7
movb -0x92(%rbp), %al
testb $0x1, %al
jne 0x4617
jmp 0x45f3
leaq 0x6a73(%rip), %rsi      # 0xb06d
leaq -0x30(%rbp), %rdi
callq 0x5090
movb %al, -0x93(%rbp)
jmp 0x460b
movb -0x93(%rbp), %al
testb $0x1, %al
jne 0x4617
jmp 0x463b
movl $0x0, -0x4(%rbp)
movl $0x1, -0x40(%rbp)
jmp 0x47ab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x47c0
callq 0x3070
movq %rax, -0x48(%rbp)
leaq -0x60(%rbp), %rdi
movq %rdi, -0xa0(%rbp)
callq 0x50c0
movq -0xa0(%rbp), %rdi
movl -0x10(%rbp), %esi
leaq -0x30(%rbp), %rdx
callq 0x4300
jmp 0x4669
callq 0x3070
movq %rax, -0x68(%rbp)
leaq -0x68(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x5110
movq %rax, -0xa8(%rbp)
jmp 0x4688
movq -0xa8(%rbp), %rax
movq %rax, -0x78(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x50e0
movq %rax, -0xb0(%rbp)
jmp 0x46a5
movq -0xb0(%rbp), %rax
movq %rax, -0x70(%rbp)
movq 0xc909(%rip), %rdi      # 0x10fc0
leaq 0x6a3b(%rip), %rsi      # 0xb0f9
callq 0x3220
movq %rax, -0xb8(%rbp)
jmp 0x46cc
leaq -0x70(%rbp), %rdi
callq 0x5160
movq %rax, -0xc0(%rbp)
jmp 0x46de
movq -0xc0(%rbp), %rsi
movq -0xb8(%rbp), %rdi
callq 0x3410
movq %rax, -0xc8(%rbp)
jmp 0x46fa
movq -0xc8(%rbp), %rdi
leaq 0x6a0a(%rip), %rsi      # 0xb112
callq 0x3220
movq %rax, -0xd0(%rbp)
jmp 0x4716
movq -0xd0(%rbp), %rdi
movq 0xc884(%rip), %rsi      # 0x10fa8
callq 0x3240
jmp 0x472b
movq 0xc88e(%rip), %rdi      # 0x10fc0
movq 0xc86f(%rip), %rsi      # 0x10fa8
callq 0x3240
movq %rax, -0xd8(%rbp)
jmp 0x4747
movq -0xd8(%rbp), %rdi
leaq 0xcbfb(%rip), %rsi      # 0x11350
callq 0x31e0
movq %rax, -0xe0(%rbp)
jmp 0x4763
movq -0xe0(%rbp), %rdi
movq 0xc837(%rip), %rsi      # 0x10fa8
callq 0x3240
jmp 0x4778
callq 0x44d0
jmp 0x477f
leaq -0x60(%rbp), %rdi
callq 0x5180
jmp 0x4589
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x5180
jmp 0x47c0
movl $0x0, -0x40(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x3458
movl -0x4(%rbp), %eax
addq $0xe0, %rsp
popq %rbp
retq
leaq -0x30(%rbp), %rdi
callq 0x3458
movq -0x38(%rbp), %rdi
callq 0x33e0
nopw %cs:(%rax,%rax)
nopl (%rax)