// File: /workspace/github_c_makefile_star2_O1/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 0xeb25
movq %r13, %rdi
callq 0x43e0
movq 0xf0(%r13), %rbx
testq %rbx, %rbx
je 0xecda
movl %ebp, 0x14(%rsp)
movq 0x280(%r13), %rax
movq %rax, 0x8(%rsp)
movq 0xe0(%r13), %rax
movslq 0xe8(%r13), %rcx
shlq $0x4, %rcx
leaq (%rax,%rcx), %rdx
movq %rdx, (%rsp)
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 0xeb6e
movl %r12d, %esi
leaq 0x8306(%rip), %rdx      # 0x16e98
movq 0x8(%rsp), %rdi
movq %rsi, 0x20(%rsp)
movl $0x302, %ecx            # imm = 0x302
callq 0x44c0
movq %r13, 0x28(%rsp)
movq 0xf0(%r13), %rbx
xorl %ebp, %ebp
testq %rbx, %rbx
movq %rax, 0x18(%rsp)
je 0xec5b
movq %rax, %r13
movq 0x8(%rsp), %r15
movq 0x18(%rbx), %rax
movq %rax, 0x30(%rsp)
movl (%rbx), %eax
subl %ebp, %eax
jle 0xebf3
movslq %ebp, %rsi
movq (%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 0x8276(%rip), %rdx      # 0x16e98
movl $0x310, %ecx            # imm = 0x310
callq 0x4280
movq %r15, %rdi
movq %rbx, %rsi
leaq 0x825f(%rip), %rdx      # 0x16e98
movl $0x311, %ecx            # imm = 0x311
callq 0x4280
movq 0x30(%rsp), %rax
movq %rax, %rbx
testq %rax, %rax
jne 0xebca
movq 0x18(%rsp), %rbx
jmp 0xec61
movq %rax, %r13
movq %rax, %rbx
movq (%rsp), %rax
movq (%rax), %rdi
addq %rbp, %rdi
callq 0x41d0
addq %r13, %rax
incq %rax
movq %rbx, %rcx
addq 0x20(%rsp), %rcx
cmpq %rcx, %rax
jbe 0xec8f
leaq 0x8441(%rip), %rdi      # 0x170cb
callq 0x4120
movq (%rsp), %rbx
addq (%rbx), %rbp
movq %r13, %rdi
movq %rbp, %rsi
callq 0x40f0
movq (%rbx), %rsi
leaq 0x81ed(%rip), %rdx      # 0x16e98
movq 0x8(%rsp), %rdi
movl $0x31e, %ecx            # imm = 0x31E
callq 0x4280
movq 0x18(%rsp), %rax
movq %rax, (%rbx)
movl %r12d, 0x8(%rbx)
movq 0x28(%rsp), %r13
movq $0x0, 0xf0(%r13)
movl 0x14(%rsp), %ebp
callq 0x4640
movq (%rax), %rax
decq %r14
movsbq 0x1(%r14), %rcx
incq %r14
testb $0x20, 0x1(%rax,%rcx,2)
jne 0xece5
testb %cl, %cl
je 0xedc2
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 0xed58
shlq $0x4, %r12
leaq (%r15,%r12), %rsi
movq %r13, %rdi
callq 0xedea
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 0xedce
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 0x45b0
jmp 0xedd0
movq %r13, %rdi
callq 0x42d0
xorl %eax, %eax
jmp 0xeddb
xorl %eax, %eax
movl $0x1, 0x100(%r13)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq