// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movl %r8d, 0xc(%rsp)
movl %edx, 0x8(%rsp)
movq %rsi, %r14
movq %rdi, 0x30(%rsp)
leaq 0x48(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq (%rcx), %rsi
movq 0x8(%rcx), %rdx
addq %rsi, %rdx
leaq 0x38(%rsp), %r15
movq %r15, %rdi
callq 0x3f8e0
movq (%r15), %rdi
movq 0x8(%r15), %rcx
movq 0x5278b(%rip), %rax     # 0xa2fd0
movb (%rax), %al
cmpb %al, -0x1(%rdi,%rcx)
je 0x5085f
movsbl %al, %esi
leaq 0x38(%rsp), %rdi
callq 0x40490
movq 0x38(%rsp), %rdi
callq 0x41620
testq %rax, %rax
je 0x509a0
movq %rax, %r12
movq %rax, %rdi
callq 0x41760
movq %rax, %r15
testq %rax, %rax
je 0x50993
leaq 0x58(%rsp), %r13
leaq 0x10(%rsp), %rbx
leaq 0x13(%r15), %rbp
leaq 0x68(%rsp), %rax
movq %rax, 0x58(%rsp)
movq %rbp, %rdi
callq 0x3f9e0
leaq (%r15,%rax), %rdx
addq $0x13, %rdx
movq %r13, %rdi
movq %rbp, %rsi
callq 0x3f8a0
movq 0x8(%r14), %rdx
movq 0x60(%rsp), %rsi
subq %rdx, %rsi
jae 0x508f6
movq %r12, %rdi
callq 0x41760
movq %rax, %r15
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x508ec
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x40880
testq %r15, %r15
jne 0x5088e
jmp 0x50993
cmpb $0x0, 0xc(%rsp)
jne 0x50907
movq 0x58(%rsp), %rax
cmpb $0x2e, (%rax)
je 0x508c5
cmpb $0x0, 0x8(%rsp)
je 0x5093c
movq %r13, %rdi
movq %r14, %rcx
callq 0x40f50
testl %eax, %eax
jne 0x508c5
movq %rbx, %rdi
leaq 0x38(%rsp), %rsi
movq %r13, %rdx
callq 0x42390
movq 0x30(%rsp), %rdi
movq %rbx, %rsi
callq 0x3f7b0
jmp 0x5096e
movq %r13, %rdi
xorl %esi, %esi
movq %r14, %rcx
callq 0x40f50
testl %eax, %eax
jne 0x508c5
movq %rbx, %rdi
leaq 0x38(%rsp), %rsi
movq %r13, %rdx
callq 0x42390
movq 0x30(%rsp), %rdi
movq %rbx, %rsi
callq 0x3f7b0
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x508c5
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x40880
jmp 0x508c5
movq %r12, %rdi
callq 0x41960
leaq 0x48(%rsp), %rbx
movq 0x38(%rsp), %rdi
cmpq %rbx, %rdi
je 0x509b7
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x40880
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x509ca
jmp 0x509f4
movq %rax, %r14
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x509f7
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x40880
jmp 0x509f7
jmp 0x509f4
jmp 0x509ef
movq %rax, %r14
jmp 0x50a13
movq %rax, %r14
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x50a13
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x40880
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x50a2f
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x40880
movq %r14, %rdi
callq 0x41f10
nop