// File: /workspace/github_cpp_makefile_star2_O1/sunpihai-up[P]MulThreadsWordsCounter/WordsCounter-v3.cpp
// Function: getFiles(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void getFiles(string path)
{
    struct stat fSta;
    stat(path.c_str(), &fSta);
    if (S_ISDIR(fSta.st_mode))
    {
        DIR *pDir = opendir(path.c_str());
        struct dirent *ptr = NULL;
        // Access the files in this directory in turn
        while ((ptr = readdir(pDir)) != 0)
        {
            // Recursively enter subfolders
            // ! Must judge whether the file name starts with '.'
            if (ptr->d_type == DT_DIR && ptr->d_name[0] != '.')
            {
                getFiles(path + "/" + ptr->d_name);
                continue;
            }

            string fName = ptr->d_name;
            // Only fetch files of TXT type
            if (fName.find(".txt") != string::npos)
            {
                pathQueue.push(path + "/" + ptr->d_name);
            }
        }
        closedir(pDir);
    }
    else if (S_ISREG(fSta.st_mode) && path.find(".txt") != string::npos)
    {
        // The path is a TXT file
        pathQueue.push(path);
    }
    else
    {
        puts("Invalid path or no TXT file under the path!\n");
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rdi, %rbx
movq (%rdi), %rdi
leaq -0x140(%rbp), %r14
movq %r14, %rsi
callq 0x21c0
movl $0xf000, %eax           # imm = 0xF000
andl 0x18(%r14), %eax
movl %eax, %ecx
negw %cx
jo 0x2952
cmpl $0x4000, %eax           # imm = 0x4000
jne 0x298e
movq (%rbx), %rdi
callq 0x22c0
movq %rax, -0x50(%rbp)
movq %rax, %rdi
callq 0x22e0
testq %rax, %rax
je 0x29ab
movq %rax, %r13
leaq -0x48(%rbp), %r15
cmpb $0x4, 0x12(%r13)
jne 0x277a
cmpb $0x2e, 0x13(%r13)
jne 0x2823
leaq 0x13(%r13), %r12
leaq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
movq %r12, %rdi
callq 0x2100
leaq (%rax,%r13), %rdx
addq $0x13, %rdx
movq %r15, %rdi
movq %r12, %rsi
callq 0x3b7c
movl $0x4, %ecx
movq %r15, %rdi
leaq 0x28b4(%rip), %rsi      # 0x5064
xorl %edx, %edx
callq 0x2370
cmpq $-0x1, %rax
leaq -0x80(%rbp), %r13
je 0x28ea
leaq -0x60(%rbp), %rax
movq %rax, -0x70(%rbp)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0x70(%rbp), %r14
movq %r14, %rdi
callq 0x3964
movq %r14, %rdi
leaq 0x2875(%rip), %rsi      # 0x5062
callq 0x23c0
movq %r14, %rdi
movq %r12, %rsi
callq 0x23c0
movq %r13, -0x90(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x2892
movq %rdx, -0x90(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x80(%rbp)
jmp 0x289a
leaq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x3964
movq %r15, %rdi
leaq 0x281b(%rip), %rsi      # 0x5062
callq 0x23c0
addq $0x13, %r13
movq %r15, %rdi
movq %r13, %rsi
callq 0x23c0
leaq -0xa0(%rbp), %r12
movq %r12, -0xb0(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x2916
movq %rdx, -0xb0(%rbp)
movq (%rcx), %rdx
movq %rdx, -0xa0(%rbp)
jmp 0x291e
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
movq %rdx, -0x88(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x59e5(%rip), %rdi      # 0x82a0
leaq -0x90(%rbp), %rsi
callq 0x3c16
movq -0x90(%rbp), %rdi
cmpq %r13, %rdi
je 0x28d8
callq 0x21d0
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x28ea
callq 0x21d0
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x28fc
callq 0x21d0
movq -0x50(%rbp), %rdi
callq 0x22e0
movq %rax, %r13
testq %rax, %rax
jne 0x2768
jmp 0x29ab
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
movq %rdx, -0xa8(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq -0xb0(%rbp), %rdi
callq 0x26fc
movq -0xb0(%rbp), %rdi
cmpq %r12, %rdi
jne 0x28e5
jmp 0x28ea
leaq 0x270b(%rip), %rsi      # 0x5064
movl $0x4, %ecx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x2370
cmpq $-0x1, %rax
je 0x298e
leaq 0x592b(%rip), %rdi      # 0x82a0
movq %rbx, %rsi
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3eba
leaq 0x26d4(%rip), %rdi      # 0x5069
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2300
movq -0x50(%rbp), %rdi
callq 0x2310
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x29db
jmp 0x29db
movq %rax, %rbx
movq -0xb0(%rbp), %rdi
cmpq %r12, %rdi
jne 0x2a08
jmp 0x2a0d
movq %rax, %rbx
jmp 0x2a0d
jmp 0x29e2
movq %rax, %rbx
jmp 0x29fb
movq %rax, %rbx
movq -0x90(%rbp), %rdi
cmpq %r13, %rdi
je 0x29fb
callq 0x21d0
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x2a0d
callq 0x21d0
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x2a24
callq 0x21d0
jmp 0x2a24
movq %rax, %rbx
movq %rbx, %rdi
callq 0x2380