// File: /workspace/github_c_makefile_star2_O0/GregorR[P]lstg/source/interp.c
// Function: bulkReplace
static int
bulkReplace(struct object *dest, struct object *start,
            struct object *stop, struct object *src, struct object *repStart)
{
  LstUInt         irepStart,
                  istart,
                  istop,
                  count;

  /*
   * We only handle simple 31-bit integer indices.  Map the
   * values onto 0-based C array type values.
   */
  if(!IS_SMALLINT(repStart) || !IS_SMALLINT(start) || !IS_SMALLINT(stop))
  {
    return (1);
  }
  irepStart = integerValue(repStart) - 1;
  istart = integerValue(start) - 1;
  istop = integerValue(stop) - 1;
  count = (istop - istart) + 1;

  /*
   * Defend against goofy negative indices.
   */
  if((irepStart < 0) || (istart < 0) || (istop < 0) || (count < 1))
  {
    return (1);
  }

  /*
   * Range check
   */
  if((SIZE(dest) < istop) || (SIZE(src) < (irepStart + count)))
  {
    return (1);
  }

  /*
   * If both source and dest are binary, do a bcopy()
   */
  if((src->size & FLAG_BIN) && (dest->size & FLAG_BIN))
  {
    /*
     * Do it.
     */
    memoryCopy(bytePtr(src) + irepStart, bytePtr(dest) + istart, count);
    return (0);
  }

  /*
   * If not both regular storage, fail
   */
  if((src->size & FLAG_BIN) || (dest->size & FLAG_BIN))
  {
    return (1);
  }

  /*
   * If we're fiddling pointers between static and dynamic memory,
   * let the VM-based implementation deal with it.
   */
  if(isDynamicMemory(src) != isDynamicMemory(dest))
  {
    return (1);
  }

  /*
   * Copy object pointer fields
   */
  memoryCopy(&src->data[irepStart], &dest->data[istart], BytesPerWord * count);
  return (0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq -0x30(%rbp), %rax
andq $0x1, %rax
cmpq $0x0, %rax
je 0x54a6
movq -0x18(%rbp), %rax
andq $0x1, %rax
cmpq $0x0, %rax
je 0x54a6
movq -0x20(%rbp), %rax
andq $0x1, %rax
cmpq $0x0, %rax
jne 0x54b2
movl $0x1, -0x4(%rbp)
jmp 0x560d
movq -0x30(%rbp), %rax
sarq %rax
subq $0x1, %rax
movl %eax, -0x34(%rbp)
movq -0x18(%rbp), %rax
sarq %rax
subq $0x1, %rax
movl %eax, -0x38(%rbp)
movq -0x20(%rbp), %rax
sarq %rax
subq $0x1, %rax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
subl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
cmpl $0x0, -0x34(%rbp)
jb 0x5500
cmpl $0x0, -0x38(%rbp)
jb 0x5500
cmpl $0x0, -0x3c(%rbp)
jb 0x5500
cmpl $0x1, -0x40(%rbp)
jae 0x550c
movl $0x1, -0x4(%rbp)
jmp 0x560d
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x2, %eax
cmpl -0x3c(%rbp), %eax
jb 0x552d
movq -0x28(%rbp), %rax
movl (%rax), %eax
shrl $0x2, %eax
movl -0x34(%rbp), %ecx
addl -0x40(%rbp), %ecx
cmpl %ecx, %eax
jae 0x5539
movl $0x1, -0x4(%rbp)
jmp 0x560d
movq -0x28(%rbp), %rax
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x5587
movq -0x10(%rbp), %rax
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x5587
movq -0x28(%rbp), %rsi
addq $0x10, %rsi
movl -0x34(%rbp), %eax
addq %rax, %rsi
movq -0x10(%rbp), %rdi
addq $0x10, %rdi
movl -0x38(%rbp), %eax
addq %rax, %rdi
movl -0x40(%rbp), %eax
movl %eax, %edx
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x560d
movq -0x28(%rbp), %rax
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
jne 0x55a3
movq -0x10(%rbp), %rax
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x55ac
movl $0x1, -0x4(%rbp)
jmp 0x560d
movq -0x28(%rbp), %rdi
callq 0x5db0
movl %eax, -0x44(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5db0
movl %eax, %ecx
movl -0x44(%rbp), %eax
cmpl %ecx, %eax
je 0x55d3
movl $0x1, -0x4(%rbp)
jmp 0x560d
movq -0x28(%rbp), %rsi
addq $0x10, %rsi
movl -0x34(%rbp), %eax
shlq $0x3, %rax
addq %rax, %rsi
movq -0x10(%rbp), %rdi
addq $0x10, %rdi
movl -0x38(%rbp), %eax
shlq $0x3, %rax
addq %rax, %rdi
movl -0x40(%rbp), %eax
shll $0x3, %eax
movl %eax, %eax
movl %eax, %edx
callq 0x22a0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)