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

```asm
<RLE_Compress>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x438,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x428(%rsp)
  xor    %eax,%eax
  test   %edx,%edx
  je     L65
  mov    %rsi,%r14
  lea    0x20(%rsp),%rsi
  mov    %rdi,%r13
  xor    %eax,%eax
  mov    %edx,%ebp
  mov    $0x80,%ecx
  lea    -0x1(%rdx),%edx
  mov    %rsi,%rdi
  rep stos %rax,%es:(%rdi)
  mov    %r13,%rax
  lea    0x1(%r13,%rdx,1),%rcx
  nopl   (%rax)
L148:
  movzbl (%rax),%edx
  add    $0x1,%rax
  addl   $0x1,0x20(%rsp,%rdx,4)
  cmp    %rax,%rcx
  jne    L148
  mov    $0x1,%eax
  xor    %edx,%edx
L190:
  movzbl %dl,%ecx
  movzbl %dl,%r12d
  mov    0x20(%rsp,%rcx,4),%edi
  cmp    %edi,(%rsi,%rax,4)
  cmovb  %eax,%edx
  cmovb  %eax,%r12d
  add    $0x1,%rax
  cmp    $0x100,%rax
  jne    L190
  mov    %dl,(%r14)
  lea    0x1c(%rsp),%rsi
  movzbl 0x0(%r13),%r9d
  movl   $0x1,0x1c(%rsp)
  cmp    $0x1,%ebp
  je     L192
  movzbl 0x1(%r13),%r8d
  mov    $0x2,%ebx
  lea    0x1c(%rsp),%rsi
  movzbl %r9b,%ecx
  cmp    %r8b,%r9b
  je     L169
  nopl   0x0(%rax,%rax,1)
L99:
  mov    %r12d,%edx
  mov    %r14,%rdi
  mov    %rsi,(%rsp)
  mov    %ebx,%r15d
  mov    %r8b,0xf(%rsp)
  call   <_RLE_WriteNonRep@plt>
  movzbl 0xf(%rsp),%r9d
  mov    (%rsp),%rsi
  mov    $0x1,%eax
L84:
  cmp    %ebp,%r15d
  jb     L142
  cmp    $0x1,%eax
  je     L192
L177:
  mov    0x1c(%rsp),%eax
L65:
  mov    0x428(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L66
  add    $0x438,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L142:
  movzbl 0x0(%r13,%r15,1),%r8d
  lea    0x1(%r15),%ebx
  movzbl %r9b,%ecx
  cmp    %r8b,%r9b
  jne    L99
L169:
  cmp    %ebp,%ebx
  jae    L173
  mov    $0x2,%eax
  nopl   0x0(%rax,%rax,1)
L64:
  mov    %ebx,%edx
  add    $0x1,%ebx
  mov    %eax,%r8d
  add    $0x1,%eax
  movzbl 0x0(%r13,%rdx,1),%r10d
  mov    %rdx,%r15
  cmp    %ebx,%ebp
  jbe    L78
  cmp    %r10b,%r9b
  jne    L127
  cmp    $0x8000,%eax
  jne    L64
  mov    $0x8000,%r8d
  mov    %r12d,%edx
  mov    %r14,%rdi
  mov    %rsi,(%rsp)
  call   <_RLE_WriteRep@plt>
  mov    (%rsp),%rsi
L21:
  movzbl 0x0(%r13,%rbx,1),%r9d
  add    $0x2,%r15d
  mov    $0x1,%eax
  jmp    L84
L78:
  cmp    %r10b,%r9b
  je     L68
L127:
  mov    %r12d,%edx
  mov    %r14,%rdi
  mov    %rsi,(%rsp)
  mov    %ebx,%r15d
  mov    %r10b,0xf(%rsp)
  call   <_RLE_WriteRep@plt>
  movzbl 0xf(%rsp),%r9d
  mov    (%rsp),%rsi
  mov    $0x1,%eax
  jmp    L84
  nopl   0x0(%rax)
L192:
  movzbl %r9b,%ecx
  mov    %r12d,%edx
  mov    %r14,%rdi
  call   <_RLE_WriteNonRep@plt>
  jmp    L177
L68:
  mov    %eax,%r8d
  mov    %r12d,%edx
  mov    %r14,%rdi
  mov    %r9b,0xf(%rsp)
  mov    %rsi,(%rsp)
  call   <_RLE_WriteRep@plt>
  cmp    %ebx,%ebp
  mov    (%rsp),%rsi
  movzbl 0xf(%rsp),%r9d
  ja     L21
  mov    %ebx,%r15d
  xor    %eax,%eax
  jmp    L84
L173:
  mov    $0x2,%r8d
  mov    %r12d,%edx
  mov    %r14,%rdi
  mov    %rsi,(%rsp)
  mov    %r9b,0xf(%rsp)
  mov    %ebx,%r15d
  call   <_RLE_WriteRep@plt>
  mov    (%rsp),%rsi
  movzbl 0xf(%rsp),%r9d
  xor    %eax,%eax
  jmp    L84
L66:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int RLE_Compress(unsigned char *in, unsigned char *out, unsigned int insize) {
  unsigned char byte1, byte2, marker;
  unsigned int inpos, outpos, count, i, histogram[256];
  if (insize < 1) {
    return 0;
  }
  for (i = 0; i < 256; ++i) {
    histogram[i] = 0;
  }
  for (i = 0; i < insize; ++i) {
    ++histogram[in[i]];
  }
  marker = 0;
  for (i = 1; i < 256; ++i) {
    if (histogram[i] < histogram[marker]) {
      marker = i;
    }
  }
  out[0] = marker;
  outpos = 1;
  byte1 = in[0];
  inpos = 1;
  count = 1;
  if (insize >= 2) {
    byte2 = in[inpos++];
    count = 2;
    do {
      if (byte1 == byte2) {
        while ((inpos < insize) && (byte1 == byte2) && (count < 32768)) {
          byte2 = in[inpos++];
          ++count;
        }
        if (byte1 == byte2) {
          _RLE_WriteRep(out, &outpos, marker, byte1, count);
          if (inpos < insize) {
            byte1 = in[inpos++];
            count = 1;
          } else {
            count = 0;
          }
        } else {
          _RLE_WriteRep(out, &outpos, marker, byte1, count - 1);
          byte1 = byte2;
          count = 1;
        }
      } else {
        _RLE_WriteNonRep(out, &outpos, marker, byte1);
        byte1 = byte2;
        count = 1;
      }
      if (inpos < insize) {
        byte2 = in[inpos++];
        count = 2;
      }
    } while ((inpos < insize) || (count >= 2));
  }
  if (count == 1) {
    _RLE_WriteNonRep(out, &outpos, marker, byte1);
  }
  return outpos;
}
```