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

```asm
<bmap2units>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x90,%rsp
  mov    %edi,-0x84(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x1,-0x64(%rbp)
  cmpl   $0x0,-0x84(%rbp)
  jne    L12
  mov    $0x7f,%edx
  lea    D76(%rip),%rax
  mov    %rax,%rsi
  lea    D4(%rip),%rax
  mov    %rax,%rdi
  call   <strncpy2@plt>
  lea    D4(%rip),%rax
  jmp    L28
L12:
  movl   $0x0,-0x6c(%rbp)
  movl   $0x0,-0x74(%rbp)
  jmp    L10
L38:
  mov    -0x74(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  lea    D73(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  mov    %eax,-0x64(%rbp)
  mov    -0x84(%rbp),%eax
  and    -0x64(%rbp),%eax
  test   %eax,%eax
  je     L29
  mov    -0x6c(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x6c(%rbp)
  mov    -0x74(%rbp),%edx
  add    $0x1,%edx
  cltq
  mov    %edx,-0x60(%rbp,%rax,4)
L29:
  addl   $0x1,-0x74(%rbp)
L10:
  cmpl   $0xf,-0x74(%rbp)
  jle    L38
  mov    -0x6c(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x6c(%rbp)
  cltq
  movl   $0x0,-0x60(%rbp,%rax,4)
  movb   $0x0,D60(%rip)
  movzbl D60(%rip),%eax
  mov    %al,D72(%rip)
  mov    -0x60(%rbp),%eax
  mov    %eax,-0x68(%rbp)
  movl   $0x1,-0x70(%rbp)
  movl   $0x1,-0x74(%rbp)
  jmp    L21
L130:
  mov    -0x74(%rbp),%eax
  cltq
  mov    -0x60(%rbp,%rax,4),%edx
  mov    -0x74(%rbp),%eax
  sub    $0x1,%eax
  cltq
  mov    -0x60(%rbp,%rax,4),%eax
  add    $0x1,%eax
  cmp    %eax,%edx
  jne    L141
  addl   $0x1,-0x70(%rbp)
  jmp    L34
L141:
  cmpl   $0x1,-0x70(%rbp)
  je     L138
  cmpl   $0x2,-0x70(%rbp)
  je     L16
  jmp    L96
L138:
  mov    -0x68(%rbp),%edx
  lea    -0x10(%rbp),%rax
  lea    D72(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  jmp    L5
L16:
  mov    -0x74(%rbp),%eax
  sub    $0x1,%eax
  cltq
  mov    -0x60(%rbp,%rax,4),%ecx
  mov    -0x68(%rbp),%edx
  lea    -0x10(%rbp),%rax
  lea    D17(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  jmp    L5
L96:
  mov    -0x74(%rbp),%eax
  sub    $0x1,%eax
  cltq
  mov    -0x60(%rbp,%rax,4),%ecx
  mov    -0x68(%rbp),%edx
  lea    -0x10(%rbp),%rax
  lea    D22(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  nop
L5:
  lea    D72(%rip),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rax,%rdx
  mov    $0x7f,%eax
  sub    %rdx,%rax
  mov    %rax,%rdx
  lea    -0x10(%rbp),%rax
  mov    %rax,%rsi
  lea    D72(%rip),%rax
  mov    %rax,%rdi
  call   <strncat@plt>
  mov    -0x74(%rbp),%eax
  cltq
  mov    -0x60(%rbp,%rax,4),%eax
  mov    %eax,-0x68(%rbp)
  movl   $0x1,-0x70(%rbp)
L34:
  addl   $0x1,-0x74(%rbp)
L21:
  mov    -0x74(%rbp),%eax
  cmp    -0x6c(%rbp),%eax
  jl     L130
  lea    D60(%rip),%rax
L28:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L1
  call   <__stack_chk_fail@plt>
L1:
  leave
  ret
```

tool_calls: name: read_data
arguments: data_label: D76
data_type: string
name: read_data
arguments: data_label: D72
data_type: string
name: read_data
arguments: data_label: D17
data_type: string
name: read_data
arguments: data_label: D22
data_type: string

tool: D76: 0

tool: D72: ,%d

tool: D17: ,%d,%d

tool: D22: ,%d-%d

assistant: ```c
char *bmap2units(unsigned int bmap) {
  static int invmap[] = {6, 14, 2, 10, 1, 9, 5, 13, 7, 15, 3, 11, 0, 8, 4, 12};
  static char buffer[128];
  char minbuf[8];
  unsigned int mask = 0x01;
  int j, count, nunits;
  int units[17];
  int first;
  if (bmap == 0) {
    (int)strncpy2(buffer, "0", sizeof(buffer) - 1);
    return buffer;
  }
  nunits = 0;
  for (j = 0; j < 16; j++) {
    mask = 0x01 << invmap[j];
    if (bmap & mask) {
      units[nunits++] = j + 1;
    }
  }
  units[nunits++] = 0;
  buffer[0] = buffer[1] = '\0';
  first = units[0];
  count = 1;
  for (j = 1; j < nunits; j++) {
    if (units[j] == units[j - 1] + 1) {
      count++;
      continue;
    }
    switch (count) {
    case 1:
      sprintf(minbuf, ",%d", first);
      break;
    case 2:
      sprintf(minbuf, ",%d,%d", first, units[j - 1]);
      break;
    default:
      sprintf(minbuf, ",%d-%d", first, units[j - 1]);
      break;
    }
    (int)strncat(buffer, minbuf, sizeof(buffer) - 1 - strlen(buffer));
    first = units[j];
    count = 1;
  }
  return buffer + 1;
}
```