// File: /workspace/github_c_makefile_star2_O1/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, %rbx
leaq 0x7f85(%rip), %rsi      # 0xd771
callq 0x3420
testq %rax, %rax
je 0x593f
movq %rax, %r14
movq %rsp, %r15
xorl %ebx, %ebx
movq %r15, %rdi
movl $0xc8, %esi
movq %r14, %rdx
callq 0x3220
movq %rax, %r13
movb $0x0, 0xc8(%rsp)
testq %rax, %rax
je 0x5924
leaq -0x2(%r13), %r12
movq %r13, %rbp
movzbl (%rbp), %eax
cmpl $0x20, %eax
je 0x583b
cmpl $0x9, %eax
jne 0x5843
incq %rbp
incq %r12
jmp 0x582d
incl %ebx
movq %rbp, %rdi
callq 0x3130
cltq
cmpq $0xc8, %rax
jae 0x596b
leaq (%rax,%rbp), %rcx
decq %rcx
cmpb $0x21, (%rcx)
setge %dl
cmpq %rbp, %rcx
setbe %cl
orb %dl, %cl
jne 0x588b
movb $0x0, 0x1(%r12,%rax)
cmpb $0x20, (%r12,%rax)
jg 0x588b
leaq (%r12,%rax), %rcx
decq %r12
cmpq %rbp, %rcx
ja 0x5872
movzbl (%rbp), %eax
cmpq $0x23, %rax
ja 0x58a5
movabsq $0x800002400, %rcx      # imm = 0x800002400
btq %rax, %rcx
jb 0x5924
movq %rbp, %rdi
movl $0x3d, %esi
callq 0x3160
testq %rax, %rax
je 0x58e2
movq %rax, %r12
incq %r12
movzbl (%r12), %ecx
cmpl $0x9, %ecx
je 0x58ba
cmpl $0x20, %ecx
je 0x58ba
movb $0x0, (%rax)
movzbl -0x1(%rax), %ecx
decq %rax
cmpl $0x9, %ecx
je 0x58cc
cmpl $0x20, %ecx
je 0x58cc
jmp 0x58e5
xorl %r12d, %r12d
cmpb $0x0, 0xd0bc(%rip)      # 0x129a8
jne 0x58fa
leaq 0x6dd6(%rip), %rdi      # 0xc6cb
callq 0x30c0
movb $0x1, 0xd0a7(%rip)      # 0x129a8
leaq 0x69c8(%rip), %rdi      # 0xc2d0
movq %rbp, %rsi
movq %r12, %rdx
xorl %eax, %eax
callq 0x3170
movq %rbp, %rdi
movq %r12, %rsi
callq 0x4ee5
testl %eax, %eax
js 0x5986
testq %r13, %r13
jne 0x5802
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xc6b2(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
leaq 0x6946(%rip), %rsi      # 0xc296
movq %rbx, %rdx
xorl %eax, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3290
movq 0xc686(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
leaq 0x6934(%rip), %rsi      # 0xc2b0
movq %rbp, %rdx
xorl %eax, %eax
callq 0x3290
movl %ebx, %edi
callq 0x36c0