// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/config.c
// Function: rewriteConfigReadOldFile
struct rewriteConfigState *rewriteConfigReadOldFile(char *path) {
    FILE *fp = fopen(path,"r");
    struct rewriteConfigState *state = zmalloc(sizeof(*state));
    char buf[CONFIG_MAX_LINE+1];
    int linenum = -1;

    if (fp == NULL && errno != ENOENT) return NULL;

    state->option_to_line = dictCreate(&optionToLineDictType,NULL);
    state->rewritten = dictCreate(&optionSetDictType,NULL);
    state->numlines = 0;
    state->lines = NULL;
    state->has_tail = 0;
    if (fp == NULL) return state;

    /* Read the old file line by line, populate the state. */
    while(fgets(buf,CONFIG_MAX_LINE+1,fp) != NULL) {
        int argc;
        sds *argv;
        sds line = sdstrim(sdsnew(buf),"\r\n\t ");

        linenum++; /* Zero based, so we init at -1 */

        /* Handle comments and empty lines. */
        if (line[0] == '#' || line[0] == '\0') {
            if (!state->has_tail && !strcmp(line,REDIS_CONFIG_REWRITE_SIGNATURE))
                state->has_tail = 1;
            rewriteConfigAppendLine(state,line);
            continue;
        }

        /* Not a comment, split into arguments. */
        argv = sdssplitargs(line,&argc);
        if (argv == NULL) {
            /* Apparently the line is unparsable for some reason, for
             * instance it may have unbalanced quotes. Load it as a
             * comment. */
            sds aux = sdsnew("# ??? ");
            aux = sdscatsds(aux,line);
            sdsfree(line);
            rewriteConfigAppendLine(state,aux);
            continue;
        }

        sdstolower(argv[0]); /* We only want lowercase config directives. */

        /* Now we populate the state according to the content of this line.
         * Append the line and populate the option -> line numbers map. */
        rewriteConfigAppendLine(state,line);
        rewriteConfigAddLineNumberToOption(state,argv[0],linenum);

        sdsfreesplitres(argv,argc);
    }
    fclose(fp);
    return state;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x418, %rsp            # imm = 0x418
leaq 0x5f34c(%rip), %rsi     # 0xb1695
callq 0x26ae0
movq %rax, %r14
pushq $0x28
popq %rdi
callq 0x327b9
movq %rax, %rbx
testq %r14, %r14
jne 0x5236f
callq 0x26880
cmpl $0x2, (%rax)
jne 0x524b7
leaq 0xa6ec2(%rip), %rdi     # 0xf9238
xorl %r15d, %r15d
xorl %esi, %esi
callq 0x2a155
movq %rax, (%rbx)
leaq 0xa6ede(%rip), %rdi     # 0xf9268
xorl %esi, %esi
callq 0x2a155
andl $0x0, 0x10(%rbx)
andq $0x0, 0x18(%rbx)
andl $0x0, 0x20(%rbx)
movq %rax, 0x8(%rbx)
testq %r14, %r14
je 0x524b9
leaq 0x10(%rsp), %r12
leaq 0x63c97(%rip), %r13     # 0xb604e
movq %r12, %rdi
movl $0x401, %esi            # imm = 0x401
movq %r14, %rdx
callq 0x26440
testq %rax, %rax
je 0x524ad
movq %r12, %rdi
callq 0x3115a
movq %rax, %rdi
movq %r13, %rsi
callq 0x31dec
movq %rax, %rbp
movzbl (%rax), %eax
cmpl $0x23, %eax
je 0x523f2
testl %eax, %eax
jne 0x52422
cmpl $0x0, 0x20(%rbx)
jne 0x52412
movq %rbp, %rdi
leaq 0x63c51(%rip), %rsi     # 0xb6053
callq 0x268f0
testl %eax, %eax
jne 0x52412
movl $0x1, 0x20(%rbx)
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x52264
jmp 0x524a5
movq %r14, %r12
movq %r13, %r14
movq %rbp, %rdi
leaq 0xc(%rsp), %rsi
callq 0x32388
testq %rax, %rax
je 0x5246d
movq %rax, %r13
movq (%rax), %rdi
callq 0x31f3c
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x52264
movq (%r13), %rsi
movq %rbx, %rdi
movl %r15d, %edx
callq 0x5229e
movl 0xc(%rsp), %esi
movq %r13, %rdi
callq 0x321be
jmp 0x5249a
leaq 0x63bfd(%rip), %rdi     # 0xb6071
callq 0x3115a
movq %rax, %rdi
movq %rbp, %rsi
callq 0x317de
movq %rax, %r13
movq %rbp, %rdi
callq 0x311c8
movq %rbx, %rdi
movq %r13, %rsi
callq 0x52264
movq %r14, %r13
movq %r12, %r14
leaq 0x10(%rsp), %r12
incl %r15d
jmp 0x523b7
movq %r14, %rdi
callq 0x26a10
jmp 0x524b9
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x418, %rsp            # imm = 0x418
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq