// File: /workspace/github_c_makefile_star2_O1/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 0xb6fe
movq (%r14), %rdx
leaq 0xafad(%rip), %rsi      # 0x1669c
leaq 0xafc0(%rip), %rcx      # 0x166b6
movq %rbx, %rdi
jmp 0xb94b
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 0xb83a
cmpl $0x64, %r15d
je 0xb7c4
cmpl $0x61, %r15d
jne 0xb937
movslq %r13d, %rdx
leaq 0xbf5a(%rip), %rsi      # 0x176a3
movq %r12, %rdi
callq 0x40c0
testl %eax, %eax
sete %al
cmpl $0x2, %r13d
setge %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xb7b0
cmpl $0x5, %ebp
jne 0xb9bf
movq 0x18(%r14), %rax
xorl %ebp, %ebp
movq 0x8(%rsp), %r15
movzbl (%rax), %ecx
cmpl $0x74, %ecx
jle 0xb795
cmpl $0x75, %ecx
je 0xb7a4
cmpl $0x77, %ecx
jne 0xbb1a
movl $0x20, %edx
jmp 0xb7a9
movl $0x10, %edx
cmpl $0x72, %ecx
je 0xb7a9
jmp 0xba9e
movl $0x40, %edx
orl %edx, %ebp
incq %rax
jmp 0xb778
cmpl $0x69, %r15d
je 0xb83a
cmpl $0x64, %r15d
jne 0xb937
movslq %r13d, %rdx
leaq 0xaf1b(%rip), %rsi      # 0x166e9
movq %r12, %rdi
callq 0x40c0
testl %eax, %eax
sete %al
cmpl $0x2, %r13d
setl %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0xb830
cmpl $0x5, %ebp
jne 0xb996
movq 0x18(%r14), %rax
xorl %ebp, %ebp
movzbl (%rax), %ecx
cmpl $0x74, %ecx
jle 0xb815
cmpl $0x75, %ecx
je 0xb824
cmpl $0x77, %ecx
jne 0xba7b
movl $0x20, %edx
jmp 0xb829
movl $0x10, %edx
cmpl $0x72, %ecx
je 0xb829
jmp 0xb9e7
movl $0x40, %edx
orl %edx, %ebp
incq %rax
jmp 0xb7f8
cmpl $0x69, %r15d
jne 0xb937
movslq %r13d, %rdx
leaq 0xaefd(%rip), %rsi      # 0x16741
movq %r12, %rdi
callq 0x40c0
testl %eax, %eax
sete %al
cmpl $0x2, %r13d
setge %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xb937
cmpl $0x3, %ebp
jne 0xb969
movq 0x10(%r14), %rsi
leaq 0x318(%rip), %rcx       # 0xbb8f
movq %rbx, %rdi
xorl %edx, %edx
xorl %r8d, %r8d
callq 0x44d0
testq %rax, %rax
je 0xb987
movq %rax, %r15
leaq 0xae85(%rip), %rsi      # 0x1671c
leaq 0x4(%rsp), %r12
leaq 0xae78(%rip), %r13      # 0x1671b
testb $0x10, (%r15)
movq %r12, %rax
je 0xb8b6
movb $0x72, 0x4(%rsp)
leaq 0x5(%rsp), %rax
testb $0x20, (%r15)
je 0xb8c2
movb $0x77, (%rax)
incq %rax
testb $0x40, (%r15)
je 0xb8ce
movb $0x75, (%rax)
incq %rax
movb $0x0, (%rax)
movq %rbx, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0x4500
movq %rbx, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x4050
leaq 0x8(%r15), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x4050
movq %rbx, %rdi
leaq 0xae14(%rip), %rsi      # 0x16719
xorl %edx, %edx
xorl %eax, %eax
callq 0x4500
movq 0x10(%r14), %rsi
movq %rbx, %rdi
xorl %edx, %edx
leaq 0x271(%rip), %rcx       # 0xbb8f
movq %r15, %r8
callq 0x44d0
movq %rax, %r15
movq %r13, %rsi
testq %rax, %rax
jne 0xb8a3
jmp 0xb987
leaq 0x9ddf(%rip), %rsi      # 0x1571d
leaq 0xadd9(%rip), %rcx      # 0x1671e
movq %rbx, %rdi
movq %r12, %rdx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x4500
movl $0x1, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%r14), %rdx
leaq 0x9f01(%rip), %rsi      # 0x15874
leaq 0xad92(%rip), %rcx      # 0x1670c
movq %rbx, %rdi
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x4500
movl $0x1, %eax
cmpl $0x3, %ebp
jne 0xb95a
jmp 0xbb48
movq (%r14), %rdx
leaq 0x9ed4(%rip), %rsi      # 0x15874
leaq 0xad4a(%rip), %rcx      # 0x166f1
movq %rbx, %rdi
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x4500
movl $0x1, %r15d
jmp 0xba81
movq (%r14), %rdx
leaq 0x9eab(%rip), %rsi      # 0x15874
leaq 0xacfd(%rip), %rcx      # 0x166cd
movq %rbx, %rdi
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x4500
movl $0x1, %ecx
jmp 0xbb1f
testl %ecx, %ecx
jne 0xba7b
testl %ebp, %ebp
je 0xba7b
movq 0x20(%r14), %rdi
callq 0x41d0
movq %rax, %r13
movq 0x10(%r14), %rsi
leaq 0x181(%rip), %rcx       # 0xbb8f
xorl %r15d, %r15d
movq %rbx, %rdi
xorl %edx, %edx
xorl %r8d, %r8d
callq 0x44d0
testq %rax, %rax
je 0xba81
movq %rax, %r12
movslq %r13d, %rax
movq %rax, 0x10(%rsp)
cmpl %r13d, 0x4(%r12)
jne 0xba56
cmpl %ebp, (%r12)
jne 0xba56
movq 0x20(%r14), %rdi
leaq 0x8(%r12), %rsi
movq 0x10(%rsp), %rdx
callq 0x40c0
testl %eax, %eax
je 0xbb53
movq 0x10(%r14), %rsi
xorl %r15d, %r15d
movq %rbx, %rdi
xorl %edx, %edx
leaq 0x126(%rip), %rcx       # 0xbb8f
movq %r12, %r8
callq 0x44d0
movq %rax, %r12
testq %rax, %rax
jne 0xba2e
jmp 0xba81
movl $0x5, %r15d
testl %r15d, %r15d
je 0xbb48
movl $0x1, %eax
cmpl $0x5, %r15d
je 0xbb31
jmp 0xb95a
testl %ecx, %ecx
jne 0xbb1a
testl %ebp, %ebp
je 0xbb1a
movq 0x20(%r14), %rdi
callq 0x41d0
movq %rax, %r13
leal 0x9(%rax), %esi
leaq 0xa826(%rip), %rdx      # 0x162e2
movq %r15, %rdi
movl $0x48f, %ecx            # imm = 0x48F
callq 0x44c0
movq %rax, %r12
movl %ebp, (%rax)
movl %r13d, 0x4(%rax)
orl $0x40, %ebp
leaq 0x8(%rax), %rdi
movq 0x20(%r14), %rsi
callq 0x40f0
movq 0x10(%r14), %rsi
leaq 0xa2(%rip), %rcx        # 0xbb8f
movq %rbx, %rdi
movl %ebp, %edx
movq %r12, %r8
callq 0x4390
testl %eax, %eax
je 0xbb4f
leaq 0xa7dd(%rip), %rdx      # 0x162e2
movq %r15, %rdi
movq %r12, %rsi
movl $0x496, %ecx            # imm = 0x496
callq 0x4280
jmp 0xb9dd
movl $0x5, %ecx
testl %ecx, %ecx
je 0xbb48
movl $0x1, %eax
cmpl $0x5, %ecx
jne 0xb95a
movq 0x18(%r14), %rdx
leaq 0xac0b(%rip), %rsi      # 0x16747
leaq 0xac15(%rip), %rcx      # 0x16758
jmp 0xb6f6
xorl %eax, %eax
jmp 0xb95a
xorl %ecx, %ecx
jmp 0xbb1f
movq 0x10(%r14), %rsi
orl $0x40, %ebp
leaq 0x2e(%rip), %rcx        # 0xbb8f
movq %rbx, %rdi
movl %ebp, %edx
movq %r12, %r8
callq 0x4230
leaq 0xa76d(%rip), %rdx      # 0x162e2
movq 0x8(%rsp), %rdi
movq %r12, %rsi
movl $0x4c5, %ecx            # imm = 0x4C5
callq 0x4280
xorl %r15d, %r15d
jmp 0xba81