// File: /workspace/github_c_makefile_star2_O0/haxlang[P]hax/haxProc.c
// Function: Hax_ProcCmd
int
Hax_ProcCmd(
    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;
    Proc *procPtr;
    int result, argCount, i;
    char **argArray = NULL;
    Arg *lastArgPtr;
    Arg *argPtr = NULL;	/* Initialization not needed, but
					 * prevents compiler warning. */

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

    procPtr = (Proc *) ckalloc(memoryp, sizeof(Proc));
    procPtr->iPtr = iPtr;
    procPtr->command =
	(char *) ckalloc(memoryp, (unsigned) strlen(argv[3]) + 1);
    strcpy(procPtr->command, argv[3]);
    procPtr->argPtr = NULL;

    /*
     * Break up the argument list into argument specifiers, then process
     * each argument specifier.
     */

    result = Hax_SplitList(interp, argv[2], &argCount, &argArray);
    if (result != HAX_OK) {
	goto procError;
    }
    lastArgPtr = NULL;
    for (i = 0; i < argCount; i++) {
	int fieldCount, nameLength, valueLength;
	char **fieldValues;

	/*
	 * Now divide the specifier up into name and default.
	 */

	result = Hax_SplitList(interp, argArray[i], &fieldCount,
		&fieldValues);
	if (result != HAX_OK) {
	    goto procError;
	}
	if (fieldCount > 2) {
	    ckfree(memoryp, (char *) fieldValues);
	    Hax_AppendResult(interp,
		    "too many fields in argument specifier \"",
		    argArray[i], "\"", (char *) NULL);
	    result = HAX_ERROR;
	    goto procError;
	}
	if ((fieldCount == 0) || (*fieldValues[0] == 0)) {
	    ckfree(memoryp, (char *) fieldValues);
	    Hax_AppendResult(interp, "procedure \"", argv[1],
		    "\" has argument with no name", (char *) NULL);
	    result = HAX_ERROR;
	    goto procError;
	}
	nameLength = strlen(fieldValues[0]) + 1;
	if (fieldCount == 2) {
	    valueLength = strlen(fieldValues[1]) + 1;
	} else {
	    valueLength = 0;
	}
	argPtr = (Arg *) ckalloc(memoryp, (unsigned)
		(sizeof(Arg) - sizeof(argPtr->name) + nameLength
		+ valueLength));
	if (lastArgPtr == NULL) {
	    procPtr->argPtr = argPtr;
	} else {
	    lastArgPtr->nextPtr = argPtr;
	}
	lastArgPtr = argPtr;
	argPtr->nextPtr = NULL;
	strcpy(argPtr->name, fieldValues[0]);
	if (fieldCount == 2) {
	    argPtr->defValue = argPtr->name + nameLength;
	    strcpy(argPtr->defValue, fieldValues[1]);
	} else {
	    argPtr->defValue = NULL;
	}
	ckfree(memoryp, (char *) fieldValues);
    }

    Hax_CreateCommand(interp, argv[1], InterpProc, (ClientData) procPtr,
	    ProcDeleteProc);
    ckfree(memoryp, (char *) argArray);
    return HAX_OK;

    procError:
    ckfree(memoryp, procPtr->command);
    while (procPtr->argPtr != NULL) {
	argPtr = procPtr->argPtr;
	procPtr->argPtr = argPtr->nextPtr;
	ckfree(memoryp, (char *) argPtr);
    }
    ckfree(memoryp, (char *) procPtr);
    if (argArray != NULL) {
	ckfree(memoryp, (char *) argArray);
    }
    return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %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)
movq $0x0, -0x58(%rbp)
movq $0x0, -0x68(%rbp)
cmpl $0x4, -0x1c(%rbp)
je 0x16a38
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rdx
leaq 0x6f5b(%rip), %rsi      # 0x1d974
leaq 0x88a6(%rip), %rcx      # 0x1f2c6
xorl %eax, %eax
movl %eax, %r8d
movb $0x0, %al
callq 0x4500
movl $0x1, -0x4(%rbp)
jmp 0x16ddb
movq -0x38(%rbp), %rdi
movl $0x18, %esi
leaq 0x888f(%rip), %rdx      # 0x1f2d7
movl $0x47, %ecx
callq 0x44c0
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, (%rax)
movq -0x38(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x41b0
movq -0x88(%rbp), %rdi
addl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
leaq 0x8849(%rip), %rdx      # 0x1f2d7
movl $0x4a, %ecx
callq 0x44c0
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0x40d0
movq -0x40(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rsi
leaq -0x48(%rbp), %rdx
leaq -0x58(%rbp), %rcx
callq 0x4520
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
je 0x16aeb
jmp 0x16d3e
movq $0x0, -0x60(%rbp)
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x48(%rbp), %eax
jge 0x16cf6
movq -0x18(%rbp), %rdi
movq -0x58(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq -0x6c(%rbp), %rdx
leaq -0x80(%rbp), %rcx
callq 0x4520
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
je 0x16b31
jmp 0x16d3e
cmpl $0x2, -0x6c(%rbp)
jle 0x16b86
movq -0x38(%rbp), %rdi
movq -0x80(%rbp), %rsi
leaq 0x8791(%rip), %rdx      # 0x1f2d7
movl $0x66, %ecx
callq 0x4260
movq -0x18(%rbp), %rdi
movq -0x58(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
leaq 0x877a(%rip), %rsi      # 0x1f2e1
leaq 0x6702(%rip), %rcx      # 0x1d270
xorl %eax, %eax
movl %eax, %r8d
movb $0x0, %al
callq 0x4500
movl $0x1, -0x44(%rbp)
jmp 0x16d3e
cmpl $0x0, -0x6c(%rbp)
je 0x16b9b
movq -0x80(%rbp), %rax
movq (%rax), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x16be6
movq -0x38(%rbp), %rdi
movq -0x80(%rbp), %rsi
leaq 0x872d(%rip), %rdx      # 0x1f2d7
movl $0x6e, %ecx
callq 0x4260
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0x71c9(%rip), %rsi      # 0x1dd90
leaq 0x873b(%rip), %rcx      # 0x1f309
xorl %eax, %eax
movl %eax, %r8d
movb $0x0, %al
callq 0x4500
movl $0x1, -0x44(%rbp)
jmp 0x16d3e
movq -0x80(%rbp), %rax
movq (%rax), %rdi
callq 0x41b0
addq $0x1, %rax
movl %eax, -0x70(%rbp)
cmpl $0x2, -0x6c(%rbp)
jne 0x16c15
movq -0x80(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x41b0
addq $0x1, %rax
movl %eax, -0x74(%rbp)
jmp 0x16c1c
movl $0x0, -0x74(%rbp)
movq -0x38(%rbp), %rdi
movslq -0x70(%rbp), %rax
addq $0x14, %rax
movslq -0x74(%rbp), %rcx
addq %rcx, %rax
movl %eax, %eax
movl %eax, %esi
leaq 0x869d(%rip), %rdx      # 0x1f2d7
movl $0x7c, %ecx
callq 0x44c0
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x60(%rbp)
jne 0x16c5d
movq -0x68(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x16c68
movq -0x68(%rbp), %rcx
movq -0x60(%rbp), %rax
movq %rcx, (%rax)
movq -0x68(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x68(%rbp), %rax
movq $0x0, (%rax)
movq -0x68(%rbp), %rdi
addq $0x10, %rdi
movq -0x80(%rbp), %rax
movq (%rax), %rsi
callq 0x40d0
cmpl $0x2, -0x6c(%rbp)
jne 0x16cc3
movq -0x68(%rbp), %rcx
addq $0x10, %rcx
movslq -0x70(%rbp), %rax
addq %rax, %rcx
movq -0x68(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x68(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x80(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x40d0
jmp 0x16ccf
movq -0x68(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x38(%rbp), %rdi
movq -0x80(%rbp), %rsi
leaq 0x85f9(%rip), %rdx      # 0x1f2d7
movl $0x8b, %ecx
callq 0x4260
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x16afa
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x40(%rbp), %rcx
leaq 0xe3(%rip), %rdx        # 0x16df0
leaq 0x45c(%rip), %r8        # 0x17170
callq 0x4030
movq -0x38(%rbp), %rdi
movq -0x58(%rbp), %rsi
leaq 0x85af(%rip), %rdx      # 0x1f2d7
movl $0x90, %ecx
callq 0x4260
movl $0x0, -0x4(%rbp)
jmp 0x16ddb
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rsi
leaq 0x8586(%rip), %rdx      # 0x1f2d7
movl $0x94, %ecx
callq 0x4260
movq -0x40(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x16d9c
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movq (%rax), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rdi
movq -0x68(%rbp), %rsi
leaq 0x8547(%rip), %rdx      # 0x1f2d7
movl $0x98, %ecx
callq 0x4260
jmp 0x16d5b
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
leaq 0x852c(%rip), %rdx      # 0x1f2d7
movl $0x9a, %ecx
callq 0x4260
cmpq $0x0, -0x58(%rbp)
je 0x16dd5
movq -0x38(%rbp), %rdi
movq -0x58(%rbp), %rsi
leaq 0x850c(%rip), %rdx      # 0x1f2d7
movl $0x9c, %ecx
callq 0x4260
movl -0x44(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
nopw (%rax,%rax)