user: Demonstrate the C code that generates the assembly output below:

```asm
<HuffmanCodeLengthsToCodes>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0xc0,%rsp
  mov    %rdi,-0xa8(%rbp)
  mov    %esi,-0xac(%rbp)
  mov    %rdx,-0xb8(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movq   $0x0,-0x90(%rbp)
  movq   $0x0,-0x88(%rbp)
  movq   $0x0,-0x80(%rbp)
  movq   $0x0,-0x78(%rbp)
  movq   $0x0,-0x70(%rbp)
  movq   $0x0,-0x68(%rbp)
  movq   $0x0,-0x60(%rbp)
  movq   $0x0,-0x58(%rbp)
  movq   $0x0,-0x50(%rbp)
  movq   $0x0,-0x48(%rbp)
  movq   $0x0,-0x40(%rbp)
  movq   $0x0,-0x38(%rbp)
  movq   $0x0,-0x30(%rbp)
  movq   $0x0,-0x28(%rbp)
  movq   $0x0,-0x20(%rbp)
  movq   $0x0,-0x18(%rbp)
  movl   $0x0,-0x94(%rbp)
  cmpq   $0x0,-0xa8(%rbp)
  setne  %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <assert@plt>
  cmpl   $0x0,-0xac(%rbp)
  setg   %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <assert@plt>
  cmpq   $0x0,-0xb8(%rbp)
  setne  %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <assert@plt>
  movl   $0x0,-0xa0(%rbp)
  jmp    L115
L65:
  mov    -0xa0(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0xa8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    %eax,-0x94(%rbp)
  jge    L87
  mov    -0xa0(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0xa8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x94(%rbp)
L87:
  addl   $0x1,-0xa0(%rbp)
L115:
  mov    -0xa0(%rbp),%eax
  cmp    -0xac(%rbp),%eax
  jl     L65
  cmpl   $0xf,-0x94(%rbp)
  jle    L53
  mov    $0x0,%eax
  jmp    L79
L53:
  movl   $0x0,-0xa0(%rbp)
  jmp    L14
L127:
  mov    -0xa0(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0xa8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  movslq %eax,%rdx
  mov    -0x90(%rbp,%rdx,4),%edx
  add    $0x1,%edx
  cltq
  mov    %edx,-0x90(%rbp,%rax,4)
  addl   $0x1,-0xa0(%rbp)
L14:
  mov    -0xa0(%rbp),%eax
  cmp    -0xac(%rbp),%eax
  jl     L127
  movl   $0x0,-0x90(%rbp)
  movl   $0x0,-0x98(%rbp)
  movl   $0xffffffff,-0x50(%rbp)
  movl   $0x1,-0x9c(%rbp)
  jmp    L43
L107:
  mov    -0x9c(%rbp),%eax
  sub    $0x1,%eax
  cltq
  mov    -0x90(%rbp,%rax,4),%edx
  mov    -0x98(%rbp),%eax
  add    %edx,%eax
  add    %eax,%eax
  mov    %eax,-0x98(%rbp)
  mov    -0x9c(%rbp),%eax
  cltq
  mov    -0x98(%rbp),%edx
  mov    %edx,-0x50(%rbp,%rax,4)
  addl   $0x1,-0x9c(%rbp)
L43:
  mov    -0x9c(%rbp),%eax
  cmp    -0x94(%rbp),%eax
  jle    L107
  movl   $0x0,-0xa0(%rbp)
  jmp    L136
L3:
  mov    -0xa0(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0xa8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  test   %eax,%eax
  jle    L57
  mov    -0xa0(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0xa8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  movslq %edx,%rax
  mov    -0x50(%rbp,%rax,4),%eax
  lea    0x1(%rax),%ecx
  movslq %edx,%rdx
  mov    %ecx,-0x50(%rbp,%rdx,4)
  mov    -0xa0(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0xb8(%rbp),%rdx
  add    %rcx,%rdx
  mov    %eax,(%rdx)
  jmp    L61
L57:
  mov    -0xa0(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0xb8(%rbp),%rax
  add    %rdx,%rax
  movl   $0xffffffff,(%rax)
L61:
  addl   $0x1,-0xa0(%rbp)
L136:
  mov    -0xa0(%rbp),%eax
  cmp    -0xac(%rbp),%eax
  jl     L3
  mov    $0x1,%eax
L79:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L72
  call   <__stack_chk_fail@plt>
L72:
  leave
  ret
```

assistant: ```c
int HuffmanCodeLengthsToCodes(const int *const code_lengths, int code_lengths_size, int *const huff_codes) {
  int symbol;
  int code_len;
  int code_length_hist[15 + 1] = {0};
  int curr_code;
  int next_codes[15 + 1] = {0};
  int max_code_length = 0;
  assert(code_lengths != NULL);
  assert(code_lengths_size > 0);
  assert(huff_codes != NULL);
  for (symbol = 0; symbol < code_lengths_size; ++symbol) {
    if (code_lengths[symbol] > max_code_length) {
      max_code_length = code_lengths[symbol];
    }
  }
  if (max_code_length > 15)
    return 0;
  for (symbol = 0; symbol < code_lengths_size; ++symbol) {
    ++code_length_hist[code_lengths[symbol]];
  }
  code_length_hist[0] = 0;
  curr_code = 0;
  next_codes[0] = -1;
  for (code_len = 1; code_len <= max_code_length; ++code_len) {
    curr_code = (curr_code + code_length_hist[code_len - 1]) << 1;
    next_codes[code_len] = curr_code;
  }
  for (symbol = 0; symbol < code_lengths_size; ++symbol) {
    if (code_lengths[symbol] > 0) {
      huff_codes[symbol] = next_codes[code_lengths[symbol]]++;
    } else {
      huff_codes[symbol] = (-1);
    }
  }
  return 1;
}
```