// File: /workspace/github_c_makefile_star2_O3/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 $0x38, %rsp
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %r13
cmpl $0x0, 0xd8(%rdi)
jne 0xe4d9
movq %r13, %rdi
callq 0x43f0
movq 0xf0(%r13), %rbx
testq %rbx, %rbx
je 0xe687
movl %ebp, 0xc(%rsp)
movq 0x280(%r13), %rax
movq %rax, (%rsp)
movq 0xe0(%r13), %rax
movslq 0xe8(%r13), %rcx
shlq $0x4, %rcx
leaq (%rax,%rcx), %r15
movq (%rax,%rcx), %rdi
callq 0x41d0
movq %rax, %r12
incl %r12d
movl 0x4(%rbx), %eax
notl %eax
addl %r12d, %eax
addl (%rbx), %eax
movl %eax, %r12d
addl 0x8(%rbx), %r12d
movq 0x18(%rbx), %rbx
testq %rbx, %rbx
jne 0xe51d
movl %r12d, %esi
leaq 0x765b(%rip), %rdx      # 0x15b9c
movq (%rsp), %rdi
movq %rsi, 0x20(%rsp)
movl $0x302, %ecx            # imm = 0x302
callq 0x44d0
movq %r13, 0x28(%rsp)
movq 0xf0(%r13), %rbx
xorl %ebp, %ebp
testq %rbx, %rbx
movq %rax, 0x10(%rsp)
je 0xe60e
movq %r15, 0x18(%rsp)
movq %rax, %r13
movq (%rsp), %r15
movq 0x18(%rbx), %rax
movq %rax, 0x30(%rsp)
movl (%rbx), %eax
subl %ebp, %eax
jle 0xe5a6
movslq %ebp, %rsi
movq 0x18(%rsp), %rcx
addq (%rcx), %rsi
movl %eax, %ebp
movq %r13, %rdi
movq %rbp, %rdx
callq 0x40a0
addq %rbp, %r13
movq %r13, %rbp
movq 0x10(%rbx), %rsi
movslq 0x8(%rbx), %rdx
movq %r13, %rdi
callq 0x40a0
movslq 0x8(%rbx), %r13
addq %rbp, %r13
movslq 0x4(%rbx), %rbp
incq %rbp
movq 0x10(%rbx), %rsi
movq %r15, %rdi
leaq 0x75c7(%rip), %rdx      # 0x15b9c
movl $0x310, %ecx            # imm = 0x310
callq 0x4280
movq %r15, %rdi
movq %rbx, %rsi
leaq 0x75b0(%rip), %rdx      # 0x15b9c
movl $0x311, %ecx            # imm = 0x311
callq 0x4280
movq 0x30(%rsp), %rax
movq %rax, %rbx
testq %rax, %rax
jne 0xe57c
movq 0x18(%rsp), %r15
jmp 0xe611
movq %rax, %r13
movq (%r15), %rbx
leaq (%rbx,%rbp), %rdi
callq 0x41d0
addq %r13, %rax
incq %rax
movq 0x10(%rsp), %rcx
addq 0x20(%rsp), %rcx
cmpq %rcx, %rax
jbe 0xe641
leaq 0x7796(%rip), %rdi      # 0x15dcf
callq 0x4120
movq (%r15), %rbx
addq %rbp, %rbx
movq %r13, %rdi
movq %rbx, %rsi
callq 0x40f0
movq (%r15), %rsi
leaq 0x7543(%rip), %rdx      # 0x15b9c
movq (%rsp), %rdi
movl $0x31e, %ecx            # imm = 0x31E
callq 0x4280
movq 0x10(%rsp), %rax
movq %rax, (%r15)
movl %r12d, 0x8(%r15)
movq 0x28(%rsp), %r13
movq $0x0, 0xf0(%r13)
movl 0xc(%rsp), %ebp
callq 0x4650
movq (%rax), %rax
decq %r14
movsbq 0x1(%r14), %rcx
incq %r14
testb $0x20, 0x1(%rax,%rcx,2)
jne 0xe692
testb %cl, %cl
je 0xe76f
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 0xe705
shlq $0x4, %r12
leaq (%r15,%r12), %rsi
movq %r13, %rdi
callq 0xe797
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 0xe77b
movq %r14, 0xf8(%r13)
movl $0x0, 0x100(%r13)
orl $0x100, %ebp            # imm = 0x100
movq %r13, %rdi
xorl %esi, %esi
movq %r14, %rdx
movl %ebp, %ecx
xorl %r8d, %r8d
callq 0x45c0
jmp 0xe77d
movq %r13, %rdi
callq 0x42d0
xorl %eax, %eax
jmp 0xe788
xorl %eax, %eax
movl $0x1, 0x100(%r13)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq