user: What is the c source code of the assembly code below?

```asm
<IntegerPacker_32>:
  endbr64
  cmp    $0x20,%edx
  jg     L310
  mov    %rdi,%rax
  mov    %edx,%edi
  cmp    %ecx,%edx
  jl     L310
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  lea    0x1f(%r9),%edx
  test   %r9d,%r9d
  cmovns %r9d,%edx
  sar    $0x5,%edx
  movslq %edx,%rdx
  lea    (%rax,%rdx,4),%r10
  mov    %r9d,%edx
  sar    $0x1f,%edx
  shr    $0x1b,%edx
  add    %edx,%r9d
  and    $0x1f,%r9d
  sub    %r9d,%edx
  lea    0x20(%rdx),%r9d
  mov    $0xffffffff,%edx
  cmp    $0x1f,%ecx
  jg     L272
  shl    %cl,%edx
  not    %edx
L272:
  cmp    $0x20,%r9d
  je     L476
  mov    $0x0,%eax
  cmp    $0x1f,%r9d
  jg     L413
  mov    (%r10),%eax
  mov    %r9d,%ecx
  shr    %cl,%eax
L413:
  cmp    $0x1,%r8d
  jle    L407
  lea    -0x2(%r8),%r12d
  shr    %r12d
  lea    0x1(%r12),%ecx
  lea    (%rsi,%rcx,8),%rbp
  jmp    L388
L476:
  cmp    $0x20,%edi
  je     L236
  cmp    $0x18,%edi
  je     L399
  cmp    $0x10,%edi
  jne    L198
  cmp    $0x3,%r8d
  jle    L472
  lea    -0x4(%r8),%ebp
  shr    $0x2,%ebp
  lea    0x1(%rbp),%r12d
  mov    %r12d,%r12d
  lea    (%r10,%r12,8),%rbx
  mov    %rsi,%rax
L364:
  mov    %edx,%r11d
  and    (%rax),%r11d
  mov    %edx,%r14d
  and    0x4(%rax),%r14d
  mov    %edx,%ecx
  and    0x8(%rax),%ecx
  add    $0x10,%rax
  mov    %edx,%r13d
  and    -0x4(%rax),%r13d
  shl    $0x10,%r11d
  or     %r14d,%r11d
  mov    %r11d,(%r10)
  add    $0x8,%r10
  shl    $0x10,%ecx
  or     %r13d,%ecx
  mov    %ecx,-0x4(%r10)
  cmp    %r10,%rbx
  jne    L364
  shl    $0x4,%r12
  add    %r12,%rsi
  neg    %ebp
  lea    -0x4(%r8,%rbp,4),%r8d
  mov    %r10,%r11
L288:
  cmp    $0x6,%edi
  jne    L41
  cmp    $0xf,%r8d
  jle    L231
  lea    -0x10(%r8),%ebp
  shr    $0x4,%ebp
  lea    0x1(%rbp),%r12d
  mov    %r12d,%r12d
  lea    (%r12,%r12,2),%rax
  lea    (%r11,%rax,4),%rbx
  mov    %rsi,%rax
L239:
  mov    %edx,%r10d
  and    0x14(%rax),%r10d
  mov    %edx,%r14d
  and    0x18(%rax),%r14d
  mov    %edx,%r13d
  and    0x1c(%rax),%r13d
  mov    %edx,%ecx
  and    (%rax),%ecx
  shl    $0x1a,%ecx
  mov    %edx,%r15d
  and    0x4(%rax),%r15d
  shl    $0x14,%r15d
  or     %r15d,%ecx
  mov    %edx,%r15d
  and    0x8(%rax),%r15d
  shl    $0xe,%r15d
  or     %r15d,%ecx
  mov    %edx,%r15d
  and    0xc(%rax),%r15d
  shl    $0x8,%r15d
  or     %r15d,%ecx
  mov    %edx,%r15d
  and    0x10(%rax),%r15d
  shl    $0x2,%r15d
  or     %r15d,%ecx
  mov    %r10d,%r15d
  shr    $0x4,%r15d
  or     %r15d,%ecx
  mov    %ecx,(%r11)
  mov    %edx,%ecx
  and    0x28(%rax),%ecx
  shl    $0x1c,%r10d
  shl    $0x16,%r14d
  or     %r14d,%r10d
  shl    $0x10,%r13d
  or     %r13d,%r10d
  mov    %edx,%r13d
  and    0x20(%rax),%r13d
  shl    $0xa,%r13d
  or     %r13d,%r10d
  mov    %edx,%r13d
  and    0x24(%rax),%r13d
  shl    $0x4,%r13d
  or     %r13d,%r10d
  mov    %ecx,%r13d
  shr    $0x2,%r13d
  or     %r13d,%r10d
  mov    %r10d,0x4(%r11)
  mov    %edx,%r15d
  and    0x2c(%rax),%r15d
  mov    %edx,%r14d
  and    0x30(%rax),%r14d
  mov    %edx,%r13d
  and    0x34(%rax),%r13d
  mov    %edx,%r10d
  and    0x38(%rax),%r10d
  add    $0x40,%rax
  add    $0xc,%r11
  shl    $0x1e,%ecx
  shl    $0x18,%r15d
  or     %r15d,%ecx
  shl    $0x12,%r14d
  or     %r14d,%ecx
  shl    $0xc,%r13d
  or     %r13d,%ecx
  shl    $0x6,%r10d
  or     %r10d,%ecx
  mov    %edx,%r10d
  and    -0x4(%rax),%r10d
  or     %r10d,%ecx
  mov    %ecx,-0x4(%r11)
  cmp    %r11,%rbx
  jne    L239
  shl    $0x6,%r12
  add    %r12,%rsi
  neg    %ebp
  shl    $0x4,%ebp
  lea    -0x10(%r8,%rbp,1),%r8d
L231:
  cmp    $0x1,%edi
  jne    L383
  cmp    $0x1f,%r8d
  jle    L86
  lea    0x80(%rsi),%rbx
  lea    -0x20(%r8),%r12d
  shr    $0x5,%r12d
  lea    0x1(%r12),%r13d
  mov    %r13d,%r13d
  lea    (%r11,%r13,4),%r10
  mov    $0x0,%ebp
  jmp    L323
L236:
  movslq %r8d,%rdx
  shl    $0x2,%rdx
  mov    %rax,%rdi
  call   <memcpy@plt>
  jmp    L419
L399:
  cmp    $0x3,%r8d
  jle    L55
  lea    -0x4(%r8),%r12d
  shr    $0x2,%r12d
  lea    0x1(%r12),%ebp
  mov    %ebp,%ebp
  lea    0x0(%rbp,%rbp,2),%rax
  lea    (%r10,%rax,4),%rbx
  mov    %rsi,%r11
L67:
  mov    %edx,%r14d
  and    (%r11),%r14d
  mov    %edx,%ecx
  and    0x4(%r11),%ecx
  mov    %edx,%eax
  and    0x8(%r11),%eax
  add    $0x10,%r11
  mov    %edx,%r13d
  and    -0x4(%r11),%r13d
  shl    $0x8,%r14d
  mov    %ecx,%r15d
  shr    $0x10,%r15d
  or     %r15d,%r14d
  mov    %r14d,(%r10)
  shl    $0x10,%ecx
  mov    %eax,%r14d
  shr    $0x8,%r14d
  or     %r14d,%ecx
  mov    %ecx,0x4(%r10)
  add    $0xc,%r10
  shl    $0x18,%eax
  or     %r13d,%eax
  mov    %eax,-0x4(%r10)
  cmp    %r10,%rbx
  jne    L67
  shl    $0x4,%rbp
  add    %rbp,%rsi
  neg    %r12d
  lea    -0x4(%r8,%r12,4),%r8d
  mov    %r10,%r11
L4:
  cmp    $0x8,%edi
  jne    L288
  cmp    $0x7,%r8d
  jle    L533
  lea    -0x8(%r8),%ebx
  shr    $0x3,%ebx
  lea    0x1(%rbx),%ebp
  mov    %ebp,%ebp
  lea    (%r11,%rbp,8),%r10
  mov    %rsi,%rax
L356:
  mov    %edx,%ecx
  and    (%rax),%ecx
  shl    $0x18,%ecx
  mov    %edx,%r12d
  and    0x4(%rax),%r12d
  shl    $0x10,%r12d
  or     %r12d,%ecx
  mov    %edx,%r12d
  and    0xc(%rax),%r12d
  or     %r12d,%ecx
  mov    %edx,%r12d
  and    0x8(%rax),%r12d
  shl    $0x8,%r12d
  or     %r12d,%ecx
  mov    %ecx,(%r11)
  mov    %edx,%ecx
  and    0x10(%rax),%ecx
  mov    %edx,%r13d
  and    0x14(%rax),%r13d
  mov    %edx,%r12d
  and    0x18(%rax),%r12d
  add    $0x20,%rax
  add    $0x8,%r11
  shl    $0x18,%ecx
  shl    $0x10,%r13d
  or     %r13d,%ecx
  shl    $0x8,%r12d
  or     %r12d,%ecx
  mov    %edx,%r12d
  and    -0x4(%rax),%r12d
  or     %r12d,%ecx
  mov    %ecx,-0x4(%r11)
  cmp    %r11,%r10
  jne    L356
  shl    $0x5,%rbp
  add    %rbp,%rsi
  neg    %ebx
  lea    -0x8(%r8,%rbx,8),%r8d
L533:
  cmp    $0x2,%edi
  jne    L231
  cmp    $0xf,%r8d
  jle    L263
  lea    -0x10(%r8),%ebp
  shr    $0x4,%ebp
  lea    0x1(%rbp),%r12d
  mov    %r12d,%r12d
  lea    (%r11,%r12,4),%r10
  mov    %rsi,%rax
L209:
  mov    %edx,%ecx
  and    (%rax),%ecx
  shl    $0x2,%ecx
  mov    %edx,%ebx
  and    0x4(%rax),%ebx
  or     %ecx,%ebx
  shl    $0x2,%ebx
  mov    %edx,%ecx
  and    0x8(%rax),%ecx
  or     %ebx,%ecx
  shl    $0x2,%ecx
  mov    %edx,%ebx
  and    0xc(%rax),%ebx
  or     %ecx,%ebx
  shl    $0x2,%ebx
  mov    %edx,%ecx
  and    0x10(%rax),%ecx
  or     %ebx,%ecx
  shl    $0x2,%ecx
  mov    %edx,%ebx
  and    0x14(%rax),%ebx
  or     %ecx,%ebx
  shl    $0x2,%ebx
  mov    %edx,%ecx
  and    0x18(%rax),%ecx
  or     %ebx,%ecx
  shl    $0x2,%ecx
  mov    %edx,%ebx
  and    0x1c(%rax),%ebx
  or     %ecx,%ebx
  shl    $0x2,%ebx
  mov    %edx,%ecx
  and    0x20(%rax),%ecx
  or     %ebx,%ecx
  shl    $0x2,%ecx
  mov    %edx,%ebx
  and    0x24(%rax),%ebx
  or     %ecx,%ebx
  shl    $0x2,%ebx
  mov    %edx,%ecx
  and    0x28(%rax),%ecx
  or     %ebx,%ecx
  shl    $0x2,%ecx
  mov    %edx,%ebx
  and    0x2c(%rax),%ebx
  or     %ecx,%ebx
  shl    $0x2,%ebx
  mov    %edx,%ecx
  and    0x30(%rax),%ecx
  or     %ebx,%ecx
  shl    $0x2,%ecx
  mov    %edx,%ebx
  and    0x34(%rax),%ebx
  or     %ecx,%ebx
  shl    $0x2,%ebx
  mov    %edx,%ecx
  and    0x38(%rax),%ecx
  or     %ebx,%ecx
  shl    $0x2,%ecx
  add    $0x40,%rax
  add    $0x4,%r11
  mov    %edx,%ebx
  and    -0x4(%rax),%ebx
  or     %ebx,%ecx
  mov    %ecx,-0x4(%r11)
  cmp    %r10,%r11
  jne    L209
  shl    $0x6,%r12
  add    %r12,%rsi
  neg    %ebp
  shl    $0x4,%ebp
  lea    -0x10(%r8,%rbp,1),%r8d
  jmp    L37
L198:
  cmp    $0xc,%edi
  jne    L15
  cmp    $0x7,%r8d
  jle    L498
  lea    -0x8(%r8),%ebp
  shr    $0x3,%ebp
  lea    0x1(%rbp),%ebx
  mov    %ebx,%ebx
  lea    (%rbx,%rbx,2),%rax
  lea    (%r10,%rax,4),%r11
  mov    %rsi,%rcx
L173:
  mov    %edx,%eax
  and    0x8(%rcx),%eax
  mov    %edx,%r13d
  and    0xc(%rcx),%r13d
  mov    %edx,%r12d
  and    (%rcx),%r12d
  shl    $0x14,%r12d
  mov    %edx,%r14d
  and    0x4(%rcx),%r14d
  shl    $0x8,%r14d
  or     %r14d,%r12d
  mov    %eax,%r14d
  shr    $0x4,%r14d
  or     %r14d,%r12d
  mov    %r12d,(%r10)
  mov    %edx,%r12d
  and    0x14(%rcx),%r12d
  shl    $0x1c,%eax
  shl    $0x10,%r13d
  or     %r13d,%eax
  mov    %edx,%r13d
  and    0x10(%rcx),%r13d
  shl    $0x4,%r13d
  or     %r13d,%eax
  mov    %r12d,%r13d
  shr    $0x8,%r13d
  or     %r13d,%eax
  mov    %eax,0x4(%r10)
  mov    %edx,%r13d
  and    0x18(%rcx),%r13d
  add    $0x20,%rcx
  add    $0xc,%r10
  mov    %r12d,%eax
  shl    $0x18,%eax
  mov    %r13d,%r12d
  shl    $0xc,%r12d
  or     %r12d,%eax
  mov    %edx,%r12d
  and    -0x4(%rcx),%r12d
  or     %r12d,%eax
  mov    %eax,-0x4(%r10)
  cmp    %r10,%r11
  jne    L173
  shl    $0x5,%rbx
  add    %rbx,%rsi
  neg    %ebp
  lea    -0x8(%r8,%rbp,8),%r8d
  mov    %r10,%r11
L41:
  cmp    $0x4,%edi
  jne    L533
  cmp    $0x7,%r8d
  jle    L488
  lea    -0x8(%r8),%ebp
  shr    $0x3,%ebp
  lea    0x1(%rbp),%r12d
  mov    %r12d,%r12d
  lea    (%r11,%r12,4),%r10
  mov    %rsi,%rax
L521:
  mov    %edx,%ecx
  and    (%rax),%ecx
  shl    $0x4,%ecx
  mov    %edx,%ebx
  and    0x4(%rax),%ebx
  or     %ecx,%ebx
  shl    $0x4,%ebx
  mov    %edx,%ecx
  and    0x8(%rax),%ecx
  or     %ebx,%ecx
  shl    $0x4,%ecx
  mov    %edx,%ebx
  and    0xc(%rax),%ebx
  or     %ecx,%ebx
  shl    $0x4,%ebx
  mov    %edx,%ecx
  and    0x10(%rax),%ecx
  or     %ebx,%ecx
  shl    $0x4,%ecx
  mov    %edx,%ebx
  and    0x14(%rax),%ebx
  or     %ecx,%ebx
  shl    $0x4,%ebx
  mov    %edx,%ecx
  and    0x18(%rax),%ecx
  or     %ebx,%ecx
  shl    $0x4,%ecx
  add    $0x20,%rax
  add    $0x4,%r11
  mov    %edx,%ebx
  and    -0x4(%rax),%ebx
  or     %ebx,%ecx
  mov    %ecx,-0x4(%r11)
  cmp    %r10,%r11
  jne    L521
  shl    $0x5,%r12
  add    %r12,%rsi
  neg    %ebp
  lea    -0x8(%r8,%rbp,8),%r8d
L37:
  mov    $0x0,%eax
  jmp    L413
L15:
  mov    %r10,%r11
  jmp    L4
L172:
  add    $0x4,%r11
  mov    %eax,-0x4(%r11)
  sub    $0xffffffffffffff80,%rbx
  cmp    %r10,%r11
  je     L397
L323:
  lea    -0x80(%rbx),%rcx
  mov    %ebp,%eax
L68:
  add    %eax,%eax
  mov    (%rcx),%r14d
  and    $0x1,%r14d
  or     %eax,%r14d
  add    %r14d,%r14d
  mov    0x4(%rcx),%eax
  and    $0x1,%eax
  or     %r14d,%eax
  add    %eax,%eax
  mov    0x8(%rcx),%r14d
  and    $0x1,%r14d
  or     %eax,%r14d
  add    %r14d,%r14d
  add    $0x10,%rcx
  mov    -0x4(%rcx),%eax
  and    $0x1,%eax
  or     %r14d,%eax
  cmp    %rbx,%rcx
  jne    L68
  jmp    L172
L397:
  neg    %r12d
  shl    $0x5,%r12d
  lea    -0x20(%r8,%r12,1),%r8d
  shl    $0x7,%r13
  add    %r13,%rsi
  jmp    L37
L449:
  mov    %edi,%ecx
  sub    %r9d,%ecx
  mov    %rax,%r15
  shr    %cl,%r15
  test   %r11d,%r11d
  cmovs  %r15,%rax
  mov    %eax,(%r10)
  add    $0x20,%r11d
  mov    %rbx,%rax
  lea    0x4(%r10),%r10
  jmp    L107
L436:
  cmp    %rsi,%rbp
  je     L431
L388:
  mov    %r9d,%r11d
  sub    %edi,%r11d
  mov    %edi,%ecx
  shl    %cl,%rax
  mov    %edx,%ebx
  and    (%rsi),%ebx
  or     %rbx,%rax
  test   %r11d,%r11d
  jle    L449
L107:
  add    $0x8,%rsi
  mov    %r11d,%r9d
  sub    %edi,%r9d
  mov    %edi,%ecx
  shl    %cl,%rax
  mov    %edx,%ebx
  and    -0x4(%rsi),%ebx
  or     %rbx,%rax
  test   %r9d,%r9d
  jg     L436
  mov    %edi,%ecx
  sub    %r11d,%ecx
  mov    %rax,%r15
  shr    %cl,%r15
  test   %r9d,%r9d
  cmovs  %r15,%rax
  mov    %eax,(%r10)
  add    $0x20,%r9d
  mov    %rbx,%rax
  lea    0x4(%r10),%r10
  jmp    L436
L431:
  neg    %r12d
  lea    -0x2(%r8,%r12,2),%r8d
L407:
  test   %r8d,%r8d
  jle    L188
  mov    %r8d,%r8d
  lea    (%rsi,%r8,4),%rbx
  mov    %r9d,%r8d
L497:
  add    $0x4,%rsi
  mov    %r8d,%r9d
  sub    %edi,%r9d
  mov    %edi,%ecx
  shl    %cl,%rax
  mov    %edx,%r11d
  and    -0x4(%rsi),%r11d
  or     %r11,%rax
  test   %r9d,%r9d
  jle    L328
L306:
  cmp    %rbx,%rsi
  jne    L324
L188:
  cmp    $0x1f,%r9d
  jg     L419
  mov    %r9d,%ecx
  shl    %cl,%rax
  mov    %eax,(%r10)
L419:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L324:
  mov    %r9d,%r8d
  jmp    L497
L328:
  mov    %edi,%ecx
  sub    %r8d,%ecx
  mov    %rax,%r8
  shr    %cl,%r8
  test   %r9d,%r9d
  cmovs  %r8,%rax
  mov    %eax,(%r10)
  add    $0x20,%r9d
  mov    %r11,%rax
  lea    0x4(%r10),%r10
  jmp    L306
L383:
  mov    %r11,%r10
  jmp    L37
L86:
  mov    %r11,%r10
  jmp    L37
L263:
  mov    %r11,%r10
  jmp    L37
L488:
  mov    %r11,%r10
  jmp    L37
L498:
  mov    %r10,%r11
  jmp    L41
L472:
  mov    %r10,%r11
  jmp    L288
L55:
  mov    %r10,%r11
  jmp    L4
L310:
  ret
```

assistant: ```c
void IntegerPacker_32(void *stream, void *src, int nbits, int nbitt, int n, int offset) {
  unsigned int *packed = (unsigned int *)stream;
  unsigned int *unpacked = (unsigned int *)src;
  unsigned long long temp;
  unsigned int maskk, token, token1, token2, token3, token4, token5, token6, token7, token8;
  int bleft, i;
  if (nbits > 32 || nbitt > nbits)
    return;
  packed += offset / 32;
  bleft = 32 - (offset % 32);
  maskk = 0xFFFFFFFF;
  if (nbitt < 32)
    maskk = ~(0xFFFFFFFF << nbitt);
  if (bleft == 32) {
    const unsigned int mask = maskk;
    if (nbits == 32) {
      packed = (unsigned int *)memcpy(stream, src, n * sizeof(unsigned int));
      return;
    }
    temp = 0;
    if (nbits == 24) {
      while (n > 3) {
        token1 = (*unpacked++) & mask;
        token2 = (*unpacked++) & mask;
        token3 = (*unpacked++) & mask;
        token4 = (*unpacked++) & mask;
        *packed++ = (token1 << 8) | (token2 >> 16);
        *packed++ = (token2 << 16) | (token3 >> 8);
        *packed++ = (token3 << 24) | token4;
        n -= 4;
      }
    }
    if (nbits == 16) {
      while (n > 3) {
        token1 = (*unpacked++) & mask;
        token2 = (*unpacked++) & mask;
        token3 = (*unpacked++) & mask;
        token4 = (*unpacked++) & mask;
        *packed++ = (token1 << 16) | token2;
        *packed++ = (token3 << 16) | token4;
        n -= 4;
      }
    }
    if (nbits == 12) {
      while (n > 7) {
        token1 = (*unpacked++) & mask;
        token2 = (*unpacked++) & mask;
        token3 = (*unpacked++) & mask;
        token4 = (*unpacked++) & mask;
        *packed++ = (token1 << 20) | (token2 << 8) | (token3 >> 4);
        token1 = (*unpacked++) & mask;
        token2 = (*unpacked++) & mask;
        *packed++ = (token3 << 28) | (token4 << 16) | (token1 << 4) | (token2 >> 8);
        token3 = (*unpacked++) & mask;
        token4 = (*unpacked++) & mask;
        *packed++ = (token2 << 24) | (token3 << 12) | token4;
        n -= 8;
      }
    }
    if (nbits == 8) {
      while (n > 7) {
        token1 = (*unpacked++) & mask;
        token2 = (*unpacked++) & mask;
        token3 = (*unpacked++) & mask;
        token4 = (*unpacked++) & mask;
        *packed++ = (token1 << 24) | (token2 << 16) | (token3 << 8) | token4;
        token1 = (*unpacked++) & mask;
        token2 = (*unpacked++) & mask;
        token3 = (*unpacked++) & mask;
        token4 = (*unpacked++) & mask;
        *packed++ = (token1 << 24) | (token2 << 16) | (token3 << 8) | token4;
        n -= 8;
      }
    }
    if (nbits == 6) {
      while (n > 15) {
        token1 = (*unpacked++) & mask;
        token2 = (*unpacked++) & mask;
        token3 = (*unpacked++) & mask;
        token4 = (*unpacked++) & mask;
        token5 = (*unpacked++) & mask;
        token6 = (*unpacked++) & mask;
        token7 = (*unpacked++) & mask;
        token8 = (*unpacked++) & mask;
        *packed++ = (token1 << 26) | (token2 << 20) | (token3 << 14) | (token4 << 8) | (token5 << 2) | (token6 >> 4);
        token1 = (*unpacked++) & mask;
        token2 = (*unpacked++) & mask;
        token3 = (*unpacked++) & mask;
        *packed++ = (token6 << 28) | (token7 << 22) | (token8 << 16) | (token1 << 10) | (token2 << 4) | (token3 >> 2);
        token4 = (*unpacked++) & mask;
        token5 = (*unpacked++) & mask;
        token6 = (*unpacked++) & mask;
        token7 = (*unpacked++) & mask;
        token8 = (*unpacked++) & mask;
        *packed++ = (token3 << 30) | (token4 << 24) | (token5 << 18) | (token6 << 12) | (token7 << 6) | token8;
        n -= 16;
      }
    }
    if (nbits == 4) {
      while (n > 7) {
        token = (*unpacked++) & mask;
        token = (token << 4) | ((*unpacked++) & mask);
        token = (token << 4) | ((*unpacked++) & mask);
        token = (token << 4) | ((*unpacked++) & mask);
        token = (token << 4) | ((*unpacked++) & mask);
        token = (token << 4) | ((*unpacked++) & mask);
        token = (token << 4) | ((*unpacked++) & mask);
        *packed++ = (token << 4) | ((*unpacked++) & mask);
        n -= 8;
      }
    }
    if (nbits == 2) {
      while (n > 15) {
        token = (*unpacked++) & mask;
        token = (token << 2) | ((*unpacked++) & mask);
        token = (token << 2) | ((*unpacked++) & mask);
        token = (token << 2) | ((*unpacked++) & mask);
        token = (token << 2) | ((*unpacked++) & mask);
        token = (token << 2) | ((*unpacked++) & mask);
        token = (token << 2) | ((*unpacked++) & mask);
        token = (token << 2) | ((*unpacked++) & mask);
        token = (token << 2) | ((*unpacked++) & mask);
        token = (token << 2) | ((*unpacked++) & mask);
        token = (token << 2) | ((*unpacked++) & mask);
        token = (token << 2) | ((*unpacked++) & mask);
        token = (token << 2) | ((*unpacked++) & mask);
        token = (token << 2) | ((*unpacked++) & mask);
        token = (token << 2) | ((*unpacked++) & mask);
        *packed++ = (token << 2) | ((*unpacked++) & mask);
        n -= 16;
      }
    }
    if (nbits == 1) {
      while (n > 31) {
        token = 0;
        i = 8;
        while (i-- != 0) {
          token = (token << 1) | ((*unpacked++) & 1);
          token = (token << 1) | ((*unpacked++) & 1);
          token = (token << 1) | ((*unpacked++) & 1);
          token = (token << 1) | ((*unpacked++) & 1);
        }
        *packed++ = token;
        n -= 32;
      }
    }
  }
  if (bleft < 32)
    temp = *packed >> bleft;
  {
    const unsigned int mask = maskk;
    while (n > 1) {
      token = (*unpacked++) & mask;
      bleft -= nbits;
      temp = (temp << nbits) | token;
      if (bleft <= 0) {
        if (bleft < 0)
          temp >>= (-bleft);
        *packed++ = temp;
        bleft += 32;
        temp = token;
      }
      token = (*unpacked++) & mask;
      bleft -= nbits;
      temp = (temp << nbits) | token;
      if (bleft <= 0) {
        if (bleft < 0)
          temp >>= (-bleft);
        *packed++ = temp;
        bleft += 32;
        temp = token;
      }
      n -= 2;
    }
    while (n-- > 0) {
      token = (*unpacked++) & mask;
      bleft -= nbits;
      temp = (temp << nbits) | token;
      if (bleft <= 0) {
        if (bleft < 0)
          temp >>= (-bleft);
        *packed++ = temp;
        bleft += 32;
        temp = token;
      }
    }
  }
  if (bleft < 32)
    *packed = (temp << bleft);
}
```