user: 请从给定的汇编指令推导出C源代码：

```asm
<AddLZ77Data>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,0x8(%rsp)
  mov    %rsi,0x10(%rsp)
  mov    %rcx,0x18(%rsp)
  mov    %r8,0x38(%rsp)
  mov    %r9,0x20(%rsp)
  cmp    %rcx,%rdx
  jae    L18
  mov    %rdx,%r15
  movq   $0x0,(%rsp)
  jmp    L45
L14:
  mov    %ebp,%edi
  call   <GetLengthSymbol@plt>
  mov    %eax,%r12d
  mov    %ebx,%edi
  call   <GetDistSymbol@plt>
  mov    %eax,%r13d
  lea    -0x3(%rbp),%eax
  cmp    $0x11d,%eax
  setbe  %dil
  movzbl %dil,%edi
  call   <assert@plt>
  mov    %r12d,%eax
  mov    0x80(%rsp),%rsi
  mov    %rax,0x28(%rsp)
  lea    (%rsi,%rax,4),%r12
  cmpl   $0x0,(%r12)
  setne  %dil
  movzbl %dil,%edi
  call   <assert@plt>
  mov    %r13d,%edx
  mov    0x90(%rsp),%rsi
  mov    %rdx,0x30(%rsp)
  lea    (%rsi,%rdx,4),%r13
  cmpl   $0x0,0x0(%r13)
  setne  %dil
  movzbl %dil,%edi
  call   <assert@plt>
  mov    0x20(%rsp),%rcx
  mov    0x28(%rsp),%rax
  mov    (%rcx,%rax,4),%edi
  mov    0xa8(%rsp),%r8
  mov    0xa0(%rsp),%rcx
  mov    0x98(%rsp),%rdx
  mov    (%r12),%esi
  call   <AddHuffmanBits@plt>
  mov    %ebp,%edi
  call   <GetLengthExtraBits@plt>
  mov    %eax,%r12d
  mov    %ebp,%edi
  call   <GetLengthExtraBitsValue@plt>
  mov    %eax,%edi
  mov    0xa8(%rsp),%r8
  mov    0xa0(%rsp),%rcx
  mov    0x98(%rsp),%rdx
  mov    %r12d,%esi
  call   <AddBits@plt>
  mov    0x88(%rsp),%rax
  mov    0x30(%rsp),%rdx
  mov    (%rax,%rdx,4),%edi
  mov    0xa8(%rsp),%r8
  mov    0xa0(%rsp),%rcx
  mov    0x98(%rsp),%rdx
  mov    0x0(%r13),%esi
  call   <AddHuffmanBits@plt>
  mov    %ebx,%edi
  call   <GetDistExtraBits@plt>
  mov    %eax,%ebp
  mov    %ebx,%edi
  call   <GetDistExtraBitsValue@plt>
  mov    %eax,%edi
  mov    0xa8(%rsp),%r8
  mov    0xa0(%rsp),%rcx
  mov    0x98(%rsp),%rdx
  mov    %ebp,%esi
  call   <AddBits@plt>
  movzwl %r14w,%eax
  add    %rax,(%rsp)
L40:
  add    $0x1,%r15
  cmp    %r15,0x18(%rsp)
  je     L21
L45:
  mov    0x10(%rsp),%rax
  movzwl (%rax,%r15,2),%ebx
  mov    0x8(%rsp),%rax
  movzwl (%rax,%r15,2),%r14d
  movzwl %r14w,%ebp
  test   %ebx,%ebx
  jne    L14
  cmp    $0xff,%ebp
  setbe  %dil
  movzbl %dil,%edi
  call   <assert@plt>
  movzwl %r14w,%r14d
  mov    0x80(%rsp),%rax
  lea    (%rax,%r14,4),%rbx
  cmpl   $0x0,(%rbx)
  setne  %dil
  movzbl %dil,%edi
  call   <assert@plt>
  mov    0x20(%rsp),%rax
  mov    (%rax,%r14,4),%edi
  mov    0xa8(%rsp),%r8
  mov    0xa0(%rsp),%rcx
  mov    0x98(%rsp),%rdx
  mov    (%rbx),%esi
  call   <AddHuffmanBits@plt>
  addq   $0x1,(%rsp)
  jmp    L40
L18:
  movq   $0x0,(%rsp)
L21:
  mov    0x38(%rsp),%rax
  test   %rax,%rax
  sete   %dil
  cmp    (%rsp),%rax
  sete   %al
  or     %eax,%edi
  movzbl %dil,%edi
  call   <assert@plt>
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void AddLZ77Data(const unsigned short *litlens, const unsigned short *dists, size_t lstart, size_t lend, size_t expected_data_size, const unsigned *ll_symbols, const unsigned *ll_lengths, const unsigned *d_symbols, const unsigned *d_lengths, unsigned char *bp, unsigned char **out, size_t *outsize) {
  size_t testlength = 0;
  size_t i;
  for (i = lstart; i < lend; i++) {
    unsigned dist = dists[i];
    unsigned litlen = litlens[i];
    if (dist == 0) {
      assert(litlen < 256);
      assert(ll_lengths[litlen] > 0);
      AddHuffmanBits(ll_symbols[litlen], ll_lengths[litlen], bp, out, outsize);
      testlength++;
    } else {
      unsigned lls = GetLengthSymbol(litlen);
      unsigned ds = GetDistSymbol(dist);
      assert(litlen >= 3 && litlen <= 288);
      assert(ll_lengths[lls] > 0);
      assert(d_lengths[ds] > 0);
      AddHuffmanBits(ll_symbols[lls], ll_lengths[lls], bp, out, outsize);
      AddBits(GetLengthExtraBitsValue(litlen), GetLengthExtraBits(litlen), bp, out, outsize);
      AddHuffmanBits(d_symbols[ds], d_lengths[ds], bp, out, outsize);
      AddBits(GetDistExtraBitsValue(dist), GetDistExtraBits(dist), bp, out, outsize);
      testlength += litlen;
    }
  }
  assert(expected_data_size == 0 || testlength == expected_data_size);
}
```