// File: /workspace/github_c_makefile_star2_O0/haxlang[P]hax/haxAssem.c
// Function: Hax_AssembleCmd
char *
Hax_AssembleCmd(
    Hax_Interp *interp,
    Hax_CmdBuf buffer,		/* Token for a command buffer previously
				 * created by Hax_CreateCmdBuf.  */
    char *string		/* Bytes to be appended to command stream.
				 * Note:  if the string is zero length,
				 * then whatever is buffered will be
				 * considered to be a complete command
				 * regardless of whether parentheses are
				 * matched or not. */)
{
    Interp *iPtr = (Interp *) interp;
    Hax_Memoryp *memoryp = iPtr->memoryp;
    CmdBuf *cbPtr = (CmdBuf *) buffer;
    int length, totalLength, c;

    /*
     * If an empty string is passed in, just pretend the current
     * command is complete, whether it really is or not.
     */

    length = strlen(string);
    if (length == 0) {
	cbPtr->buffer[cbPtr->bytesUsed] = 0;
	cbPtr->bytesUsed = 0;
	return cbPtr->buffer;
    }

    /*
     * Add the new information to the buffer.  If the current buffer
     * isn't large enough, grow it by at least a factor of two, or
     * enough to hold the new text.
     */

    length = strlen(string);
    totalLength = cbPtr->bytesUsed + length + 1;
    if (totalLength > cbPtr->bufSize) {
	unsigned int newSize;
	char *newBuf;

	newSize = cbPtr->bufSize*2;
	if (newSize < totalLength) {
	    newSize = totalLength;
	}
	newBuf = (char *) ckalloc(memoryp, newSize);
	strcpy(newBuf, cbPtr->buffer);
	ckfree(memoryp, cbPtr->buffer);
	cbPtr->buffer = newBuf;
	cbPtr->bufSize = newSize;
    }
    strcpy(cbPtr->buffer+cbPtr->bytesUsed, string);
    cbPtr->bytesUsed += length;

    /*
     * See if there is now a complete command in the buffer.
     */

    c = cbPtr->buffer[cbPtr->bytesUsed-1];
    if ((c != '\n') && (c != ';')) {
	return NULL;
    }
    if (Hax_CommandComplete(cbPtr->buffer)) {
	cbPtr->bytesUsed = 0;
	return cbPtr->buffer;
    }
    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq 0x280(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rdi
callq 0x41b0
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
jne 0x6643
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq -0x38(%rbp), %rcx
movslq 0xc(%rcx), %rcx
movb $0x0, (%rax,%rcx)
movq -0x38(%rbp), %rax
movl $0x0, 0xc(%rax)
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0x676e
movq -0x20(%rbp), %rdi
callq 0x41b0
movl %eax, -0x3c(%rbp)
movq -0x38(%rbp), %rax
movl 0xc(%rax), %eax
addl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
movq -0x38(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jle 0x66e4
movq -0x38(%rbp), %rax
movl 0x8(%rax), %eax
shll %eax
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x40(%rbp), %eax
jae 0x6685
movl -0x40(%rbp), %eax
movl %eax, -0x48(%rbp)
movq -0x30(%rbp), %rdi
movl -0x48(%rbp), %eax
movl %eax, %esi
leaq 0x16b61(%rip), %rdx     # 0x1d1f6
movl $0xb8, %ecx
callq 0x44c0
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
movq -0x38(%rbp), %rax
movq (%rax), %rsi
callq 0x40d0
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rax
movq (%rax), %rsi
leaq 0x16b31(%rip), %rdx     # 0x1d1f6
movl $0xba, %ecx
callq 0x4260
movq -0x50(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movl -0x48(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x38(%rbp), %rax
movq (%rax), %rdi
movq -0x38(%rbp), %rax
movslq 0xc(%rax), %rax
addq %rax, %rdi
movq -0x20(%rbp), %rsi
callq 0x40d0
movl -0x3c(%rbp), %ecx
movq -0x38(%rbp), %rax
addl 0xc(%rax), %ecx
movl %ecx, 0xc(%rax)
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq -0x38(%rbp), %rcx
movl 0xc(%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
movl %eax, -0x44(%rbp)
cmpl $0xa, -0x44(%rbp)
je 0x673d
cmpl $0x3b, -0x44(%rbp)
je 0x673d
movq $0x0, -0x8(%rbp)
jmp 0x676e
movq -0x38(%rbp), %rax
movq (%rax), %rdi
callq 0x44f0
cmpl $0x0, %eax
je 0x6766
movq -0x38(%rbp), %rax
movl $0x0, 0xc(%rax)
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0x676e
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)