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

```asm
<decode_bitstring>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x40(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  mov    %eax,-0x1c(%rbp)
  cmpl   $0x0,-0x1c(%rbp)
  jne    L76
  movl   $0x100,-0x1c(%rbp)
L76:
  mov    -0x1c(%rbp),%eax
  add    $0x3,%eax
  lea    0x3(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x2,%eax
  mov    %eax,-0x18(%rbp)
  cmpl   $0x63,-0x1c(%rbp)
  jg     L179
  cmpl   $0x9,-0x1c(%rbp)
  jle    L163
  mov    $0x8,%edx
  jmp    L67
L163:
  mov    $0x7,%edx
  jmp    L67
L179:
  mov    $0x9,%edx
L67:
  mov    -0x18(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x18(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  cmp    %rax,-0x48(%rbp)
  ja     L7
  mov    $0xffffffff,%eax
  jmp    L12
L7:
  addq   $0x1,-0x10(%rbp)
  mov    -0x40(%rbp),%rax
  lea    D4(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  mov    %eax,-0x14(%rbp)
  cmpl   $0x0,-0x14(%rbp)
  jns    L49
  mov    $0xffffffff,%eax
  jmp    L12
L49:
  mov    -0x14(%rbp),%eax
  cltq
  add    %rax,-0x40(%rbp)
  mov    -0x1c(%rbp),%eax
  mov    %eax,-0x20(%rbp)
  jmp    L47
L27:
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%edx
  mov    -0x40(%rbp),%rax
  lea    D1(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  mov    %eax,-0x14(%rbp)
  cmpl   $0x0,-0x14(%rbp)
  jns    L13
  mov    $0xffffffff,%eax
  jmp    L12
L13:
  mov    -0x14(%rbp),%eax
  cltq
  add    %rax,-0x40(%rbp)
  subl   $0x8,-0x20(%rbp)
  addq   $0x1,-0x10(%rbp)
L47:
  cmpl   $0x7,-0x20(%rbp)
  jg     L27
  cmpl   $0x4,-0x20(%rbp)
  jle    L75
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movzbl (%rax),%eax
  mov    %al,-0x21(%rbp)
  movsbl -0x21(%rbp),%edx
  mov    $0x8,%eax
  sub    -0x20(%rbp),%eax
  mov    $0xff,%esi
  mov    %eax,%ecx
  shl    %cl,%esi
  mov    %esi,%eax
  and    %eax,%edx
  mov    -0x40(%rbp),%rax
  lea    D1(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  mov    %eax,-0x14(%rbp)
  cmpl   $0x0,-0x14(%rbp)
  jns    L174
  mov    $0xffffffff,%eax
  jmp    L12
L174:
  mov    -0x14(%rbp),%eax
  cltq
  add    %rax,-0x40(%rbp)
  jmp    L112
L75:
  cmpl   $0x0,-0x20(%rbp)
  jle    L112
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movzbl (%rax),%eax
  mov    %al,-0x21(%rbp)
  movzbl -0x21(%rbp),%eax
  sar    $0x4,%al
  movsbl %al,%eax
  and    $0xf,%eax
  mov    %eax,%edx
  mov    $0x4,%eax
  sub    -0x20(%rbp),%eax
  mov    $0xf,%esi
  mov    %eax,%ecx
  shl    %cl,%esi
  mov    %esi,%eax
  and    %eax,%edx
  mov    -0x40(%rbp),%rax
  lea    D19(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  mov    %eax,-0x14(%rbp)
  cmpl   $0x0,-0x14(%rbp)
  jns    L84
  mov    $0xffffffff,%eax
  jmp    L12
L84:
  mov    -0x14(%rbp),%eax
  cltq
  add    %rax,-0x40(%rbp)
L112:
  mov    -0x1c(%rbp),%edx
  mov    -0x40(%rbp),%rax
  lea    D25(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  mov    %eax,-0x14(%rbp)
  cmpl   $0x0,-0x14(%rbp)
  jns    L109
  mov    $0xffffffff,%eax
  jmp    L12
L109:
  mov    -0x14(%rbp),%eax
  cltq
  add    %rax,-0x40(%rbp)
  mov    -0x38(%rbp),%rax
  mov    -0x10(%rbp),%rdx
  mov    %rdx,(%rax)
  mov    -0x40(%rbp),%rax
  sub    -0x8(%rbp),%rax
L12:
  leave
  ret
```

tool_calls: name: read_data
arguments: data_label: D4
type: string
name: read_data
arguments: data_label: D1
type: string
name: read_data
arguments: data_label: D19
type: string
name: read_data
arguments: data_label: D25
type: string

tool: D4: \[x

tool: D1: %02x

tool: D19: %1x

tool: D25: /%d]

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