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

```asm
<lz77_compress>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x88,%rsp
  mov    %rdi,%r14
  mov    %rsi,0x30(%rsp)
  mov    %edx,0x3c(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x1078(%rsp)
  xor    %eax,%eax
  movq   $0x0,(%rsi)
  mov    $0x4,%edi
  call   <malloc@plt>
  test   %rax,%rax
  je     L98
  mov    %rax,%rbp
  lea    0x3c(%rsp),%rsi
  mov    $0x4,%edx
  mov    %rax,%rdi
  call   <memcpy@plt>
  lea    0x70(%rsp),%rdi
  mov    $0x1000,%edx
  mov    $0x0,%esi
  call   <memset@plt>
  lea    0x50(%rsp),%rdi
  mov    $0x20,%edx
  mov    $0x0,%esi
  call   <memset@plt>
  mov    0x3c(%rsp),%ecx
  mov    %ecx,0x10(%rsp)
  mov    $0x0,%eax
L45:
  mov    %eax,%r13d
  cmp    %eax,%ecx
  jle    L185
  movzbl (%r14,%rax,1),%edx
  mov    %dl,0x50(%rsp,%rax,1)
  lea    0x1(%rax),%r13d
  add    $0x1,%rax
  cmp    $0x20,%rax
  jne    L45
L185:
  cmpl   $0x0,0x10(%rsp)
  jle    L82
  mov    $0x20,%ebx
  lea    0x47(%rsp),%rax
  mov    %rax,0x18(%rsp)
  lea    0x4c(%rsp),%rax
  mov    %rax,0x20(%rsp)
  mov    %r13d,0x38(%rsp)
  jmp    L5
L19:
  movzbl 0x47(%rsp),%edi
  mov    $0x9,%r12d
  jmp    L177
L192:
  mov    %rbp,%rdi
  call   <free@plt>
  mov    $0xffffffff,%eax
L88:
  mov    0x1078(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L4
  add    $0x1088,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L71:
  mov    0x8(%rsp),%eax
  lea    (%rax,%r12,1),%esi
  mov    %r13,%rdi
  call   <bit_get@plt>
  mov    %eax,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <bit_set@plt>
  add    $0x1,%ebx
  cmp    %r15d,%ebx
  je     L89
L163:
  mov    %ebx,%r12d
  test   $0x7,%bl
  jne    L71
  lea    0x7(%rbx),%esi
  test   %ebx,%ebx
  cmovns %ebx,%esi
  sar    $0x3,%esi
  add    $0x1,%esi
  mov    %rbp,%rdi
  call   <realloc@plt>
  test   %rax,%rax
  je     L192
  mov    %rax,%rbp
  jmp    L71
L89:
  mov    0x14(%rsp),%eax
  lea    0x1(%rax),%r15d
  mov    $0x1000,%r12d
  sub    %r15d,%r12d
  movslq %r15d,%rcx
  lea    0x70(%rsp),%rax
  mov    %rax,%rsi
  mov    %rcx,0x8(%rsp)
  add    %rcx,%rsi
  mov    %r12d,%edx
  mov    %rax,0x28(%rsp)
  mov    %rax,%rdi
  call   <memmove@plt>
  lea    0x50(%rsp),%r13
  movslq %r12d,%r12
  mov    0x28(%rsp),%rax
  lea    (%rax,%r12,1),%rdi
  mov    %r15d,%edx
  mov    %r13,%rsi
  call   <memmove@plt>
  mov    $0x20,%r12d
  sub    %r15d,%r12d
  mov    0x8(%rsp),%rcx
  lea    0x0(%r13,%rcx,1),%rsi
  mov    %r12d,%edx
  mov    %r13,%rdi
  call   <memmove@plt>
  cmp    $0x1f,%r12d
  jg     L143
  mov    0x3c(%rsp),%ecx
  movslq 0x38(%rsp),%rdx
  mov    0x14(%rsp),%eax
  lea    0x1(%rdx,%rax,1),%rdi
  mov    %rdx,%rax
  movslq %r12d,%r12
  sub    %rdx,%r12
  lea    0x50(%rsp,%r12,1),%rsi
L65:
  cmp    %eax,%ecx
  jle    L160
  movzbl (%r14,%rax,1),%edx
  mov    %dl,(%rsi,%rax,1)
  lea    0x1(%rax),%edx
  add    $0x1,%rax
  cmp    %rdi,%rax
  jne    L65
  mov    %edx,0x38(%rsp)
  jmp    L143
L160:
  mov    %eax,0x38(%rsp)
L143:
  sub    %r15d,0x10(%rsp)
  mov    0x10(%rsp),%eax
  test   %eax,%eax
  jle    L164
L5:
  lea    0x50(%rsp),%rsi
  lea    0x70(%rsp),%rdi
  mov    0x18(%rsp),%rcx
  mov    0x20(%rsp),%rdx
  call   <compare_win@plt>
  mov    %eax,0x14(%rsp)
  test   %eax,%eax
  je     L19
  shl    $0x8,%eax
  mov    %eax,%edi
  movzbl 0x47(%rsp),%eax
  or     %eax,%edi
  mov    0x4c(%rsp),%eax
  shl    $0xd,%eax
  or     %eax,%edi
  or     $0x2000000,%edi
  mov    $0x1a,%r12d
L177:
  mov    %edi,0x48(%rsp)
  call   <htonl@plt>
  mov    %eax,0x48(%rsp)
  lea    (%r12,%rbx,1),%r15d
  mov    $0x20,%eax
  sub    %ebx,%eax
  sub    %r12d,%eax
  mov    %eax,0x8(%rsp)
  lea    0x48(%rsp),%r13
  jmp    L163
L82:
  mov    $0x20,%ebx
L164:
  mov    0x30(%rsp),%rax
  mov    %rbp,(%rax)
  lea    0x6(%rbx),%eax
  sub    $0x1,%ebx
  cmovns %ebx,%eax
  sar    $0x3,%eax
  add    $0x1,%eax
  jmp    L88
L98:
  mov    $0xffffffff,%eax
  jmp    L88
L4:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int lz77_compress(const unsigned char *original, unsigned char **compressed, int size) {
  unsigned int token;
  unsigned char window[4096], buffer[32], *comp, *temp, next;
  int offset, length, remaining, tbits, hsize, ipos, opos, tpos, i;
  *compressed = NULL;
  hsize = sizeof(int);
  if ((comp = (unsigned char *)malloc(hsize)) == NULL)
    return -1;
  memcpy(comp, &size, sizeof(int));
  memset(window, 0, 4096);
  memset(buffer, 0, 32);
  ipos = 0;
  for (i = 0; i < 32 && ipos < size; i++) {
    buffer[i] = original[ipos];
    ipos++;
  }
  opos = hsize * 8;
  remaining = size;
  while (remaining > 0) {
    if ((length = compare_win(window, buffer, &offset, &next)) != 0) {
      token = 0x00000001 << ((1 + 12 + 8 + 5) - 1);
      token = token | (offset << ((1 + 12 + 8 + 5) - 1 - 12));
      token = token | (length << ((1 + 12 + 8 + 5) - 1 - 12 - 5));
      token = token | next;
      tbits = (1 + 12 + 8 + 5);
    } else {
      token = 0x00000000;
      token = token | next;
      tbits = (1 + 8);
    }
    token = htonl(token);
    for (i = 0; i < tbits; i++) {
      if (opos % 8 == 0) {
        if ((temp = (unsigned char *)realloc(comp, (opos / 8) + 1)) == NULL) {
          free(comp);
          return -1;
        }
        comp = temp;
      }
      tpos = (sizeof(unsigned int) * 8) - tbits + i;
      bit_set(comp, opos, bit_get((unsigned char *)&token, tpos));
      opos++;
    }
    length++;
    memmove(&window[0], &window[length], 4096 - length);
    memmove(&window[4096 - length], &buffer[0], length);
    memmove(&buffer[0], &buffer[length], 32 - length);
    for (i = 32 - length; i < 32 && ipos < size; i++) {
      buffer[i] = original[ipos];
      ipos++;
    }
    remaining = remaining - length;
  }
  *compressed = comp;
  return ((opos - 1) / 8) + 1;
}
```