// File: /workspace/github_c_makefile_star2_O2/enzo1982[P]smooth/classes/files/directory.cpp
// Function: smooth::Directory::GetDirectoriesByPattern(smooth::String const&) const
const S::Array<S::Directory> &S::Directory::GetDirectoriesByPattern(const String &pattern) const
{
	directories.RemoveAll();

#ifdef __WIN32__
	WIN32_FIND_DATA	 findData;
	HANDLE		 handle = FindFirstFile(MakeExtendedPath(*this).Append(kBackslash).Append(pattern), &findData);

	Bool	 success = (handle != INVALID_HANDLE_VALUE);

	while (success)
	{
		if ((findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && String(findData.cFileName) != kDot && String(findData.cFileName) != kDots) directories.Add(Directory(findData.cFileName, *this));

		success = FindNextFile(handle, &findData);
	}

	FindClose(handle);
#else
	String	 path	  = String(*this).Replace("*", "\\*").Replace("?", "\\?").
					  Replace("[", "\\[").Replace("]", "\\]");
	glob_t	 fileData = { 0 };

	if (glob(path.Append(kSlash).Append(pattern).ConvertTo("UTF-8"), GLOB_MARK | GLOB_ONLYDIR, NIL, &fileData) == 0)
	{
		String::InputFormat	 inputFormat("UTF-8");

		for (size_t i = 0; i < fileData.gl_pathc; i++)
		{
			if (String(fileData.gl_pathv[i]).EndsWith(kSlash)) directories.Add(Directory(fileData.gl_pathv[i]));
		}

		globfree(&fileData);
	}
#endif

	return directories;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1f8, %rsp            # imm = 0x1F8
movq %rsi, %r14
movq %rdi, %r15
addq $0x30, %rdi
movq %rdi, 0x8(%rsp)
callq 0x5deb2
leaq 0x118(%rsp), %rdi
movq %r15, %rsi
callq 0x57f20
leaq 0xa4db2(%rip), %rsi     # 0x1023e2
leaq 0xd0(%rsp), %rdi
callq 0x58c40
leaq 0x85bf1(%rip), %rsi     # 0xe3235
leaq 0x10(%rsp), %rdi
callq 0x58c40
leaq 0x118(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0x58800
movq %rax, %r15
leaq 0x85bc7(%rip), %rsi     # 0xe3239
leaq 0x40(%rsp), %rdi
callq 0x58c40
leaq 0x85bb5(%rip), %rsi     # 0xe3238
leaq 0x28(%rsp), %rdi
callq 0x58c40
leaq 0x40(%rsp), %rsi
leaq 0x28(%rsp), %rdx
movq %r15, %rdi
callq 0x58800
movq %rax, %r15
leaq 0x85b93(%rip), %rsi     # 0xe323c
leaq 0xa0(%rsp), %rdi
callq 0x58c40
leaq 0x85b7e(%rip), %rsi     # 0xe323b
leaq 0x88(%rsp), %rdi
callq 0x58c40
leaq 0xa0(%rsp), %rsi
leaq 0x88(%rsp), %rdx
movq %r15, %rdi
callq 0x58800
movq %rax, %r15
leaq 0xaf222(%rip), %rsi     # 0x10c90e
leaq 0x70(%rsp), %rdi
callq 0x58c40
leaq 0x85b41(%rip), %rsi     # 0xe323e
leaq 0x58(%rsp), %rdi
callq 0x58c40
leaq 0x70(%rsp), %rsi
leaq 0x58(%rsp), %rdx
movq %r15, %rdi
callq 0x58800
leaq 0xb8(%rsp), %rdi
movq %rax, %rsi
callq 0x58280
leaq 0x58(%rsp), %rdi
callq 0x5a588
leaq 0x70(%rsp), %rdi
callq 0x5a588
leaq 0x88(%rsp), %rdi
callq 0x5a588
leaq 0xa0(%rsp), %rdi
callq 0x5a588
leaq 0x28(%rsp), %rdi
callq 0x5a588
leaq 0x40(%rsp), %rdi
callq 0x5a588
leaq 0x10(%rsp), %rdi
callq 0x5a588
leaq 0xd0(%rsp), %r15
movq %r15, %rdi
callq 0x5a588
leaq 0x118(%rsp), %rdi
callq 0x5a588
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%r15)
movaps %xmm0, 0x20(%r15)
movaps %xmm0, 0x10(%r15)
movaps %xmm0, (%r15)
andq $0x0, 0x40(%r15)
leaq 0x106f54(%rip), %rsi    # 0x164708
leaq 0xb8(%rsp), %rdi
callq 0x573e0
movq %rax, %rdi
movq %r14, %rsi
callq 0x573e0
leaq 0xa49f3(%rip), %rsi     # 0x1021c6
movq %rax, %rdi
callq 0x58b90
leaq 0xd0(%rsp), %rcx
movq %rax, %rdi
movl $0x2002, %esi           # imm = 0x2002
xorl %edx, %edx
callq 0x589d0
testl %eax, %eax
jne 0x5d8d2
leaq 0xa49c5(%rip), %rsi     # 0x1021c6
leaq 0x10(%rsp), %rdi
callq 0x5a450
xorl %ebx, %ebx
leaq 0x118(%rsp), %r14
leaq 0x106eec(%rip), %r15    # 0x164708
leaq 0x40(%rsp), %r12
leaq 0x28(%rsp), %r13
cmpq 0xd0(%rsp), %rbx
jae 0x5d8bb
movq 0xd8(%rsp), %rax
movq (%rax,%rbx,8), %rsi
movq %r14, %rdi
callq 0x58c40
movq %r14, %rdi
movq %r15, %rsi
callq 0x59e50
movl %eax, %ebp
movq %r14, %rdi
callq 0x5a588
testb %bpl, %bpl
je 0x5d8b3
movq 0xd8(%rsp), %rax
movq (%rax,%rbx,8), %rsi
movq %r12, %rdi
callq 0x58c40
movq %r13, %rdi
xorl %esi, %esi
callq 0x5a180
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x59fb0
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x5e5f0
movq %r14, %rdi
callq 0x5a598
movq %r13, %rdi
callq 0x5a588
movq %r12, %rdi
callq 0x5a588
incq %rbx
jmp 0x5d826
leaq 0xd0(%rsp), %rdi
callq 0x56290
leaq 0x10(%rsp), %rdi
callq 0x57b90
leaq 0xb8(%rsp), %rdi
callq 0x5a588
movq 0x8(%rsp), %rax
addq $0x1f8, %rsp            # imm = 0x1F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5d98f
movq %rax, %rbx
jmp 0x5d936
jmp 0x5d902
movq %rax, %rbx
jmp 0x5d940
movq %rax, %rbx
jmp 0x5d94d
jmp 0x5d90e
movq %rax, %rbx
jmp 0x5d95a
movq %rax, %rbx
jmp 0x5d964
jmp 0x5d91a
movq %rax, %rbx
jmp 0x5d96e
movq %rax, %rbx
jmp 0x5d978
movq %rax, %rbx
jmp 0x5d985
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x5a588
leaq 0x70(%rsp), %rdi
callq 0x5a588
leaq 0x88(%rsp), %rdi
callq 0x5a588
leaq 0xa0(%rsp), %rdi
callq 0x5a588
leaq 0x28(%rsp), %rdi
callq 0x5a588
leaq 0x40(%rsp), %rdi
callq 0x5a588
leaq 0x10(%rsp), %rdi
callq 0x5a588
leaq 0xd0(%rsp), %rdi
callq 0x5a588
leaq 0x118(%rsp), %rdi
jmp 0x5d9e8
movq %rax, %rbx
jmp 0x5d9e0
movq %rax, %rbx
leaq 0x118(%rsp), %rdi
callq 0x5a598
jmp 0x5d9a9
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x5a588
jmp 0x5d9ba
jmp 0x5d9c1
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
jmp 0x5d9d1
movq %rax, %rbx
jmp 0x5d9d6
movq %rax, %rbx
leaq 0x118(%rsp), %rdi
callq 0x5a588
leaq 0x10(%rsp), %rdi
callq 0x57b90
leaq 0xb8(%rsp), %rdi
callq 0x5a588
movq %rbx, %rdi
callq 0x58260
nop