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

```asm
<hw_fixspisamples>:
  endbr64
  test   %rsi,%rsi
  jle    L16
  push   %rbx
  mov    %rcx,%r8
  mov    %rdx,%r9
  add    %rdi,%rsi
  xor    %r10d,%r10d
  xor    %eax,%eax
  xor    %ecx,%ecx
  xchg   %ax,%ax
L41:
  movzbl (%rdi),%edx
  add    %eax,%eax
  mov    %edx,%r11d
  lea    (%rdx,%rdx,1),%ebx
  shr    $0x7,%r11b
  shr    $0x7,%bl
  or     %r11d,%eax
  cmp    $0x7,%r10b
  je     L103
  add    %eax,%eax
  or     %r11d,%eax
  cmp    $0x6,%r10b
  je     L29
  add    %eax,%eax
  or     %ebx,%eax
  cmp    $0x5,%r10b
  jne    L48
  cmp    %r8,%rcx
  jge    L133
  mov    %al,(%r9,%rcx,1)
  add    $0x1,%rcx
L133:
  mov    %edx,%r10d
  lea    0x0(,%rdx,8),%eax
  mov    $0x5,%r11d
  shr    $0x4,%r10d
  shr    $0x7,%al
  and    $0x2,%r10d
  or     %r10d,%eax
  mov    %edx,%r10d
  shl    $0x4,%r10d
  add    %eax,%eax
  shr    $0x7,%r10b
  or     %r10d,%eax
  mov    %edx,%r10d
  shl    $0x5,%r10d
  add    %eax,%eax
  shr    $0x7,%r10b
  or     %r10d,%eax
  mov    %edx,%r10d
  shl    $0x6,%r10d
  add    %eax,%eax
  shr    $0x7,%r10b
  or     %r10d,%eax
L23:
  add    %eax,%eax
  and    $0x1,%edx
  lea    0x1(%r11),%r10d
  or     %edx,%eax
  cmp    $0x7,%r11b
  jne    L32
  cmp    %rcx,%r8
  jle    L223
  mov    %al,(%r9,%rcx,1)
  xor    %r10d,%r10d
  add    $0x1,%rcx
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L32:
  cmp    %rcx,%r8
  jle    L223
  add    $0x1,%rdi
  cmp    %rdi,%rsi
  jne    L41
L223:
  pop    %rbx
  ret
  nopl   0x0(%rax)
L29:
  cmp    %r8,%rcx
  jge    L154
  mov    %al,(%r9,%rcx,1)
  add    $0x1,%rcx
L154:
  lea    0x0(,%rdx,4),%r10d
  lea    (%rbx,%rbx,1),%eax
  mov    $0x5,%ebx
  shr    $0x7,%r10b
  or     %r10d,%eax
  lea    0x0(,%rdx,8),%r10d
  shr    $0x7,%r10b
  add    %eax,%eax
  or     %r10d,%eax
  mov    %edx,%r10d
  shl    $0x4,%r10d
  add    %eax,%eax
  shr    $0x7,%r10b
  or     %r10d,%eax
  mov    %edx,%r10d
  shl    $0x5,%r10d
  add    %eax,%eax
  shr    $0x7,%r10b
  or     %r10d,%eax
L2:
  mov    %edx,%r10d
  add    %eax,%eax
  lea    0x1(%rbx),%r11d
  shl    $0x6,%r10d
  shr    $0x7,%r10b
  or     %r10d,%eax
  cmp    $0x7,%bl
  jne    L23
  cmp    %rcx,%r8
  jle    L219
  mov    %al,(%r9,%rcx,1)
  add    $0x1,%rcx
L219:
  mov    %edx,%eax
  mov    $0x1,%r10d
  and    $0x1,%eax
  jmp    L32
  nopw   0x0(%rax,%rax,1)
L103:
  cmp    %r8,%rcx
  jge    L140
  mov    %al,(%r9,%rcx,1)
  add    $0x1,%rcx
L140:
  lea    (%r11,%r11,1),%eax
  lea    0x0(,%rdx,4),%r10d
  mov    $0x5,%r11d
  or     %ebx,%eax
  shr    $0x7,%r10b
  add    %eax,%eax
  or     %r10d,%eax
  lea    0x0(,%rdx,8),%r10d
  shr    $0x7,%r10b
  add    %eax,%eax
  or     %r10d,%eax
  mov    %edx,%r10d
  shl    $0x4,%r10d
  add    %eax,%eax
  shr    $0x7,%r10b
  or     %r10d,%eax
L42:
  lea    (%rax,%rax,1),%r10d
  mov    %edx,%eax
  lea    0x1(%r11),%ebx
  shl    $0x5,%eax
  shr    $0x7,%al
  or     %r10d,%eax
  cmp    $0x7,%r11b
  jne    L2
  cmp    %rcx,%r8
  jle    L30
  mov    %al,(%r9,%rcx,1)
  add    $0x1,%rcx
L30:
  mov    %edx,%eax
  mov    $0x2,%r10d
  and    $0x3,%eax
  jmp    L32
L16:
  ret
L48:
  lea    0x0(,%rdx,4),%r11d
  add    %eax,%eax
  shr    $0x7,%r11b
  or     %r11d,%eax
  cmp    $0x4,%r10b
  jne    L198
  cmp    %r8,%rcx
  jge    L126
  mov    %al,(%r9,%rcx,1)
  add    $0x1,%rcx
L126:
  mov    %edx,%r10d
  mov    %edx,%eax
  shr    $0x3,%r10d
  shl    $0x4,%eax
  and    $0x2,%r10d
  shr    $0x7,%al
  or     %r10d,%eax
  mov    %edx,%r10d
  shl    $0x5,%r10d
  add    %eax,%eax
  shr    $0x7,%r10b
  or     %r10d,%eax
  mov    %edx,%r10d
  and    $0x1,%edx
  shl    $0x6,%r10d
  add    %eax,%eax
  shr    $0x7,%r10b
  or     %r10d,%eax
  mov    $0x5,%r10d
  add    %eax,%eax
  or     %edx,%eax
  jmp    L32
L198:
  lea    0x0(,%rdx,8),%r11d
  add    %eax,%eax
  shr    $0x7,%r11b
  or     %r11d,%eax
  cmp    $0x3,%r10b
  jne    L243
  cmp    %r8,%rcx
  jge    L89
  mov    %al,(%r9,%rcx,1)
  add    $0x1,%rcx
L89:
  mov    %edx,%r10d
  mov    %edx,%eax
  shr    $0x2,%r10d
  shl    $0x5,%eax
  and    $0x2,%r10d
  shr    $0x7,%al
  or     %r10d,%eax
  mov    %edx,%r10d
  and    $0x1,%edx
  shl    $0x6,%r10d
  add    %eax,%eax
  shr    $0x7,%r10b
  or     %r10d,%eax
  mov    $0x4,%r10d
  add    %eax,%eax
  or     %edx,%eax
  jmp    L32
L243:
  mov    %edx,%ebx
  add    %eax,%eax
  lea    0x6(%r10),%r11d
  shl    $0x4,%ebx
  shr    $0x7,%bl
  or     %ebx,%eax
  cmp    $0x2,%r10b
  jne    L42
  cmp    %r8,%rcx
  jge    L237
  mov    %al,(%r9,%rcx,1)
  add    $0x1,%rcx
L237:
  mov    %edx,%r10d
  mov    %edx,%eax
  and    $0x1,%edx
  shr    %r10d
  shl    $0x6,%eax
  and    $0x2,%r10d
  shr    $0x7,%al
  or     %r10d,%eax
  mov    $0x3,%r10d
  add    %eax,%eax
  or     %edx,%eax
  jmp    L32
```

assistant: ```c
void hw_fixspisamples(char *inbuf, long inlen, char *outbuf, long outlen) {
  long inpos, outpos;
  unsigned char c, o, olen, bitpos;
  outpos = 0;
  o = 0;
  olen = 0;
  for (inpos = 0; inpos < inlen; inpos++) {
    c = inbuf[inpos];
    o = (o << 1) | ((c & 0x80) >> 7);
    olen++;
    if (olen == 8) {
      if (outpos < outlen)
        outbuf[outpos++] = o;
      olen = 0;
      o = 0;
    }
    for (bitpos = 0; bitpos < 8; bitpos++) {
      o = (o << 1) | ((c & 0x80) >> 7);
      olen++;
      if (olen == 8) {
        if (outpos < outlen)
          outbuf[outpos++] = o;
        olen = 0;
        o = 0;
      }
      c = c << 1;
    }
    if (outpos >= outlen)
      return;
  }
}
```