// File: /workspace/github_c_makefile_star2_O3/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, %r15
movq %r8, %r12
movl %ecx, 0x10(%rsp)
movl %edx, %ebp
movq %rsi, %r13
movq %rdi, %rbx
movq 0x8(%r9), %r14
movq %rsi, 0x18(%rsp)
movq %r8, 0x20(%rsp)
movl %edx, 0xc(%rsp)
cmpq 0x10(%r15), %r14
jne 0xf2de
movq %r14, 0x8(%r15)
movq %rbx, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq *0x18(%r15)
movq 0x8(%r15), %r14
movsbl (%r13), %eax
leaq 0x1(%r13), %rsi
cmpl %ebp, %eax
je 0xf3ee
movslq %eax, %rcx
movq 0xbcb7(%rip), %rdx      # 0x1afb0
cmpb $0x0, 0x80(%rdx,%rcx)
je 0xf3e0
movzbl %al, %ecx
cmpl $0x5a, %ecx
jle 0xf341
cmpl $0x5b, %ecx
je 0xf3b5
cmpl $0x5c, %ecx
jne 0xf3e0
movq %r13, %rdi
leaq 0x14(%rsp), %rsi
callq 0x42c0
movb %al, (%r14)
cmpb $0x1, %al
sbbq $-0x1, %r14
movslq 0x14(%rsp), %rax
addq %rax, %r13
jmp 0xf2c1
cmpl $0x24, %ecx
jne 0xf3dc
movq %rbx, %rbp
movq %rbx, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x4400
testq %rax, %rax
je 0xf435
movq %rax, %rbx
movq (%r12), %r13
movq %rax, %rdi
callq 0x41d0
movq 0x10(%r15), %rcx
subq %r14, %rcx
movslq %eax, %r12
cmpq %r12, %rcx
jg 0xf396
movq %r14, 0x8(%r15)
movq %rbp, %rdi
movq %r15, %rsi
movl %eax, %edx
callq *0x18(%r15)
movq 0x8(%r15), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x40f0
addq %r12, %r14
movq 0x20(%rsp), %r12
movq %rbp, %rbx
movl 0xc(%rsp), %ebp
jmp 0xf2c1
movq %r14, 0x8(%r15)
movq %rbx, %rdi
movl 0x10(%rsp), %edx
movq %r12, %rcx
movq %r15, %r8
callq 0x4630
testl %eax, %eax
jne 0xf3fc
movq (%r12), %r13
movq 0x8(%r15), %r14
jmp 0xf2c1
testl %ecx, %ecx
je 0xf40b
movb %al, (%r14)
incq %r14
movq %rsi, %r13
jmp 0xf2c1
movb $0x0, (%r14)
movq %r14, 0x8(%r15)
xorl %eax, %eax
movq %rsi, (%r12)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x42d0
movq (%rbx), %rdi
leaq 0x6a47(%rip), %rsi      # 0x15e64
movl %ebp, %edx
xorl %eax, %eax
callq 0x45e0
movq 0x18(%rsp), %rsi
decq %rsi
movl $0x1, %eax
jmp 0xf3f8
movl $0x1, %eax
jmp 0xf3fc