// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq 0x280(%rax), %rax
movq %rax, -0x38(%rbp)
cmpl $0x2, -0x1c(%rbp)
jge 0x8cb5
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rdx
leaq 0x14a0e(%rip), %rsi     # 0x1d6a4
leaq 0x14a22(%rip), %rcx     # 0x1d6bf
xorl %eax, %eax
movl %eax, %r8d
movb $0x0, %al
callq 0x4500
movl $0x1, -0x4(%rbp)
jmp 0x8fe7
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x14725(%rip), %rsi     # 0x1d3e9
callq 0x4300
cmpl $0x0, %eax
jne 0x8d0b
cmpl $0x3, -0x1c(%rbp)
je 0x8cd9
jmp 0x8fa7
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdi
leaq 0x151ed(%rip), %rsi     # 0x1ded5
callq 0x4300
cmpl $0x0, %eax
sete %al
andb $0x1, %al
movzbl %al, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x40(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x8fe7
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x149b7(%rip), %rsi     # 0x1d6d1
callq 0x4300
cmpl $0x0, %eax
jne 0x8d61
cmpl $0x3, -0x1c(%rbp)
je 0x8d2f
jmp 0x8fa7
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdi
leaq 0x15197(%rip), %rsi     # 0x1ded5
callq 0x4300
cmpl $0x0, %eax
sete %al
andb $0x1, %al
movzbl %al, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x44(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x8fe7
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x14a0d(%rip), %rsi     # 0x1d77d
callq 0x4300
cmpl $0x0, %eax
jne 0x8db7
cmpl $0x3, -0x1c(%rbp)
je 0x8d85
jmp 0x8fa7
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdi
leaq 0x15141(%rip), %rsi     # 0x1ded5
callq 0x4300
cmpl $0x0, %eax
sete %al
andb $0x1, %al
movzbl %al, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x48(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x8fe7
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x14910(%rip), %rsi     # 0x1d6d6
callq 0x4300
cmpl $0x0, %eax
jne 0x8e11
cmpl $0x3, -0x1c(%rbp)
je 0x8ddb
jmp 0x8f65
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x38(%rbp), %rdx
addq $0x3c, %rdx
callq 0x41a0
cmpl $0x0, %eax
je 0x8e05
movl $0x1, -0x4(%rbp)
jmp 0x8fe7
movl $0x0, -0x4(%rbp)
jmp 0x8fe7
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x148c9(%rip), %rsi     # 0x1d6e9
callq 0x4300
cmpl $0x0, %eax
jne 0x8e6b
cmpl $0x3, -0x1c(%rbp)
je 0x8e35
jmp 0x8f65
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x38(%rbp), %rdx
addq $0x38, %rdx
callq 0x41a0
cmpl $0x0, %eax
je 0x8e5f
movl $0x1, -0x4(%rbp)
jmp 0x8fe7
movl $0x0, -0x4(%rbp)
jmp 0x8fe7
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x15868(%rip), %rsi     # 0x1e6e2
callq 0x4300
cmpl $0x0, %eax
jne 0x8e99
movq -0x38(%rbp), %rdi
callq 0x89b0
movl $0x0, -0x4(%rbp)
jmp 0x8fe7
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x14852(%rip), %rsi     # 0x1d6fa
callq 0x4300
cmpl $0x0, %eax
jne 0x8f2c
cmpl $0x2, -0x1c(%rbp)
je 0x8ee9
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rdx
leaq 0x147da(%rip), %rsi     # 0x1d6a4
leaq 0x14828(%rip), %rcx     # 0x1d6f9
xorl %eax, %eax
movl %eax, %r8d
movb $0x0, %al
callq 0x4500
movl $0x1, -0x4(%rbp)
jmp 0x8fe7
movq -0x30(%rbp), %rax
movq 0x280(%rax), %rdi
callq 0x4160
cmpl $0x0, %eax
je 0x8f20
movq -0x18(%rbp), %rdi
leaq 0x147f8(%rip), %rsi     # 0x1d701
xorl %eax, %eax
movl %eax, %edx
movb $0x0, %al
callq 0x4500
movl $0x1, -0x4(%rbp)
jmp 0x8fe7
movl $0x0, -0x4(%rbp)
jmp 0x8fe7
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0x147df(%rip), %rsi     # 0x1d71e
leaq 0x147e5(%rip), %rcx     # 0x1d72b
leaq 0x14812(%rip), %r8      # 0x1d75f
xorl %eax, %eax
movl %eax, %r9d
movb $0x0, %al
callq 0x4500
movl $0x1, -0x4(%rbp)
jmp 0x8fe7
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rdx
movq -0x28(%rbp), %rax
movq 0x8(%rax), %r8
leaq 0x14725(%rip), %rsi     # 0x1d6a4
leaq 0x15eea(%rip), %rcx     # 0x1ee70
leaq 0x14da3(%rip), %r9      # 0x1dd30
xorl %eax, %eax
movq $0x0, (%rsp)
movb $0x0, %al
callq 0x4500
movl $0x1, -0x4(%rbp)
jmp 0x8fe7
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rdx
movq -0x28(%rbp), %rax
movq 0x8(%rax), %r8
leaq 0x146e3(%rip), %rsi     # 0x1d6a4
leaq 0x15ea8(%rip), %rcx     # 0x1ee70
leaq 0x147b7(%rip), %r9      # 0x1d786
xorl %eax, %eax
movq $0x0, (%rsp)
movb $0x0, %al
callq 0x4500
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq