// File: /workspace/github_c_makefile_star2_O0/justy989[P]ce/ce_commands.c
// Function: find_files_in_directory_recursively
CeStrNode_t* find_files_in_directory_recursively(const char* directory, CeStrNode_t* node, char** ignore_dirs,
                                                 int* ignore_dir_lens, uint64_t ignore_dir_count){
     char* path = ce_strndup((char*)directory, MAX_PATH_LEN);
     CeListDirResult_t list_dir_result = ce_list_dir(path);

     int64_t path_len = strnlen(path, MAX_PATH_LEN);

    // Strip the search characters at the end of the path if they exist.
#if defined(PLATFORM_WINDOWS)
     if(path_len > 0 && path_len < MAX_PATH_LEN){
         if(path[path_len - 1] == CE_CURRENT_DIR_SEARCH){
             path[path_len - 1] = 0;
             path_len--;
         }
         if(path_len > 0 && path[path_len - 1] == CE_PATH_SEPARATOR){
             path[path_len - 1] = 0;
             path_len--;
         }
     }
#else
     if(path_len > 2){
         if(path[path_len - 1] == CE_CURRENT_DIR_SEARCH){
             path[path_len - 1] = 0;
             path_len--;
         }
         if(path_len > 0 && path[path_len - 1] == CE_PATH_SEPARATOR){
             path[path_len - 1] = 0;
             path_len--;
         }
     }

#endif

     bool path_is_current_dir = false;
#if defined(PLATFORM_WINDOWS)
     path_is_current_dir = path_len == 2 &&
                           path[0] == '.' &&
                           path[1] == '\\';
#else
     path_is_current_dir = path_len == 1 &&
                           path[0] == '.';
#endif


     char full_path[MAX_PATH_LEN];
     for(int64_t i = 0; i < list_dir_result.count; i++){
          if(strcmp(list_dir_result.filenames[i], ".") == 0 ||
             strcmp(list_dir_result.filenames[i], "..") == 0){
              continue;
          }
          int full_path_len = 0;
          if (path_is_current_dir){
              full_path_len = snprintf(full_path, MAX_PATH_LEN, "%s", list_dir_result.filenames[i]);
          }else{
              full_path_len = snprintf(full_path, MAX_PATH_LEN, "%s%c%s", path,
                                       CE_PATH_SEPARATOR, list_dir_result.filenames[i]);
          }
          if(list_dir_result.is_directories[i] && full_path_len < (MAX_PATH_LEN - 3)){
               bool ignore_dir = false;
               for(uint64_t j = 0; j < ignore_dir_count; j++){
                    if(full_path_len >= ignore_dir_lens[j] &&
                       strcmp(full_path + full_path_len - ignore_dir_lens[j], ignore_dirs[j]) == 0){
                        ignore_dir = true;
                        break;
                    }
               }
               if(ignore_dir) continue;
               full_path[full_path_len] = CE_PATH_SEPARATOR;
               full_path[full_path_len + 1] = CE_CURRENT_DIR_SEARCH;
               full_path[full_path_len + 2] = 0;
               node = find_files_in_directory_recursively(full_path, node, ignore_dirs,
                                                          ignore_dir_lens, ignore_dir_count);
          }else{
               CeStrNode_t* new_node = malloc(sizeof(*new_node));
               new_node->string = strdup(full_path);
               new_node->next = NULL;
               node->next = new_node;
               node = new_node;
          }
     }
     ce_free_list_dir_result(&list_dir_result);
     free(path);

     return node;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x490, %rsp            # imm = 0x490
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movl $0x400, %esi            # imm = 0x400
callq 0x10cc0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x12a50
movq -0x30(%rbp), %rdi
movl $0x400, %esi            # imm = 0x400
callq 0xd2b0
movq %rax, -0x50(%rbp)
cmpq $0x2, -0x50(%rbp)
jle 0x1ddb2
movq -0x30(%rbp), %rax
movq -0x50(%rbp), %rcx
subq $0x1, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x2e, %eax
jne 0x1dd78
movq -0x30(%rbp), %rax
movq -0x50(%rbp), %rcx
subq $0x1, %rcx
movb $0x0, (%rax,%rcx)
movq -0x50(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jle 0x1ddb0
movq -0x30(%rbp), %rax
movq -0x50(%rbp), %rcx
subq $0x1, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x2f, %eax
jne 0x1ddb0
movq -0x30(%rbp), %rax
movq -0x50(%rbp), %rcx
subq $0x1, %rcx
movb $0x0, (%rax,%rcx)
movq -0x50(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x1ddb2
movb $0x0, -0x51(%rbp)
xorl %eax, %eax
cmpq $0x1, -0x50(%rbp)
movb %al, -0x481(%rbp)
jne 0x1ddd8
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2e, %eax
sete %al
movb %al, -0x481(%rbp)
movb -0x481(%rbp), %al
andb $0x1, %al
movb %al, -0x51(%rbp)
movq $0x0, -0x468(%rbp)
movq -0x468(%rbp), %rax
cmpq -0x48(%rbp), %rax
jge 0x1e04c
movq -0x40(%rbp), %rax
movq -0x468(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x264f2(%rip), %rsi     # 0x44307
callq 0xd370
cmpl $0x0, %eax
je 0x1de3f
movq -0x40(%rbp), %rax
movq -0x468(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x264d1(%rip), %rsi     # 0x44306
callq 0xd370
cmpl $0x0, %eax
jne 0x1de44
jmp 0x1e035
movl $0x0, -0x46c(%rbp)
testb $0x1, -0x51(%rbp)
je 0x1de85
leaq -0x460(%rbp), %rdi
movq -0x40(%rbp), %rax
movq -0x468(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movl $0x400, %esi            # imm = 0x400
leaq 0x27d64(%rip), %rdx     # 0x45bda
movb $0x0, %al
callq 0xd250
movl %eax, -0x46c(%rbp)
jmp 0x1debe
leaq -0x460(%rbp), %rdi
movq -0x30(%rbp), %rcx
movq -0x40(%rbp), %rax
movq -0x468(%rbp), %rdx
movq (%rax,%rdx,8), %r9
movl $0x400, %esi            # imm = 0x400
leaq 0x249b5(%rip), %rdx     # 0x42860
movl $0x2f, %r8d
movb $0x0, %al
callq 0xd250
movl %eax, -0x46c(%rbp)
movq -0x38(%rbp), %rax
movq -0x468(%rbp), %rcx
testb $0x1, (%rax,%rcx)
je 0x1dfe0
cmpl $0x3fd, -0x46c(%rbp)    # imm = 0x3FD
jge 0x1dfe0
movb $0x0, -0x46d(%rbp)
movq $0x0, -0x478(%rbp)
movq -0x478(%rbp), %rax
cmpq -0x28(%rbp), %rax
jae 0x1df7b
movl -0x46c(%rbp), %eax
movq -0x20(%rbp), %rcx
movq -0x478(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jl 0x1df62
leaq -0x460(%rbp), %rdi
movslq -0x46c(%rbp), %rax
addq %rax, %rdi
movq -0x20(%rbp), %rax
movq -0x478(%rbp), %rcx
movslq (%rax,%rcx,4), %rcx
xorl %eax, %eax
subq %rcx, %rax
addq %rax, %rdi
movq -0x18(%rbp), %rax
movq -0x478(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0xd370
cmpl $0x0, %eax
jne 0x1df62
movb $0x1, -0x46d(%rbp)
jmp 0x1df7b
jmp 0x1df64
movq -0x478(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x478(%rbp)
jmp 0x1def5
testb $0x1, -0x46d(%rbp)
je 0x1df89
jmp 0x1e035
movslq -0x46c(%rbp), %rax
movb $0x2f, -0x460(%rbp,%rax)
movl -0x46c(%rbp), %eax
addl $0x1, %eax
cltq
movb $0x2e, -0x460(%rbp,%rax)
movl -0x46c(%rbp), %eax
addl $0x2, %eax
cltq
movb $0x0, -0x460(%rbp,%rax)
leaq -0x460(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %r8
callq 0x1dcf0
movq %rax, -0x10(%rbp)
jmp 0x1e033
movl $0x10, %edi
callq 0xd4a0
movq %rax, -0x480(%rbp)
leaq -0x460(%rbp), %rdi
callq 0xd620
movq %rax, %rcx
movq -0x480(%rbp), %rax
movq %rcx, (%rax)
movq -0x480(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x480(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x480(%rbp), %rax
movq %rax, -0x10(%rbp)
jmp 0x1e035
movq -0x468(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x468(%rbp)
jmp 0x1ddee
leaq -0x48(%rbp), %rdi
callq 0x12b90
movq -0x30(%rbp), %rdi
callq 0xd090
movq -0x10(%rbp), %rax
addq $0x490, %rsp            # imm = 0x490
popq %rbp
retq
nopl (%rax,%rax)