// File: /workspace/github_c_makefile_star2_O2/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 0xc35a
andl $0x0, 0x78(%r14)
movq 0x68(%r14), %rax
testq %rax, %rax
je 0xc4ee
movq 0x8(%rax), %rax
movq %rax, (%rsi)
testq %r12, %r12
je 0xc321
movq 0x68(%r14), %rax
movl 0x14(%rax), %eax
movl %eax, (%r12)
pushq $0x1
popq %r13
testq %r15, %r15
je 0xc4dc
movq 0x70(%r14), %rax
testq %rax, %rax
je 0xc50d
movq 0x8(%rax), %rax
movq %rax, (%r15)
testq %r8, %r8
je 0xc4dc
movq 0x70(%r14), %rax
movl 0x14(%rax), %eax
movl %eax, (%r8)
jmp 0xc4dc
andq $0x0, (%rsi)
testq %r15, %r15
je 0xc367
andq $0x0, (%r15)
movq 0x68(%r14), %rax
testq %rax, %rax
movq %r8, 0x8(%rsp)
movq %rsi, 0x10(%rsp)
je 0xc396
andl $0x0, 0x14(%rax)
movq 0x8(%rax), %rax
xorl %ecx, %ecx
movb %cl, (%rax)
movq 0x70(%r14), %rax
andl $0x0, 0x14(%rax)
movq 0x8(%rax), %rax
movb %cl, (%rax)
jmp 0xc3b2
movl $0x400, %edi            # imm = 0x400
callq 0x9df0
movq %rax, 0x68(%r14)
movl $0x400, %edi            # imm = 0x400
callq 0x9df0
movq %rax, 0x70(%r14)
movq %rsp, %rbp
xorl %r13d, %r13d
movq %r14, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0xbcea
testl %eax, %eax
je 0xc4dc
movq (%rsp), %rdi
callq 0x722d
movq %rax, %r13
movb (%rax), %cl
movq %rax, %rbx
cmpb $0x23, %cl
jne 0xc3f3
movq %r13, %rdi
callq 0x3200
movq %rax, %rbx
addq %r13, %rbx
jmp 0xc44f
testb %cl, %cl
je 0xc44f
incq %rbx
testb %cl, %cl
je 0xc44c
movzbl %cl, %eax
cmpl $0x5c, %eax
je 0xc40a
movb (%rbx), %cl
jmp 0xc3f7
movb $0x5c, %cl
cmpb $0x5c, (%rbx)
je 0xc3f3
movq %rbx, %rdi
callq 0x722d
movb (%rax), %cl
testq %r15, %r15
je 0xc424
testb %cl, %cl
je 0xc42f
testb %cl, %cl
je 0xc44c
movb (%rax), %cl
movq %rax, %rbx
jmp 0xc3f3
movq 0x70(%r14), %rdi
movq (%rsp), %rsi
subl %esi, %eax
movl %eax, %edx
callq 0x9eec
movq 0x70(%r14), %rdi
pushq $0xa
popq %rsi
callq 0x9f5e
decq %rbx
movq 0x68(%r14), %rdi
cmpl $0x0, 0x14(%rdi)
je 0xc468
cmpq %rbx, %r13
jae 0xc475
movl %ebx, %edx
subl %r13d, %edx
movq %r13, %rsi
jmp 0xc470
movq (%rsp), %rsi
movl %ebx, %edx
subl %esi, %edx
callq 0x9eec
cmpb $0x5c, (%rbx)
je 0xc3b5
movq 0x68(%r14), %rax
movq 0x8(%rax), %rax
movq 0x10(%rsp), %rcx
movq %rax, (%rcx)
testq %r12, %r12
je 0xc49e
movq 0x68(%r14), %rax
movl 0x14(%rax), %eax
movl %eax, (%r12)
pushq $0x1
popq %r13
testq %r15, %r15
je 0xc4dc
movq 0x70(%r14), %rdi
cmpl $0x0, 0x14(%rdi)
jle 0xc4dc
movq (%rsp), %rsi
subl %esi, %ebx
movl %ebx, %edx
callq 0x9eec
movq 0x70(%r14), %rax
movq 0x8(%rax), %rax
movq %rax, (%r15)
movq 0x8(%rsp), %rcx
testq %rcx, %rcx
je 0xc4dc
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 0xba8d(%rip), %rdi      # 0x17f82
leaq 0xb913(%rip), %rsi      # 0x17e0f
leaq 0xbabe(%rip), %rcx      # 0x17fc1
movl $0x2dc, %edx            # imm = 0x2DC
callq 0x32e0
leaq 0xbaf5(%rip), %rdi      # 0x18009
leaq 0xb8f4(%rip), %rsi      # 0x17e0f
leaq 0xba9f(%rip), %rcx      # 0x17fc1
movl $0x2e2, %edx            # imm = 0x2E2
callq 0x32e0