// File: /workspace/github_c_makefile_star2_O2/haxlang[P]hax/haxParse.c
// Function: HaxParseQuotes
int
HaxParseQuotes(
    Hax_Interp *interp,		/* Interpreter to use for nested command
				 * evaluations and error messages. */
    char *string,		/* Character just after opening double-
				 * quote. */
    int termChar,		/* Character that terminates "quoted" string
				 * (usually double-quote, but sometimes
				 * right-paren or something else). */
    int flags,			/* Flags to pass to nested Hax_Eval calls. */
    char **termPtr,		/* Store address of terminating character
				 * here. */
    ParseValue *pvPtr		/* Information about where to place
				 * fully-substituted result of parse. */)
{
    char *src, *dst, c;

    src = string;
    dst = pvPtr->next;

    while (1) {
	if (dst == pvPtr->end) {
	    /*
	     * Target buffer space is about to run out.  Make more space.
	     */

	    pvPtr->next = dst;
	    (*pvPtr->expandProc)(interp, pvPtr, 1);
	    dst = pvPtr->next;
	}

	c = *src;
	src++;
	if (c == termChar) {
	    *dst = '\0';
	    pvPtr->next = dst;
	    *termPtr = src;
	    return HAX_OK;
	} else if (CHAR_TYPE(c) == HAX_NORMAL) {
	    copy:
	    *dst = c;
	    dst++;
	    continue;
	} else if (c == '$') {
	    int length;
	    char *value;

	    value = Hax_ParseVar(interp, src-1, termPtr);
	    if (value == NULL) {
		return HAX_ERROR;
	    }
	    src = *termPtr;
	    length = strlen(value);
	    if ((pvPtr->end - dst) <= length) {
		pvPtr->next = dst;
		(*pvPtr->expandProc)(interp, pvPtr, length);
		dst = pvPtr->next;
	    }
	    strcpy(dst, value);
	    dst += length;
	    continue;
	} else if (c == '[') {
	    int result;

	    pvPtr->next = dst;
	    result = HaxParseNestedCmd(interp, src, flags, termPtr, pvPtr);
	    if (result != HAX_OK) {
		return result;
	    }
	    src = *termPtr;
	    dst = pvPtr->next;
	    continue;
	} else if (c == '\\') {
	    int numRead;

	    src--;
	    *dst = Hax_Backslash(src, &numRead);
	    if (*dst != 0) {
		dst++;
	    }
	    src += numRead;
	    continue;
	} else if (c == '\0') {
	    Hax_ResetResult(interp);
	    sprintf(interp->result, "missing %c", termChar);
	    *termPtr = string-1;
	    return HAX_ERROR;
	} else {
	    goto copy;
	}
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, %r12
movq %r8, %r13
movl %ecx, 0x10(%rsp)
movl %edx, %r15d
movq %rsi, %rbp
movq %rdi, 0x8(%rsp)
movq 0x8(%r9), %r14
pushq $0x1
popq %rbx
movq %rsi, 0x18(%rsp)
movq %r8, 0x20(%rsp)
cmpq 0x10(%r12), %r14
jne 0xe5f1
movq %r14, 0x8(%r12)
movq 0x8(%rsp), %rdi
movq %r12, %rsi
movl %ebx, %edx
callq *0x18(%r12)
movq 0x8(%r12), %r14
movsbl (%rbp), %eax
leaq 0x1(%rbp), %rsi
cmpl %r15d, %eax
je 0xe6fd
movslq %eax, %rcx
movq 0xc9a4(%rip), %rdx      # 0x1afb0
cmpb $0x0, 0x80(%rdx,%rcx)
je 0xe634
movzbl %al, %ecx
cmpl $0x24, %ecx
je 0xe66e
cmpl $0x5b, %ecx
je 0xe63f
cmpl $0x5c, %ecx
je 0xe6da
testl %ecx, %ecx
je 0xe71b
movb %al, (%r14)
incq %r14
movq %rsi, %rbp
jmp 0xe5d1
movq %r14, 0x8(%r12)
movq 0x8(%rsp), %rdi
movl 0x10(%rsp), %edx
movq %r13, %rcx
movq %r12, %r8
callq 0x4640
testl %eax, %eax
jne 0xe70c
movq (%r13), %rbp
movq 0x8(%r12), %r14
jmp 0xe5d1
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x4410
testq %rax, %rax
je 0xe749
movq %rax, %rbx
movq (%r13), %rbp
movq %rax, %rdi
callq 0x41d0
movq 0x10(%r12), %rcx
subq %r14, %rcx
movslq %eax, %r13
cmpq %r13, %rcx
jg 0xe6bf
movq %r14, 0x8(%r12)
movq 0x8(%rsp), %rdi
movq %r12, %rsi
movl %eax, %edx
callq *0x18(%r12)
movq 0x8(%r12), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x40f0
addq %r13, %r14
movq 0x20(%rsp), %r13
pushq $0x1
popq %rbx
jmp 0xe5d1
movq %rbp, %rdi
leaq 0x14(%rsp), %rsi
callq 0x42c0
movb %al, (%r14)
cmpb $0x1, %al
sbbq $-0x1, %r14
movslq 0x14(%rsp), %rax
addq %rax, %rbp
jmp 0xe5d1
movb $0x0, (%r14)
movq %r14, 0x8(%r12)
xorl %eax, %eax
movq %rsi, (%r13)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x42d0
movq (%rbx), %rdi
leaq 0x6702(%rip), %rsi      # 0x14e34
movl %r15d, %edx
xorl %eax, %eax
callq 0x45f0
movq 0x18(%rsp), %rsi
decq %rsi
pushq $0x1
popq %rax
jmp 0xe708
pushq $0x1
popq %rax
jmp 0xe70c