// File: jstaursky[P]hutch/src/Sleigh/filemanage.cc
// Function: FileManage::matchListDir(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>>>>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, bool)
void FileManage::matchListDir(vector<string> &res,const string &match,bool isSuffix,const string &dirname,bool allowdot)

{				// Look through files in a directory for those matching -match-
  DIR *dir;
  struct dirent *entry;
  string dirfinal = dirname;
  if (dirfinal[dirfinal.size()-1] != separator)
    dirfinal += separator;

  dir = opendir(dirfinal.c_str());
  if (dir == (DIR *)0) return;
  entry = readdir(dir);
  while(entry != (struct dirent *)0) {
    string fullname(entry->d_name);
    if (match.size() <= fullname.size()) {
      if (allowdot||(fullname[0] != '.')) {
	if (isSuffix) {
	  if (0==fullname.compare( fullname.size()-match.size(),match.size(),match))
	    res.push_back( dirfinal + fullname );
	}
	else {
	  if (0==fullname.compare(0,match.size(),match))
	    res.push_back(dirfinal + fullname);
	}
      }
    }
    entry = readdir(dir);
  }
  closedir(dir);
}

// Assembly:
subq $0x158, %rsp            # imm = 0x158
movb %r8b, %al
movq %rdi, 0x150(%rsp)
movq %rsi, 0x148(%rsp)
andb $0x1, %dl
movb %dl, 0x147(%rsp)
movq %rcx, 0x138(%rsp)
andb $0x1, %al
movb %al, 0x137(%rsp)
movq 0x138(%rsp), %rsi
leaq 0x100(%rsp), %rdi
movq %rdi, 0x78(%rsp)
callq 0xd2230
movq 0x78(%rsp), %rdi
callq 0xd5290
movq 0x78(%rsp), %rdi
movq %rax, %rsi
decq %rsi
callq 0xe2f50
movq %rax, 0x80(%rsp)
jmp 0x10a0b3
movq 0x80(%rsp), %rax
movsbl (%rax), %eax
movq 0xbdf0b(%rip), %rcx     # 0x1c7fd0
movsbl (%rcx), %ecx
cmpl %ecx, %eax
je 0x10a100
movq 0xbdefd(%rip), %rax     # 0x1c7fd0
movsbl (%rax), %esi
leaq 0x100(%rsp), %rdi
callq 0xd46b0
jmp 0x10a0e5
jmp 0x10a100
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf8(%rsp)
movl %eax, 0xf4(%rsp)
jmp 0x10a478
leaq 0x100(%rsp), %rdi
callq 0xd1d80
movq %rax, %rdi
callq 0xdd9d0
movq %rax, 0x70(%rsp)
jmp 0x10a11c
movq 0x70(%rsp), %rax
movq %rax, 0x128(%rsp)
cmpq $0x0, 0x128(%rsp)
jne 0x10a144
movl $0x1, 0xf0(%rsp)
jmp 0x10a463
movq 0x128(%rsp), %rdi
callq 0xde0c0
movq %rax, 0x68(%rsp)
jmp 0x10a158
movq 0x68(%rsp), %rax
movq %rax, 0x120(%rsp)
cmpq $0x0, 0x120(%rsp)
je 0x10a449
movq 0x120(%rsp), %rax
addq $0x13, %rax
movq %rax, 0x58(%rsp)
leaq 0xcf(%rsp), %rdi
movq %rdi, 0x60(%rsp)
callq 0xe0c80
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
leaq 0xd0(%rsp), %rdi
callq 0xe00a0
jmp 0x10a1b0
leaq 0xcf(%rsp), %rdi
callq 0xd8ec0
movq 0x148(%rsp), %rdi
callq 0xd5290
movq %rax, 0x50(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0xd5290
movq %rax, %rcx
movq 0x50(%rsp), %rax
cmpq %rcx, %rax
ja 0x10a407
testb $0x1, 0x137(%rsp)
jne 0x10a220
xorl %eax, %eax
movl %eax, %esi
leaq 0xd0(%rsp), %rdi
callq 0xe2f50
movq %rax, 0x48(%rsp)
jmp 0x10a20f
movq 0x48(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x2e, %eax
je 0x10a405
testb $0x1, 0x147(%rsp)
je 0x10a356
leaq 0xd0(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0xd5290
movq %rax, 0x28(%rsp)
movq 0x148(%rsp), %rdi
callq 0xd5290
movq %rax, %rcx
movq 0x28(%rsp), %rax
subq %rcx, %rax
movq %rax, 0x38(%rsp)
movq 0x148(%rsp), %rdi
callq 0xd5290
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq %rax, %rdx
movq 0x148(%rsp), %rcx
callq 0xdb600
movl %eax, 0x44(%rsp)
jmp 0x10a28f
movl 0x44(%rsp), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x10a351
movq 0x150(%rsp), %rax
movq %rax, 0x20(%rsp)
leaq 0xa8(%rsp), %rdi
leaq 0x100(%rsp), %rsi
leaq 0xd0(%rsp), %rdx
callq 0xe28b0
jmp 0x10a2c9
movq 0x20(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0xd5950
jmp 0x10a2dd
leaq 0xa8(%rsp), %rdi
callq 0xd4550
jmp 0x10a351
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf8(%rsp)
movl %eax, 0xf4(%rsp)
leaq 0xcf(%rsp), %rdi
callq 0xd8ec0
jmp 0x10a478
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf8(%rsp)
movl %eax, 0xf4(%rsp)
jmp 0x10a43a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf8(%rsp)
movl %eax, 0xf4(%rsp)
leaq 0xa8(%rsp), %rdi
callq 0xd4550
jmp 0x10a43a
jmp 0x10a403
movq 0x148(%rsp), %rdi
callq 0xd5290
movq %rax, %rdx
movq 0x148(%rsp), %rcx
xorl %eax, %eax
movl %eax, %esi
leaq 0xd0(%rsp), %rdi
callq 0xdb600
movl %eax, 0x1c(%rsp)
jmp 0x10a385
movl 0x1c(%rsp), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x10a401
movq 0x150(%rsp), %rax
movq %rax, 0x10(%rsp)
leaq 0x88(%rsp), %rdi
leaq 0x100(%rsp), %rsi
leaq 0xd0(%rsp), %rdx
callq 0xe28b0
jmp 0x10a3bb
movq 0x10(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0xd5950
jmp 0x10a3cf
leaq 0x88(%rsp), %rdi
callq 0xd4550
jmp 0x10a401
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf8(%rsp)
movl %eax, 0xf4(%rsp)
leaq 0x88(%rsp), %rdi
callq 0xd4550
jmp 0x10a43a
jmp 0x10a403
jmp 0x10a405
jmp 0x10a407
movq 0x128(%rsp), %rdi
callq 0xde0c0
movq %rax, 0x8(%rsp)
jmp 0x10a41b
movq 0x8(%rsp), %rax
movq %rax, 0x120(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0xd4550
jmp 0x10a165
leaq 0xd0(%rsp), %rdi
callq 0xd4550
jmp 0x10a478
movq 0x128(%rsp), %rdi
callq 0xdee90
jmp 0x10a458
movl $0x0, 0xf0(%rsp)
leaq 0x100(%rsp), %rdi
callq 0xd4550
addq $0x158, %rsp            # imm = 0x158
retq
leaq 0x100(%rsp), %rdi
callq 0xd4550
movq 0xf8(%rsp), %rdi
callq 0xe0be0
nopw %cs:(%rax,%rax)