// File: phillip-h[P]todo/src/args.cpp
// Function: listFiles(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
vector<string> listFiles(string dir)
{
    auto list = std::vector<std::string>();

    DIR *dp;
    struct dirent *dirp;
    if ((dp = opendir(dir.c_str())) == NULL){
        cout << ANSI_RED << "Could not find directory \"";
        cout << dir << "\" !\n";
        cout << ANSI_RESET;
    }

    while ((dirp = readdir(dp)) != NULL){
        if (dirp->d_name[0] != '.'){
            string name(dirp->d_name);
            if (name.size() > extension.size()){
                name = name.substr(0, name.size() - extension.size());
            }
            if (!name.empty()){
                list.push_back(name);
            }
        }
    }
    closedir(dp);
    
    return list;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rsi, -0x90(%rbp)
movq %rdi, -0xa0(%rbp)
movq %rdi, %rax
movq %rax, -0x98(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb $0x0, -0x11(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
callq 0x86a0
movq -0x90(%rbp), %rdi
callq 0x41b0
movq %rax, %rdi
callq 0x4570
movq %rax, -0x88(%rbp)
jmp 0x836f
movq -0x88(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
jne 0x840e
movq 0xfc3d(%rip), %rdi      # 0x17fc8
leaq 0x10156(%rip), %rsi     # 0x184e8
callq 0x4300
movq %rax, -0xa8(%rbp)
jmp 0x83a0
movq -0xa8(%rbp), %rdi
leaq 0x9d1d(%rip), %rsi      # 0x120cb
callq 0x4340
jmp 0x83b5
movq -0x90(%rbp), %rsi
movq 0xfc05(%rip), %rdi      # 0x17fc8
callq 0x4300
movq %rax, -0xb0(%rbp)
jmp 0x83d1
movq -0xb0(%rbp), %rdi
leaq 0x9d07(%rip), %rsi      # 0x120e6
callq 0x4340
jmp 0x83e6
movq 0xfbdb(%rip), %rdi      # 0x17fc8
leaq 0x100d4(%rip), %rsi     # 0x184c8
callq 0x4300
jmp 0x83fb
jmp 0x840e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x85a1
jmp 0x8410
movq -0x20(%rbp), %rdi
callq 0x4590
movq %rax, -0xb8(%rbp)
jmp 0x8422
movq -0xb8(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
je 0x8570
movq -0x28(%rbp), %rax
movsbl 0x13(%rax), %eax
cmpl $0x2e, %eax
je 0x856b
movq -0x28(%rbp), %rax
addq $0x13, %rax
movq %rax, -0xc8(%rbp)
leaq -0x59(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
callq 0x4690
movq -0xc8(%rbp), %rsi
movq -0xc0(%rbp), %rdx
leaq -0x58(%rbp), %rdi
callq 0x85c0
jmp 0x8480
leaq -0x59(%rbp), %rdi
callq 0x43d0
leaq -0x58(%rbp), %rdi
callq 0x4270
movq %rax, -0xd0(%rbp)
leaq 0xffe8(%rip), %rdi      # 0x18488
callq 0x4270
movq %rax, %rcx
movq -0xd0(%rbp), %rax
cmpq %rcx, %rax
jbe 0x8541
leaq -0x58(%rbp), %rdi
movq %rdi, -0xd8(%rbp)
callq 0x4270
movq %rax, -0xe0(%rbp)
leaq 0xffb2(%rip), %rdi      # 0x18488
callq 0x4270
movq -0xe0(%rbp), %rcx
movq -0xd8(%rbp), %rsi
subq %rax, %rcx
xorl %eax, %eax
movl %eax, %edx
leaq -0x80(%rbp), %rdi
callq 0x4370
jmp 0x84fb
leaq -0x58(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x4470
leaq -0x80(%rbp), %rdi
callq 0x4738
jmp 0x8541
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x59(%rbp), %rdi
callq 0x43d0
jmp 0x85a1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x4738
jmp 0x85a1
leaq -0x58(%rbp), %rdi
callq 0x4630
testb $0x1, %al
jne 0x8562
movq -0xa0(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x86c0
jmp 0x8560
jmp 0x8562
leaq -0x58(%rbp), %rdi
callq 0x4738
jmp 0x8410
movq -0x20(%rbp), %rdi
callq 0x45f0
jmp 0x857b
movb $0x1, -0x11(%rbp)
testb $0x1, -0x11(%rbp)
jne 0x8591
movq -0xa0(%rbp), %rdi
callq 0x8730
movq -0x98(%rbp), %rax
addq $0xe0, %rsp
popq %rbp
retq
movq -0xa0(%rbp), %rdi
callq 0x8730
movq -0x30(%rbp), %rdi
callq 0x4680
nopw %cs:(%rax,%rax)