// File: /workspace/github_c_makefile_star2_O1/zenlinux[P]cwm/linux.c
// Function: fparseln
char *
fparseln(FILE *fp, size_t *size, size_t *lineno, const char str[3],
    int flags)
{
	static const char dstr[3] = { '\\', '\\', '#' };
	char	*buf = NULL, *ptr, *cp, esc, con, nl, com;
	size_t	s, len = 0;
	int	cnt = 1;

	if (str == NULL)
		str = dstr;

	esc = str[0];
	con = str[1];
	com = str[2];

	/*
	 * XXX: it would be cool to be able to specify the newline character,
	 * but unfortunately, fgetln does not let us
	 */
	nl  = '\n';

	while (cnt) {
		cnt = 0;

		if (lineno)
			(*lineno)++;

		if ((ptr = fgetln(fp, &s)) == NULL)
			break;

		if (s && com) {		/* Check and eliminate comments */
			for (cp = ptr; cp < ptr + s; cp++)
				if (*cp == com && !isescaped(ptr, cp, esc)) {
					s = cp - ptr;
					cnt = s == 0 && buf == NULL;
					break;
				}
		}

		if (s && nl) {		/* Check and eliminate newlines */
			cp = &ptr[s - 1];

			if (*cp == nl)
				s--;	/* forget newline */
		}

		if (s && con) {		/* Check and eliminate continuations */
			cp = &ptr[s - 1];

			if (*cp == con && !isescaped(ptr, cp, esc)) {
				s--;	/* forget escape */
				cnt = 1;
			}
		}

		if (s == 0 && buf != NULL)
			continue;

		if ((cp = realloc(buf, len + s + 1)) == NULL) {
			free(buf);
			return NULL;
		}
		buf = cp;

		(void) memcpy(buf + len, ptr, s);
		len += s;
		buf[len] = '\0';
	}

	if ((flags & FPARSELN_UNESCALL) != 0 && esc && buf != NULL &&
	    strchr(buf, esc) != NULL) {
		ptr = cp = buf;
		while (cp[0] != '\0') {
			int skipesc;

			while (cp[0] != '\0' && cp[0] != esc)
				*ptr++ = *cp++;
			if (cp[0] == '\0' || cp[1] == '\0')
				break;

			skipesc = 0;
			if (cp[1] == com)
				skipesc += (flags & FPARSELN_UNESCCOMM);
			if (cp[1] == con)
				skipesc += (flags & FPARSELN_UNESCCONT);
			if (cp[1] == esc)
				skipesc += (flags & FPARSELN_UNESCESC);
			if (cp[1] != com && cp[1] != con && cp[1] != esc)
				skipesc = (flags & FPARSELN_UNESCREST);

			if (skipesc)
				cp++;
			else
				*ptr++ = *cp++;
			*ptr++ = *cp++;
		}
		*ptr = '\0';
		len = strlen(buf);
	}

	if (size)
		*size = len;
	return buf;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %r8d, 0x24(%rsp)
movq %rdx, %r13
movq %rsi, 0x28(%rsp)
testq %rcx, %rcx
leaq 0x1762(%rip), %rax      # 0xee87
cmovneq %rcx, %rax
movq %rdi, 0x30(%rsp)
movsbl (%rax), %r15d
movb 0x1(%rax), %cl
movb %cl, 0x7(%rsp)
movb 0x2(%rax), %bl
movl $0x1, %r14d
xorl %edi, %edi
movq $0x0, 0x18(%rsp)
movq %rdi, 0x8(%rsp)
testl %r14d, %r14d
je 0xd8d8
testq %r13, %r13
je 0xd764
incq (%r13)
movq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0xd5d3
testq %rax, %rax
movq 0x8(%rsp), %rdi
movb 0x7(%rsp), %r8b
je 0xd8d8
movq %rax, %r12
testb %bl, %bl
setne %cl
movq 0x10(%rsp), %rax
testq %rax, %rax
setne %dl
andb %cl, %dl
xorl %r14d, %r14d
cmpb $0x1, %dl
jne 0xd802
testq %rax, %rax
jle 0xd802
addq %r12, %rax
movq %r12, %rcx
testb %r15b, %r15b
sete %dl
cmpb %bl, (%rcx)
setne %sil
orb %dl, %sil
jne 0xd7e0
leaq -0x1(%rcx), %rdx
cmpq %r12, %rdx
jb 0xd7ea
xorl %esi, %esi
cmpb %r15b, (%rdx)
jne 0xd7da
incq %rsi
decq %rdx
cmpq %r12, %rdx
jae 0xd7ca
testb $0x1, %sil
je 0xd7ea
incq %rcx
cmpq %rax, %rcx
jb 0xd7ae
jmp 0xd802
movq %rcx, %rax
subq %r12, %rax
movq %rax, 0x10(%rsp)
xorq %r12, %rcx
xorl %r14d, %r14d
orq %rdi, %rcx
sete %r14b
movq 0x10(%rsp), %rax
testq %rax, %rax
je 0xd81c
cmpb $0xa, -0x1(%r12,%rax)
jne 0xd81c
decq %rax
movq %rax, 0x10(%rsp)
testb %r8b, %r8b
setne %cl
movq 0x10(%rsp), %rax
testq %rax, %rax
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0xd872
cmpb %r8b, -0x1(%r12,%rax)
jne 0xd872
testb %r15b, %r15b
je 0xd872
leaq (%r12,%rax), %rcx
addq $-0x2, %rcx
cmpq %r12, %rcx
jb 0xd864
xorl %edx, %edx
cmpb %r15b, (%rcx)
jne 0xd85f
incq %rdx
decq %rcx
cmpq %r12, %rcx
jae 0xd84f
testb $0x1, %dl
jne 0xd872
decq %rax
movq %rax, 0x10(%rsp)
movl $0x1, %r14d
movq 0x10(%rsp), %rbp
testq %rbp, %rbp
jne 0xd885
testq %rdi, %rdi
jne 0xd752
movq 0x18(%rsp), %rax
leaq (%rax,%rbp), %rsi
incq %rsi
callq 0x57e0
testq %rax, %rax
je 0xda18
movq 0x18(%rsp), %rcx
leaq (%rcx,%rbp), %rdx
movq %rdx, 0x8(%rsp)
movq %rax, %rdi
addq %rcx, %rdi
movq %r12, %rsi
movq %rbp, %rdx
movq %rax, %r12
callq 0x5870
movq 0x8(%rsp), %rax
movb $0x0, (%r12,%rax)
movq %r12, %rdi
movq %rax, 0x18(%rsp)
jmp 0xd74d
movl 0x24(%rsp), %r12d
testb $0xf, %r12b
je 0xd9f2
testb %r15b, %r15b
movq 0x28(%rsp), %r14
movq 0x18(%rsp), %r13
je 0xd9fc
testq %rdi, %rdi
je 0xd9fc
movl %r15d, %esi
callq 0x5530
testq %rax, %rax
je 0xd9fc
movl %r12d, %eax
andl $0x4, %eax
movl %r12d, %ecx
andl $0x2, %ecx
movl %r12d, %edx
andl $0x1, %edx
andl $0x8, %r12d
movq 0x8(%rsp), %rsi
movq %rsi, %rdi
movb 0x7(%rsp), %r13b
cmpb $0x0, (%rdi)
je 0xd9e0
movb (%rdi), %r8b
testb %r8b, %r8b
sete %r9b
je 0xd960
cmpb %r15b, %r8b
je 0xd960
movb %r8b, (%rsi)
incq %rsi
movb 0x1(%rdi), %r8b
incq %rdi
jmp 0xd943
testb %r9b, %r9b
jne 0xd9d4
movb 0x1(%rdi), %r9b
testb %r9b, %r9b
je 0xd9d4
cmpb %bl, %r9b
movl $0x0, %r10d
cmovel %eax, %r10d
cmpb %r13b, %r9b
movl $0x0, %r11d
cmovel %ecx, %r11d
orl %r10d, %r11d
cmpb %r15b, %r9b
sete %r10b
movl $0x0, %ebp
cmovel %edx, %ebp
orl %r11d, %ebp
testb $0x1, %r10b
movl %r12d, %r10d
cmovnel %ebp, %r10d
cmpb %r13b, %r9b
cmovel %ebp, %r10d
cmpb %bl, %r9b
cmovel %ebp, %r10d
testl %r10d, %r10d
jne 0xd9c1
movb %r8b, (%rsi)
incq %rsi
movb 0x1(%rdi), %r8b
addq $0x2, %rdi
movb %r8b, (%rsi)
incq %rsi
movb $0x1, %r8b
jmp 0xd9d7
xorl %r8d, %r8d
testb %r8b, %r8b
jne 0xd937
movb $0x0, (%rsi)
movq 0x8(%rsp), %rdi
callq 0x5330
movq %rax, %r13
jmp 0xd9fc
movq 0x28(%rsp), %r14
movq 0x18(%rsp), %r13
testq %r14, %r14
je 0xda04
movq %r13, (%r14)
movq 0x8(%rsp), %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rsp), %rdi
callq 0x5300
xorl %eax, %eax
jmp 0xda09