// File: /workspace/github_c_makefile_star2_O1/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 0x74e8
movq (%r12), %rdx
leaq 0xe1f1(%rip), %rsi      # 0x156c0
leaq 0xe205(%rip), %rcx      # 0x156db
movq %r14, %rdi
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x4500
jmp 0x7657
movl %edx, %ebp
movq 0x280(%r14), %rbx
movq 0x8(%r12), %r15
leaq 0xdf2b(%rip), %rsi      # 0x15428
movq %r15, %rdi
callq 0x4310
testl %eax, %eax
je 0x75ba
leaq 0xe1d9(%rip), %rsi      # 0x156ed
movq %r15, %rdi
callq 0x4310
testl %eax, %eax
je 0x75df
leaq 0xe251(%rip), %rsi      # 0x1577c
movq %r15, %rdi
callq 0x4310
testl %eax, %eax
je 0x7604
leaq 0xe1b0(%rip), %rsi      # 0x156f2
movq %r15, %rdi
callq 0x4310
testl %eax, %eax
je 0x765b
leaq 0xe1ac(%rip), %rsi      # 0x15705
movq %r15, %rdi
callq 0x4310
testl %eax, %eax
je 0x766b
leaq 0xf1d2(%rip), %rsi      # 0x16742
movq %r15, %rdi
callq 0x4310
testl %eax, %eax
je 0x76ae
leaq 0xe18f(%rip), %rsi      # 0x15716
movq %r15, %rdi
callq 0x4310
testl %eax, %eax
je 0x76b8
leaq 0xe17f(%rip), %rsi      # 0x1571d
leaq 0xe185(%rip), %rcx      # 0x1572a
leaq 0xe1b2(%rip), %r8       # 0x1575e
movq %r14, %rdi
movq %r15, %rdx
xorl %r9d, %r9d
jmp 0x7650
cmpl $0x3, %ebp
jne 0x7629
movq 0x10(%r12), %rdi
leaq 0xe9f4(%rip), %rsi      # 0x15fbf
callq 0x4310
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
movl %ecx, 0x40(%rbx)
jmp 0x76c5
cmpl $0x3, %ebp
jne 0x7629
movq 0x10(%r12), %rdi
leaq 0xe9cf(%rip), %rsi      # 0x15fbf
callq 0x4310
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
movl %ecx, 0x44(%rbx)
jmp 0x76c5
cmpl $0x3, %ebp
jne 0x7629
movq 0x10(%r12), %rdi
leaq 0xe9aa(%rip), %rsi      # 0x15fbf
callq 0x4310
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
movl %ecx, 0x48(%rbx)
jmp 0x76c5
movq (%r12), %rdx
movq $0x0, (%rsp)
leaq 0xe084(%rip), %rsi      # 0x156c0
leaq 0xf8ed(%rip), %rcx      # 0x16f30
leaq 0xe13b(%rip), %r9       # 0x15785
movq %r14, %rdi
movq %r15, %r8
xorl %eax, %eax
callq 0x4500
movb $0x1, %al
jmp 0x76c7
cmpl $0x3, %ebp
jne 0x768b
movq 0x10(%r12), %rsi
addq $0x3c, %rbx
jmp 0x7679
cmpl $0x3, %ebp
jne 0x768b
movq 0x10(%r12), %rsi
addq $0x38, %rbx
movq %r14, %rdi
movq %rbx, %rdx
callq 0x41c0
testl %eax, %eax
setne %al
jmp 0x76c7
movq (%r12), %rdx
movq $0x0, (%rsp)
leaq 0xe022(%rip), %rsi      # 0x156c0
leaq 0xf88b(%rip), %rcx      # 0x16f30
leaq 0xe76e(%rip), %r9       # 0x15e1a
jmp 0x764a
movq %rbx, %rdi
callq 0x72e6
jmp 0x76c5
cmpl $0x2, %ebp
jne 0x76d7
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 0xdfde(%rip), %rsi      # 0x156c0
leaq 0xe02c(%rip), %rcx      # 0x15715
jmp 0x74d6