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

```asm
<compress>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x18(%rbp)
  movl   $0xffffffff,-0x14(%rbp)
  jmp    L0
L78:
  cmpl   $0x0,-0x10(%rbp)
  jne    L22
  cmpl   $0x1,-0x14(%rbp)
  jne    L176
  addl   $0x1,-0x18(%rbp)
  jmp    L0
L176:
  cmpl   $0x0,-0x18(%rbp)
  jle    L51
  cmpl   $0x1,-0x14(%rbp)
  jne    L46
  mov    -0x18(%rbp),%eax
  shr    $0x18,%eax
  or     $0xffffff80,%eax
  mov    %al,-0xc(%rbp)
  mov    -0x18(%rbp),%eax
  sar    $0x10,%eax
  mov    %al,-0xb(%rbp)
  mov    -0x18(%rbp),%eax
  sar    $0x8,%eax
  mov    %al,-0xa(%rbp)
  mov    -0x18(%rbp),%eax
  mov    %al,-0x9(%rbp)
  mov    -0x30(%rbp),%rdx
  lea    -0xc(%rbp),%rax
  mov    %rdx,%rcx
  mov    $0x1,%edx
  mov    $0x4,%esi
  mov    %rax,%rdi
  call   <fwrite@plt>
  jmp    L51
L46:
  cmpl   $0x0,-0x14(%rbp)
  jne    L51
  mov    -0x18(%rbp),%eax
  sar    $0x8,%eax
  and    $0x7f,%eax
  mov    %al,-0xc(%rbp)
  mov    -0x18(%rbp),%eax
  mov    %al,-0xb(%rbp)
  mov    -0x30(%rbp),%rdx
  lea    -0xc(%rbp),%rax
  mov    %rdx,%rcx
  mov    $0x1,%edx
  mov    $0x2,%esi
  mov    %rax,%rdi
  call   <fwrite@plt>
  mov    -0x30(%rbp),%rdx
  mov    -0x18(%rbp),%eax
  mov    %rdx,%rcx
  mov    $0x1,%edx
  mov    %eax,%esi
  lea    D30(%rip),%rax
  mov    %rax,%rdi
  call   <fwrite@plt>
L51:
  movl   $0x1,-0x14(%rbp)
  movl   $0x1,-0x18(%rbp)
  jmp    L0
L22:
  cmpl   $0x0,-0x14(%rbp)
  jne    L69
  cmpl   $0x7ffe,-0x18(%rbp)
  jg     L69
  mov    -0x18(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x18(%rbp)
  mov    -0x10(%rbp),%edx
  mov    %edx,%ecx
  cltq
  lea    D30(%rip),%rdx
  mov    %cl,(%rax,%rdx,1)
  jmp    L0
L69:
  cmpl   $0x0,-0x18(%rbp)
  jle    L177
  cmpl   $0x1,-0x14(%rbp)
  jne    L54
  mov    -0x18(%rbp),%eax
  shr    $0x18,%eax
  or     $0xffffff80,%eax
  mov    %al,-0xc(%rbp)
  mov    -0x18(%rbp),%eax
  sar    $0x10,%eax
  mov    %al,-0xb(%rbp)
  mov    -0x18(%rbp),%eax
  sar    $0x8,%eax
  mov    %al,-0xa(%rbp)
  mov    -0x18(%rbp),%eax
  mov    %al,-0x9(%rbp)
  mov    -0x30(%rbp),%rdx
  lea    -0xc(%rbp),%rax
  mov    %rdx,%rcx
  mov    $0x1,%edx
  mov    $0x4,%esi
  mov    %rax,%rdi
  call   <fwrite@plt>
  jmp    L177
L54:
  cmpl   $0x0,-0x14(%rbp)
  jne    L177
  mov    -0x18(%rbp),%eax
  sar    $0x8,%eax
  and    $0x7f,%eax
  mov    %al,-0xc(%rbp)
  mov    -0x18(%rbp),%eax
  mov    %al,-0xb(%rbp)
  mov    -0x30(%rbp),%rdx
  lea    -0xc(%rbp),%rax
  mov    %rdx,%rcx
  mov    $0x1,%edx
  mov    $0x2,%esi
  mov    %rax,%rdi
  call   <fwrite@plt>
  mov    -0x30(%rbp),%rdx
  mov    -0x18(%rbp),%eax
  mov    %rdx,%rcx
  mov    $0x1,%edx
  mov    %eax,%esi
  lea    D30(%rip),%rax
  mov    %rax,%rdi
  call   <fwrite@plt>
L177:
  movl   $0x0,-0x14(%rbp)
  mov    -0x10(%rbp),%eax
  mov    %al,D20(%rip)
  movl   $0x1,-0x18(%rbp)
L0:
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <getc@plt>
  mov    %eax,-0x10(%rbp)
  mov    D20(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x10(%rbp)
  jne    L78
  cmpl   $0x0,-0x18(%rbp)
  jle    L180
  cmpl   $0x1,-0x14(%rbp)
  jne    L208
  mov    -0x18(%rbp),%eax
  shr    $0x18,%eax
  or     $0xffffff80,%eax
  mov    %al,-0xc(%rbp)
  mov    -0x18(%rbp),%eax
  sar    $0x10,%eax
  mov    %al,-0xb(%rbp)
  mov    -0x18(%rbp),%eax
  sar    $0x8,%eax
  mov    %al,-0xa(%rbp)
  mov    -0x18(%rbp),%eax
  mov    %al,-0x9(%rbp)
  mov    -0x30(%rbp),%rdx
  lea    -0xc(%rbp),%rax
  mov    %rdx,%rcx
  mov    $0x1,%edx
  mov    $0x4,%esi
  mov    %rax,%rdi
  call   <fwrite@plt>
  jmp    L180
L208:
  cmpl   $0x0,-0x14(%rbp)
  jne    L180
  mov    -0x18(%rbp),%eax
  sar    $0x8,%eax
  and    $0x7f,%eax
  mov    %al,-0xc(%rbp)
  mov    -0x18(%rbp),%eax
  mov    %al,-0xb(%rbp)
  mov    -0x30(%rbp),%rdx
  lea    -0xc(%rbp),%rax
  mov    %rdx,%rcx
  mov    $0x1,%edx
  mov    $0x2,%esi
  mov    %rax,%rdi
  call   <fwrite@plt>
  mov    -0x30(%rbp),%rdx
  mov    -0x18(%rbp),%eax
  mov    %rdx,%rcx
  mov    $0x1,%edx
  mov    %eax,%esi
  lea    D20(%rip),%rax
  mov    %rax,%rdi
  call   <fwrite@plt>
L180:
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L155
  call   <__stack_chk_fail@plt>
L155:
  leave
  ret
```

assistant: ```c
void compress(FILE *in, FILE *out) {
  static unsigned char data_buf[65526];
  unsigned char number_buf[4];
  int count = 0;
  int zero_mode = -1;
  int input;
  while ((input = getc(in)) != EOF) {
    if (input == 0) {
      if (zero_mode == 1) {
        count++;
      } else {
        if (count > 0) {
          if (zero_mode == 1) {
            number_buf[0] = ((count >> 24) & 0x7f) | 0x80;
            number_buf[1] = (count >> 16) & 0xff;
            number_buf[2] = (count >> 8) & 0xff;
            number_buf[3] = count & 0xff;
            fwrite(number_buf, 4, 1, out);
          } else if (zero_mode == 0) {
            number_buf[0] = (count >> 8) & 0x7f;
            number_buf[1] = count & 0xff;
            fwrite(number_buf, 2, 1, out);
            fwrite(data_buf, count, 1, out);
          }
        }
        zero_mode = 1;
        count = 1;
      }
    } else {
      if (zero_mode == 0 && count < 0x7fff) {
        data_buf[count++] = input;
      } else {
        if (count > 0) {
          if (zero_mode == 1) {
            number_buf[0] = ((count >> 24) & 0x7f) | 0x80;
            number_buf[1] = (count >> 16) & 0xff;
            number_buf[2] = (count >> 8) & 0xff;
            number_buf[3] = count & 0xff;
            fwrite(number_buf, 4, 1, out);
          } else if (zero_mode == 0) {
            number_buf[0] = (count >> 8) & 0x7f;
            number_buf[1] = count & 0xff;
            fwrite(number_buf, 2, 1, out);
            fwrite(data_buf, count, 1, out);
          }
        }
        zero_mode = 0;
        data_buf[0] = input;
        count = 1;
      }
    }
  }
  if (count > 0) {
    if (zero_mode == 1) {
      number_buf[0] = ((count >> 24) & 0x7f) | 0x80;
      number_buf[1] = (count >> 16) & 0xff;
      number_buf[2] = (count >> 8) & 0xff;
      number_buf[3] = count & 0xff;
      fwrite(number_buf, 4, 1, out);
    } else if (zero_mode == 0) {
      number_buf[0] = (count >> 8) & 0x7f;
      number_buf[1] = count & 0xff;
      fwrite(number_buf, 2, 1, out);
      fwrite(data_buf, count, 1, out);
    }
  }
}
```