// File: /workspace/github_c_makefile_star2_O3/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:
testq %rdi, %rdi
je 0x2a5c
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r12
movq %rdx, %rdi
callq 0x20a0
movq %rax, %r14
movq %rax, %rdi
callq 0x2130
testq %rax, %rax
je 0x2a19
movq %rax, %r13
movzbl 0x12(%r13), %eax
cmpl $0x4, %eax
je 0x2988
cmpl $0x8, %eax
jne 0x29e6
addq $0x13, %r13
movq %r13, %rdi
callq 0x20b0
leal -0x2(%rax), %esi
movq %r13, %rdi
movl $0x2, %edx
callq 0x7e1a
movq %rax, %rbp
cmpb $0x2e, (%rax)
jne 0x297e
cmpb $0x63, 0x1(%rbp)
jne 0x290f
cmpb $0x0, 0x2(%rbp)
je 0x291b
cmpb $0x68, 0x1(%rbp)
jne 0x297e
cmpb $0x0, 0x2(%rbp)
jne 0x297e
movq %r12, %rdi
movq %r13, %rsi
callq 0x609f
testl %eax, %eax
jne 0x297e
movq %r15, (%rsp)
movl $0x418, %edi            # imm = 0x418
callq 0x2140
movq %rax, %r15
cmpb $0x2e, (%rbx)
jne 0x294a
cmpb $0x0, 0x1(%rbx)
je 0x2a09
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2080
movq %r15, %rdi
callq 0x20b0
movw $0x2f, (%r15,%rax)
movq %r15, %rdi
movq %r13, %rsi
callq 0x2180
movq (%rsp), %rdi
movq %r15, %rsi
movq %rdi, %r15
callq 0x6c26
movq %rbp, %rdi
callq 0x2030
jmp 0x29e6
cmpb $0x2e, 0x13(%r13)
jne 0x29a4
cmpb $0x0, 0x14(%r13)
je 0x29e6
cmpb $0x2e, 0x14(%r13)
jne 0x29a4
cmpb $0x0, 0x15(%r13)
je 0x29e6
movq %r12, %rdi
callq 0x5fde
testl %eax, %eax
je 0x29e6
addq $0x13, %r13
cmpb $0x2e, (%rbx)
jne 0x29bf
cmpb $0x0, 0x1(%rbx)
je 0x29fc
movq %rbx, %rdi
callq 0x20b0
movw $0x2f, (%rbx,%rax)
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2180
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x288c
movq %r14, %rdi
callq 0x2130
movq %rax, %r13
testq %rax, %rax
jne 0x28c8
jmp 0x2a19
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2080
jmp 0x29d8
movq %r15, %rdi
movq %r13, %rsi
callq 0x2080
jmp 0x296f
movq %rbx, %rdi
movl $0x2f, %esi
callq 0x7fba
cmpl $-0x1, %eax
je 0x2a5d
movq %rbx, %rdi
movl $0x2f, %esi
callq 0x7ff1
movq %rbx, %rdi
xorl %esi, %esi
movl %eax, %edx
callq 0x7e1a
movq %rax, %r15
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2080
movq %r15, %rdi
callq 0x2030
jmp 0x2a62
retq
movw $0x2e, (%rbx)
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2100