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

```asm
<IntegerPacker_32>:
  endbr64
  cmp    $0x20,%edx
  jg     L111
  mov    %edx,%r10d
  cmp    %ecx,%edx
  jl     L111
  test   %r9d,%r9d
  lea    0x1f(%r9),%eax
  mov    $0xffffffff,%edx
  push   %r15
  cmovns %r9d,%eax
  shl    %cl,%edx
  push   %r14
  not    %edx
  push   %r13
  sar    $0x5,%eax
  push   %r12
  cltq
  push   %rbp
  lea    (%rdi,%rax,4),%r11
  mov    %r9d,%eax
  push   %rbx
  sar    $0x1f,%eax
  shr    $0x1b,%eax
  add    %eax,%r9d
  and    $0x1f,%r9d
  sub    %r9d,%eax
  cmp    $0x20,%ecx
  lea    0x20(%rax),%r9d
  mov    $0xffffffff,%eax
  cmovge %eax,%edx
  cmp    $0x20,%r9d
  je     L53
  xor    %eax,%eax
  cmp    $0x1f,%r9d
  jg     L260
  mov    (%r11),%eax
  mov    %r9d,%ecx
  shr    %cl,%eax
L260:
  cmp    $0x1,%r8d
  jle    L446
  sub    $0x2,%r8d
  mov    %r8d,%r12d
  shr    %r12d
  lea    0x1(%r12),%ecx
  lea    (%rsi,%rcx,8),%rbp
  nopl   0x0(%rax,%rax,1)
L378:
  mov    %r9d,%edi
  mov    %r10d,%ecx
  mov    %edx,%ebx
  and    (%rsi),%ebx
  shl    %cl,%rax
  sub    %r10d,%edi
  or     %rbx,%rax
  test   %edi,%edi
  jg     L26
  mov    %r10d,%ecx
  mov    %rax,%r14
  sub    %r9d,%ecx
  shr    %cl,%r14
  test   %edi,%edi
  cmovne %r14,%rax
  add    $0x20,%edi
  add    $0x4,%r11
  mov    %eax,-0x4(%r11)
  mov    %rbx,%rax
L26:
  add    $0x8,%rsi
  mov    %edi,%r9d
  mov    %r10d,%ecx
  mov    %edx,%ebx
  shl    %cl,%rax
  and    -0x4(%rsi),%ebx
  sub    %r10d,%r9d
  or     %rbx,%rax
  test   %r9d,%r9d
  jg     L339
  mov    %r10d,%ecx
  sub    %edi,%ecx
  mov    %rax,%rdi
  shr    %cl,%rdi
  test   %r9d,%r9d
  cmovne %rdi,%rax
  add    $0x20,%r9d
  add    $0x4,%r11
  mov    %eax,-0x4(%r11)
  mov    %rbx,%rax
L339:
  cmp    %rbp,%rsi
  jne    L378
  neg    %r12d
  lea    (%r8,%r12,2),%r8d
L216:
  mov    %r9d,%esi
  cmp    $0x1,%r8d
  jne    L362
  mov    %r10d,%ecx
  and    0x0(%rbp),%edx
  sub    %r10d,%esi
  shl    %cl,%rax
  or     %rdx,%rax
  test   %esi,%esi
  jg     L362
  mov    %r10d,%ecx
  mov    %rax,%rbx
  sub    %r9d,%ecx
  shr    %cl,%rbx
  test   %esi,%esi
  cmovne %rbx,%rax
  add    $0x20,%esi
  add    $0x4,%r11
  mov    %eax,-0x4(%r11)
  mov    %rdx,%rax
L362:
  cmp    $0x1f,%esi
  jg     L299
  mov    %esi,%ecx
  shl    %cl,%rax
  mov    %eax,(%r11)
L299:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L53:
  cmp    $0x20,%r10d
  je     L243
  cmp    $0x18,%r10d
  je     L428
  cmp    $0x10,%r10d
  jne    L188
  cmp    $0x3,%r8d
  jle    L150
  sub    $0x4,%r8d
  mov    %rsi,%rcx
  mov    %r8d,%r12d
  shr    $0x2,%r12d
  lea    0x1(%r12),%eax
  lea    (%r11,%rax,8),%rbx
  nopw   0x0(%rax,%rax,1)
L16:
  mov    (%rcx),%ebp
  mov    0x4(%rcx),%r14d
  add    $0x10,%rcx
  add    $0x8,%r11
  mov    -0x8(%rcx),%edi
  mov    -0x4(%rcx),%r13d
  and    %edx,%ebp
  and    %edx,%r14d
  and    %edx,%edi
  shl    $0x10,%ebp
  and    %edx,%r13d
  or     %r14d,%ebp
  shl    $0x10,%edi
  mov    %ebp,-0x8(%r11)
  or     %r13d,%edi
  mov    %edi,-0x4(%r11)
  cmp    %rbx,%r11
  jne    L16
  shl    $0x4,%rax
  neg    %r12d
  add    %rsi,%rax
  lea    (%r8,%r12,4),%r8d
L469:
  mov    %rbx,%rdi
  cmp    $0x4,%r10d
  jne    L142
  cmp    $0x7,%r8d
  jle    L87
  sub    $0x8,%r8d
  mov    %rax,%rcx
  mov    %r8d,%r12d
  shr    $0x3,%r12d
  lea    0x1(%r12),%esi
  lea    (%rbx,%rsi,4),%r11
  nopl   0x0(%rax)
L246:
  mov    (%rcx),%ebx
  mov    0x4(%rcx),%ebp
  add    $0x20,%rcx
  add    $0x4,%rdi
  and    %edx,%ebx
  and    %edx,%ebp
  shl    $0x4,%ebx
  or     %ebx,%ebp
  mov    -0x18(%rcx),%ebx
  shl    $0x4,%ebp
  and    %edx,%ebx
  or     %ebp,%ebx
  mov    -0x14(%rcx),%ebp
  shl    $0x4,%ebx
  and    %edx,%ebp
  or     %ebx,%ebp
  mov    -0x10(%rcx),%ebx
  shl    $0x4,%ebp
  and    %edx,%ebx
  or     %ebp,%ebx
  mov    -0xc(%rcx),%ebp
  shl    $0x4,%ebx
  and    %edx,%ebp
  or     %ebx,%ebp
  mov    -0x8(%rcx),%ebx
  shl    $0x4,%ebp
  and    %edx,%ebx
  or     %ebp,%ebx
  mov    -0x4(%rcx),%ebp
  shl    $0x4,%ebx
  and    %edx,%ebp
  or     %ebp,%ebx
  mov    %ebx,-0x4(%rdi)
  cmp    %r11,%rdi
  jne    L246
  shl    $0x5,%rsi
  neg    %r12d
  add    %rax,%rsi
  lea    (%r8,%r12,8),%r8d
  xor    %eax,%eax
  jmp    L260
  nopw   0x0(%rax,%rax,1)
L111:
  ret
  nopl   0x0(%rax)
L446:
  mov    %rsi,%rbp
  jmp    L216
L188:
  cmp    $0xc,%r10d
  jne    L330
  cmp    $0x7,%r8d
  jle    L234
  sub    $0x8,%r8d
  mov    %r11,%rdi
  mov    %r8d,%ebx
  shr    $0x3,%ebx
  lea    0x1(%rbx),%ebp
  mov    %rbp,%rax
  shl    $0x5,%rax
  add    %rsi,%rax
  xchg   %ax,%ax
L165:
  mov    (%rsi),%r12d
  mov    0x4(%rsi),%r14d
  add    $0x20,%rsi
  add    $0xc,%rdi
  mov    -0x18(%rsi),%ecx
  mov    -0x14(%rsi),%r13d
  and    %edx,%r12d
  and    %edx,%r14d
  shl    $0x8,%r14d
  and    %edx,%ecx
  shl    $0x14,%r12d
  and    %edx,%r13d
  or     %r14d,%r12d
  mov    %ecx,%r14d
  shl    $0x10,%r13d
  shr    $0x4,%r14d
  shl    $0x1c,%ecx
  or     %r14d,%r12d
  or     %r13d,%ecx
  mov    %r12d,-0xc(%rdi)
  mov    -0x10(%rsi),%r13d
  mov    -0xc(%rsi),%r12d
  and    %edx,%r13d
  and    %edx,%r12d
  shl    $0x4,%r13d
  or     %r13d,%ecx
  mov    %r12d,%r13d
  shr    $0x8,%r13d
  or     %r13d,%ecx
  mov    %ecx,-0x8(%rdi)
  mov    -0x8(%rsi),%r13d
  mov    %r12d,%ecx
  shl    $0x18,%ecx
  and    %edx,%r13d
  mov    %r13d,%r12d
  shl    $0xc,%r12d
  or     %r12d,%ecx
  mov    -0x4(%rsi),%r12d
  and    %edx,%r12d
  or     %r12d,%ecx
  mov    %ecx,-0x4(%rdi)
  cmp    %rax,%rsi
  jne    L165
  lea    0x0(%rbp,%rbp,2),%rcx
  neg    %ebx
  lea    (%r11,%rcx,4),%rdi
  lea    (%r8,%rbx,8),%r8d
L142:
  mov    %rax,%rsi
  cmp    $0x2,%r10d
  jne    L390
  cmp    $0xf,%r8d
  jle    L118
  sub    $0x10,%r8d
  mov    %rax,%rcx
  mov    %r8d,%r12d
  shr    $0x4,%r12d
  lea    0x1(%r12),%esi
  lea    (%rdi,%rsi,4),%r11
L398:
  mov    (%rcx),%ebx
  mov    0x4(%rcx),%ebp
  and    %edx,%ebx
  and    %edx,%ebp
  shl    $0x2,%ebx
  or     %ebx,%ebp
  mov    0x8(%rcx),%ebx
  shl    $0x2,%ebp
  and    %edx,%ebx
  or     %ebp,%ebx
  mov    0xc(%rcx),%ebp
  shl    $0x2,%ebx
  and    %edx,%ebp
  or     %ebx,%ebp
  mov    0x10(%rcx),%ebx
  shl    $0x2,%ebp
  and    %edx,%ebx
  or     %ebp,%ebx
  mov    0x14(%rcx),%ebp
  shl    $0x2,%ebx
  and    %edx,%ebp
  or     %ebx,%ebp
  mov    0x18(%rcx),%ebx
  shl    $0x2,%ebp
  and    %edx,%ebx
  or     %ebp,%ebx
  mov    0x1c(%rcx),%ebp
  shl    $0x2,%ebx
  and    %edx,%ebp
  or     %ebx,%ebp
  mov    0x20(%rcx),%ebx
  shl    $0x2,%ebp
  and    %edx,%ebx
  or     %ebp,%ebx
  mov    0x24(%rcx),%ebp
  shl    $0x2,%ebx
  and    %edx,%ebp
  or     %ebx,%ebp
  mov    0x28(%rcx),%ebx
  shl    $0x2,%ebp
  and    %edx,%ebx
  or     %ebp,%ebx
  mov    0x2c(%rcx),%ebp
  shl    $0x2,%ebx
  and    %edx,%ebp
  add    $0x40,%rcx
  add    $0x4,%rdi
  or     %ebx,%ebp
  mov    -0x10(%rcx),%ebx
  shl    $0x2,%ebp
  and    %edx,%ebx
  or     %ebp,%ebx
  mov    -0xc(%rcx),%ebp
  shl    $0x2,%ebx
  and    %edx,%ebp
  or     %ebx,%ebp
  mov    -0x8(%rcx),%ebx
  shl    $0x2,%ebp
  and    %edx,%ebx
  or     %ebp,%ebx
  mov    -0x4(%rcx),%ebp
  shl    $0x2,%ebx
  and    %edx,%ebp
  or     %ebp,%ebx
  mov    %ebx,-0x4(%rdi)
  cmp    %r11,%rdi
  jne    L398
  shl    $0x6,%rsi
  shl    $0x4,%r12d
  add    %rax,%rsi
  sub    %r12d,%r8d
  xor    %eax,%eax
  jmp    L260
  nopl   0x0(%rax,%rax,1)
L428:
  cmp    $0x3,%r8d
  jle    L158
  sub    $0x4,%r8d
  mov    %rsi,%rdi
  mov    %r8d,%r12d
  shr    $0x2,%r12d
  lea    0x1(%r12),%ebp
  lea    0x0(%rbp,%rbp,2),%rax
  lea    (%r11,%rax,4),%rbx
  xchg   %ax,%ax
L461:
  mov    0x4(%rdi),%ecx
  mov    (%rdi),%r14d
  add    $0x10,%rdi
  add    $0xc,%r11
  mov    -0x8(%rdi),%eax
  mov    -0x4(%rdi),%r13d
  and    %edx,%ecx
  and    %edx,%r14d
  mov    %ecx,%r15d
  shl    $0x8,%r14d
  and    %edx,%eax
  and    %edx,%r13d
  shr    $0x10,%r15d
  shl    $0x10,%ecx
  or     %r15d,%r14d
  mov    %r14d,-0xc(%r11)
  mov    %eax,%r14d
  shl    $0x18,%eax
  shr    $0x8,%r14d
  or     %r13d,%eax
  or     %r14d,%ecx
  mov    %ecx,-0x8(%r11)
  mov    %eax,-0x4(%r11)
  cmp    %rbx,%r11
  jne    L461
  shl    $0x4,%rbp
  neg    %r12d
  add    %rbp,%rsi
  lea    (%r8,%r12,4),%r8d
L190:
  mov    %rsi,%rax
  cmp    $0x6,%r10d
  jne    L469
  cmp    $0xf,%r8d
  jle    L436
  sub    $0x10,%r8d
  mov    %rbx,%r11
  mov    %r8d,%r12d
  shr    $0x4,%r12d
  lea    0x1(%r12),%ebp
  mov    %rbp,%rcx
  shl    $0x6,%rcx
  add    %rcx,%rsi
  nopl   0x0(%rax,%rax,1)
L71:
  mov    (%rax),%ecx
  mov    0x4(%rax),%r15d
  mov    0x14(%rax),%edi
  mov    0x18(%rax),%r14d
  and    %edx,%ecx
  and    %edx,%r15d
  mov    0x1c(%rax),%r13d
  shl    $0x14,%r15d
  shl    $0x1a,%ecx
  and    %edx,%edi
  and    %edx,%r14d
  or     %r15d,%ecx
  mov    0x8(%rax),%r15d
  shl    $0x16,%r14d
  and    %edx,%r13d
  shl    $0x10,%r13d
  and    %edx,%r15d
  shl    $0xe,%r15d
  or     %r15d,%ecx
  mov    0xc(%rax),%r15d
  and    %edx,%r15d
  shl    $0x8,%r15d
  or     %r15d,%ecx
  mov    0x10(%rax),%r15d
  and    %edx,%r15d
  shl    $0x2,%r15d
  or     %r15d,%ecx
  mov    %edi,%r15d
  shl    $0x1c,%edi
  shr    $0x4,%r15d
  or     %r14d,%edi
  or     %r15d,%ecx
  or     %r13d,%edi
  mov    %ecx,(%r11)
  mov    0x20(%rax),%r13d
  mov    0x28(%rax),%ecx
  and    %edx,%r13d
  shl    $0xa,%r13d
  and    %edx,%ecx
  or     %r13d,%edi
  mov    0x24(%rax),%r13d
  and    %edx,%r13d
  shl    $0x4,%r13d
  or     %r13d,%edi
  mov    %ecx,%r13d
  shr    $0x2,%r13d
  or     %r13d,%edi
  shl    $0x1e,%ecx
  add    $0x40,%rax
  add    $0xc,%r11
  mov    %edi,-0x8(%r11)
  mov    -0x14(%rax),%r15d
  mov    -0x10(%rax),%r14d
  mov    -0xc(%rax),%r13d
  and    %edx,%r15d
  mov    -0x8(%rax),%edi
  and    %edx,%r14d
  shl    $0x18,%r15d
  and    %edx,%r13d
  shl    $0x12,%r14d
  or     %r15d,%ecx
  and    %edx,%edi
  shl    $0xc,%r13d
  or     %r14d,%ecx
  shl    $0x6,%edi
  or     %r13d,%ecx
  or     %edi,%ecx
  mov    -0x4(%rax),%edi
  and    %edx,%edi
  or     %edi,%ecx
  mov    %ecx,-0x4(%r11)
  cmp    %rsi,%rax
  jne    L71
  lea    0x0(%rbp,%rbp,2),%rax
  shl    $0x4,%r12d
  lea    (%rbx,%rax,4),%rbx
  sub    %r12d,%r8d
L436:
  mov    %rbx,%r11
  xor    %eax,%eax
  jmp    L260
  nopl   0x0(%rax)
L243:
  movslq %r8d,%r8
  pop    %rbx
  pop    %rbp
  lea    0x0(,%r8,4),%rdx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1050 <memcpy@plt>
L118:
  mov    %rdi,%r11
  xor    %eax,%eax
  jmp    L260
L150:
  mov    %rsi,%rax
  mov    %r11,%rbx
  jmp    L469
L234:
  mov    %rsi,%rax
  mov    %r11,%rdi
  jmp    L142
L87:
  mov    %rax,%rsi
  mov    %rbx,%r11
  xor    %eax,%eax
  jmp    L260
L158:
  mov    %r11,%rbx
  jmp    L190
L330:
  mov    %r11,%rbx
  cmp    $0x8,%r10d
  jne    L190
  cmp    $0x7,%r8d
  jle    L220
  sub    $0x8,%r8d
  mov    %rsi,%rax
  mov    %r8d,%ebp
  shr    $0x3,%ebp
  lea    0x1(%rbp),%r11d
  lea    (%rbx,%r11,8),%rdi
  nopl   0x0(%rax,%rax,1)
L444:
  mov    (%rax),%ecx
  mov    0x4(%rax),%r12d
  add    $0x20,%rax
  add    $0x8,%rbx
  and    %edx,%ecx
  and    %edx,%r12d
  shl    $0x10,%r12d
  shl    $0x18,%ecx
  or     %r12d,%ecx
  mov    -0x14(%rax),%r12d
  and    %edx,%r12d
  or     %r12d,%ecx
  mov    -0x18(%rax),%r12d
  and    %edx,%r12d
  shl    $0x8,%r12d
  or     %r12d,%ecx
  mov    %ecx,-0x8(%rbx)
  mov    -0x10(%rax),%ecx
  mov    -0xc(%rax),%r13d
  mov    -0x8(%rax),%r12d
  and    %edx,%ecx
  and    %edx,%r13d
  and    %edx,%r12d
  shl    $0x18,%ecx
  shl    $0x10,%r13d
  shl    $0x8,%r12d
  or     %r13d,%ecx
  or     %r12d,%ecx
  mov    -0x4(%rax),%r12d
  and    %edx,%r12d
  or     %r12d,%ecx
  mov    %ecx,-0x4(%rbx)
  cmp    %rdi,%rbx
  jne    L444
  shl    $0x5,%r11
  neg    %ebp
  add    %r11,%rsi
  lea    (%r8,%rbp,8),%r8d
L390:
  mov    %rdi,%rbx
  cmp    $0x1,%r10d
  jne    L436
  cmp    $0x1f,%r8d
  jle    L118
  sub    $0x20,%r8d
  lea    0x80(%rsi),%rbp
  mov    %r8d,%r13d
  shr    $0x5,%r13d
  lea    0x1(%r13),%r12d
  lea    (%rdi,%r12,4),%r11
  nopl   0x0(%rax)
L106:
  lea    -0x80(%rbp),%rcx
  xor    %eax,%eax
  xchg   %ax,%ax
L192:
  mov    (%rcx),%edi
  add    %eax,%eax
  add    $0x10,%rcx
  and    $0x1,%edi
  or     %eax,%edi
  mov    -0xc(%rcx),%eax
  add    %edi,%edi
  and    $0x1,%eax
  or     %edi,%eax
  mov    -0x8(%rcx),%edi
  add    %eax,%eax
  and    $0x1,%edi
  or     %eax,%edi
  mov    -0x4(%rcx),%eax
  add    %edi,%edi
  and    $0x1,%eax
  or     %edi,%eax
  cmp    %rbp,%rcx
  jne    L192
  add    $0x4,%rbx
  lea    0x80(%rcx),%rbp
  mov    %eax,-0x4(%rbx)
  cmp    %r11,%rbx
  jne    L106
  shl    $0x5,%r13d
  shl    $0x7,%r12
  xor    %eax,%eax
  sub    %r13d,%r8d
  add    %r12,%rsi
  jmp    L260
L220:
  mov    %r11,%rdi
  jmp    L390
```

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);
}
```