// File: /workspace/github_c_makefile_star2_O0/haxlang[P]hax/haxVar.c
// Function: Hax_TraceVar2
int
Hax_TraceVar2(
    Hax_Interp *interp,		/* Interpreter in which variable is
				 * to be traced. */
    char *part1,		/* Name of scalar variable or array. */
    char *part2,		/* Name of element within array;  NULL means
				 * trace applies to scalar variable or array
				 * as-a-whole. */
    int flags,			/* OR-ed collection of bits, including any
				 * of HAX_TRACE_READS, HAX_TRACE_WRITES,
				 * HAX_TRACE_UNSETS, and HAX_GLOBAL_ONLY. */
    Hax_VarTraceProc *proc,	/* Procedure to call when specified ops are
				 * invoked upon varName. */
    ClientData clientData	/* Arbitrary argument to pass to proc. */)
{
    Hax_HashEntry *hPtr;
    Var *varPtr = NULL;		/* Initial value only used to stop compiler
				 * from complaining; not really needed. */
    Interp *iPtr = (Interp *) interp;
    Hax_Memoryp *memoryp = iPtr->memoryp;
    VarTrace *tracePtr;
    int newPtr;

    /*
     * Locate the variable, making a new (undefined) one if necessary.
     */

    if ((flags & HAX_GLOBAL_ONLY) || (iPtr->varFramePtr == NULL)) {
	hPtr = Hax_CreateHashEntry(interp, &iPtr->globalTable, part1, &newPtr);
    } else {
	hPtr = Hax_CreateHashEntry(interp, &iPtr->varFramePtr->varTable, part1,
		    &newPtr);
    }
    if (!newPtr) {
	varPtr = (Var *) Hax_GetHashValue(hPtr);
	if (varPtr->flags & VAR_UPVAR) {
	    hPtr = varPtr->value.upvarPtr;
	    varPtr = (Var *) Hax_GetHashValue(hPtr);
	}
    }

    /*
     * If the trace is to be on an array element, make sure that the
     * variable is an array variable.  If the variable doesn't exist
     * then define it as an empty array.  Then find the specific
     * array element.
     */

    if (part2 != NULL) {
	if (newPtr) {
	    varPtr = NewVar(interp, 0);
	    Hax_SetHashValue(hPtr, varPtr);
	    varPtr->flags = VAR_ARRAY;
	    varPtr->value.tablePtr = (Hax_HashTable *)
		    ckalloc(memoryp, sizeof(Hax_HashTable));
	    Hax_InitHashTable(varPtr->value.tablePtr, HAX_STRING_KEYS);
	} else {
	    if (varPtr->flags & VAR_UNDEFINED) {
		varPtr->flags = VAR_ARRAY;
		varPtr->value.tablePtr = (Hax_HashTable *)
			ckalloc(memoryp, sizeof(Hax_HashTable));
		Hax_InitHashTable(varPtr->value.tablePtr, HAX_STRING_KEYS);
	    } else if (!(varPtr->flags & VAR_ARRAY)) {
		iPtr->result = (char *) needArray;
		return HAX_ERROR;
	    }
	}
	hPtr = Hax_CreateHashEntry(interp, varPtr->value.tablePtr, part2,
			&newPtr);
    }

    if (newPtr) {
	if ((part2 != NULL) && (varPtr->searchPtr != NULL)) {
	    DeleteSearches(interp, varPtr);
	}
	varPtr = NewVar(interp, 0);
	varPtr->flags = VAR_UNDEFINED;
	Hax_SetHashValue(hPtr, varPtr);
    } else {
	varPtr = (Var *) Hax_GetHashValue(hPtr);
    }

    /*
     * Set up trace information.
     */

    tracePtr = (VarTrace *) ckalloc(memoryp, sizeof(VarTrace));
    tracePtr->traceProc = proc;
    tracePtr->clientData = clientData;
    tracePtr->flags = flags &
	    (HAX_TRACE_READS|HAX_TRACE_WRITES|HAX_TRACE_UNSETS);
    tracePtr->nextPtr = varPtr->tracePtr;
    varPtr->tracePtr = tracePtr;
    return HAX_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq 0x280(%rax), %rax
movq %rax, -0x58(%rbp)
movl -0x24(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x1ab27
movq -0x50(%rbp), %rax
cmpq $0x0, 0xc8(%rax)
jne 0x1ab4e
movq -0x50(%rbp), %rax
movq 0xb0(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x50(%rbp), %rsi
addq $0x68, %rsi
movq -0x18(%rbp), %rdx
leaq -0x64(%rbp), %rcx
callq *%rax
movq %rax, -0x40(%rbp)
jmp 0x1ab7a
movq -0x50(%rbp), %rax
movq 0xc8(%rax), %rax
movq 0x48(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x50(%rbp), %rcx
movq 0xc8(%rcx), %rsi
movq -0x18(%rbp), %rdx
leaq -0x64(%rbp), %rcx
callq *%rax
movq %rax, -0x40(%rbp)
cmpl $0x0, -0x64(%rbp)
jne 0x1abb5
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movl 0x20(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x1abb3
movq -0x48(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0x1abb5
cmpq $0x0, -0x20(%rbp)
je 0x1acc5
cmpl $0x0, -0x64(%rbp)
je 0x1ac22
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x1a1e0
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x48(%rbp), %rax
movl $0x1, 0x20(%rax)
movq -0x58(%rbp), %rdi
movl $0x50, %esi
leaq 0x4cb3(%rip), %rdx      # 0x1f8af
movl $0x374, %ecx            # imm = 0x374
callq 0x44c0
movq %rax, %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x48(%rbp), %rax
movq 0x28(%rax), %rdi
xorl %esi, %esi
callq 0x4590
jmp 0x1ac9f
movq -0x48(%rbp), %rax
movl 0x20(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x1ac72
movq -0x48(%rbp), %rax
movl $0x1, 0x20(%rax)
movq -0x58(%rbp), %rdi
movl $0x50, %esi
leaq 0x4c63(%rip), %rdx      # 0x1f8af
movl $0x37a, %ecx            # imm = 0x37A
callq 0x44c0
movq %rax, %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x48(%rbp), %rax
movq 0x28(%rax), %rdi
xorl %esi, %esi
callq 0x4590
jmp 0x1ac9d
movq -0x48(%rbp), %rax
movl 0x20(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x1ac9b
movq 0x8be0(%rip), %rcx      # 0x23868
movq -0x50(%rbp), %rax
movq %rcx, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0x1ad83
jmp 0x1ac9d
jmp 0x1ac9f
movq -0x48(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x48(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rcx
movq 0x28(%rcx), %rsi
movq -0x20(%rbp), %rdx
leaq -0x64(%rbp), %rcx
callq *%rax
movq %rax, -0x40(%rbp)
cmpl $0x0, -0x64(%rbp)
je 0x1ad12
cmpq $0x0, -0x20(%rbp)
je 0x1acea
movq -0x48(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x1acea
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x1a2a0
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x1a1e0
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movl $0x4, 0x20(%rax)
movq -0x48(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x18(%rax)
jmp 0x1ad1e
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x58(%rbp), %rdi
movl $0x20, %esi
leaq 0x4b81(%rip), %rdx      # 0x1f8af
movl $0x394, %ecx            # imm = 0x394
callq 0x44c0
movq %rax, -0x60(%rbp)
movq -0x30(%rbp), %rcx
movq -0x60(%rbp), %rax
movq %rcx, (%rax)
movq -0x38(%rbp), %rcx
movq -0x60(%rbp), %rax
movq %rcx, 0x8(%rax)
movl -0x24(%rbp), %ecx
andl $0x70, %ecx
movq -0x60(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x60(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x60(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x10(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax)