// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/linefile.c
// Function: lineFileNextFull
boolean lineFileNextFull(struct lineFile *lf, char **retFull, int *retFullSize,
                        char **retRaw, int *retRawSize)
// Fetch next line from file joining up any that are continued by ending '\'
// If requested, and was joined, the unjoined raw lines are also returned
// NOTE: comment lines can't be continued!  ("# comment \ \n more comment" is 2 lines.)
{
// May have requested reusing the last full line.
if (lf->fullLineReuse)
    {
    lf->fullLineReuse = FALSE;
    assert(lf->fullLine != NULL);
    *retFull = dyStringContents(lf->fullLine);
    if (retFullSize)
        *retFullSize = dyStringLen(lf->fullLine);
    if (retRaw != NULL)
        {
        assert(lf->rawLines != NULL);
        *retRaw = dyStringContents(lf->rawLines);
        if (retRawSize)
            *retRawSize = dyStringLen(lf->rawLines);
        }
    return TRUE;
    }

// Empty pointers
*retFull = NULL;
if (retRaw != NULL)
    *retRaw = NULL;

// Prepare lf buffers
if (lf->fullLine == NULL)
    {
    lf->fullLine = dyStringNew(1024);
    lf->rawLines = dyStringNew(1024); // Better to always create it than test every time
    }
else
    {
    dyStringClear(lf->fullLine);
    dyStringClear(lf->rawLines);
    }

char *line;
while (lineFileNext(lf, &line, NULL))
    {
    char *start = skipLeadingSpaces(line);

    // Will the next line continue this one?
    char *end = start;
    if (*start == '#')  // Comment lines can't be continued!
        end = start + strlen(start);
    else
        {
        while (*end != '\0')  // walking forward for efficiency (avoid strlens())
            {
            for (;*end != '\0' && *end != '\\'; end++) ; // Tight loop to find '\'
            if (*end == '\0')
                break;

            // This could be a continuation
            char *slash = end;
            if (*(++end) == '\\')  // escaped
                continue;
            end = skipLeadingSpaces(end);

            if (*end == '\0') // Just whitespace after '\', so true continuation mark
                {
                if (retRaw != NULL) // Only if actually requested.
                    {
                    dyStringAppendN(lf->rawLines,line,(end - line));
                    dyStringAppendC(lf->rawLines,'\n'); // New lines delimit raw lines.
                    }
                end = slash; // Don't need to zero, because of appending by length
                break;
                }
            }
        }

    // Stitch together full lines
    if (dyStringLen(lf->fullLine) == 0)
        dyStringAppendN(lf->fullLine,line,(end - line)); // includes first line's whitespace
    else if (start < end)             // don't include continued line's leading spaces
        dyStringAppendN(lf->fullLine,start,(end - start));

    if (*end == '\\')
        continue;

    // Got a full line now!
    *retFull = dyStringContents(lf->fullLine);
    if (retFullSize)
        *retFullSize = dyStringLen(lf->fullLine);

    if (retRaw != NULL && dyStringLen(lf->rawLines) > 0) // Only if actually requested & continued
        {
        // This is the final line which doesn't have a continuation char
        dyStringAppendN(lf->rawLines,line,(end - line));
        *retRaw = dyStringContents(lf->rawLines);
        if (retRawSize)
            *retRawSize = dyStringLen(lf->rawLines);
        }
    return TRUE;
    }
return FALSE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %r15
movq %rdx, %r12
movq %rdi, %r14
cmpl $0x0, 0x78(%rdi)
je 0xd752
movl $0x0, 0x78(%r14)
movq 0x68(%r14), %rax
testq %rax, %rax
je 0xd8f9
movq 0x8(%rax), %rax
movq %rax, (%rsi)
testq %r12, %r12
je 0xd717
movq 0x68(%r14), %rax
movl 0x14(%rax), %eax
movl %eax, (%r12)
movl $0x1, %r13d
testq %r15, %r15
je 0xd8e7
movq 0x70(%r14), %rax
testq %rax, %rax
je 0xd918
movq 0x8(%rax), %rax
movq %rax, (%r15)
testq %r8, %r8
je 0xd8e7
movq 0x70(%r14), %rax
movl 0x14(%rax), %eax
movl %eax, (%r8)
jmp 0xd8e7
movq $0x0, (%rsi)
testq %r15, %r15
je 0xd765
movq $0x0, (%r15)
movq 0x68(%r14), %rax
testq %rax, %rax
movq %r8, 0x8(%rsp)
movq %rsi, 0x10(%rsp)
je 0xd792
xorl %ecx, %ecx
movl %ecx, 0x14(%rax)
movq 0x8(%rax), %rax
movb %cl, (%rax)
movq 0x70(%r14), %rax
movl %ecx, 0x14(%rax)
movq 0x8(%rax), %rax
movb %cl, (%rax)
jmp 0xd7ae
movl $0x400, %edi            # imm = 0x400
callq 0xad14
movq %rax, 0x68(%r14)
movl $0x400, %edi            # imm = 0x400
callq 0xad14
movq %rax, 0x70(%r14)
movq %rsp, %rbp
xorl %r13d, %r13d
movq %r14, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0xd043
testl %eax, %eax
je 0xd8e7
movq (%rsp), %rdi
callq 0x7b0d
movq %rax, %r13
movzbl (%rax), %ecx
movq %rax, %rbx
testl %ecx, %ecx
je 0xd858
movq %r13, %rbx
cmpl $0x23, %ecx
jne 0xd7f7
movq %r13, %rdi
callq 0x3200
movq %rax, %rbx
addq %r13, %rbx
jmp 0xd858
cmpb $0x5c, %cl
je 0xd80b
movzbl %cl, %eax
testl %eax, %eax
je 0xd858
movb 0x1(%rbx), %cl
incq %rbx
jmp 0xd7f7
leaq 0x1(%rbx), %rax
movb $0x5c, %cl
cmpb $0x5c, 0x1(%rbx)
je 0xd830
movq %rax, %rdi
callq 0x7b0d
movb (%rax), %cl
testq %r15, %r15
je 0xd82a
testb %cl, %cl
je 0xd839
testb %cl, %cl
je 0xd858
movb (%rax), %cl
movq %rax, %rbx
testb %cl, %cl
jne 0xd7f7
jmp 0xd858
movq 0x70(%r14), %rdi
movq (%rsp), %rsi
subl %esi, %eax
movl %eax, %edx
callq 0xae1e
movq 0x70(%r14), %rdi
movl $0xa, %esi
callq 0xaeab
movq 0x68(%r14), %rdi
cmpl $0x0, 0x14(%rdi)
je 0xd871
cmpq %rbx, %r13
jae 0xd87e
movl %ebx, %edx
subl %r13d, %edx
movq %r13, %rsi
jmp 0xd879
movq (%rsp), %rsi
movl %ebx, %edx
subl %esi, %edx
callq 0xae1e
cmpb $0x5c, (%rbx)
je 0xd7b1
movq 0x68(%r14), %rax
movq 0x8(%rax), %rax
movq 0x10(%rsp), %rcx
movq %rax, (%rcx)
testq %r12, %r12
je 0xd8a7
movq 0x68(%r14), %rax
movl 0x14(%rax), %eax
movl %eax, (%r12)
movl $0x1, %r13d
testq %r15, %r15
je 0xd8e7
movq 0x70(%r14), %rdi
cmpl $0x0, 0x14(%rdi)
jle 0xd8e7
movq (%rsp), %rsi
subl %esi, %ebx
movl %ebx, %edx
callq 0xae1e
movq 0x70(%r14), %rax
movq 0x8(%rax), %rax
movq %rax, (%r15)
movq 0x8(%rsp), %rcx
testq %rcx, %rcx
je 0xd8e7
movq 0x70(%r14), %rax
movl 0x14(%rax), %eax
movl %eax, (%rcx)
movl %r13d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xc682(%rip), %rdi      # 0x19f82
leaq 0xc508(%rip), %rsi      # 0x19e0f
leaq 0xc6b3(%rip), %rcx      # 0x19fc1
movl $0x2dc, %edx            # imm = 0x2DC
callq 0x32e0
leaq 0xc6ea(%rip), %rdi      # 0x1a009
leaq 0xc4e9(%rip), %rsi      # 0x19e0f
leaq 0xc694(%rip), %rcx      # 0x19fc1
movl $0x2e2, %edx            # imm = 0x2E2
callq 0x32e0