// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
cmpl $0x4, -0x1c(%rbp)
jge 0xc421
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rdx
leaq 0x11572(%rip), %rsi     # 0x1d974
leaq 0x11c18(%rip), %rcx     # 0x1e021
xorl %eax, %eax
movl %eax, %r8d
movb $0x0, %al
callq 0x4500
movl $0x1, -0x4(%rbp)
jmp 0xc71a
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rsi
leaq -0x60(%rbp), %rdx
callq 0x44b0
cmpl $0x0, %eax
je 0xc447
movl $0x1, -0x4(%rbp)
jmp 0xc71a
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rsi
leaq -0x68(%rbp), %rdx
callq 0x4070
cmpl $0x0, %eax
je 0xc46d
movl $0x1, -0x4(%rbp)
jmp 0xc71a
cmpq $0x0, -0x60(%rbp)
jge 0xc47c
movq $0x0, -0x60(%rbp)
cmpq $0x0, -0x68(%rbp)
jge 0xc48b
movq $0x0, -0x68(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x68(%rbp), %rax
jle 0xc4b7
movq -0x18(%rbp), %rdi
leaq 0x11ba9(%rip), %rsi     # 0x1e049
xorl %eax, %eax
movl %eax, %edx
movb $0x0, %al
callq 0x4500
movl $0x1, -0x4(%rbp)
jmp 0xc71a
movq $0x0, -0x78(%rbp)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
movq $0x0, -0x70(%rbp)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x70(%rbp), %rcx
xorl %eax, %eax
cmpq -0x60(%rbp), %rcx
movb %al, -0x7d(%rbp)
jge 0xc4fe
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x7d(%rbp)
movb -0x7d(%rbp), %al
testb $0x1, %al
jne 0xc507
jmp 0xc549
movq -0x18(%rbp), %rdi
movq -0x30(%rbp), %rsi
leaq -0x40(%rbp), %rdx
leaq -0x30(%rbp), %rcx
leaq -0x78(%rbp), %r8
xorl %eax, %eax
movl %eax, %r9d
callq 0x4350
movl %eax, -0x7c(%rbp)
cmpl $0x0, -0x7c(%rbp)
je 0xc539
movl -0x7c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xc71a
jmp 0xc53b
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0xc4df
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0xc57f
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdx
leaq 0x11b0d(%rip), %rsi     # 0x1e075
xorl %eax, %eax
movl %eax, %ecx
movb $0x0, %al
callq 0x4500
movl $0x1, -0x4(%rbp)
jmp 0xc71a
movq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x70(%rbp), %rcx
xorl %eax, %eax
cmpq -0x68(%rbp), %rcx
movb %al, -0x7e(%rbp)
jg 0xc5a6
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x7e(%rbp)
movb -0x7e(%rbp), %al
testb $0x1, %al
jne 0xc5af
jmp 0xc5f0
movq -0x18(%rbp), %rdi
movq -0x38(%rbp), %rsi
leaq -0x50(%rbp), %rdx
leaq -0x38(%rbp), %rcx
xorl %eax, %eax
movl %eax, %r9d
movq %r9, %r8
callq 0x4350
movl %eax, -0x7c(%rbp)
cmpl $0x0, -0x7c(%rbp)
je 0xc5e0
movl -0x7c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xc71a
jmp 0xc5e2
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0xc587
movq -0x40(%rbp), %rax
addq -0x78(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x40(%rbp), %rax
movq -0x28(%rbp), %rcx
cmpq 0x8(%rcx), %rax
je 0xc65c
jmp 0xc60c
movq -0x30(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x7f(%rbp)
je 0xc643
callq 0x4630
movq (%rax), %rax
movq -0x30(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
movb %al, -0x7f(%rbp)
movb -0x7f(%rbp), %al
testb $0x1, %al
jne 0xc64c
jmp 0xc65a
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0xc60c
jmp 0xc65c
movq -0x30(%rbp), %rax
movb (%rax), %al
movb %al, -0x41(%rbp)
movq -0x30(%rbp), %rax
movb $0x0, (%rax)
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rsi
xorl %eax, %eax
movl %eax, %edx
movb $0x0, %al
callq 0x4500
movb -0x41(%rbp), %cl
movq -0x30(%rbp), %rax
movb %cl, (%rax)
movq $0x4, -0x58(%rbp)
movq -0x58(%rbp), %rax
movslq -0x1c(%rbp), %rcx
cmpq %rcx, %rax
jge 0xc6c6
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
xorl %edx, %edx
callq 0x4040
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0xc694
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0xc713
movq -0x18(%rbp), %rax
movq (%rax), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0xc6f7
movq -0x18(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq $-0x1, %rdx
callq 0x44e0
jmp 0xc711
movq -0x18(%rbp), %rdi
movq -0x38(%rbp), %rdx
leaq 0x1276a(%rip), %rsi     # 0x1ee70
xorl %eax, %eax
movl %eax, %ecx
movb $0x0, %al
callq 0x4500
jmp 0xc713
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)