// File: /workspace/github_c_makefile_star2_O3/Matthias-Wandel[P]imgcomp/src/config.c
// Function: read_config_file
void read_config_file(char *config_file)
{
    FILE * file;
    char ConfLine[201];
    int linenum = 0;

    file = fopen(config_file, "r");
    if (file == NULL){
        fprintf(stderr, "No configuration file %s\n",config_file);
        return;
    }
    for(;;){
        char *s, *value, *t;
        int len, a;
        s = fgets(ConfLine, sizeof(ConfLine)-1, file);
        ConfLine[sizeof(ConfLine)-1] = '\0';
        if (s == NULL) break;
        linenum += 1;

        // Remove leading spaces
        while (*s == ' ' || *s == '\t') s++;

        // Check line length not exceeded.
        len = strlen(s);
        if(len >= sizeof(ConfLine)-1){
            fprintf(stderr, "Configuration line too long:\n%s",s);
            goto no_good;
        }

        // Remove trailing spaces and linefeed.
        t = s+len-1;
        while (*t <= ' ' && t > s) *t-- = '\0';

        if (*s == '#') continue; // comment.
        if (*s == '\r' || *s == '\n') continue; // Blank line.

        value = strstr(s, "=");
        if (value != NULL){
            t = value;

            // Remove value leading spaces
            value += 1;
            while (*value == ' ' || *value == '\t') value++;

            // remove tag trailing spaces.
            *t = '\0';
            t--;
            while (*t == ' ' || *t == '\t'){
                *t = '\0';
                t--;
            }
        }
        
        {
            static int msg_shown = 0;
            if (!msg_shown) printf("Configuration parameters:\n");
            msg_shown = 1;
        }

        // Now finally have the tag extracted.
        printf("    '%s' = '%s'\n",s, value);

        a = parse_parameter(s,value);
        if (a < 0){
no_good:            
            fprintf(stderr, "Error on line %d of imgcomp.conf\n",linenum);
            exit(-1);
        }

    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rdi, %r14
leaq 0x7fa0(%rip), %rsi      # 0xd7e1
callq 0x3430
testq %rax, %rax
je 0x59b4
movq %rax, %rbx
movq %rsp, %r15
movq %r15, %rdi
movl $0xc8, %esi
movq %rax, %rdx
callq 0x3220
movb $0x0, 0xc8(%r15)
testq %rax, %rax
je 0x59a2
movq %rax, %r14
movq %rsp, %r13
xorl %ebp, %ebp
leaq -0x2(%r14), %r12
movzbl (%r14), %r15d
cmpl $0x20, %r15d
je 0x5892
cmpl $0x9, %r15d
jne 0x589a
incq %r14
incq %r12
jmp 0x5882
incl %ebp
movq %r14, %rdi
callq 0x3130
cltq
cmpq $0xc8, %rax
jae 0x59e0
leaq (%r14,%rax), %rcx
decq %rcx
cmpb $0x21, (%rcx)
setge %dl
cmpq %r14, %rcx
setbe %cl
orb %dl, %cl
jne 0x58e5
movb $0x0, 0x1(%r12,%rax)
cmpb $0x20, (%r12,%rax)
jg 0x58e2
leaq (%r12,%rax), %rcx
decq %r12
cmpq %r14, %rcx
ja 0x58c9
movb (%r14), %r15b
cmpb $0x23, %r15b
ja 0x58ff
movzbl %r15b, %eax
movabsq $0x800002400, %rcx      # imm = 0x800002400
btq %rax, %rcx
jb 0x597e
movq %r14, %rdi
movl $0x3d, %esi
callq 0x3160
testq %rax, %rax
je 0x593c
movq %rax, %r12
incq %r12
movzbl (%r12), %ecx
cmpl $0x9, %ecx
je 0x5914
cmpl $0x20, %ecx
je 0x5914
movb $0x0, (%rax)
movzbl -0x1(%rax), %ecx
decq %rax
cmpl $0x9, %ecx
je 0x5926
cmpl $0x20, %ecx
je 0x5926
jmp 0x593f
xorl %r12d, %r12d
cmpb $0x0, 0xd062(%rip)      # 0x129a8
jne 0x5954
leaq 0x6d8c(%rip), %rdi      # 0xc6db
callq 0x30c0
movb $0x1, 0xd04d(%rip)      # 0x129a8
leaq 0x697e(%rip), %rdi      # 0xc2e0
movq %r14, %rsi
movq %r12, %rdx
xorl %eax, %eax
callq 0x3170
movq %r14, %rdi
movq %r12, %rsi
callq 0x4f3d
testl %eax, %eax
js 0x59fb
movq %r13, %rdi
movl $0xc8, %esi
movq %rbx, %rdx
callq 0x3220
movq %rax, %r14
movb $0x0, 0xc8(%rsp)
testq %rax, %rax
jne 0x587e
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xc63d(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
leaq 0x68e1(%rip), %rsi      # 0xc2a6
movq %r14, %rdx
xorl %eax, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x32a0
movq 0xc611(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
leaq 0x68cf(%rip), %rsi      # 0xc2c0
movq %r14, %rdx
xorl %eax, %eax
callq 0x32a0
movl %ebp, %edi
callq 0x36d0