// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: readdir_raw
static char **readdir_raw(char *dir, int return_subdirs, char *mask)
{
   char **results = NULL;
   char buffer[4096], with_slash[4096];
   size_t n;

   #ifdef _MSC_VER
      stb__wchar *ws;
      struct _wfinddata_t data;
   #ifdef _WIN64
      const intptr_t none = -1;
      intptr_t z;
   #else
      const long none = -1;
      long z;
   #endif
   #else // !_MSC_VER
      const DIR *none = NULL;
      DIR *z;
   #endif

   n = stb_strscpy(buffer,dir,sizeof(buffer));
   if (!n || n >= sizeof(buffer))
      return NULL;
   stb_fixpath(buffer);
   n--;

   if (n > 0 && (buffer[n-1] != '/')) {
      buffer[n++] = '/';
   }
   buffer[n] = 0;
   if (!stb_strscpy(with_slash,buffer,sizeof(with_slash)))
      return NULL;

   #ifdef _MSC_VER
      if (!stb_strscpy(buffer+n,"*.*",sizeof(buffer)-n))
         return NULL;
      ws = stb__from_utf8(buffer);
      z = _wfindfirst((const wchar_t *)ws, &data);
   #else
      z = opendir(dir);
   #endif

   if (z != none) {
      int nonempty = STB_TRUE;
      #ifndef _MSC_VER
      struct dirent *data = readdir(z);
      nonempty = (data != NULL);
      #endif

      if (nonempty) {

         do {
            int is_subdir;
            #ifdef _MSC_VER
            char *name = stb__to_utf8((stb__wchar *)data.name);
            if (name == NULL) {
               fprintf(stderr, "%s to convert '%S' to %s!\n", "Unable", data.name, "utf8");
               continue;
            }
            is_subdir = !!(data.attrib & _A_SUBDIR);
            #else
            char *name = data->d_name;
            if (!stb_strscpy(buffer+n,name,sizeof(buffer)-n))
               break;
            // Could follow DT_LNK, but would need to check for recursive links.
            is_subdir = !!(data->d_type & DT_DIR);
            #endif

            if (is_subdir == return_subdirs) {
               if (!is_subdir || !isdotdirname(name)) {
                  if (!mask || stb_wildmatchi(mask, name)) {
                     char buffer[4096],*p=buffer;
                     if ( stb_snprintf(buffer, sizeof(buffer), "%s%s", with_slash, name) < 0 )
                        break;
                     if (buffer[0] == '.' && buffer[1] == '/')
                        p = buffer+2;
                     stb_arr_push(results, strdup(p));
                  }
               }
            }
         }
         #ifdef _MSC_VER
         while (0 == _wfindnext(z, &data));
         #else
         while ((data = readdir(z)) != NULL);
         #endif
      }
      #ifdef _MSC_VER
         _findclose(z);
      #else
         closedir(z);
      #endif
   }
   return results;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3028, %rsp           # imm = 0x3028
movq %rdx, 0x18(%rsp)
movl %esi, 0x14(%rsp)
movq %rdi, %r14
movq $0x0, 0x8(%rsp)
leaq 0x20(%rsp), %rbx
movl $0x1000, %edx           # imm = 0x1000
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3c39
leaq -0x1000(%rax), %rcx
cmpq $-0xfff, %rcx           # imm = 0xF001
jb 0x9aea
movq %rax, %r13
movzbl (%rbx), %ecx
cmpl $0x5c, %ecx
je 0x9940
testl %ecx, %ecx
jne 0x9943
jmp 0x9948
movb $0x2f, (%rbx)
incq %rbx
jmp 0x9932
decq %rax
je 0x995f
leaq 0x20(%rsp), %rcx
cmpb $0x2f, -0x2(%r13,%rcx)
jne 0x9964
movq %rax, %r13
jmp 0x9969
xorl %r13d, %r13d
jmp 0x9969
movb $0x2f, 0x20(%rsp,%rax)
movb $0x0, 0x20(%rsp,%r13)
leaq 0x2020(%rsp), %rdi
leaq 0x20(%rsp), %rsi
movl $0x1000, %edx           # imm = 0x1000
callq 0x3c39
testq %rax, %rax
je 0x9aea
movq %r14, %rdi
callq 0x20e0
testq %rax, %rax
je 0x9aea
movq %rax, %r14
movq %rax, %rdi
callq 0x2240
testq %rax, %rax
je 0x9b02
movq %rax, %rbp
leaq (%rsp,%r13), %r15
addq $0x20, %r15
movl $0x1000, %r12d          # imm = 0x1000
subq %r13, %r12
xorl %r13d, %r13d
leaq 0x13(%rbp), %rbx
movq %r15, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x3c39
testq %rax, %rax
je 0x9b05
movzbl 0x12(%rbp), %eax
andl $0x4, %eax
movl %eax, %ecx
shrl $0x2, %ecx
cmpl 0x14(%rsp), %ecx
jne 0x9ad4
testb %al, %al
je 0x9a17
cmpb $0x2e, (%rbx)
jne 0x9a17
movb 0x14(%rbp), %al
cmpb $0x2e, %al
jne 0x9a0f
movb 0x15(%rbp), %al
testb %al, %al
je 0x9ad4
cmpq $0x0, 0x18(%rsp)
je 0x9a3b
movq 0x18(%rsp), %rdi
movq %rbx, %rsi
xorl %edx, %edx
movl $0x1, %ecx
callq 0xd504
testl %eax, %eax
js 0x9ad4
movl $0x1000, %esi           # imm = 0x1000
leaq 0x1020(%rsp), %rdi
leaq 0x963a(%rip), %rdx      # 0x13089
leaq 0x2020(%rsp), %rcx
movq %rbx, %r8
xorl %eax, %eax
callq 0x2998
testl %eax, %eax
js 0x9b0f
movb 0x1020(%rsp), %al
movb 0x1021(%rsp), %cl
xorb $0x2e, %al
xorb $0x2f, %cl
xorl %edx, %edx
orb %al, %cl
sete %dl
leaq (%rsp,%rdx,2), %rdi
addq $0x1020, %rdi           # imm = 0x1020
callq 0x2380
movq %rax, %rbx
movq 0x8(%rsp), %r13
testq %r13, %r13
je 0x9ab2
movl -0x10(%r13), %eax
cmpl -0xc(%r13), %eax
jge 0x9ab2
incl %eax
movl %eax, -0x10(%r13)
jmp 0x9acb
leaq 0x8(%rsp), %rdi
movl $0x8, %esi
movl $0x1, %edx
callq 0x56ce
movq 0x8(%rsp), %r13
movslq -0x10(%r13), %rax
movq %rbx, -0x8(%r13,%rax,8)
movq %r14, %rdi
callq 0x2240
movq %rax, %rbp
testq %rax, %rax
jne 0x99cb
jmp 0x9b05
xorl %r13d, %r13d
movq %r13, %rax
addq $0x3028, %rsp           # imm = 0x3028
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r13d, %r13d
movq %r14, %rdi
callq 0x21a0
jmp 0x9aed
movq 0x8(%rsp), %r13
jmp 0x9b05