// File: /workspace/github_c_makefile_star2_O2/haxlang[P]hax/haxHistory.c
// Function: Hax_RecordAndEval
int
Hax_RecordAndEval(
    Hax_Interp *interp,		/* Token for interpreter in which command
				 * will be executed. */
    char *cmd,			/* Command to record. */
    int flags			/* Additional flags to pass to Hax_Eval.
				 * HAX_NO_EVAL means only record: don't
				 * execute command. */)
{
    Interp *iPtr = (Interp *) interp;
    HistoryEvent *eventPtr;
    int length, result;

    if (iPtr->numEvents == 0) {
	Hax_InitHistory(interp);
    }
    DoRevs(iPtr);

    /*
     * Don't record empty commands.
     */

    while (isspace(*cmd)) {
	cmd++;
    }
    if (*cmd == '\0') {
	Hax_ResetResult(interp);
	return HAX_OK;
    }

    iPtr->curEventNum++;
    iPtr->curEvent++;
    if (iPtr->curEvent >= iPtr->numEvents) {
	iPtr->curEvent = 0;
    }
    eventPtr = &iPtr->events[iPtr->curEvent];

    /*
     * Chop off trailing newlines before recording the command.
     */

    length = strlen(cmd);
    while (cmd[length-1] == '\n') {
	length--;
    }
    MakeSpace(iPtr, eventPtr, length + 1);
    strncpy(eventPtr->command, cmd, length);
    eventPtr->command[length] = 0;

    /*
     * Execute the command.  Note: history revision isn't possible after
     * a nested call to this procedure, because the event at the top of
     * the history list no longer corresponds to what's going on when
     * a nested call here returns.  Thus, must leave history revision
     * disabled when we return.
     */

    result = HAX_OK;
    if (flags != HAX_NO_EVAL) {
	iPtr->historyFirst = cmd;
	iPtr->revDisables = 0;
	result = Hax_Eval(interp, NULL, cmd, flags | HAX_RECORD_BOUNDS,
		(char **) NULL);
    }
    iPtr->revDisables = 1;
    return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %r13
cmpl $0x0, 0xd8(%rdi)
jne 0xdcd5
movq %r13, %rdi
callq 0x4400
movq 0xf0(%r13), %rbx
testq %rbx, %rbx
je 0xde7c
movq 0x280(%r13), %rax
movq %rax, 0x8(%rsp)
movq 0xe0(%r13), %rax
movslq 0xe8(%r13), %rcx
shlq $0x4, %rcx
leaq (%rax,%rcx), %r15
movq (%rax,%rcx), %rdi
callq 0x41d0
incl %eax
testq %rbx, %rbx
je 0xdd29
movl 0x4(%rbx), %ecx
notl %ecx
addl %ecx, %eax
addl (%rbx), %eax
addl 0x8(%rbx), %eax
movq 0x18(%rbx), %rbx
jmp 0xdd12
movq %r15, 0x20(%rsp)
movl %ebp, 0x14(%rsp)
movq %rax, 0x28(%rsp)
movl %eax, %esi
leaq 0x6e2c(%rip), %rdx      # 0x14b6c
movq 0x8(%rsp), %rdi
movq %rsi, 0x30(%rsp)
movl $0x302, %ecx            # imm = 0x302
callq 0x44e0
movq %r13, 0x38(%rsp)
movq 0xf0(%r13), %rbx
xorl %r15d, %r15d
movq %rax, 0x18(%rsp)
movq %rax, %r13
movslq %r15d, %rbp
testq %rbx, %rbx
je 0xddfe
movq 0x18(%rbx), %rax
movq %rax, 0x40(%rsp)
movl (%rbx), %eax
subl %r15d, %eax
jle 0xdda3
movq 0x20(%rsp), %rcx
addq (%rcx), %rbp
movl %eax, %r15d
movq %r13, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0x40a0
addq %r15, %r13
movq 0x10(%rbx), %rsi
movslq 0x8(%rbx), %rdx
movq %r13, %rdi
callq 0x40a0
movslq 0x8(%rbx), %rax
addq %rax, %r13
movl 0x4(%rbx), %r15d
incl %r15d
movq 0x10(%rbx), %rsi
movq 0x8(%rsp), %rbp
movq %rbp, %rdi
leaq 0x6d98(%rip), %r12      # 0x14b6c
movq %r12, %rdx
movl $0x310, %ecx            # imm = 0x310
callq 0x4280
movq %rbp, %rdi
movq %rbx, %rsi
movq %r12, %rdx
movl $0x311, %ecx            # imm = 0x311
callq 0x4280
movq 0x40(%rsp), %rbx
jmp 0xdd6b
movq 0x20(%rsp), %r15
movq (%r15), %rbx
leaq (%rbx,%rbp), %rdi
callq 0x41d0
addq %r13, %rax
incq %rax
movq 0x18(%rsp), %rcx
addq 0x30(%rsp), %rcx
cmpq %rcx, %rax
jbe 0xde33
leaq 0x6f74(%rip), %rdi      # 0x14d9f
callq 0x4120
movq (%r15), %rbx
addq %rbp, %rbx
movq %r13, %rdi
movq %rbx, %rsi
callq 0x40f0
movq (%r15), %rsi
leaq 0x6d21(%rip), %rdx      # 0x14b6c
movq 0x8(%rsp), %rdi
movl $0x31e, %ecx            # imm = 0x31E
callq 0x4280
movq 0x18(%rsp), %rax
movq %rax, (%r15)
movq 0x28(%rsp), %rax
movl %eax, 0x8(%r15)
movq 0x38(%rsp), %r13
andq $0x0, 0xf0(%r13)
movl 0x14(%rsp), %ebp
callq 0x4660
movq (%rax), %rax
decq %r14
movsbq 0x1(%r14), %rcx
incq %r14
testb $0x20, 0x1(%rax,%rcx,2)
jne 0xde87
testb %cl, %cl
je 0xdf61
incl 0xec(%r13)
movl 0xe8(%r13), %eax
incl %eax
xorl %ecx, %ecx
cmpl 0xd8(%r13), %eax
cmovll %eax, %ecx
movl %ecx, 0xe8(%r13)
movq 0xe0(%r13), %r15
movslq %ecx, %r12
movq %r14, %rdi
callq 0x41d0
movslq %eax, %rcx
shlq $0x20, %rax
movabsq $0x100000000, %rbx      # imm = 0x100000000
addq %rax, %rbx
leal 0x2(%rcx), %edx
addq %r14, %rcx
decq %rcx
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
addq %rax, %rbx
decl %edx
cmpb $0xa, (%rcx)
leaq -0x1(%rcx), %rcx
je 0xdefa
shlq $0x4, %r12
leaq (%r15,%r12), %rsi
movq %r13, %rdi
callq 0xdf89
movq (%r15,%r12), %rdi
sarq $0x20, %rbx
movq %r14, %rsi
movq %rbx, %rdx
callq 0x40a0
movq (%r15,%r12), %rax
movb $0x0, (%rax,%rbx)
cmpl $-0x1, %ebp
je 0xdf6d
movq %r14, 0xf8(%r13)
andl $0x0, 0x100(%r13)
orl $0x100, %ebp            # imm = 0x100
movq %r13, %rdi
xorl %esi, %esi
movq %r14, %rdx
movl %ebp, %ecx
xorl %r8d, %r8d
callq 0x45d0
jmp 0xdf6f
movq %r13, %rdi
callq 0x42d0
xorl %eax, %eax
jmp 0xdf7a
xorl %eax, %eax
movl $0x1, 0x100(%r13)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq