user: Translate the below assembly code into C programming language:

```asm
<fgen_copy_partial_bitstring>:
  endbr64
  test   %ecx,%ecx
  je     L10
  push   %rbx
  mov    %rdi,%r8
  mov    %ecx,%eax
  lea    0x7(%rdx),%r10d
  test   %edx,%edx
  cmovns %edx,%r10d
  sar    $0x3,%r10d
  mov    %r10d,%edi
  mov    %edx,%ecx
  and    $0x7,%ecx
  je     L186
  movslq %r10d,%r11
  lea    (%rsi,%r11,1),%r9
  mov    $0x1,%edx
  shl    %cl,%edx
  mov    %edx,%edi
  not    %edi
  and    (%r9),%dil
  mov    %dil,(%r9)
  add    %r8,%r11
  and    (%r11),%dl
  or     %edi,%edx
  mov    %dl,(%r9)
  sub    $0x1,%eax
  je     L136
  mov    $0x1,%ebx
L185:
  add    $0x1,%ecx
  cmp    $0x8,%ecx
  je     L67
  mov    %ebx,%edi
  shl    %cl,%edi
  mov    %edi,%edx
  not    %edx
  and    (%r9),%dl
  mov    %dl,(%r9)
  and    (%r11),%dil
  or     %edx,%edi
  mov    %dil,(%r9)
  sub    $0x1,%eax
  jne    L185
  jmp    L136
L67:
  lea    0x1(%r10),%edi
L186:
  cmp    $0x7,%eax
  jle    L149
  movslq %edi,%rcx
  lea    (%rsi,%rcx,1),%rdx
  test   $0x3,%dl
  je     L41
  mov    %rcx,%rdx
  add    $0x1,%edi
  sub    %ecx,%edi
  lea    0x1(%rsi),%r10d
L103:
  movzbl (%r8,%rdx,1),%ecx
  mov    %cl,(%rsi,%rdx,1)
  sub    $0x8,%eax
  mov    %edx,%ecx
  lea    (%rdi,%rdx,1),%r9d
  cmp    $0x7,%eax
  jle    L13
  add    $0x1,%rdx
  add    %r10d,%ecx
  test   $0x3,%cl
  jne    L103
L126:
  mov    %eax,%ecx
  cmp    $0x1f,%eax
  jg     L25
  jmp    L53
L41:
  mov    %edi,%r9d
  jmp    L126
L149:
  mov    %edi,%r9d
L13:
  cmp    $0x1f,%eax
  jle    L91
L25:
  movslq %r9d,%rdx
  mov    %eax,%ecx
L140:
  mov    (%r8,%rdx,1),%edi
  mov    %edi,(%rsi,%rdx,1)
  sub    $0x20,%ecx
  add    $0x4,%rdx
  cmp    $0x1f,%ecx
  jg     L140
  lea    -0x20(%rax),%ecx
  mov    %ecx,%edx
  shr    $0x5,%edx
  mov    $0x0,%r10d
  mov    %edx,%edi
  neg    %edi
  shl    $0x5,%edi
  cmp    $0x1f,%eax
  cmovle %r10d,%edi
  add    %edi,%ecx
  shl    $0x2,%edx
  cmp    $0x1f,%eax
  cmovle %r10d,%edx
  lea    0x4(%r9,%rdx,1),%r9d
  mov    %ecx,%eax
  cmp    $0x7,%ecx
  jle    L91
L53:
  movslq %r9d,%rax
  mov    %ecx,%edx
L150:
  movzbl (%r8,%rax,1),%edi
  mov    %dil,(%rsi,%rax,1)
  sub    $0x8,%edx
  add    $0x1,%rax
  cmp    $0x7,%edx
  jg     L150
  lea    -0x8(%rcx),%r10d
  mov    %r10d,%edx
  shr    $0x3,%edx
  mov    $0x0,%edi
  mov    %edx,%eax
  neg    %eax
  shl    $0x3,%eax
  cmp    $0x7,%ecx
  cmovle %edi,%eax
  add    %r10d,%eax
  cmp    $0x7,%ecx
  cmovle %edi,%edx
  lea    0x1(%r9,%rdx,1),%r9d
L91:
  test   %eax,%eax
  jle    L136
  mov    $0x0,%ecx
  movslq %r9d,%r9
  add    %r9,%rsi
  mov    $0x1,%r10d
L57:
  mov    %r10d,%edx
  shl    %cl,%edx
  mov    %edx,%edi
  not    %edi
  and    (%rsi),%dil
  mov    %dil,(%rsi)
  and    (%r8,%r9,1),%dl
  or     %edi,%edx
  mov    %dl,(%rsi)
  add    $0x1,%ecx
  cmp    %eax,%ecx
  jne    L57
L136:
  pop    %rbx
  ret
L10:
  ret
```

assistant: ```c
void fgen_copy_partial_bitstring(const unsigned char *src, unsigned char *dest, int bitoffset, int number_of_bits) {
  int i, offset;
  if (number_of_bits == 0)
    return;
  offset = bitoffset / 8;
  if ((bitoffset & 7) != 0) {
    for (i = bitoffset & 7; i < 8; i++) {
      dest[offset] &= ~(1 << i);
      dest[offset] |= src[offset] & (1 << i);
      number_of_bits--;
      if (number_of_bits == 0)
        return;
    }
    offset++;
  }
  while (number_of_bits >= 8 && (((unsigned int)(&dest[offset])) & 3) != 0) {
    dest[offset] = src[offset];
    number_of_bits -= 8;
    offset++;
  }
  while (number_of_bits >= 32) {
    *(unsigned int *)&dest[offset] = *(unsigned int *)&src[offset];
    number_of_bits -= 32;
    offset += 4;
  }
  while (number_of_bits >= 8) {
    dest[offset] = src[offset];
    number_of_bits -= 8;
    offset++;
  }
  for (i = 0; i < number_of_bits; i++) {
    dest[offset] &= ~(1 << i);
    dest[offset] |= src[offset] & (1 << i);
  }
}
```