// File: /workspace/github_c_makefile_star2_O1/System-Glitch[P]ESGILinter-C/src/fileloader.c
// Function: search_files
void search_files(arraylist_t *conf, arraylist_t *files, char *path){
    if(!conf) return;

    struct dirent *read;
    DIR *rep;
    char *ext = NULL;
    char *name;

    rep = opendir(path);
    while ((read = readdir(rep))) {
        if(read->d_type == 8){
            ext = strsubstr(read->d_name, strlen(read->d_name)-2,2);
            if((strcmp(ext,".c") == 0 || strcmp(ext,".h") == 0) && is_excluded(conf, read->d_name) == 0){
                name = malloc(sizeof(char) * 1048);
                if(strcmp(path, ".") == 0){
                    strcpy(name,read->d_name);
                }else{
                    strcpy(name, path);
                    strcat(name,"/");
                    strcat(name, read->d_name);
                }
                arraylist_add(files, name);
            }
            free(ext);
            ext = NULL;
        }else if(read->d_type == 4 && strcmp(read->d_name,".") != 0 && strcmp(read->d_name,"..") != 0 && is_recursive(conf) != 0){

            if(strcmp(path, ".") == 0){
                strcpy(path, read->d_name);
            }else{
                strcat(path, "/");
                strcat(path, read->d_name);
            }
            search_files(conf, files, path);
        }
    }
    if(strindexof(path, '/') != -1){
        ext = strsubstr(path, 0, strlastindexof(path, '/'));
        strcpy(path, ext);
        free(ext);

    }else{
        strcpy(path,".");
    }
    closedir(rep);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, 0x8(%rsp)
testq %rdi, %rdi
je 0x2a4a
movq %rdx, %rbx
movq %rdi, %r12
movq %rdx, %rdi
callq 0x20a0
movq %rax, %r14
movq %rax, %rdi
callq 0x2130
testq %rax, %rax
je 0x2a07
movq %rax, %rbp
leaq 0xbbeb(%rip), %r13      # 0xe47a
movq %r12, 0x10(%rsp)
movzbl 0x12(%rbp), %eax
cmpl $0x4, %eax
je 0x2954
cmpl $0x8, %eax
jne 0x29f3
addq $0x13, %rbp
movq %rbp, %rdi
callq 0x20b0
leal -0x2(%rax), %esi
movq %rbp, %rdi
movl $0x2, %edx
callq 0x7db1
movq %rax, %r15
movq %rax, %rdi
leaq 0xb033(%rip), %rsi      # 0xd906
callq 0x2120
testl %eax, %eax
je 0x28f3
movq %r15, %rdi
leaq 0xa748(%rip), %rsi      # 0xd02e
callq 0x2120
testl %eax, %eax
jne 0x29eb
movq %r12, %rdi
movq %rbp, %rsi
callq 0x5fd3
testl %eax, %eax
jne 0x29eb
movl $0x418, %edi            # imm = 0x418
callq 0x2140
movq %r13, %rsi
movq %rax, %r13
movq %rbx, %rdi
movq %rsi, %r12
callq 0x2120
movq %r13, %rdi
testl %eax, %eax
je 0x29ce
movq %rbx, %rsi
callq 0x2080
movq %r13, %rdi
callq 0x20b0
movw $0x2f, (%r13,%rax)
movq %r13, %rdi
movq %rbp, %rsi
callq 0x2180
jmp 0x29d6
addq $0x13, %rbp
movq %rbp, %rdi
movq %r13, %rsi
callq 0x2120
testl %eax, %eax
je 0x29f3
movq %rbp, %rdi
leaq 0xbb04(%rip), %rsi      # 0xe479
callq 0x2120
testl %eax, %eax
je 0x29f3
movq %r12, %rdi
callq 0x5f12
testl %eax, %eax
je 0x29f3
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2120
movq %rbx, %rdi
testl %eax, %eax
je 0x29b4
callq 0x20b0
movw $0x2f, (%rbx,%rax)
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x2180
jmp 0x29bc
movq %rbp, %rsi
callq 0x2080
movq %r12, %rdi
movq 0x8(%rsp), %rsi
movq %rbx, %rdx
callq 0x2847
jmp 0x29f3
movq %rbp, %rsi
callq 0x2080
movq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0x6b96
movq %r12, %r13
movq 0x10(%rsp), %r12
movq %r15, %rdi
callq 0x2030
movq %r14, %rdi
callq 0x2130
movq %rax, %rbp
testq %rax, %rax
jne 0x2894
movq %rbx, %rdi
movl $0x2f, %esi
callq 0x7f51
cmpl $-0x1, %eax
je 0x2a59
movq %rbx, %rdi
movl $0x2f, %esi
callq 0x7f88
movq %rbx, %rdi
xorl %esi, %esi
movl %eax, %edx
callq 0x7db1
movq %rax, %r15
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2080
movq %r15, %rdi
callq 0x2030
jmp 0x2a5e
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movw $0x2e, (%rbx)
movq %r14, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2100