user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<decode_bitstring>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x18,%rsp
  mov    (%rdi),%r14
  mov    %rdi,(%rsp)
  movzbl (%r14),%r12d
  test   %r12d,%r12d
  je     L6
  lea    0x3(%r12),%eax
  sar    $0x2,%eax
  cmp    $0x63,%r12d
  jg     L122
  lea    0x7(%rax),%ecx
  add    $0x8,%eax
  cmp    $0x9,%r12d
  cmovle %rcx,%rax
  jmp    L63
  nopw   0x0(%rax,%rax,1)
L6:
  mov    $0x49,%eax
  mov    $0x100,%r12d
L63:
  add    %rbx,%rax
  cmp    %rax,%rdx
  jbe    L161
  xor    %eax,%eax
  lea    D46(%rip),%rsi
  mov    %rbx,%rdi
  add    $0x1,%r14
  call   <sprintf@plt>
  test   %eax,%eax
  js     L161
  cltq
  mov    %r12d,%r15d
  lea    (%rbx,%rax,1),%r13
  cmp    $0x7,%r12d
  jle    L120
  lea    D26(%rip),%rbp
  jmp    L132
  nopl   0x0(%rax,%rax,1)
L39:
  cltq
  sub    $0x8,%r15d
  add    $0x1,%r14
  add    %rax,%r13
  cmp    $0x7,%r15d
  jle    L174
L132:
  movzbl (%r14),%edx
  xor    %eax,%eax
  mov    %rbp,%rsi
  mov    %r13,%rdi
  call   <sprintf@plt>
  test   %eax,%eax
  jns    L39
L161:
  add    $0x18,%rsp
  mov    $0xffffffff,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L174:
  cmp    $0x4,%r15d
  jg     L32
  test   %r15d,%r15d
  jne    L64
L160:
  xor    %eax,%eax
  mov    %r12d,%edx
  lea    D11(%rip),%rsi
  mov    %r13,%rdi
  call   <sprintf@plt>
  test   %eax,%eax
  js     L161
  mov    (%rsp),%rcx
  add    %r13d,%eax
  sub    %ebx,%eax
  mov    %r14,(%rcx)
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L122:
  add    $0x9,%eax
  jmp    L63
L120:
  cmp    $0x4,%r12d
  jle    L64
  lea    D26(%rip),%rbp
  nopl   (%rax)
L32:
  lea    0x1(%r14),%rax
  mov    $0x8,%ecx
  mov    %rbp,%rsi
  mov    %r13,%rdi
  sub    %r15d,%ecx
  mov    %rax,0x8(%rsp)
  mov    $0xff,%edx
  movsbl (%r14),%eax
  shl    %cl,%edx
  and    %eax,%edx
  xor    %eax,%eax
  call   <sprintf@plt>
  test   %eax,%eax
  js     L161
  cltq
  mov    0x8(%rsp),%r14
  add    %rax,%r13
  jmp    L160
  nopw   0x0(%rax,%rax,1)
L64:
  movzbl (%r14),%edx
  mov    $0x4,%ecx
  mov    %r13,%rdi
  lea    0x1(%r14),%rbp
  sub    %r15d,%ecx
  mov    $0xf,%eax
  lea    D18(%rip),%rsi
  shr    $0x4,%dl
  shl    %cl,%eax
  movzbl %dl,%edx
  and    %eax,%edx
  xor    %eax,%eax
  call   <sprintf@plt>
  test   %eax,%eax
  js     L161
  cltq
  mov    %rbp,%r14
  add    %rax,%r13
  jmp    L160
```

tool_calls: name: disassemble_data
arguments: data_tag: D46
data_type: string
name: disassemble_data
arguments: data_tag: D26
data_type: string
name: disassemble_data
arguments: data_tag: D11
data_type: string
name: disassemble_data
arguments: data_tag: D18
data_type: string

tool: D46: \[x

tool: D26: %02x

tool: D11: /%d]

tool: D18: %1x

assistant: ```c
int decode_bitstring(const unsigned char **cpp, char *dn, const char *eom) {
  const unsigned char *cp = *cpp;
  char *beg = dn, tc;
  int b, blen, plen, i;
  if ((blen = (*cp & 0xff)) == 0)
    blen = 256;
  plen = (blen + 3) / 4;
  plen += sizeof("\\[x/]") + (blen > 99 ? 3 : (blen > 9) ? 2 : 1);
  if (dn + plen >= eom)
    return (-1);
  cp++;
  i = ((size_t)sprintf(dn, "\\[x"));
  if (i < 0)
    return (-1);
  dn += i;
  for (b = blen; b > 7; b -= 8, cp++) {
    i = ((size_t)sprintf(dn, "%02x", *cp & 0xff));
    if (i < 0)
      return (-1);
    dn += i;
  }
  if (b > 4) {
    tc = *cp++;
    i = ((size_t)sprintf(dn, "%02x", tc & (0xff << (8 - b))));
    if (i < 0)
      return (-1);
    dn += i;
  } else if (b > 0) {
    tc = *cp++;
    i = ((size_t)sprintf(dn, "%1x", ((tc >> 4) & 0x0f) & (0x0f << (4 - b))));
    if (i < 0)
      return (-1);
    dn += i;
  }
  i = ((size_t)sprintf(dn, "/%d]", blen));
  if (i < 0)
    return (-1);
  dn += i;
  *cpp = cp;
  return (dn - beg);
}
```