// File: /workspace/github_c_makefile_star2_O0/haxlang[P]hax/haxParse.c
// Function: Hax_ParseVar
char *
Hax_ParseVar(
    Hax_Interp *interp,			/* Context for looking up variable. */
    char *string,		/* String containing variable name.
					 * First character must be "$". */
    char **termPtr			/* If non-NULL, points to word to fill
					 * in with character just after last
					 * one in the variable specifier. */)
{
    Interp *iPtr = (Interp *) interp;
    Hax_Memoryp *memoryp = iPtr->memoryp;
    char *name1, *name1End, c, *result;
    char *name2;
#define NUM_CHARS 200
    char copyStorage[NUM_CHARS];
    ParseValue pv;
    const char *ellipsis = "";		/* Used in setting errorInfo variable;
					 * set to "..." to indicate that not
					 * all of offending command is included
					 * in errorInfo.  "" means that the
					 * command is all there. */

    /*
     * There are three cases:
     * 1. The $ sign is followed by an open curly brace.  Then the variable
     *    name is everything up to the next close curly brace, and the
     *    variable is a scalar variable.
     * 2. The $ sign is not followed by an open curly brace.  Then the
     *    variable name is everything up to the next character that isn't
     *    a letter, digit, or underscore.  If the following character is an
     *    open parenthesis, then the information between parentheses is
     *    the array element name, which can include any of the substitutions
     *    permissible between quotes.
     * 3. The $ sign is followed by something that isn't a letter, digit,
     *    or underscore:  in this case, there is no variable name, and "$"
     *    is returned.
     */

    name2 = NULL;
    string++;
    if (*string == '{') {
	string++;
	name1 = string;
	while (*string != '}') {
	    if (*string == 0) {
		Hax_SetResult(interp,
			(char *) "missing close-brace for variable name",
			HAX_STATIC);
		if (termPtr != 0) {
		    *termPtr = string;
		}
		return NULL;
	    }
	    string++;
	}
	name1End = string;
	string++;
    } else {
	name1 = string;
	while (isalnum(*string) || (*string == '_')) {
	    string++;
	}
	if (string == name1) {
	    if (termPtr != 0) {
		*termPtr = string;
	    }
	    return (char *) "$";
	}
	name1End = string;
	if (*string == '(') {
	    char *end;

	    /*
	     * Perform substitutions on the array element name, just as
	     * is done for quotes.
	     */

	    pv.buffer = pv.next = copyStorage;
	    pv.end = copyStorage + NUM_CHARS - 1;
	    pv.expandProc = HaxExpandParseValue;
	    pv.clientData = (ClientData) NULL;
	    if (HaxParseQuotes(interp, string+1, ')', 0, &end, &pv)
		    != HAX_OK) {
		char msg[100];
		int n = (int) (string - name1);
		if (n > sizeof(msg)) {
			n = sizeof(msg);
			ellipsis = " ...";
		}
		sprintf(msg, "\n    (parsing index for array \"%.*s%s\")",
			n, name1, ellipsis);
		Hax_AddErrorInfo(interp, msg);
		result = NULL;
		name2 = pv.buffer;
		if (termPtr != 0) {
		    *termPtr = end;
		}
		goto done;
	    }
	    string = end;
	    name2 = pv.buffer;
	}
    }
    if (termPtr != 0) {
	*termPtr = string;
    }

    if (((Interp *) interp)->noEval) {
	return (char *) "";
    }
    c = *name1End;
    *name1End = 0;
    result = Hax_GetVar2(interp, name1, name2, HAX_LEAVE_ERR_MSG);
    *name1End = c;

    done:
    if ((name2 != NULL) && (pv.buffer != copyStorage)) {
	ckfree(memoryp, pv.buffer);
    }
    return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1d0, %rsp            # imm = 0x1D0
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq 0x280(%rax), %rax
movq %rax, -0x30(%rbp)
leaq 0x977e(%rip), %rax      # 0x1ee73
movq %rax, -0x150(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x7b, %eax
jne 0x157a6
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x7d, %eax
je 0x1578d
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x1577f
movq -0x10(%rbp), %rdi
leaq 0x9b1f(%rip), %rsi      # 0x1f276
xorl %eax, %eax
movl %eax, %edx
callq 0x44e0
cmpq $0x0, -0x20(%rbp)
je 0x15772
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq $0x0, -0x8(%rbp)
jmp 0x15a05
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x15734
movq -0x18(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x15968
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
callq 0x4630
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %ecx
andl $0x8, %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, -0x1c5(%rbp)
jne 0x157e7
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5f, %eax
sete %al
movb %al, -0x1c5(%rbp)
movb -0x1c5(%rbp), %al
testb $0x1, %al
jne 0x157f3
jmp 0x15801
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x157ae
movq -0x18(%rbp), %rax
cmpq -0x38(%rbp), %rax
jne 0x1582d
cmpq $0x0, -0x20(%rbp)
je 0x1581d
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
leaq 0x9a78(%rip), %rax      # 0x1f29c
movq %rax, -0x8(%rbp)
jmp 0x15a05
movq -0x18(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x28, %eax
jne 0x15966
leaq -0x120(%rbp), %rax
movq %rax, -0x140(%rbp)
movq %rax, -0x148(%rbp)
leaq -0x120(%rbp), %rax
addq $0xc8, %rax
addq $-0x1, %rax
movq %rax, -0x138(%rbp)
movq 0xd767(%rip), %rax      # 0x22fe0
movq %rax, -0x130(%rbp)
movq $0x0, -0x128(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x1, %rsi
movl $0x29, %edx
xorl %ecx, %ecx
leaq -0x158(%rbp), %r8
leaq -0x148(%rbp), %r9
callq 0x4470
cmpl $0x0, %eax
je 0x15950
movq -0x18(%rbp), %rax
movq -0x38(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x1c4(%rbp)
movslq -0x1c4(%rbp), %rax
cmpq $0x64, %rax
jbe 0x158f0
movl $0x64, -0x1c4(%rbp)
leaq 0x79ee(%rip), %rax      # 0x1d2d7
movq %rax, -0x150(%rbp)
leaq -0x1c0(%rbp), %rdi
movl -0x1c4(%rbp), %edx
movq -0x38(%rbp), %rcx
movq -0x150(%rbp), %r8
leaq 0x998f(%rip), %rsi      # 0x1f29e
movb $0x0, %al
callq 0x45d0
movq -0x10(%rbp), %rdi
leaq -0x1c0(%rbp), %rsi
callq 0x43f0
movq $0x0, -0x50(%rbp)
movq -0x148(%rbp), %rax
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x1594e
movq -0x158(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
jmp 0x159c7
movq -0x158(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x148(%rbp), %rax
movq %rax, -0x58(%rbp)
jmp 0x15968
cmpq $0x0, -0x20(%rbp)
je 0x1597a
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x194(%rax)
je 0x15994
leaq 0x94e5(%rip), %rax      # 0x1ee73
movq %rax, -0x8(%rbp)
jmp 0x15a05
movq -0x40(%rbp), %rax
movb (%rax), %al
movb %al, -0x41(%rbp)
movq -0x40(%rbp), %rax
movb $0x0, (%rax)
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x58(%rbp), %rdx
movl $0x200, %ecx            # imm = 0x200
callq 0x44a0
movq %rax, -0x50(%rbp)
movb -0x41(%rbp), %cl
movq -0x40(%rbp), %rax
movb %cl, (%rax)
cmpq $0x0, -0x58(%rbp)
je 0x159fd
movq -0x148(%rbp), %rax
leaq -0x120(%rbp), %rcx
cmpq %rcx, %rax
je 0x159fd
movq -0x30(%rbp), %rdi
movq -0x148(%rbp), %rsi
leaq 0x9808(%rip), %rdx      # 0x1f1fb
movl $0x4c2, %ecx            # imm = 0x4C2
callq 0x4260
movq -0x50(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbp
retq
nopw %cs:(%rax,%rax)