// File: /workspace/github_c_makefile_star2_O0/haxlang[P]hax/haxHistory.c
// Function: RevResult
static void
RevResult(
    Interp *iPtr,		/* Interpreter in which to perform the
				 * substitution. */
    char *string		/* String to substitute. */)
{
    Hax_Memoryp *memoryp = iPtr->memoryp;
    HistoryRev *revPtr;
    char *evalFirst, *evalLast;
    char *argv[2];

    if ((iPtr->evalFirst == NULL) || (iPtr->revDisables > 0)) {
	return;
    }

    /*
     * Expand the replacement range to include the brackets that surround
     * the command.  If there aren't any brackets (i.e. this command was
     * invoked at top-level) then don't do any revision.  Also, if there
     * are several commands in brackets, of which this is just one,
     * then don't do any revision.
     */

    evalFirst = iPtr->evalFirst;
    evalLast = iPtr->evalLast + 1;
    while (1) {
	if (evalFirst == iPtr->historyFirst) {
	    return;
	}
	evalFirst--;
	if (*evalFirst == '[') {
	    break;
	}
	if (!isspace(*evalFirst)) {
	    return;
	}
    }
    if (*evalLast != ']') {
	return;
    }

    revPtr = (HistoryRev *) ckalloc(memoryp, sizeof(HistoryRev));
    revPtr->firstIndex = evalFirst - iPtr->historyFirst;
    revPtr->lastIndex = evalLast - iPtr->historyFirst;
    argv[0] = string;
    revPtr->newBytes = Hax_Merge((Hax_Interp *) iPtr, 1, argv);
    revPtr->newSize = strlen(revPtr->newBytes);
    InsertRev(iPtr, revPtr);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x280(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x108(%rax)
je 0x147ba
movq -0x8(%rbp), %rax
cmpl $0x0, 0x100(%rax)
jle 0x147bf
jmp 0x148e4
movq -0x8(%rbp), %rax
movq 0x108(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x110(%rax), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0xf8(%rcx), %rax
jne 0x147f7
jmp 0x148e4
movq -0x28(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5b, %eax
jne 0x14811
jmp 0x14838
callq 0x4630
movq (%rax), %rax
movq -0x28(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
jne 0x14836
jmp 0x148e4
jmp 0x147e1
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5d, %eax
je 0x14849
jmp 0x148e4
movq -0x18(%rbp), %rdi
movl $0x20, %esi
leaq 0xa57f(%rip), %rdx      # 0x1edd8
movl $0x2cb, %ecx            # imm = 0x2CB
callq 0x44c0
movq %rax, -0x20(%rbp)
movq -0x28(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0xf8(%rcx), %rcx
subq %rcx, %rax
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movq -0x30(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0xf8(%rcx), %rcx
subq %rcx, %rax
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x40(%rbp), %rdx
movl $0x1, %esi
callq 0x4510
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x41b0
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x14f90
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)