// File: /workspace/github_cpp_makefile_star2_O2/waltersharpWEI[P]CommentEliminator/main.cpp
// Function: initializeSourceFileDir(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int initializeSourceFileDir(string Dir) {
    if (DIR* Dp = opendir(Dir.c_str())) {
        //if can not open the Directory, display the error
        if (Dp == NULL) {
            cout << strerror(errno);
        }
        //read every item in the directory
        while (struct dirent * Ep = readdir(Dp)) {
            //if it's a regular file
            if (Ep->d_type == DT_REG) {
                // and it's a source file
                if (isSource(Ep->d_name)) {
                    //construct the full path of the source file
                    string FilePath = Dir + "/" + Ep->d_name;
                    cout << "Adding source file " << FilePath << endl;
                    int TempFileSize = 0;
                    struct stat StatBuffer;
                    if (stat(FilePath.c_str(),&StatBuffer) < 0) {
                        //just use 0
                    } else {
                        TempFileSize = StatBuffer.st_size;
                    }

                    FileList.push_back(FileRecord(FilePath,TempFileSize));
                    cout << "Source file added" << endl;
                }
            //if it's a directory
            } else if (Ep->d_type == DT_DIR) {
                //if it's not a (current directory or father directory)
                if (strncmp(Ep->d_name,".",100000) != 0 && strncmp(Ep->d_name,"..",100000) != 0){
                    cout << "Entering Directory " << Dir << endl;
                    //recursive call to the child directory
                    initializeSourceFileDir(Dir + "/" + Ep->d_name);
                    cout << "Leaving Directory " << endl;
                }
            }
        }
        //close the directory handle
        closedir(Dp);
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movq %rdi, -0x30(%rbp)
movq (%rdi), %rdi
callq 0x2270
testq %rax, %rax
je 0x2a6e
movq %rax, %r14
leaq -0x168(%rbp), %r12
movq %r14, %rdi
callq 0x2280
testq %rax, %rax
je 0x2a66
movq %rax, %r15
movzbl 0x12(%rax), %eax
cmpl $0x4, %eax
je 0x29b8
cmpl $0x8, %eax
jne 0x287e
addq $0x13, %r15
leaq -0xb0(%rbp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x32d0
movq %rbx, %rdi
callq 0x272d
movl %eax, %r13d
movq %rbx, %rdi
callq 0x20a0
testb %r13b, %r13b
leaq -0x90(%rbp), %rbx
je 0x287e
movq %r12, %rdi
movq -0x30(%rbp), %rsi
leaq 0x2765(%rip), %rdx      # 0x504f
callq 0x3344
leaq -0x50(%rbp), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x331b
movq %r12, %rdi
callq 0x20a0
movq 0x56bb(%rip), %rdi      # 0x7fc8
leaq 0x273d(%rip), %rsi      # 0x5051
callq 0x2190
movq %rax, %rdi
leaq -0x50(%rbp), %rsi
callq 0x2140
movq %rax, %rdi
callq 0x20b0
movq -0x50(%rbp), %rdi
movq %r12, %rsi
callq 0x2160
movl %eax, %r13d
movq -0x138(%rbp), %r15
movq %rbx, %rdi
leaq -0x50(%rbp), %rsi
callq 0x2220
testl %r13d, %r13d
movl $0x0, %eax
cmovsl %eax, %r15d
leaq -0xd8(%rbp), %r13
movq %r13, %rdi
movq %rbx, %rsi
movl %r15d, %edx
callq 0x337c
leaq 0x5859(%rip), %rdi      # 0x81d0
movq %r13, %rsi
callq 0x35f2
movq %r13, %rdi
callq 0x20a0
movq %rbx, %rdi
callq 0x20a0
movq 0x5632(%rip), %rdi      # 0x7fc8
leaq 0x26c8(%rip), %rsi      # 0x5065
callq 0x2190
movq %rax, %rdi
callq 0x20b0
leaq -0x50(%rbp), %rdi
callq 0x20a0
jmp 0x287e
cmpb $0x2e, 0x13(%r15)
jne 0x29dc
cmpb $0x0, 0x14(%r15)
je 0x287e
cmpb $0x2e, 0x14(%r15)
jne 0x29dc
cmpb $0x0, 0x15(%r15)
je 0x287e
addq $0x13, %r15
movq 0x55e1(%rip), %rdi      # 0x7fc8
leaq 0x2689(%rip), %rsi      # 0x5077
callq 0x2190
movq %rax, %rdi
movq -0x30(%rbp), %rbx
movq %rbx, %rsi
callq 0x2140
movq %rax, %rdi
callq 0x20b0
movq %r12, %rdi
movq %rbx, %rsi
leaq 0x2638(%rip), %rdx      # 0x504f
callq 0x3344
leaq -0x70(%rbp), %r13
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x331b
movq %r13, %rdi
callq 0x284b
movq %r13, %rdi
callq 0x20a0
movq %r12, %rdi
callq 0x20a0
movq 0x557b(%rip), %rdi      # 0x7fc8
leaq 0x2637(%rip), %rsi      # 0x508b
callq 0x2190
movq %rax, %rdi
callq 0x20b0
jmp 0x287e
movq %r14, %rdi
callq 0x22b0
xorl %eax, %eax
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2ab6
movq %rax, %rbx
leaq -0xd8(%rbp), %rdi
callq 0x20a0
jmp 0x2a98
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
callq 0x20a0
jmp 0x2ad8
jmp 0x2ad5
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x20a0
jmp 0x2ab9
movq %rax, %rbx
leaq -0x168(%rbp), %rdi
jmp 0x2adc
jmp 0x2ad5
movq %rax, %rbx
jmp 0x2ae1
movq %rax, %rbx
leaq -0xb0(%rbp), %rdi
jmp 0x2adc
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x20a0
movq %rbx, %rdi
callq 0x22e0