// File: /workspace/github_c_makefile_star2_O0/haxlang[P]hax/haxParse.c
// Function: HaxParseWords
int
HaxParseWords(
    Hax_Interp *interp,		/* Interpreter to use for nested command
				 * evaluations and error messages. */
    char *string,		/* First character of word. */
    int flags,			/* Flags to control parsing (same values as
				 * passed to Hax_Eval). */
    int maxWords,		/* Maximum number of words to parse. */
    char **termPtr,		/* Store address of terminating character
				 * here. */
    int *argcPtr,		/* Filled in with actual number of words
				 * parsed. */
    char **argv,		/* Store addresses of individual words here. */
    ParseValue *pvPtr		/* Information about where to place
				 * fully-substituted word. */)
{
    char *src, *dst;
    char c;
    int type, result, argc;
    char *oldBuffer;		/* Used to detect when pvPtr's buffer gets
				 * reallocated, so we can adjust all of the
				 * argv pointers. */

    src = string;
    oldBuffer = pvPtr->buffer;
    dst = pvPtr->next;
    for (argc = 0; argc < maxWords; argc++) {
	argv[argc] = dst;

	/*
	 * Skip leading space.
	 */

	skipSpace:
	c = *src;
	type = CHAR_TYPE(c);
	while (type == HAX_SPACE) {
	    src++;
	    c = *src;
	    type = CHAR_TYPE(c);
	}

	/*
	 * Handle the normal case (i.e. no leading double-quote or brace).
	 */

	if (type == HAX_NORMAL) {
	    normalArg:
	    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;
		}

		if (type == HAX_NORMAL) {
		    copy:
		    *dst = c;
		    dst++;
		    src++;
		} else if (type == HAX_SPACE) {
		    goto wordEnd;
		} else if (type == HAX_DOLLAR) {
		    int length;
		    char *value;

		    value = Hax_ParseVar(interp, src, 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;
		} else if (type == HAX_COMMAND_END) {
		    if ((c == ']') && !(flags & HAX_BRACKET_TERM)) {
			goto copy;
		    }

		    /*
		     * End of command;  simulate a word-end first, so
		     * that the end-of-command can be processed as the
		     * first thing in a new word.
		     */

		    goto wordEnd;
		} else if (type == HAX_OPEN_BRACKET) {
		    pvPtr->next = dst;
		    result = HaxParseNestedCmd(interp, src+1, flags, termPtr,
			    pvPtr);
		    if (result != HAX_OK) {
			return result;
		    }
		    src = *termPtr;
		    dst = pvPtr->next;
		} else if (type == HAX_BACKSLASH) {
		    int numRead;

		    *dst = Hax_Backslash(src, &numRead);
		    if (*dst != 0) {
			dst++;
		    }
		    src += numRead;
		} else {
		    goto copy;
		}
		c = *src;
		type = CHAR_TYPE(c);
	    }
	} else {

	    /*
	     * Check for the end of the command.
	     */

	    if (type == HAX_COMMAND_END) {
		if (flags & HAX_BRACKET_TERM) {
		    if (c == '\0') {
			Hax_SetResult(interp, (char *) "missing close-bracket",
				HAX_STATIC);
			return HAX_ERROR;
		    }
		} else {
		    if (c == ']') {
			goto normalArg;
		    }
		}
		goto done;
	    }

	    /*
	     * Now handle the special cases: open braces, double-quotes,
	     * and backslash-newline.
	     */

	    pvPtr->next = dst;
	    if (type == HAX_QUOTE) {
		result = HaxParseQuotes(interp, src+1, '"', flags,
			termPtr, pvPtr);
	    } else if (type == HAX_OPEN_BRACE) {
		result = HaxParseBraces(interp, src+1, termPtr, pvPtr);
	    } else if ((type == HAX_BACKSLASH) && (src[1] == '\n')) {
		src += 2;
		goto skipSpace;
	    } else {
		goto normalArg;
	    }
	    if (result != HAX_OK) {
		return result;
	    }

	    /*
	     * Back from quotes or braces;  make sure that the terminating
	     * character was the end of the word.  Have to be careful here
	     * to handle continuation lines (i.e. lines ending in backslash).
	     */

	    c = **termPtr;
	    if ((c == '\\') && ((*termPtr)[1] == '\n')) {
		c = (*termPtr)[2];
	    }
	    type = CHAR_TYPE(c);
	    if ((type != HAX_SPACE) && (type != HAX_COMMAND_END)) {
		if (*src == '"') {
		    Hax_SetResult(interp,
			    (char *) "extra characters after close-quote",
			    HAX_STATIC);
		} else {
		    Hax_SetResult(interp,
			    (char *) "extra characters after close-brace",
			    HAX_STATIC);
		}
		return HAX_ERROR;
	    }
	    src = *termPtr;
	    dst = pvPtr->next;

	}

	/*
	 * We're at the end of a word, so add a null terminator.  Then
	 * see if the buffer was re-allocated during this word.  If so,
	 * update all of the argv pointers.
	 */

	wordEnd:
	*dst = '\0';
	dst++;
	if (oldBuffer != pvPtr->buffer) {
	    int i;

	    for (i = 0; i <= argc; i++) {
		argv[i] = pvPtr->buffer + (argv[i] - oldBuffer);
	    }
	    oldBuffer = pvPtr->buffer;
	}
    }

    done:
    pvPtr->next = dst;
    *termPtr = src;
    *argcPtr = argc;
    return HAX_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq 0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x58(%rbp)
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
movl $0x0, -0x50(%rbp)
movl -0x50(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x162f1
movq -0x40(%rbp), %rdx
movq 0x10(%rbp), %rax
movslq -0x50(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x38(%rbp), %rax
movb (%rax), %al
movb %al, -0x41(%rbp)
movsbq -0x41(%rbp), %rcx
movq 0xd14b(%rip), %rax      # 0x22fb8
movsbl 0x80(%rax,%rcx), %eax
movl %eax, -0x48(%rbp)
cmpl $0x1, -0x48(%rbp)
jne 0x15eac
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movb (%rax), %al
movb %al, -0x41(%rbp)
movsbq -0x41(%rbp), %rcx
movq 0xd119(%rip), %rax      # 0x22fb8
movsbl 0x80(%rax,%rcx), %eax
movl %eax, -0x48(%rbp)
jmp 0x15e78
cmpl $0x0, -0x48(%rbp)
jne 0x160da
jmp 0x15eb8
jmp 0x15eba
movq -0x40(%rbp), %rax
movq 0x18(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jne 0x15ef7
movq -0x40(%rbp), %rcx
movq 0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
movl $0x1, %edx
callq *%rax
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
cmpl $0x0, -0x48(%rbp)
jne 0x15f25
jmp 0x15eff
movb -0x41(%rbp), %cl
movq -0x40(%rbp), %rax
movb %cl, (%rax)
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x160b5
cmpl $0x1, -0x48(%rbp)
jne 0x15f30
jmp 0x16273
cmpl $0x8, -0x48(%rbp)
jne 0x15fe1
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x43e0
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x68(%rbp)
jne 0x15f62
movl $0x1, -0x4(%rbp)
jmp 0x1631a
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x68(%rbp), %rdi
callq 0x41b0
movl %eax, -0x5c(%rbp)
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x40(%rbp), %rcx
subq %rcx, %rax
movslq -0x5c(%rbp), %rcx
cmpq %rcx, %rax
jg 0x15fbe
movq -0x40(%rbp), %rcx
movq 0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
movl -0x5c(%rbp), %edx
callq *%rax
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0x40d0
movl -0x5c(%rbp), %ecx
movq -0x40(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
jmp 0x160b1
cmpl $0x2, -0x48(%rbp)
jne 0x16005
movsbl -0x41(%rbp), %eax
cmpl $0x5d, %eax
jne 0x16000
movl -0x1c(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x16000
jmp 0x15eff
jmp 0x16273
cmpl $0x4, -0x48(%rbp)
jne 0x16060
movq -0x40(%rbp), %rcx
movq 0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
addq $0x1, %rsi
movl -0x1c(%rbp), %edx
movq -0x28(%rbp), %rcx
movq 0x18(%rbp), %r8
callq 0x4620
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x4c(%rbp)
je 0x16047
movl -0x4c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1631a
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0x160ad
cmpl $0x7, -0x48(%rbp)
jne 0x160a6
movq -0x38(%rbp), %rdi
leaq -0x6c(%rbp), %rsi
callq 0x42a0
movb %al, %cl
movq -0x40(%rbp), %rax
movb %cl, (%rax)
movq -0x40(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x16093
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
movl -0x6c(%rbp), %ecx
movq -0x38(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
jmp 0x160ab
jmp 0x15eff
jmp 0x160ad
jmp 0x160af
jmp 0x160b1
jmp 0x160b3
jmp 0x160b5
movq -0x38(%rbp), %rax
movb (%rax), %al
movb %al, -0x41(%rbp)
movsbq -0x41(%rbp), %rcx
movq 0xceee(%rip), %rax      # 0x22fb8
movsbl 0x80(%rax,%rcx), %eax
movl %eax, -0x48(%rbp)
jmp 0x15eba
cmpl $0x2, -0x48(%rbp)
jne 0x1612b
movl -0x1c(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x16116
movsbl -0x41(%rbp), %eax
cmpl $0x0, %eax
jne 0x16114
movq -0x10(%rbp), %rdi
leaq 0x911b(%rip), %rsi      # 0x1f21a
xorl %eax, %eax
movl %eax, %edx
callq 0x44e0
movl $0x1, -0x4(%rbp)
jmp 0x1631a
jmp 0x16126
movsbl -0x41(%rbp), %eax
cmpl $0x5d, %eax
jne 0x16124
jmp 0x15eb8
jmp 0x16126
jmp 0x162f3
movq -0x40(%rbp), %rcx
movq 0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
cmpl $0x3, -0x48(%rbp)
jne 0x16163
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
addq $0x1, %rsi
movl -0x1c(%rbp), %ecx
movq -0x28(%rbp), %r8
movq 0x18(%rbp), %r9
movl $0x22, %edx
callq 0x4470
movl %eax, -0x4c(%rbp)
jmp 0x161b2
cmpl $0x5, -0x48(%rbp)
jne 0x16187
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
addq $0x1, %rsi
movq -0x28(%rbp), %rdx
movq 0x18(%rbp), %rcx
callq 0x45c0
movl %eax, -0x4c(%rbp)
jmp 0x161b0
cmpl $0x7, -0x48(%rbp)
jne 0x161ab
movq -0x38(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0xa, %eax
jne 0x161ab
movq -0x38(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x38(%rbp)
jmp 0x15e58
jmp 0x15eb8
jmp 0x161b2
cmpl $0x0, -0x4c(%rbp)
je 0x161c3
movl -0x4c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1631a
movq -0x28(%rbp), %rax
movq (%rax), %rax
movb (%rax), %al
movb %al, -0x41(%rbp)
movsbl -0x41(%rbp), %eax
cmpl $0x5c, %eax
jne 0x161f5
movq -0x28(%rbp), %rax
movq (%rax), %rax
movsbl 0x1(%rax), %eax
cmpl $0xa, %eax
jne 0x161f5
movq -0x28(%rbp), %rax
movq (%rax), %rax
movb 0x2(%rax), %al
movb %al, -0x41(%rbp)
movsbq -0x41(%rbp), %rcx
movq 0xcdb7(%rip), %rax      # 0x22fb8
movsbl 0x80(%rax,%rcx), %eax
movl %eax, -0x48(%rbp)
cmpl $0x1, -0x48(%rbp)
je 0x1625a
cmpl $0x2, -0x48(%rbp)
je 0x1625a
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x22, %eax
jne 0x1623a
movq -0x10(%rbp), %rdi
leaq 0x9001(%rip), %rsi      # 0x1f230
xorl %eax, %eax
movl %eax, %edx
callq 0x44e0
jmp 0x1624e
movq -0x10(%rbp), %rdi
leaq 0x900e(%rip), %rsi      # 0x1f253
xorl %eax, %eax
movl %eax, %edx
callq 0x44e0
movl $0x1, -0x4(%rbp)
jmp 0x1631a
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0x16273
movq -0x40(%rbp), %rax
movb $0x0, (%rax)
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
movq -0x58(%rbp), %rax
movq 0x18(%rbp), %rcx
cmpq (%rcx), %rax
je 0x162e1
movl $0x0, -0x70(%rbp)
movl -0x70(%rbp), %eax
cmpl -0x50(%rbp), %eax
jg 0x162d6
movq 0x18(%rbp), %rax
movq (%rax), %rdx
movq 0x10(%rbp), %rax
movslq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x58(%rbp), %rcx
subq %rcx, %rax
addq %rax, %rdx
movq 0x10(%rbp), %rax
movslq -0x70(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
jmp 0x1629a
movq 0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x58(%rbp)
jmp 0x162e3
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x15e3c
jmp 0x162f3
movq -0x40(%rbp), %rcx
movq 0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movl -0x50(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)