// File: /workspace/github_c_makefile_star2_O1/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 $0x28, %rsp
movq %rcx, %r15
movq %rdi, %r14
cmpl $0x0, 0x78(%rdi)
je 0xd9ed
movl $0x0, 0x78(%r14)
movq 0x68(%r14), %rax
testq %rax, %rax
je 0xdbaf
movq 0x8(%rax), %rax
movq %rax, (%rsi)
testq %rdx, %rdx
je 0xd9b2
movq 0x68(%r14), %rax
movl 0x14(%rax), %eax
movl %eax, (%rdx)
movl $0x1, %r13d
testq %r15, %r15
je 0xdb9d
movq 0x70(%r14), %rax
testq %rax, %rax
je 0xdbce
movq 0x8(%rax), %rax
movq %rax, (%r15)
testq %r8, %r8
je 0xdb9d
movq 0x70(%r14), %rax
movl 0x14(%rax), %eax
movl %eax, (%r8)
jmp 0xdb9d
movq $0x0, (%rsi)
testq %r15, %r15
je 0xda00
movq $0x0, (%r15)
movq 0x68(%r14), %rax
testq %rax, %rax
movq %r8, 0x10(%rsp)
movq %rdx, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
je 0xda32
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 0xda4e
movl $0x400, %edi            # imm = 0x400
callq 0xaf38
movq %rax, 0x68(%r14)
movl $0x400, %edi            # imm = 0x400
callq 0xaf38
movq %rax, 0x70(%r14)
leaq 0x8(%rsp), %rbp
xorl %r13d, %r13d
movq %r14, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0xd274
testl %eax, %eax
je 0xdb9d
movq 0x8(%rsp), %rdi
callq 0x7cb1
movq %rax, %r13
cmpb $0x23, (%rax)
movq %rax, %rbx
jne 0xda90
movq %r13, %rdi
callq 0x3200
movq %rax, %rbx
addq %r13, %rbx
jmp 0xdb09
cmpb $0x0, (%rbx)
je 0xdb09
incq %rbx
movzbl -0x1(%rbx), %eax
testl %eax, %eax
je 0xdb06
cmpl $0x5c, %eax
jne 0xda95
cmpb $0x5c, (%rbx)
movl $0x4, %ecx
je 0xdaff
leaq -0x1(%rbx), %r12
movq %rbx, %rdi
callq 0x7cb1
movb (%rax), %dl
xorl %ecx, %ecx
testb %dl, %dl
sete %cl
movq %r12, %rbx
cmovneq %rax, %rbx
leal (%rcx,%rcx,4), %ecx
testq %r15, %r15
je 0xdaff
testb %dl, %dl
jne 0xdaff
movq 0x70(%r14), %rdi
movq 0x8(%rsp), %rsi
subl %esi, %eax
movl %eax, %edx
callq 0xb042
movq 0x70(%r14), %rdi
movl $0xa, %esi
callq 0xb0c7
movl $0x5, %ecx
movq %r12, %rbx
cmpl $0x5, %ecx
jne 0xda90
jmp 0xdb09
decq %rbx
movq 0x68(%r14), %rdi
cmpl $0x0, 0x14(%rdi)
je 0xdb22
cmpq %rbx, %r13
jae 0xdb30
movl %ebx, %edx
subl %r13d, %edx
movq %r13, %rsi
jmp 0xdb2b
movq 0x8(%rsp), %rsi
movl %ebx, %edx
subl %esi, %edx
callq 0xb042
cmpb $0x5c, (%rbx)
je 0xda53
movq 0x68(%r14), %rax
movq 0x8(%rax), %rax
movq 0x18(%rsp), %rcx
movq %rax, (%rcx)
movq 0x20(%rsp), %rcx
testq %rcx, %rcx
je 0xdb5c
movq 0x68(%r14), %rax
movl 0x14(%rax), %eax
movl %eax, (%rcx)
movl $0x1, %r13d
testq %r15, %r15
je 0xdb9d
movq 0x70(%r14), %rdi
cmpl $0x0, 0x14(%rdi)
jle 0xdb9d
movq 0x8(%rsp), %rsi
subl %esi, %ebx
movl %ebx, %edx
callq 0xb042
movq 0x70(%r14), %rax
movq 0x8(%rax), %rax
movq %rax, (%r15)
movq 0x10(%rsp), %rcx
testq %rcx, %rcx
je 0xdb9d
movq 0x70(%r14), %rax
movl 0x14(%rax), %eax
movl %eax, (%rcx)
movl %r13d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xc3bc(%rip), %rdi      # 0x19f72
leaq 0xc242(%rip), %rsi      # 0x19dff
leaq 0xc3ed(%rip), %rcx      # 0x19fb1
movl $0x2dc, %edx            # imm = 0x2DC
callq 0x32e0
leaq 0xc424(%rip), %rdi      # 0x19ff9
leaq 0xc223(%rip), %rsi      # 0x19dff
leaq 0xc3ce(%rip), %rcx      # 0x19fb1
movl $0x2e2, %edx            # imm = 0x2E2
callq 0x32e0