// File: /workspace/github_c_makefile_star2_O0/System-Glitch[P]ESGILinter-C/src/conf.c
// Function: load_configuration
char load_configuration(char *filename, arraylist_t *conf) {
    if (strlen(filename) <= 0) return 1;

    FILE *src;
    char *line;
    char *tmp;
    char *get; //fgets return

    src = fopen(filename, "rb");
    if(src == NULL) return 1;

    line = malloc(sizeof(char) * 1048);
    tmp = malloc(sizeof(char) * 1048);

    exclude_conf_file(conf, filename);

    while(fgets(line, 1048, src) != NULL){
        if(strstr(line, "=extends") ==  line){
            get = fgets(line, 1048, src);
            if(get == NULL) { //Unexpected EOF reached
                fclose(src);
                free(tmp);
                free(line);
                return 2;
            }
            if(!is_whitespace(line[0])){
                strcpy(tmp, "conf_inc_");
                strformat(line, 1048);
                strcat(tmp, line);
                while(!is_whitespace(line[0]) && line[0] != '#' && find_rule_index(conf, tmp) == -1 ){
                    load_configuration(line, conf);
                    get = fgets(line, 1048, src);
                    if(get == NULL) { //Unexpected EOF reached
                        fclose(src);
                        free(tmp);
                        free(line);
                        return 2;
                    }
                }
            }
        }else if(strstr(line, "=rules") == line){
            load_rules(src, conf);
        }else if(strstr(line, "=excludedFiles") == line){
            exclude_file(src, conf);
        }else if(strstr(line, "=recursive") == line){
            recursive_activation(src, conf);
        }
    }

    fclose(src);
    free(line);
    free(tmp);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2090
cmpq $0x0, %rax
ja 0x69b8
movb $0x1, -0x1(%rbp)
jmp 0x6bf1
movq -0x10(%rbp), %rdi
leaq 0xc641(%rip), %rsi      # 0x13004
callq 0x2130
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x69dc
movb $0x1, -0x1(%rbp)
jmp 0x6bf1
movl $0x418, %edi            # imm = 0x418
callq 0x2110
movq %rax, -0x28(%rbp)
movl $0x418, %edi            # imm = 0x418
callq 0x2110
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x6c00
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rdx
movl $0x418, %esi            # imm = 0x418
callq 0x20e0
cmpq $0x0, %rax
je 0x6bd2
movq -0x28(%rbp), %rdi
leaq 0xdd13(%rip), %rsi      # 0x1473f
callq 0x2190
cmpq -0x28(%rbp), %rax
jne 0x6b5a
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rdx
movl $0x418, %esi            # imm = 0x418
callq 0x20e0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x6a7c
movq -0x20(%rbp), %rdi
callq 0x2070
movq -0x30(%rbp), %rdi
callq 0x2030
movq -0x28(%rbp), %rdi
callq 0x2030
movb $0x2, -0x1(%rbp)
jmp 0x6bf1
movq -0x28(%rbp), %rax
movsbl (%rax), %edi
callq 0xa7d0
cmpb $0x0, %al
jne 0x6b58
movq -0x30(%rbp), %rdi
leaq 0xdcad(%rip), %rsi      # 0x14748
callq 0x2060
movq -0x28(%rbp), %rdi
movl $0x418, %esi            # imm = 0x418
callq 0xabb0
movq -0x30(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x2150
movq -0x28(%rbp), %rax
movsbl (%rax), %edi
callq 0xa7d0
movb %al, %cl
xorl %eax, %eax
cmpb $0x0, %cl
movb %al, -0x39(%rbp)
jne 0x6afa
movq -0x28(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x23, %ecx
movb %al, -0x39(%rbp)
je 0x6afa
movq -0x18(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x6c90
cmpl $-0x1, %eax
sete %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0x6b03
jmp 0x6b56
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x6990
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rdx
movl $0x418, %esi            # imm = 0x418
callq 0x20e0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x6b51
movq -0x20(%rbp), %rdi
callq 0x2070
movq -0x30(%rbp), %rdi
callq 0x2030
movq -0x28(%rbp), %rdi
callq 0x2030
movb $0x2, -0x1(%rbp)
jmp 0x6bf1
jmp 0x6abb
jmp 0x6b58
jmp 0x6bcd
movq -0x28(%rbp), %rdi
leaq 0xdbed(%rip), %rsi      # 0x14752
callq 0x2190
cmpq -0x28(%rbp), %rax
jne 0x6b7f
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x6d20
jmp 0x6bcb
movq -0x28(%rbp), %rdi
leaq 0xdbcf(%rip), %rsi      # 0x14759
callq 0x2190
cmpq -0x28(%rbp), %rax
jne 0x6ba4
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x7050
jmp 0x6bc9
movq -0x28(%rbp), %rdi
leaq 0xdbb9(%rip), %rsi      # 0x14768
callq 0x2190
cmpq -0x28(%rbp), %rax
jne 0x6bc7
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x71f0
jmp 0x6bc9
jmp 0x6bcb
jmp 0x6bcd
jmp 0x6a05
movq -0x20(%rbp), %rdi
callq 0x2070
movq -0x28(%rbp), %rdi
callq 0x2030
movq -0x30(%rbp), %rdi
callq 0x2030
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)