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

```asm
<ZopfliLengthsToSymbols>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %edx,-0x34(%rbp)
  mov    %rcx,-0x40(%rbp)
  mov    -0x34(%rbp),%eax
  add    $0x1,%eax
  shl    $0x3,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x34(%rbp),%eax
  add    $0x1,%eax
  shl    $0x3,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  movl   $0x0,-0x1c(%rbp)
  jmp    L76
L20:
  mov    -0x1c(%rbp),%eax
  lea    0x0(,%rax,4),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movl   $0x0,(%rax)
  addl   $0x1,-0x1c(%rbp)
L76:
  mov    -0x1c(%rbp),%eax
  cmp    %rax,-0x30(%rbp)
  ja     L20
  movl   $0x0,-0x20(%rbp)
  jmp    L50
L63:
  mov    -0x20(%rbp),%eax
  lea    0x0(,%rax,8),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  movq   $0x0,(%rax)
  addl   $0x1,-0x20(%rbp)
L50:
  mov    -0x20(%rbp),%eax
  cmp    -0x34(%rbp),%eax
  jbe    L63
  movl   $0x0,-0x1c(%rbp)
  jmp    L94
L102:
  mov    -0x1c(%rbp),%eax
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    %eax,-0x34(%rbp)
  setae  %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <assert@plt>
  mov    -0x1c(%rbp),%eax
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,%eax
  lea    0x0(,%rax,8),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  add    $0x1,%rdx
  mov    %rdx,(%rax)
  addl   $0x1,-0x1c(%rbp)
L94:
  mov    -0x1c(%rbp),%eax
  cmp    %rax,-0x30(%rbp)
  ja     L102
  movl   $0x0,-0x18(%rbp)
  mov    -0x10(%rbp),%rax
  movq   $0x0,(%rax)
  movl   $0x1,-0x20(%rbp)
  jmp    L71
L26:
  mov    -0x20(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,%eax
  lea    0x0(,%rax,8),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %eax,%edx
  mov    -0x18(%rbp),%eax
  add    %edx,%eax
  add    %eax,%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x20(%rbp),%eax
  lea    0x0(,%rax,8),%rdx
  mov    -0x8(%rbp),%rax
  add    %rax,%rdx
  mov    -0x18(%rbp),%eax
  mov    %rax,(%rdx)
  addl   $0x1,-0x20(%rbp)
L71:
  mov    -0x20(%rbp),%eax
  cmp    -0x34(%rbp),%eax
  jbe    L26
  movl   $0x0,-0x1c(%rbp)
  jmp    L4
L5:
  mov    -0x1c(%rbp),%eax
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x14(%rbp)
  cmpl   $0x0,-0x14(%rbp)
  je     L22
  mov    -0x14(%rbp),%eax
  lea    0x0(,%rax,8),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x1c(%rbp),%eax
  lea    0x0(,%rax,4),%rcx
  mov    -0x40(%rbp),%rax
  add    %rcx,%rax
  mov    %edx,(%rax)
  mov    -0x14(%rbp),%eax
  lea    0x0(,%rax,8),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  add    $0x1,%rdx
  mov    %rdx,(%rax)
L22:
  addl   $0x1,-0x1c(%rbp)
L4:
  mov    -0x1c(%rbp),%eax
  cmp    %rax,-0x30(%rbp)
  ja     L5
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  nop
  leave
  ret
```

assistant: ```c
void ZopfliLengthsToSymbols(const unsigned *lengths, size_t n, unsigned maxbits, unsigned *symbols) {
  size_t *bl_count = (size_t *)malloc(sizeof(size_t) * (maxbits + 1));
  size_t *next_code = (size_t *)malloc(sizeof(size_t) * (maxbits + 1));
  unsigned bits, i;
  unsigned code;
  for (i = 0; i < n; i++) {
    symbols[i] = 0;
  }
  for (bits = 0; bits <= maxbits; bits++) {
    bl_count[bits] = 0;
  }
  for (i = 0; i < n; i++) {
    assert(lengths[i] <= maxbits);
    bl_count[lengths[i]]++;
  }
  code = 0;
  bl_count[0] = 0;
  for (bits = 1; bits <= maxbits; bits++) {
    code = (code + bl_count[bits - 1]) << 1;
    next_code[bits] = code;
  }
  for (i = 0; i < n; i++) {
    unsigned len = lengths[i];
    if (len != 0) {
      symbols[i] = next_code[len];
      next_code[len]++;
    }
  }
  free(bl_count);
  free(next_code);
}
```