// File: /workspace/github_c_makefile_star2_O2/haxlang[P]hax/haxVar.c
// Function: Hax_GetVar2
char *
Hax_GetVar2(
    Hax_Interp *interp,		/* Command interpreter in which variable is
				 * to be looked up. */
    char *part1,		/* Name of array (if part2 is NULL) or
				 * name of variable. */
    char *part2,		/* If non-null, gives name of element in
				 * array. */
    int flags			/* OR-ed combination of HAX_GLOBAL_ONLY
				 * or HAX_LEAVE_ERR_MSG bits. */)
{
    Hax_HashEntry *hPtr;
    Var *varPtr;
    Interp *iPtr = (Interp *) interp;
    Var *arrayPtr = NULL;

    /*
     * Lookup the first name.
     */

    if ((flags & HAX_GLOBAL_ONLY) || (iPtr->varFramePtr == NULL)) {
	hPtr = Hax_FindHashEntry(&iPtr->globalTable, part1);
    } else {
	hPtr = Hax_FindHashEntry(&iPtr->varFramePtr->varTable, part1);
    }
    if (hPtr == NULL) {
	if (flags & HAX_LEAVE_ERR_MSG) {
	    VarErrMsg(interp, part1, part2, (char *) "read",
		(char *) noSuchVar);
	}
	return NULL;
    }
    varPtr = (Var *) Hax_GetHashValue(hPtr);
    if (varPtr->flags & VAR_UPVAR) {
	hPtr = varPtr->value.upvarPtr;
	varPtr = (Var *) Hax_GetHashValue(hPtr);
    }

    /*
     * If this is an array reference, then remember the traces on the array
     * and lookup the element within the array.
     */

    if (part2 != NULL) {
	if (varPtr->flags & VAR_UNDEFINED) {
	    if (flags & HAX_LEAVE_ERR_MSG) {
		VarErrMsg(interp, part1, part2, (char *) "read",
		    (char *) noSuchVar);
	    }
	    return NULL;
	} else if (!(varPtr->flags & VAR_ARRAY)) {
	    if (flags & HAX_LEAVE_ERR_MSG) {
		VarErrMsg(interp, part1, part2, (char *) "read",
		    (char *) needArray);
	    }
	    return NULL;
	}
	arrayPtr = varPtr;
	hPtr = Hax_FindHashEntry(varPtr->value.tablePtr, part2);
	if (hPtr == NULL) {
	    if (flags & HAX_LEAVE_ERR_MSG) {
		VarErrMsg(interp, part1, part2, (char *) "read",
		    (char *) noSuchElement);
	    }
	    return NULL;
	}
	varPtr = (Var *) Hax_GetHashValue(hPtr);
    }

    /*
     * Invoke any traces that have been set for the variable.
     */

    if ((varPtr->tracePtr != NULL)
	    || ((arrayPtr != NULL) && (arrayPtr->tracePtr != NULL))) {
	char *msg;

	msg = CallTraces(iPtr, arrayPtr, hPtr, part1, part2,
		(flags & HAX_GLOBAL_ONLY) | HAX_TRACE_READS);
	if (msg != NULL) {
	    VarErrMsg(interp, part1, part2, (char *) "read", msg);
	    return NULL;
	}

	/*
	 * Watch out!  The variable could have gotten re-allocated to
	 * a larger size.  Fortunately the hash table entry will still
	 * be around.
	 */

	varPtr = (Var *) Hax_GetHashValue(hPtr);
    }
    if (varPtr->flags & (VAR_UNDEFINED|VAR_UPVAR|VAR_ARRAY)) {
	if (flags & HAX_LEAVE_ERR_MSG) {
	    VarErrMsg(interp, part1, part2, (char *) "read",
		(char *) noSuchVar);
	}
	return NULL;
    }
    return varPtr->value.string;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
testb $0x1, %bpl
jne 0x10cbd
movq 0xc8(%r15), %rdi
testq %rdi, %rdi
je 0x10cbd
leaq 0x40(%rdi), %rax
jmp 0x10cc8
leaq 0x68(%r15), %rdi
leaq 0xa8(%r15), %rax
movq %r14, %rsi
callq *(%rax)
testq %rax, %rax
je 0x10dbe
movq %rax, %r13
movq 0x18(%rax), %r12
testb $0x2, 0x20(%r12)
je 0x10cee
movq 0x28(%r12), %r13
movq 0x18(%r13), %r12
testq %rbx, %rbx
je 0x10d21
movl 0x20(%r12), %eax
testb $0x4, %al
jne 0x10dbe
testb $0x1, %al
jne 0x10d31
btl $0x9, %ebp
jae 0x10de0
leaq 0x4479(%rip), %rcx      # 0x1518e
leaq 0x4664(%rip), %r8       # 0x15380
jmp 0x10dd2
cmpq $0x0, 0x10(%r12)
je 0x10db6
xorl %esi, %esi
jmp 0x10d7c
movq 0x28(%r12), %rdi
movq %rbx, %rsi
callq *0x40(%rdi)
testq %rax, %rax
je 0x10d54
movq %rax, %r13
movq 0x18(%rax), %rax
cmpq $0x0, 0x10(%rax)
je 0x10d6e
movq %r12, %rsi
jmp 0x10d7c
btl $0x9, %ebp
jae 0x10de0
leaq 0x4429(%rip), %rcx      # 0x1518e
leaq 0x4629(%rip), %r8       # 0x15395
jmp 0x10dd2
cmpq $0x0, 0x10(%r12)
movq %r12, %rsi
movq %rax, %r12
je 0x10db6
movl %ebp, %r9d
andl $0x1, %r9d
orl $0x10, %r9d
movq %r15, %rdi
movq %r13, %rdx
movq %r14, %rcx
movq %rbx, %r8
callq 0x10e7b
testq %rax, %rax
je 0x10db2
leaq 0x43ea(%rip), %rcx      # 0x1518e
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %rax, %r8
jmp 0x10ddb
movq 0x18(%r13), %r12
testb $0x7, 0x20(%r12)
je 0x10df5
btl $0x9, %ebp
jae 0x10de0
leaq 0x43c3(%rip), %rcx      # 0x1518e
leaq 0x459d(%rip), %r8       # 0x1536f
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x10dfb
xorl %r12d, %r12d
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq $0x28, %r12
jmp 0x10de3