// File: /workspace/github_c_makefile_star2_O2/haxlang[P]hax/haxCkalloc.c
// Function: MemoryCmd
static int
MemoryCmd (
    ClientData  clientData,
    Hax_Interp *interp,
    int         argc,
    char      **argv)
{
    Interp *iPtr = (Interp *) interp;
    Memoryp *memCtx = (Memoryp *) iPtr->memoryp;

    if (argc < 2) {
	Hax_AppendResult(interp, "wrong # args:  should be \"",
		argv[0], " option [args..]\"", (char *) NULL);
	return HAX_ERROR;
    }

    if (strcmp(argv[1],"trace") == 0) {
        if (argc != 3)
            goto bad_suboption;
        memCtx->alloc_tracing = (strcmp(argv[2],"on") == 0);
        return HAX_OK;
    }
    if (strcmp(argv[1],"init") == 0) {
        if (argc != 3)
            goto bad_suboption;
        memCtx->init_malloced_bodies = (strcmp(argv[2],"on") == 0);
        return HAX_OK;
    }
    if (strcmp(argv[1],"validate") == 0) {
        if (argc != 3)
             goto bad_suboption;
        memCtx->validate_memory = (strcmp(argv[2],"on") == 0);
        return HAX_OK;
    }
    if (strcmp(argv[1],"trace_on_at_malloc") == 0) {
        if (argc != 3)
            goto argError;
        if (Hax_GetInt(interp, argv[2], &memCtx->trace_on_at_malloc) != HAX_OK)
                return HAX_ERROR;
         return HAX_OK;
    }
    if (strcmp(argv[1],"break_on_malloc") == 0) {
        if (argc != 3)
            goto argError;
        if (Hax_GetInt(interp, argv[2], &memCtx->break_on_malloc) != HAX_OK)
                return HAX_ERROR;
        return HAX_OK;
    }

    if (strcmp(argv[1],"info") == 0) {
        dump_memory_info(memCtx);
        return HAX_OK;
    }
    if (strcmp(argv[1],"active") == 0) {
        if (argc != 2) {
	    Hax_AppendResult(interp, "wrong # args:  should be \"",
		    argv[0], " active", (char *) NULL);
	    return HAX_ERROR;
	}
        if (Hax_DumpActiveMemory (iPtr->memoryp) != HAX_OK) {
	    Hax_AppendResult(interp, "error dumping active memory ",
		    (char *) NULL);
	    return HAX_ERROR;
	}
	return HAX_OK;
    }
    Hax_AppendResult(interp, "bad option \"", argv[1],
	    "\":  should be info, init, active, break_on_malloc, ",
	    "trace_on_at_malloc, trace, or validate", (char *) NULL);
    return HAX_ERROR;

argError:
    Hax_AppendResult(interp, "wrong # args:  should be \"", argv[0],
	    " ", argv[1], "count\"", (char *) NULL);
    return HAX_ERROR;

bad_suboption:
    Hax_AppendResult(interp, "wrong # args:  should be \"", argv[0],
	    " ", argv[1], " on|off\"", (char *) NULL);
    return HAX_ERROR;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rcx, %r12
movq %rsi, %r14
cmpl $0x1, %edx
jg 0x6e1b
movq (%r12), %rdx
leaq 0xc8be(%rip), %rsi      # 0x136c0
leaq 0xc8d2(%rip), %rcx      # 0x136db
movq %r14, %rdi
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x4520
jmp 0x6f90
movl %edx, %ebp
movq 0x280(%r14), %rbx
movq 0x8(%r12), %r15
leaq 0xc5f8(%rip), %rsi      # 0x13428
movq %r15, %rdi
callq 0x4330
testl %eax, %eax
je 0x6eed
leaq 0xc8a6(%rip), %rsi      # 0x136ed
movq %r15, %rdi
callq 0x4330
testl %eax, %eax
je 0x6f15
leaq 0xc91e(%rip), %rsi      # 0x1377c
movq %r15, %rdi
callq 0x4330
testl %eax, %eax
je 0x6f3d
leaq 0xc87d(%rip), %rsi      # 0x136f2
movq %r15, %rdi
callq 0x4330
testl %eax, %eax
je 0x6f94
leaq 0xc879(%rip), %rsi      # 0x13705
movq %r15, %rdi
callq 0x4330
testl %eax, %eax
je 0x6fa4
leaq 0xd67f(%rip), %rsi      # 0x14522
movq %r15, %rdi
callq 0x4330
testl %eax, %eax
je 0x6fe4
leaq 0xc85c(%rip), %rsi      # 0x13716
movq %r15, %rdi
callq 0x4330
testl %eax, %eax
je 0x6fee
leaq 0xc84c(%rip), %rsi      # 0x1371d
leaq 0xc852(%rip), %rcx      # 0x1372a
leaq 0xc87f(%rip), %r8       # 0x1375e
movq %r14, %rdi
movq %r15, %rdx
xorl %r9d, %r9d
jmp 0x6f89
cmpl $0x3, %ebp
jne 0x6f65
movq 0x10(%r12), %rcx
xorl %eax, %eax
cmpb $0x6f, (%rcx)
jne 0x6f0d
cmpb $0x6e, 0x1(%rcx)
jne 0x6f0d
xorl %eax, %eax
cmpb $0x0, 0x2(%rcx)
sete %al
movl %eax, 0x40(%rbx)
jmp 0x6ffb
cmpl $0x3, %ebp
jne 0x6f65
movq 0x10(%r12), %rcx
xorl %eax, %eax
cmpb $0x6f, (%rcx)
jne 0x6f35
cmpb $0x6e, 0x1(%rcx)
jne 0x6f35
xorl %eax, %eax
cmpb $0x0, 0x2(%rcx)
sete %al
movl %eax, 0x44(%rbx)
jmp 0x6ffb
cmpl $0x3, %ebp
jne 0x6f65
movq 0x10(%r12), %rcx
xorl %eax, %eax
cmpb $0x6f, (%rcx)
jne 0x6f5d
cmpb $0x6e, 0x1(%rcx)
jne 0x6f5d
xorl %eax, %eax
cmpb $0x0, 0x2(%rcx)
sete %al
movl %eax, 0x48(%rbx)
jmp 0x6ffb
movq (%r12), %rdx
andq $0x0, (%rsp)
leaq 0xc74b(%rip), %rsi      # 0x136c0
leaq 0xdc88(%rip), %rcx      # 0x14c04
leaq 0xc802(%rip), %r9       # 0x13785
movq %r14, %rdi
movq %r15, %r8
xorl %eax, %eax
callq 0x4520
movb $0x1, %al
jmp 0x6ffd
cmpl $0x3, %ebp
jne 0x6fc4
movq 0x10(%r12), %rsi
addq $0x3c, %rbx
jmp 0x6fb2
cmpl $0x3, %ebp
jne 0x6fc4
movq 0x10(%r12), %rsi
addq $0x38, %rbx
movq %r14, %rdi
movq %rbx, %rdx
callq 0x41c0
testl %eax, %eax
setne %al
jmp 0x6ffd
movq (%r12), %rdx
andq $0x0, (%rsp)
leaq 0xc6ec(%rip), %rsi      # 0x136c0
leaq 0xdc29(%rip), %rcx      # 0x14c04
leaq 0xcc94(%rip), %r9       # 0x13c76
jmp 0x6f83
movq %rbx, %rdi
callq 0x6c3c
jmp 0x6ffb
cmpl $0x2, %ebp
jne 0x700d
movq %rbx, %rdi
callq 0x4180
xorl %eax, %eax
movzbl %al, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq (%r12), %rdx
leaq 0xc6a8(%rip), %rsi      # 0x136c0
leaq 0xc6f6(%rip), %rcx      # 0x13715
jmp 0x6e09