// File: /workspace/github_c_makefile_star2_O2/haxlang[P]hax/haxVar.c
// Function: Hax_UntraceVar2
void
Hax_UntraceVar2(
    Hax_Interp *interp,		/* Interpreter containing traced variable. */
    char *part1,		/* Name of 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 describing
				 * current trace, including any of
				 * HAX_TRACE_READS, HAX_TRACE_WRITES,
				 * HAX_TRACE_UNSETS, and HAX_GLOBAL_ONLY. */
    Hax_VarTraceProc *proc,	/* Procedure assocated with trace. */
    ClientData clientData	/* Arbitrary argument to pass to proc. */)
{
    VarTrace *tracePtr;
    VarTrace *prevPtr;
    Var *varPtr;
    Interp *iPtr = (Interp *) interp;
    Hax_Memoryp *memoryp = iPtr->memoryp;
    Hax_HashEntry *hPtr;
    ActiveVarTrace *activePtr;

    /*
     * First, lookup the variable.
     */

    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) {
	return;
    }
    varPtr = (Var *) Hax_GetHashValue(hPtr);
    if (varPtr->flags & VAR_UPVAR) {
	hPtr = varPtr->value.upvarPtr;
	varPtr = (Var *) Hax_GetHashValue(hPtr);
    }
    if (part2 != NULL) {
	if (!(varPtr->flags & VAR_ARRAY)) {
	    return;
	}
	hPtr = Hax_FindHashEntry(varPtr->value.tablePtr, part2);
	if (hPtr == NULL) {
	    return;
	}
	varPtr = (Var *) Hax_GetHashValue(hPtr);
    }

    flags &= (HAX_TRACE_READS | HAX_TRACE_WRITES | HAX_TRACE_UNSETS);
    for (tracePtr = varPtr->tracePtr, prevPtr = NULL; ;
	    prevPtr = tracePtr, tracePtr = tracePtr->nextPtr) {
	if (tracePtr == NULL) {
	    return;
	}
	if ((tracePtr->traceProc == proc) && (tracePtr->flags == flags)
		&& (tracePtr->clientData == clientData)) {
	    break;
	}
    }

    /*
     * The code below makes it possible to delete traces while traces
     * are active:  it makes sure that the deleted trace won't be
     * processed by CallTraces.
     */

    for (activePtr = iPtr->activeTracePtr; activePtr != NULL;
	    activePtr = activePtr->nextPtr) {
	if (activePtr->nextTracePtr == tracePtr) {
	    activePtr->nextTracePtr = tracePtr->nextPtr;
	}
    }
    if (prevPtr == NULL) {
	varPtr->tracePtr = tracePtr->nextPtr;
    } else {
	prevPtr->nextPtr = tracePtr->nextPtr;
    }
    ckfree(memoryp, (char *) tracePtr);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %r15
movq %r8, %r12
movl %ecx, %ebp
movq %rdx, %r13
movq %rdi, %rbx
testb $0x1, %bpl
jne 0x11a56
movq 0xc8(%rbx), %rdi
testq %rdi, %rdi
je 0x11a56
leaq 0x40(%rdi), %rax
jmp 0x11a61
leaq 0x68(%rbx), %rdi
leaq 0xa8(%rbx), %rax
movq 0x280(%rbx), %r14
callq *(%rax)
testq %rax, %rax
je 0x11acc
movq 0x18(%rax), %rax
testb $0x2, 0x20(%rax)
je 0x11a81
movq 0x28(%rax), %rax
movq 0x18(%rax), %rax
testq %r13, %r13
je 0x11a9f
testb $0x1, 0x20(%rax)
je 0x11acc
movq 0x28(%rax), %rdi
movq %r13, %rsi
callq *0x40(%rdi)
testq %rax, %rax
je 0x11acc
movq 0x18(%rax), %rax
andl $0x70, %ebp
addq $0x10, %rax
xorl %ecx, %ecx
movq %rax, %rdx
movq (%rdx), %rsi
testq %rsi, %rsi
je 0x11acc
cmpq %r12, (%rsi)
jne 0x11ac3
cmpl %ebp, 0x10(%rsi)
jne 0x11ac3
cmpq %r15, 0x8(%rsi)
je 0x11adb
leaq 0x18(%rsi), %rdx
movq %rsi, %rcx
jmp 0x11aab
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq $0xd0, %rbx
movq (%rbx), %rbx
testq %rbx, %rbx
je 0x11afa
cmpq %rsi, 0x8(%rbx)
jne 0x11ae2
movq 0x18(%rsi), %rdx
movq %rdx, 0x8(%rbx)
jmp 0x11ae2
leaq 0x18(%rcx), %rdx
testq %rcx, %rcx
movq 0x18(%rsi), %rcx
cmoveq %rax, %rdx
movq %rcx, (%rdx)
leaq 0x3680(%rip), %rdx      # 0x15193
movq %r14, %rdi
movl $0x43c, %ecx            # imm = 0x43C
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4280