user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x98,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x88(%rsp)
  xor    %eax,%eax
  mov    $0x20000,%edx
  lea    D21(%rip),%rsi
  mov    D10(%rip),%rax
  mov    (%rax),%edi
  call   <read@plt>
  mov    %rax,%r15
  cmp    $0x4000,%rax
  setbe  %dil
  movzbl %dil,%edi
  call   <assert@plt>
  lea    D21(%rip),%rdx
  jmp    L128
L39:
  mov    %rax,%r15
L128:
  test   %r15,%r15
  je     L118
  lea    -0x1(%r15),%rax
  cmpq   $0x0,-0x8(%rdx,%r15,8)
  je     L39
L118:
  mov    $0xffffffff,%r12d
  mov    $0xffffffff,%eax
  mov    $0x0,%r14d
  mov    $0x0,%ebp
  movq   $0x0,0x8(%rsp)
  mov    $0x0,%r13d
  jmp    L52
L85:
  test   %ebp,%ebp
  je     L133
  mov    $0x0,%ebx
  jmp    L56
L78:
  add    $0x2,%ebp
  lea    0x0(,%r14,4),%eax
  mov    %eax,%r14d
  or     $0x2,%r14d
  mov    %r12d,%edx
  cmp    %rbx,%rdx
  je     L83
L29:
  cmp    $0x7,%ebp
  ja     L26
L105:
  mov    %r12d,%eax
  mov    %ebx,%r12d
L52:
  mov    %r13d,%edx
  cmp    %r15,%rdx
  je     L85
  mov    %r13d,%edx
  lea    D21(%rip),%rcx
  mov    (%rcx,%rdx,8),%rbx
  lea    0x1(%r13),%r13d
L56:
  mov    %eax,%eax
  cmp    %rbx,%rax
  je     L78
  mov    %r12d,%eax
  cmp    %rbx,%rax
  jne    L21
  add    $0x2,%ebp
  lea    0x0(,%r14,4),%eax
L83:
  or     $0x3,%eax
  mov    %eax,%r14d
  jmp    L29
L21:
  lea    0x20(%rsp),%rsi
  mov    %r12d,%edi
  call   <opts@plt>
  mov    $0x0,%eax
  lea    0x20(%rsp),%rdx
L53:
  cmp    %rbx,(%rdx,%rax,8)
  je     L42
  add    $0x1,%rax
  cmp    $0x4,%rax
  jne    L53
  add    $0x2,%ebp
  shl    $0x2,%r14d
  mov    0x8(%rsp),%rax
  mov    %rbx,0x40(%rsp,%rax,8)
  lea    0x1(%rax),%rax
  mov    %rax,0x8(%rsp)
  jmp    L29
L42:
  add    $0x4,%ebp
  shl    $0x4,%r14d
  or     %eax,%r14d
  or     $0x4,%r14d
  jmp    L29
L26:
  sub    $0x8,%ebp
  mov    %r14d,%eax
  mov    %ebp,%ecx
  shr    %cl,%eax
  mov    %rax,0x18(%rsp)
  cmp    $0x1,%rax
  setne  %dil
  movzbl %dil,%edi
  call   <assert@plt>
  lea    0x18(%rsp),%rsi
  mov    $0x1,%edx
  mov    D3(%rip),%rax
  mov    (%rax),%edi
  call   <write_all@plt>
  lea    0x40(%rsp),%rsi
  mov    0x8(%rsp),%edx
  mov    D3(%rip),%rax
  mov    (%rax),%edi
  call   <write_all@plt>
  mov    $0x1,%eax
  mov    %ebp,%ecx
  shl    %cl,%eax
  sub    $0x1,%eax
  and    %eax,%r14d
  movq   $0x0,0x8(%rsp)
  jmp    L105
L133:
  movq   $0x1,0x18(%rsp)
  lea    0x18(%rsp),%rsi
  mov    $0x1,%edx
  mov    D3(%rip),%rax
  mov    (%rax),%edi
  call   <write_all@plt>
  mov    0x88(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L5
  mov    $0x0,%eax
  add    $0x98,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L5:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int main() {
  static uint8_t source[0x4000];
  size_t size = read(STDIN_FILENO, &source, sizeof(source));
  unsigned pos = 0;
  assert(size <= 0x4000);
  while (size && source[size - 1] == 0) {
    size--;
  }
  uint8_t literals[8];
  size_t literals_size = 0;
  unsigned bits = 0;
  unsigned control = 0;
  unsigned prev[2] = {-1, -1};
  while (true) {
    uint8_t byte = 0;
    if (pos == size) {
      if (bits == 0)
        break;
    } else {
      byte = source[pos++];
    }
    if (byte == prev[0] || byte == prev[1]) {
      bits += 2;
      control <<= 1;
      control |= 1;
      control <<= 1;
      if (byte == prev[1]) {
        control |= 1;
      }
    } else {
      bits += 2;
      control <<= 2;
      uint8_t options[4];
      opts(prev[1], options);
      bool found = false;
      for (unsigned i = 0; i < 4; i++) {
        if (options[i] == byte) {
          control |= 1;
          bits += 2;
          control <<= 2;
          control |= i;
          found = true;
          break;
        }
      }
      if (!found) {
        literals[literals_size++] = byte;
      }
    }
    prev[0] = prev[1];
    prev[1] = byte;
    if (bits >= 8) {
      uint8_t outctl = control >> (bits - 8);
      assert(outctl != 1);
      write_all(STDOUT_FILENO, &outctl, 1);
      write_all(STDOUT_FILENO, literals, literals_size);
      bits -= 8;
      control &= (1 << bits) - 1;
      literals_size = 0;
    }
  }
  uint8_t end_byte = 1;
  write_all(STDOUT_FILENO, &end_byte, 1);
  return 0;
}
```