// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movl -0x24(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x19660
movq -0x40(%rbp), %rax
cmpq $0x0, 0xc8(%rax)
jne 0x1967f
movq -0x40(%rbp), %rax
movq 0xa8(%rax), %rax
movq -0x40(%rbp), %rdi
addq $0x68, %rdi
movq -0x18(%rbp), %rsi
callq *%rax
movq %rax, -0x30(%rbp)
jmp 0x196a3
movq -0x40(%rbp), %rax
movq 0xc8(%rax), %rax
movq 0x40(%rax), %rax
movq -0x40(%rbp), %rcx
movq 0xc8(%rcx), %rdi
movq -0x18(%rbp), %rsi
callq *%rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x196e3
movl -0x24(%rbp), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x196d6
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq 0xa196(%rip), %r8       # 0x23860
leaq 0x61d9(%rip), %rcx      # 0x1f8aa
callq 0x19900
movq $0x0, -0x8(%rbp)
jmp 0x198f5
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movl 0x20(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x19716
movq -0x38(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x19825
movq -0x38(%rbp), %rax
movl 0x20(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x19769
movl -0x24(%rbp), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x1975c
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq 0xa110(%rip), %r8       # 0x23860
leaq 0x6153(%rip), %rcx      # 0x1f8aa
callq 0x19900
movq $0x0, -0x8(%rbp)
jmp 0x198f5
movq -0x38(%rbp), %rax
movl 0x20(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x197b1
movl -0x24(%rbp), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x197a4
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq 0xa0d0(%rip), %r8       # 0x23868
leaq 0x610b(%rip), %rcx      # 0x1f8aa
callq 0x19900
movq $0x0, -0x8(%rbp)
jmp 0x198f5
jmp 0x197b3
movq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x38(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x40(%rax), %rax
movq -0x38(%rbp), %rcx
movq 0x28(%rcx), %rdi
movq -0x20(%rbp), %rsi
callq *%rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x19819
movl -0x24(%rbp), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x1980c
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq 0xa070(%rip), %r8       # 0x23870
leaq 0x60a3(%rip), %rcx      # 0x1f8aa
callq 0x19900
movq $0x0, -0x8(%rbp)
jmp 0x198f5
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x19842
cmpq $0x0, -0x48(%rbp)
je 0x198a4
movq -0x48(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x198a4
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
movl -0x24(%rbp), %r9d
andl $0x1, %r9d
orl $0x10, %r9d
callq 0x199a0
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
je 0x19898
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x50(%rbp), %r8
leaq 0x6021(%rip), %rcx      # 0x1f8aa
callq 0x19900
movq $0x0, -0x8(%rbp)
jmp 0x198f5
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movl 0x20(%rax), %eax
andl $0x7, %eax
cmpl $0x0, %eax
je 0x198e9
movl -0x24(%rbp), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x198df
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq 0x9f8d(%rip), %r8       # 0x23860
leaq 0x5fd0(%rip), %rcx      # 0x1f8aa
callq 0x19900
movq $0x0, -0x8(%rbp)
jmp 0x198f5
movq -0x38(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nop