user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<bitcpy>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    %ecx,-0x30(%rbp)
  mov    %r8,-0x40(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %eax,%edi
  call   <assert@plt>
  mov    -0x38(%rbp),%rax
  mov    %eax,%edi
  call   <assert@plt>
  mov    $0x1,%edi
  call   <assert@plt>
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x2c(%rbp),%eax
  sar    $0x3,%eax
  cltq
  add    %rax,-0x10(%rbp)
  mov    -0x30(%rbp),%eax
  sar    $0x3,%eax
  cltq
  add    %rax,-0x8(%rbp)
  andl   $0x7,-0x2c(%rbp)
  andl   $0x7,-0x30(%rbp)
  cmpl   $0x0,-0x2c(%rbp)
  jne    L23
  cmpl   $0x0,-0x30(%rbp)
  jne    L23
  mov    -0x40(%rbp),%rax
  and    $0x7,%eax
  test   %rax,%rax
  jne    L23
  mov    -0x40(%rbp),%rax
  shr    $0x3,%rax
  mov    %eax,%edx
  mov    -0x38(%rbp),%rcx
  mov    -0x28(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
L23:
  mov    -0x30(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  cmp    $0x37,%rax
  ja     L13
  mov    -0x40(%rbp),%rax
  mov    %eax,%edi
  mov    -0x8(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  mov    -0x30(%rbp),%ecx
  mov    -0x2c(%rbp),%esi
  mov    %edi,%r8d
  mov    %rax,%rdi
  call   <_bitcpy_short@plt>
  jmp    L110
L13:
  mov    -0x30(%rbp),%eax
  cmp    -0x2c(%rbp),%eax
  jne    L113
  mov    $0x8,%eax
  sub    -0x30(%rbp),%eax
  mov    %eax,-0x20(%rbp)
  mov    -0x8(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  mov    -0x20(%rbp),%edi
  mov    -0x30(%rbp),%ecx
  mov    -0x2c(%rbp),%esi
  mov    %edi,%r8d
  mov    %rax,%rdi
  call   <_bitcpy_short@plt>
  addq   $0x1,-0x10(%rbp)
  addq   $0x1,-0x8(%rbp)
  mov    -0x20(%rbp),%eax
  cltq
  sub    %rax,-0x40(%rbp)
  mov    -0x40(%rbp),%rax
  shr    $0x3,%rax
  mov    %eax,-0x1c(%rbp)
  mov    -0x8(%rbp),%rcx
  mov    -0x10(%rbp),%rax
  mov    -0x1c(%rbp),%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x40(%rbp),%rax
  and    $0x7,%eax
  mov    %eax,%edx
  mov    -0x1c(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  mov    %rax,%rsi
  mov    -0x1c(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x10(%rbp),%rax
  add    %rcx,%rax
  mov    %edx,%r8d
  mov    $0x0,%ecx
  mov    %rsi,%rdx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <_bitcpy_short@plt>
L113:
  movl   $0x0,-0x18(%rbp)
  cmpl   $0x0,-0x2c(%rbp)
  jne    L49
  mov    -0x10(%rbp),%rax
  and    $0x3,%eax
  test   %rax,%rax
  je     L63
L49:
  mov    -0x10(%rbp),%rax
  shl    $0x3,%eax
  and    $0x18,%eax
  mov    %eax,%edx
  mov    -0x2c(%rbp),%eax
  add    %eax,%edx
  mov    $0x20,%eax
  sub    %edx,%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x18(%rbp),%eax
  cltq
  cmp    %rax,-0x40(%rbp)
  seta   %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <assert@plt>
  mov    -0x8(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  mov    -0x18(%rbp),%edi
  mov    -0x30(%rbp),%ecx
  mov    -0x2c(%rbp),%esi
  mov    %edi,%r8d
  mov    %rax,%rdi
  call   <_bitcpy_short@plt>
  mov    -0x18(%rbp),%eax
  add    %eax,-0x2c(%rbp)
  mov    -0x18(%rbp),%eax
  add    %eax,-0x30(%rbp)
  mov    -0x18(%rbp),%eax
  cltq
  sub    %rax,-0x40(%rbp)
L63:
  mov    -0x2c(%rbp),%eax
  sar    $0x3,%eax
  cltq
  add    %rax,-0x10(%rbp)
  mov    -0x30(%rbp),%eax
  sar    $0x3,%eax
  cltq
  add    %rax,-0x8(%rbp)
  mov    -0x2c(%rbp),%eax
  and    $0x7,%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  shl    $0x3,%eax
  and    $0x18,%eax
  or     %edx,%eax
  mov    %eax,-0x2c(%rbp)
  mov    -0x30(%rbp),%eax
  and    $0x7,%eax
  mov    %eax,%edx
  mov    -0x8(%rbp),%rax
  shl    $0x3,%eax
  and    $0x18,%eax
  or     %edx,%eax
  mov    %eax,-0x30(%rbp)
  andq   $0xfffffffffffffffc,-0x10(%rbp)
  andq   $0xfffffffffffffffc,-0x8(%rbp)
  cmpl   $0x0,-0x2c(%rbp)
  sete   %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <assert@plt>
  cmpl   $0x0,-0x30(%rbp)
  js     L82
  cmpl   $0x1f,-0x30(%rbp)
  jg     L82
  mov    $0x1,%eax
  jmp    L25
L82:
  mov    $0x0,%eax
L25:
  mov    %eax,%edi
  call   <assert@plt>
  mov    -0x40(%rbp),%rax
  and    $0xffffffe0,%eax
  mov    %eax,-0x14(%rbp)
  cmpl   $0x0,-0x14(%rbp)
  je     L31
  mov    -0x14(%rbp),%eax
  sar    $0x5,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,%rcx
  mov    -0x8(%rbp),%rsi
  mov    -0x10(%rbp),%rax
  mov    -0x30(%rbp),%edx
  mov    %rax,%rdi
  call   <_bitcpy_aligned@plt>
L31:
  mov    -0x14(%rbp),%eax
  cltq
  sub    %rax,-0x40(%rbp)
  mov    -0x14(%rbp),%eax
  add    %eax,-0x2c(%rbp)
  mov    -0x14(%rbp),%eax
  add    %eax,-0x30(%rbp)
  mov    -0x2c(%rbp),%eax
  sar    $0x3,%eax
  cltq
  add    %rax,-0x10(%rbp)
  mov    -0x30(%rbp),%eax
  sar    $0x3,%eax
  cltq
  add    %rax,-0x8(%rbp)
  andl   $0x7,-0x2c(%rbp)
  andl   $0x7,-0x30(%rbp)
  mov    -0x40(%rbp),%rax
  mov    %eax,%edi
  mov    -0x8(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  mov    -0x30(%rbp),%ecx
  mov    -0x2c(%rbp),%esi
  mov    %edi,%r8d
  mov    %rax,%rdi
  call   <_bitcpy_short@plt>
L110:
  leave
  ret
```

assistant: ```c
void bitcpy(void *dest, int destn, const void *src, int srcn, size_t nbits) {
  assert(dest);
  assert(src);
  assert(0 <= nbits);
  uintptr_t a = (uintptr_t)dest;
  uintptr_t b = (uintptr_t)src;
  a += destn >> 3;
  b += srcn >> 3;
  destn &= 7;
  srcn &= 7;
  if (!destn && !srcn && !(nbits & 7)) {
    memcpy(dest, src, nbits >> 3);
  }
  if (srcn + nbits < 56) {
    _bitcpy_short((unsigned char *)a, destn, (unsigned char *)b, srcn, (int)nbits);
    return;
  }
  if (srcn == destn) {
    int m = 8 - srcn;
    _bitcpy_short((unsigned char *)a, destn, (unsigned char *)b, srcn, m);
    ++a;
    ++b;
    nbits -= m;
    int p = (int)(nbits >> 3);
    memcpy((void *)a, (void *)b, p);
    _bitcpy_short((unsigned char *)a + p, 0, (unsigned char *)b + p, 0, nbits & 7);
  }
  int m = 0;
  if (destn || (a & 3)) {
    m = (int)(32 - (destn + ((a & 3) << 3)));
    assert(m < nbits);
    _bitcpy_short((unsigned char *)a, destn, (unsigned char *)b, srcn, m);
    destn += m;
    srcn += m;
    nbits -= m;
  }
  a += destn >> 3;
  b += srcn >> 3;
  destn = (destn & 7) | (((int)a & 3) << 3);
  srcn = (srcn & 7) | (((int)b & 3) << 3);
  a &= ~3;
  b &= ~3;
  assert(!destn);
  assert((0 <= srcn) && (srcn < 32));
  int p = (int)nbits & ~31;
  if (p) {
    _bitcpy_aligned((int *)a, (const int *)b, srcn, ((const int *)b) + (p >> 5));
  }
  nbits -= p;
  destn += p;
  srcn += p;
  a += destn >> 3;
  b += srcn >> 3;
  destn &= 7;
  srcn &= 7;
  _bitcpy_short((unsigned char *)a, destn, (unsigned char *)b, srcn, (int)nbits);
}
```