// File: /workspace/github_c_makefile_star2_O2/haxlang[P]hax/haxCmdMZ.c
// Function: Hax_TraceCmd
int
Hax_TraceCmd(
    ClientData dummy,			/* Not used. */
    Hax_Interp *interp,			/* Current interpreter. */
    int argc,				/* Number of arguments. */
    char **argv				/* Argument strings. */)
{
    Interp *iPtr = (Interp *) interp;
    Hax_Memoryp *memoryp = iPtr->memoryp;
    char c;
    int length;

    if (argc < 2) {
	Hax_AppendResult(interp, "too few args: should be \"",
		argv[0], " option [arg arg ...]\"", (char *) NULL);
	return HAX_ERROR;
    }
    c = argv[1][1];
    length = strlen(argv[1]);
    if ((c == 'a') && (strncmp(argv[1], "variable", length) == 0)
	    && (length >= 2)) {
	char *p;
	int flags, length;
	TraceVarInfo *tvarPtr;

	if (argc != 5) {
	    Hax_AppendResult(interp, "wrong # args: should be \"",
		    argv[0], " variable name ops command\"", (char *) NULL);
	    return HAX_ERROR;
	}

	flags = 0;
	for (p = argv[3] ; *p != 0; p++) {
	    if (*p == 'r') {
		flags |= HAX_TRACE_READS;
	    } else if (*p == 'w') {
		flags |= HAX_TRACE_WRITES;
	    } else if (*p == 'u') {
		flags |= HAX_TRACE_UNSETS;
	    } else {
		goto badOps;
	    }
	}
	if (flags == 0) {
	    goto badOps;
	}

	length = strlen(argv[4]);
	tvarPtr = (TraceVarInfo *) ckalloc(memoryp, (unsigned)
		(sizeof(TraceVarInfo) - sizeof(tvarPtr->command) + length + 1));
	tvarPtr->flags = flags;
	tvarPtr->length = length;
	flags |= HAX_TRACE_UNSETS;
	strcpy(tvarPtr->command, argv[4]);
	if (Hax_TraceVar(interp, argv[2], flags, TraceVarProc,
		(ClientData) tvarPtr) != HAX_OK) {
	    ckfree(memoryp, (char *) tvarPtr);
	    return HAX_ERROR;
	}
    } else if ((c == 'd') && (strncmp(argv[1], "vdelete", length)
	    && (length >= 2)) == 0) {
	char *p;
	int flags, length;
	TraceVarInfo *tvarPtr;
	ClientData clientData;

	if (argc != 5) {
	    Hax_AppendResult(interp, "wrong # args: should be \"",
		    argv[0], " vdelete name ops command\"", (char *) NULL);
	    return HAX_ERROR;
	}

	flags = 0;
	for (p = argv[3] ; *p != 0; p++) {
	    if (*p == 'r') {
		flags |= HAX_TRACE_READS;
	    } else if (*p == 'w') {
		flags |= HAX_TRACE_WRITES;
	    } else if (*p == 'u') {
		flags |= HAX_TRACE_UNSETS;
	    } else {
		goto badOps;
	    }
	}
	if (flags == 0) {
	    goto badOps;
	}

	/*
	 * Search through all of our traces on this variable to
	 * see if there's one with the given command.  If so, then
	 * delete the first one that matches.
	 */

	length = strlen(argv[4]);
	clientData = 0;
	while ((clientData = Hax_VarTraceInfo(interp, argv[2], 0,
		TraceVarProc, clientData)) != 0) {
	    tvarPtr = (TraceVarInfo *) clientData;
	    if ((tvarPtr->length == length) && (tvarPtr->flags == flags)
		    && (strncmp(argv[4], tvarPtr->command, length) == 0)) {
		Hax_UntraceVar(interp, argv[2], flags | HAX_TRACE_UNSETS,
			TraceVarProc, clientData);
		ckfree(memoryp, (char *) tvarPtr);
		break;
	    }
	}
    } else if ((c == 'i') && (strncmp(argv[1], "vinfo", length) == 0)
	    && (length >= 2)) {
	ClientData clientData;
	char ops[4], *p;
	char *prefix = (char *) "{";

	if (argc != 3) {
	    Hax_AppendResult(interp, "wrong # args: should be \"",
		    argv[0], " vinfo name\"", (char *) NULL);
	    return HAX_ERROR;
	}
	clientData = 0;
	while ((clientData = Hax_VarTraceInfo(interp, argv[2], 0,
		TraceVarProc, clientData)) != 0) {
	    TraceVarInfo *tvarPtr = (TraceVarInfo *) clientData;
	    p = ops;
	    if (tvarPtr->flags & HAX_TRACE_READS) {
		*p = 'r';
		p++;
	    }
	    if (tvarPtr->flags & HAX_TRACE_WRITES) {
		*p = 'w';
		p++;
	    }
	    if (tvarPtr->flags & HAX_TRACE_UNSETS) {
		*p = 'u';
		p++;
	    }
	    *p = '\0';
	    Hax_AppendResult(interp, prefix, (char *) NULL);
	    Hax_AppendElement(interp, ops, 1);
	    Hax_AppendElement(interp, tvarPtr->command, 0);
	    Hax_AppendResult(interp, "}", (char *) NULL);
	    prefix = (char *) " {";
	}
    } else {
	Hax_AppendResult(interp, "bad option \"", argv[1],
		"\": should be variable, vdelete, or vinfo",
		(char *) NULL);
	return HAX_ERROR;
    }
    return HAX_OK;

    badOps:
    Hax_AppendResult(interp, "bad operations \"", argv[3],
	    "\": should be one or more of rwu", (char *) NULL);
    return HAX_ERROR;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %r14
movq %rsi, %rbx
cmpl $0x1, %edx
jg 0xa94b
movq (%r14), %rdx
leaq 0x9b40(%rip), %rsi      # 0x1447c
leaq 0x9b53(%rip), %rcx      # 0x14496
movq %rbx, %rdi
jmp 0xab6e
movl %edx, %ebp
movq 0x280(%rbx), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%r14), %r12
movzbl 0x1(%r12), %r15d
movq %r12, %rdi
callq 0x41d0
movq %rax, %r13
cmpl $0x69, %r15d
je 0xaa73
cmpl $0x64, %r15d
je 0xaa02
cmpl $0x61, %r15d
jne 0xab5a
movslq %r13d, %rdx
leaq 0xa9e1(%rip), %rsi      # 0x15377
movq %r12, %rdi
callq 0x40c0
testl %eax, %eax
sete %al
cmpl $0x2, %r13d
setge %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xab5a
cmpl $0x5, %ebp
jne 0xac63
movq 0x18(%r14), %rdx
xorl %ebp, %ebp
pushq $0x10
popq %rax
pushq $0x40
popq %rcx
pushq $0x20
popq %rsi
movq %rdx, %rdi
movq 0x8(%rsp), %r13
movzbl (%rdi), %r8d
movl %eax, %r9d
cmpl $0x72, %r8d
je 0xa9fa
cmpl $0x75, %r8d
je 0xa9f7
cmpl $0x77, %r8d
jne 0xac79
movl %esi, %r9d
jmp 0xa9fa
movl %ecx, %r9d
orl %r9d, %ebp
incq %rdi
jmp 0xa9d5
movslq %r13d, %rdx
leaq 0x9abd(%rip), %rsi      # 0x144c9
movq %r12, %rdi
callq 0x40c0
testl %eax, %eax
sete %al
cmpl $0x2, %r13d
setl %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0xab5a
cmpl $0x5, %ebp
jne 0xab8e
movq 0x18(%r14), %rdx
xorl %ebp, %ebp
pushq $0x10
popq %rax
pushq $0x40
popq %rcx
pushq $0x20
popq %rsi
movq %rdx, %rdi
movzbl (%rdi), %r8d
movl %eax, %r9d
cmpl $0x72, %r8d
je 0xaa6b
cmpl $0x75, %r8d
je 0xaa68
cmpl $0x77, %r8d
jne 0xaba4
movl %esi, %r9d
jmp 0xaa6b
movl %ecx, %r9d
orl %r9d, %ebp
incq %rdi
jmp 0xaa46
movslq %r13d, %rdx
leaq 0x9aa4(%rip), %rsi      # 0x14521
movq %r12, %rdi
callq 0x40c0
testl %eax, %eax
sete %al
cmpl $0x2, %r13d
setge %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xab5a
cmpl $0x3, %ebp
jne 0xac4d
leaq 0x9a50(%rip), %r13      # 0x144fc
leaq 0x4(%rsp), %r12
leaq 0x9a43(%rip), %r15      # 0x144fb
xorl %ebp, %ebp
movq 0x10(%r14), %rsi
movq %rbx, %rdi
xorl %edx, %edx
leaq 0x247(%rip), %rcx       # 0xad11
movq %rbp, %r8
callq 0x44f0
testq %rax, %rax
je 0xad09
movq %rax, %rbp
movl (%rax), %ecx
movq %r12, %rax
testb $0x10, %cl
je 0xaaf5
movb $0x72, 0x4(%rsp)
movl (%rbp), %ecx
leaq 0x5(%rsp), %rax
testb $0x20, %cl
je 0xab03
movb $0x77, (%rax)
incq %rax
movl (%rbp), %ecx
testb $0x40, %cl
je 0xab0e
movb $0x75, (%rax)
incq %rax
movb $0x0, (%rax)
movq %rbx, %rdi
movq %r13, %rsi
xorl %edx, %edx
xorl %eax, %eax
callq 0x4520
movq %rbx, %rdi
movq %r12, %rsi
pushq $0x1
popq %rdx
callq 0x4050
movq %rbp, %rsi
addq $0x8, %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x4050
movq %rbx, %rdi
leaq 0x99b0(%rip), %rsi      # 0x144f9
xorl %edx, %edx
xorl %eax, %eax
callq 0x4520
movq %r15, %r13
jmp 0xaaba
leaq 0x8bbc(%rip), %rsi      # 0x1371d
leaq 0x9996(%rip), %rcx      # 0x144fe
movq %rbx, %rdi
movq %r12, %rdx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x4520
pushq $0x1
popq %r12
movl %r12d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%r14), %rdx
leaq 0x8cc8(%rip), %rsi      # 0x13860
leaq 0x9932(%rip), %rcx      # 0x144d1
jmp 0xa943
testl %r8d, %r8d
jne 0xacf6
testl %ebp, %ebp
je 0xacf6
movq 0x20(%r14), %rdi
callq 0x41d0
movq %rax, %r15
movslq %r15d, %rax
movq %rax, 0x10(%rsp)
xorl %r12d, %r12d
xorl %r13d, %r13d
movq 0x10(%r14), %rsi
movq %rbx, %rdi
xorl %edx, %edx
leaq 0x132(%rip), %rcx       # 0xad11
movq %r13, %r8
callq 0x44f0
testq %rax, %rax
je 0xab7c
movq %rax, %r13
cmpl %r15d, 0x4(%rax)
jne 0xabcf
cmpl %ebp, (%r13)
jne 0xabcf
movq 0x20(%r14), %rdi
movq %r13, %rsi
addq $0x8, %rsi
movq 0x10(%rsp), %rdx
callq 0x40c0
testl %eax, %eax
jne 0xabcf
movq 0x10(%r14), %rsi
orl $0x40, %ebp
leaq 0xef(%rip), %rcx        # 0xad11
movq %rbx, %rdi
movl %ebp, %edx
movq %r13, %r8
callq 0x4230
leaq 0x948c(%rip), %rdx      # 0x140c2
movq 0x8(%rsp), %rdi
movq %r13, %rsi
movl $0x4c5, %ecx            # imm = 0x4C5
callq 0x4280
jmp 0xab7c
movq (%r14), %rdx
leaq 0x8c09(%rip), %rsi      # 0x13860
leaq 0x988e(%rip), %rcx      # 0x144ec
jmp 0xa943
movq (%r14), %rdx
leaq 0x8bf3(%rip), %rsi      # 0x13860
leaq 0x9839(%rip), %rcx      # 0x144ad
jmp 0xa943
testl %r8d, %r8d
jne 0xacf6
testl %ebp, %ebp
je 0xacf6
movq 0x20(%r14), %rdi
callq 0x41d0
movq %rax, %r12
leal 0x9(%rax), %esi
leaq 0x942a(%rip), %rdx      # 0x140c2
movq %r13, %rdi
movl $0x48f, %ecx            # imm = 0x48F
callq 0x44e0
movq %rax, %r15
movl %ebp, (%rax)
movl %r12d, 0x4(%rax)
orl $0x40, %ebp
leaq 0x8(%rax), %rdi
movq 0x20(%r14), %rsi
callq 0x40f0
movq 0x10(%r14), %rsi
leaq 0x48(%rip), %rcx        # 0xad11
movq %rbx, %rdi
movl %ebp, %edx
movq %r15, %r8
callq 0x43b0
testl %eax, %eax
je 0xad09
leaq 0x93e1(%rip), %rdx      # 0x140c2
movq %r13, %rdi
movq %r15, %rsi
movl $0x496, %ecx            # imm = 0x496
callq 0x4280
jmp 0xab78
leaq 0x982a(%rip), %rsi      # 0x14527
leaq 0x9834(%rip), %rcx      # 0x14538
jmp 0xa943
xorl %r12d, %r12d
jmp 0xab7c