// File: /workspace/github_c_makefile_star2_O0/System-Glitch[P]ESGILinter-C/src/conf.c
// Function: load_rules
void load_rules(FILE *src, arraylist_t *conf){
    if(src == NULL) return;
    char *line;
    char *name;
    char *tmp;
    char *get; //fgets return
    int sum;
    int enable;
    int found;
    size_t length;
    rule_t *e;
    const char equal[2] = "=";

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

    get = fgets(line, 1048, src);
    if(get == NULL) { //Unexpected EOF reached
        free(line);
        free(name);
        return;
    }
    while(!is_whitespace(line[0])){
        if(line[0] != '#'){
            tmp = strtok(line, equal);
            if(tmp == NULL) return;

            if(line[1] == ' '){
                strcpy(name, tmp+2);
            }else{
                strcpy(name, tmp+1);
            }

            if(name[strlen(name) -1 ] == ' '){
                name[strlen(name) -1 ] = '\0';
            }

            tmp = strtok(NULL, equal);
            if(tmp == NULL) return;

            if(tmp[0] == ' ') tmp = tmp+1;
            sum = 0;
            enable = 0;
            length = strlen(tmp);
            for(size_t i = 0; i  < length ; i++){
                if(tmp[i] >= 48 && tmp[i] <= 57){
                    sum += (tmp[i]-48);
                    if(i != strlen(tmp) -2){
                        sum *= 10;
                    }
                    enable = 1;
                }
                if(sum == 0 && tmp[i] == 'o'){
                    if(strstr(tmp, "on")) {
                        enable = 1;
                        break;
                    }else{
                        break;
                    }
                }
            }
            found = find_rule_index(conf, name);
            if(found >= 0){
                ((rule_t*)(conf->array[found]))->value = sum;
                ((rule_t*)(conf->array[found]))->enable= enable;
            }else if(found == -1){
                e = malloc(sizeof(rule_t));
                e->name = malloc(sizeof(char) * 255);
                strcpy(e->name, name);
                e->value = sum;
                e->enable = enable;
                arraylist_add(conf, e);
            }
        }
        get = fgets(line, 1048, src);
        if(get == NULL) break;
    }
    free(line);
    free(name);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x6d3f
jmp 0x7047
movw 0xdb6a(%rip), %ax       # 0x148b0
movw %ax, -0x52(%rbp)
movl $0x418, %edi            # imm = 0x418
callq 0x2110
movq %rax, -0x18(%rbp)
movl $0x418, %edi            # imm = 0x418
callq 0x2110
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rdx
movl $0x418, %esi            # imm = 0x418
callq 0x20e0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x6d9a
movq -0x18(%rbp), %rdi
callq 0x2030
movq -0x20(%rbp), %rdi
callq 0x2030
jmp 0x7047
jmp 0x6d9c
movq -0x18(%rbp), %rax
movsbl (%rax), %edi
callq 0xa7d0
cmpb $0x0, %al
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x6db8
jmp 0x7035
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x23, %eax
je 0x7011
movq -0x18(%rbp), %rdi
leaq -0x52(%rbp), %rsi
callq 0x2140
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x6de5
jmp 0x7047
movq -0x18(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x20, %eax
jne 0x6e05
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq $0x2, %rsi
callq 0x2060
jmp 0x6e16
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq $0x1, %rsi
callq 0x2060
movq -0x20(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x20(%rbp), %rdi
callq 0x2090
movq %rax, %rcx
movq -0x68(%rbp), %rax
subq $0x1, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x20, %eax
jne 0x6e5b
movq -0x20(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x20(%rbp), %rdi
callq 0x2090
movq %rax, %rcx
movq -0x70(%rbp), %rax
subq $0x1, %rcx
movb $0x0, (%rax,%rcx)
leaq -0x52(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edi
callq 0x2140
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x6e78
jmp 0x7047
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x20, %eax
jne 0x6e90
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movl $0x0, -0x34(%rbp)
movl $0x0, -0x38(%rbp)
movq -0x28(%rbp), %rdi
callq 0x2090
movq %rax, -0x48(%rbp)
movq $0x0, -0x60(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x48(%rbp), %rax
jae 0x6f72
movq -0x28(%rbp), %rax
movq -0x60(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x30, %eax
jl 0x6f27
movq -0x28(%rbp), %rax
movq -0x60(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x39, %eax
jg 0x6f27
movq -0x28(%rbp), %rax
movq -0x60(%rbp), %rcx
movsbl (%rax,%rcx), %eax
subl $0x30, %eax
addl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x28(%rbp), %rdi
callq 0x2090
movq %rax, %rcx
movq -0x78(%rbp), %rax
subq $0x2, %rcx
cmpq %rcx, %rax
je 0x6f20
imull $0xa, -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movl $0x1, -0x38(%rbp)
cmpl $0x0, -0x34(%rbp)
jne 0x6f5f
movq -0x28(%rbp), %rax
movq -0x60(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x6f, %eax
jne 0x6f5f
movq -0x28(%rbp), %rdi
leaq 0xd8e8(%rip), %rsi      # 0x14831
callq 0x2190
cmpq $0x0, %rax
je 0x6f5d
movl $0x1, -0x38(%rbp)
jmp 0x6f72
jmp 0x6f72
jmp 0x6f61
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x6eb3
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x6c90
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
jl 0x6fb4
movl -0x34(%rbp), %ecx
movq -0x10(%rbp), %rax
movq (%rax), %rax
movslq -0x3c(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movl %ecx, 0xc(%rax)
movl -0x38(%rbp), %ecx
movq -0x10(%rbp), %rax
movq (%rax), %rax
movslq -0x3c(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movl %ecx, 0x8(%rax)
jmp 0x700f
cmpl $-0x1, -0x3c(%rbp)
jne 0x700d
movl $0x10, %edi
callq 0x2110
movq %rax, -0x50(%rbp)
movl $0xff, %edi
callq 0x2110
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, (%rax)
movq -0x50(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rsi
callq 0x2060
movl -0x34(%rbp), %ecx
movq -0x50(%rbp), %rax
movl %ecx, 0xc(%rax)
movl -0x38(%rbp), %ecx
movq -0x50(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x10(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x8730
jmp 0x700f
jmp 0x7011
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rdx
movl $0x418, %esi            # imm = 0x418
callq 0x20e0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x7030
jmp 0x7035
jmp 0x6d9c
movq -0x18(%rbp), %rdi
callq 0x2030
movq -0x20(%rbp), %rdi
callq 0x2030
addq $0x80, %rsp
popq %rbp
retq