user: Please show me the C implementation that matches the assembly code listed below:

```asm
<AddLZ77Data>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x78,%rsp
  mov    0xb0(%rsp),%rax
  mov    %rdi,0x8(%rsp)
  mov    %rsi,0x10(%rsp)
  mov    0xc8(%rsp),%r13
  mov    %rax,0x28(%rsp)
  mov    0xb8(%rsp),%rax
  mov    %rcx,0x18(%rsp)
  mov    0xd0(%rsp),%r14
  mov    %rax,0x58(%rsp)
  mov    0xc0(%rsp),%rax
  mov    %r8,0x68(%rsp)
  mov    0xd8(%rsp),%r15
  mov    %r9,0x20(%rsp)
  mov    %rax,0x60(%rsp)
  cmp    %rcx,%rdx
  jae    L59
  movq   $0x0,(%rsp)
  mov    %rdx,%r10
  jmp    L54
L45:
  xor    %edi,%edi
  cmp    $0xff,%ebp
  mov    %r10,0x30(%rsp)
  setbe  %dil
  call   <assert@plt>
  mov    0x28(%rsp),%rax
  xor    %edi,%edi
  lea    (%rax,%rbp,4),%rbp
  mov    0x0(%rbp),%ecx
  test   %ecx,%ecx
  setne  %dil
  call   <assert@plt>
  mov    0x20(%rsp),%rax
  mov    0x0(%rbp),%esi
  mov    %r15,%r8
  mov    %r14,%rcx
  mov    %r13,%rdx
  mov    (%rax,%rbx,4),%edi
  call   <AddHuffmanBits@plt>
  mov    0x30(%rsp),%r10
  addq   $0x1,(%rsp)
  add    $0x1,%r10
  cmp    %r10,0x18(%rsp)
  je     L7
L54:
  mov    0x10(%rsp),%rax
  movzwl (%rax,%r10,2),%r12d
  mov    0x8(%rsp),%rax
  movzwl (%rax,%r10,2),%ebp
  mov    %rbp,%rbx
  test   %r12d,%r12d
  je     L45
  mov    %ebp,%edi
  mov    %r10,0x50(%rsp)
  call   <ZopfliGetLengthSymbol@plt>
  mov    %r12d,%edi
  mov    %eax,0x30(%rsp)
  call   <ZopfliGetDistSymbol@plt>
  xor    %edi,%edi
  mov    %eax,0x38(%rsp)
  lea    -0x3(%rbp),%eax
  cmp    $0x11d,%eax
  setbe  %dil
  call   <assert@plt>
  mov    0x30(%rsp),%edx
  mov    0x28(%rsp),%rcx
  lea    (%rcx,%rdx,4),%rsi
  mov    %rdx,0x48(%rsp)
  mov    (%rsi),%eax
  mov    %rsi,0x30(%rsp)
  test   %eax,%eax
  setne  %dil
  movzbl %dil,%edi
  call   <assert@plt>
  mov    0x38(%rsp),%r11d
  mov    0x60(%rsp),%rax
  lea    (%rax,%r11,4),%r9
  mov    %r11,0x40(%rsp)
  mov    (%r9),%edx
  mov    %r9,0x38(%rsp)
  test   %edx,%edx
  setne  %dil
  movzbl %dil,%edi
  call   <assert@plt>
  mov    0x48(%rsp),%rdx
  mov    %r15,%r8
  mov    %r14,%rcx
  mov    0x20(%rsp),%rax
  mov    0x30(%rsp),%rsi
  mov    (%rax,%rdx,4),%edi
  mov    (%rsi),%esi
  mov    %r13,%rdx
  call   <AddHuffmanBits@plt>
  mov    %ebp,%edi
  call   <ZopfliGetLengthExtraBits@plt>
  mov    %ebp,%edi
  mov    %eax,0x30(%rsp)
  call   <ZopfliGetLengthExtraBitsValue@plt>
  mov    0x30(%rsp),%esi
  mov    %r15,%r8
  mov    %r14,%rcx
  mov    %eax,%edi
  mov    %r13,%rdx
  call   <AddBits@plt>
  mov    0x40(%rsp),%r11
  mov    %r15,%r8
  mov    %r14,%rcx
  mov    0x38(%rsp),%r9
  mov    0x58(%rsp),%rax
  mov    %r13,%rdx
  mov    (%rax,%r11,4),%edi
  mov    (%r9),%esi
  call   <AddHuffmanBits@plt>
  mov    %r12d,%edi
  call   <ZopfliGetDistExtraBits@plt>
  mov    %r12d,%edi
  mov    %eax,%ebp
  call   <ZopfliGetDistExtraBitsValue@plt>
  mov    %r15,%r8
  mov    %r14,%rcx
  mov    %r13,%rdx
  mov    %eax,%edi
  mov    %ebp,%esi
  call   <AddBits@plt>
  mov    0x50(%rsp),%r10
  add    %rbx,(%rsp)
  add    $0x1,%r10
  cmp    %r10,0x18(%rsp)
  jne    L54
L7:
  mov    0x68(%rsp),%rax
  test   %rax,%rax
  sete   %dil
  cmp    (%rsp),%rax
  sete   %al
  add    $0x78,%rsp
  or     %eax,%edi
  pop    %rbx
  pop    %rbp
  movzbl %dil,%edi
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1110 <assert@plt>
  nopw   0x0(%rax,%rax,1)
L59:
  movq   $0x0,(%rsp)
  jmp    L7
```

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 = ZopfliGetLengthSymbol(litlen);
      unsigned ds = ZopfliGetDistSymbol(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(ZopfliGetLengthExtraBitsValue(litlen), ZopfliGetLengthExtraBits(litlen), bp, out, outsize);
      AddHuffmanBits(d_symbols[ds], d_lengths[ds], bp, out, outsize);
      AddBits(ZopfliGetDistExtraBitsValue(dist), ZopfliGetDistExtraBits(dist), bp, out, outsize);
      testlength += litlen;
    }
  }
  assert(expected_data_size == 0 || testlength == expected_data_size);
}
```