// File: /workspace/github_c_makefile_star2_O2/haxlang[P]hax/haxCmdIL.c
// Function: Hax_LreplaceCmd
int
Hax_LreplaceCmd(
    ClientData notUsed,			/* Not used. */
    Hax_Interp *interp,			/* Current interpreter. */
    int argc,				/* Number of arguments. */
    char **argv				/* Argument strings. */)
{
    char *p1, *p2, *element, savedChar, *dummy;
    long int i, first, last, count, size;
    int result;

    if (argc < 4) {
	Hax_AppendResult(interp, "wrong # args: should be \"", argv[0],
		" list first last ?element element ...?\"", (char *) NULL);
	return HAX_ERROR;
    }
    if (Hax_GetLong(interp, argv[2], &first) != HAX_OK) {
	return HAX_ERROR;
    }
    if (HaxGetListIndex(interp, argv[3], &last) != HAX_OK) {
	return HAX_ERROR;
    }
    if (first < 0) {
	first = 0;
    }
    if (last < 0) {
	last = 0;
    }
    if (first > last) {
	Hax_AppendResult(interp, "first index must not be greater than second",
		(char *) NULL);
	return HAX_ERROR;
    }

    /*
     * Skip over the elements of the list before "first".
     */

    size = 0;
    element = argv[1];
    for (count = 0, p1 = argv[1]; (count < first) && (*p1 != 0); count++) {
	result = HaxFindElement(interp, p1, &element, &p1, &size,
		(int *) NULL);
	if (result != HAX_OK) {
	    return result;
	}
    }
    if (*p1 == 0) {
	Hax_AppendResult(interp, "list doesn't contain element ",
		argv[2], (char *) NULL);
	return HAX_ERROR;
    }

    /*
     * Skip over the elements of the list up through "last".
     */

    for (p2 = p1 ; (count <= last) && (*p2 != 0); count++) {
	result = HaxFindElement(interp, p2, &dummy, &p2, (long int *) NULL,
		(int *) NULL);
	if (result != HAX_OK) {
	    return result;
	}
    }

    /*
     * Add the elements before "first" to the result.  Be sure to
     * include quote or brace characters that might terminate the
     * last of these elements.
     */

    p1 = element+size;
    if (element != argv[1]) {
	while ((*p1 != 0) && !isspace(*p1)) {
	    p1++;
	}
    }
    savedChar = *p1;
    *p1 = 0;
    Hax_AppendResult(interp, argv[1], (char *) NULL);
    *p1 = savedChar;

    /*
     * Add the new list elements.
     */

    for (i = 4; i < argc; i++) {
	Hax_AppendElement(interp, argv[i], 0);
    }

    /*
     * Append the remainder of the original list.
     */

    if (*p2 != 0) {
	if (*interp->result == 0) {
	    Hax_SetResult(interp, p2, HAX_VOLATILE);
	} else {
	    Hax_AppendResult(interp, " ", p2, (char *) NULL);
	}
    }
    return HAX_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, %r14
movq %rsi, %rbx
pushq $0x1
popq %r15
cmpl $0x3, %edx
jg 0x9136
movq (%r14), %rdx
leaq 0xa743(%rip), %rsi      # 0x13860
leaq 0xae3f(%rip), %rcx      # 0x13f63
movq %rbx, %rdi
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x4520
jmp 0x9260
movl %edx, %ebp
movq 0x10(%r14), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x44d0
testl %eax, %eax
jne 0x9260
movq 0x18(%r14), %rsi
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x4090
testl %eax, %eax
jne 0x9260
movq 0x10(%rsp), %rax
testq %rax, %rax
jns 0x917c
andq $0x0, 0x10(%rsp)
xorl %eax, %eax
movq 0x8(%rsp), %rcx
testq %rcx, %rcx
jns 0x918e
andq $0x0, 0x8(%rsp)
xorl %ecx, %ecx
cmpq %rcx, %rax
jbe 0x91ab
leaq 0xadf1(%rip), %rsi      # 0x13f8b
movq %rbx, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0x4520
jmp 0x9260
leaq 0x18(%rsp), %rcx
andq $0x0, (%rcx)
movq 0x8(%r14), %rsi
leaq 0x20(%rsp), %rcx
movq %rsi, (%rcx)
movq %rsp, %rcx
movq %rsi, (%rcx)
pushq $-0x1
popq %r12
leaq 0x1(%r12), %r13
movb (%rsi), %cl
cmpq %rax, %r13
jge 0x9204
testb %cl, %cl
je 0x9244
movq %rbx, %rdi
leaq 0x20(%rsp), %rdx
movq %rsp, %rcx
leaq 0x18(%rsp), %r8
xorl %r9d, %r9d
callq 0x4380
testl %eax, %eax
jne 0x925d
movq 0x10(%rsp), %rax
movq (%rsp), %rsi
movq %r13, %r12
jmp 0x91ca
testb %cl, %cl
je 0x9244
leaq 0x28(%rsp), %r13
movq %rsi, (%r13)
incq %r12
cmpq 0x8(%rsp), %r12
jg 0x9272
movq 0x28(%rsp), %rsi
cmpb $0x0, (%rsi)
je 0x9272
movq %rbx, %rdi
leaq 0x30(%rsp), %rdx
movq %r13, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x4380
movl %eax, %r15d
testl %eax, %eax
je 0x9211
jmp 0x9260
movq 0x10(%r14), %rdx
leaq 0xad68(%rip), %rsi      # 0x13fb7
movq %rbx, %rdi
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x4520
jmp 0x9260
movl %eax, %r15d
movl %r15d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x20(%rsp), %rax
movq 0x18(%rsp), %r15
addq %rax, %r15
movq %r15, (%rsp)
cmpq 0x8(%r14), %rax
je 0x92ab
movsbq (%r15), %r12
testq %r12, %r12
je 0x92b0
callq 0x4660
movq (%rax), %rax
testb $0x20, 0x1(%rax,%r12,2)
jne 0x92b3
incq %r15
movq %r15, (%rsp)
jmp 0x9289
movb (%r15), %r12b
jmp 0x92b3
xorl %r12d, %r12d
movb $0x0, (%r15)
movq 0x8(%r14), %rsi
movq %rbx, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0x4520
movq (%rsp), %rax
movb %r12b, (%rax)
movl %ebp, %r15d
pushq $0x4
popq %r12
cmpq %r15, %r12
jae 0x92ed
movq (%r14,%r12,8), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x4050
incq %r12
jmp 0x92d5
movq 0x28(%rsp), %rdx
xorl %r15d, %r15d
cmpb $0x0, (%rdx)
je 0x9260
movq (%rbx), %rax
cmpb $0x0, (%rax)
je 0x9315
leaq 0xb8f7(%rip), %rsi      # 0x14c04
xorl %r15d, %r15d
jmp 0x924f
pushq $-0x1
popq %rax
movq %rbx, %rdi
movq %rdx, %rsi
movq %rax, %rdx
callq 0x4500
jmp 0x9260