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

```asm
<mmini_lzl_compress>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdx,%r13
  lea    (%rdi,%rsi,1),%r8
  lea    (%rdx,%rcx,1),%rbp
  mov    %rdx,%r10
  cmp    %r8,%rdi
  je     L36
  mov    %rdi,%r11
  mov    %rdi,%rsi
  mov    %rdi,%rdx
  mov    $0x0,%ebx
  mov    $0x0,%r9d
  mov    $0x3,%edi
  mov    $0x7ff,%r12d
  jmp    L124
L140:
  cmp    %rdi,%rax
  jbe    L153
  cmp    %rax,%r15
  je     L65
  mov    %rdx,%r9
  mov    %rax,%rdi
L153:
  add    $0x1,%rdx
  cmp    %cl,(%rdx)
  jne    L153
  cmp    %rsi,%rdx
  je     L196
L68:
  cmp    %cl,(%rdx)
  jne    L153
  mov    $0x0,%eax
  cmp    %rsi,%r8
  je     L153
L157:
  add    $0x1,%rax
  movzbl (%rsi,%rax,1),%r14d
  cmp    %r14b,(%rdx,%rax,1)
  jne    L140
  cmp    %rax,%r15
  jne    L157
  jmp    L140
L65:
  mov    %rdx,%r9
  mov    %rax,%rdi
L196:
  cmp    $0x3,%rdi
  jbe    L49
  mov    %rsi,%rdx
  sub    %r9,%rdx
  lea    0x3(%r10),%rax
  cmp    %rax,%rbp
  jb     L9
  mov    %edi,%eax
  and    $0x3,%eax
  mov    %al,(%r10)
  lea    (%rdi,%rdi,1),%eax
  and    $0xfffffff8,%eax
  mov    %rdx,%rcx
  shr    $0x8,%rcx
  or     %ecx,%eax
  mov    %al,0x1(%r10)
  mov    %dl,0x2(%r10)
  add    %rdi,%rsi
  lea    0x3(%r10),%r10
  mov    $0x0,%ebx
  mov    $0x3,%edi
L47:
  cmp    %r8,%rsi
  je     L36
  mov    %ebx,%ecx
  shr    $0x4,%ecx
  mov    %r12d,%eax
  sar    %cl,%eax
  cltq
  mov    %rsi,%rcx
  sub    %r11,%rcx
  mov    %rsi,%rdx
  sub    %rax,%rdx
  cmp    %rax,%rcx
  cmovbe %r11,%rdx
L124:
  mov    %r8,%r15
  sub    %rsi,%r15
  mov    $0x7f,%eax
  cmp    %rax,%r15
  cmova  %rax,%r15
  cmp    %rsi,%rdx
  je     L196
  movzbl (%rsi),%ecx
  jmp    L68
L49:
  movzbl (%rsi),%edx
  cmp    $0x3,%dl
  ja     L231
  cmp    %r10,%rbp
  je     L218
  lea    0x1(%r10),%rax
  mov    %dl,(%r10)
  jmp    L101
L231:
  mov    %r10,%rax
L101:
  cmp    %rbp,%rax
  je     L52
  lea    0x1(%rsi),%rdx
  lea    0x1(%rax),%r10
  movzbl (%rsi),%ecx
  mov    %cl,(%rax)
  mov    %rdx,%rsi
  cmp    $0x7e,%ebx
  ja     L47
  add    $0x1,%ebx
  jmp    L47
L36:
  mov    %r10,%rax
  sub    %r13,%rax
L67:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L9:
  mov    $0x0,%eax
  jmp    L67
L218:
  mov    $0x0,%eax
  jmp    L67
L52:
  mov    $0x0,%eax
  jmp    L67
```

assistant: ```c
unsigned long mmini_lzl_compress(const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long outlen) {
  unsigned long best_match_l = 3, match_l, match_max, offset, tmp;
  const unsigned char *scan_i, *best_scan_match_i = (const unsigned char *)0, *i = in, *ieof = (in + inlen);
  unsigned char *o = out, *oeof = (out + outlen);
  unsigned int slack = 0;
  while (i != ieof) {
    tmp = 0x7ff >> (slack >> 4);
    scan_i = (((unsigned long)(i - in)) > tmp) ? (i - tmp) : in;
    tmp = (unsigned long)(ieof - i);
    match_max = (tmp > 0x7f) ? 0x7f : tmp;
    while (scan_i != i) {
      match_l = 0;
      while ((scan_i[match_l] == i[match_l]) && (match_l != match_max))
        ++match_l;
      if (match_l > best_match_l) {
        best_scan_match_i = scan_i;
        best_match_l = match_l;
        if (match_l == match_max)
          break;
      }
      while (*(++scan_i) != *i) {
      }
    }
    if (best_match_l >= 4) {
      offset = (unsigned long)(i - best_scan_match_i);
      if ((o + 3) > oeof)
        return 0;
      *(o++) = (unsigned char)(best_match_l & 0x03);
      *(o++) = (unsigned char)(((best_match_l & 0x7c) << 1) | (offset >> 8));
      *(o++) = (unsigned char)(offset & 0xff);
      i += best_match_l;
      best_match_l = 3;
      slack = 0;
    } else {
      if (*i <= 0x03) {
        if (o == oeof)
          return 0;
        *(o++) = *i;
      }
      if (o == oeof)
        return 0;
      *(o++) = *(i++);
      if (slack < 0x7f)
        ++slack;
    }
  }
  return (unsigned long)(o - out);
}
```