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

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rsi,%r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  cmp    $0x4,%edi
  jne    L114
  mov    0x10(%rsi),%rdi
  lea    D35(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L27
  mov    0x18(%r13),%rdi
  lea    D63(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,0x8(%rsp)
  test   %rax,%rax
  je     L81
  mov    $0x10000,%edi
  mov    $0x10000,%ebx
  xor    %r14d,%r14d
  call   <malloc@plt>
  mov    %rax,%rbp
  nopl   (%rax)
L156:
  mov    %rbx,%rdx
  lea    0x0(%rbp,%r14,1),%rdi
  mov    %r12,%rcx
  mov    $0x1,%esi
  sub    %r14,%rdx
  call   <fread@plt>
  test   %rax,%rax
  jle    L164
  add    %rax,%r14
  mov    %rbx,%rax
  sub    %r14,%rax
  cmp    $0x4000,%rax
  jg     L156
  add    %rbx,%rbx
  mov    %rbp,%rdi
  mov    %rbx,%rsi
  call   <realloc@plt>
  mov    %rax,%rbp
  jmp    L156
  nopl   0x0(%rax)
L164:
  mov    $0x9898,%edi
  add    $0x1000,%rbx
  call   <malloc@plt>
  mov    %rbx,%rdi
  mov    %rax,0x10(%rsp)
  call   <malloc@plt>
  mov    %rbx,%rdi
  mov    %rax,0x18(%rsp)
  call   <malloc@plt>
  mov    %rax,%r15
  mov    0x8(%r13),%rax
  movzbl (%rax),%eax
  sub    $0x48,%eax
  cmp    $0x24,%al
  ja     L99
  lea    D11(%rip),%rdx
  movzbl %al,%eax
  movslq (%rdx,%rax,4),%rax
  add    %rdx,%rax
  notrack jmp *%rax
L99:
  mov    %r13,%rsi
  mov    $0x4,%edi
  call   <print_help@plt>
  or     $0xffffffff,%eax
L74:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  mov    0x10(%rsp),%r8
  mov    %r15,%rdx
  mov    %rbx,%rcx
  mov    %r14,%rsi
  mov    %rbp,%rdi
  call   <mmini_huffman_compress@plt>
  mov    %rax,%rdx
  test   %rax,%rax
  je     L113
L124:
  mov    0x8(%rsp),%rcx
  mov    $0x1,%esi
  mov    %r15,%rdi
  call   <fwrite@plt>
  mov    %r12,%rdi
  call   <fclose@plt>
  mov    0x8(%rsp),%rdi
  call   <fclose@plt>
  mov    %r15,%rdi
  call   <free@plt>
  mov    0x18(%rsp),%rdi
  call   <free@plt>
  mov    0x10(%rsp),%rdi
  call   <free@plt>
  mov    %rbp,%rdi
  call   <free@plt>
  add    $0x28,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  mov    %r15,%rdx
  mov    %rbx,%rcx
  mov    %r14,%rsi
  mov    %rbp,%rdi
  call   <mmini_lzl_compress@plt>
  mov    %rax,%rdx
  test   %rax,%rax
  jne    L124
L113:
  lea    D8(%rip),%rdi
  call   <puts@plt>
  or     $0xffffffff,%eax
  jmp    L74
  push   %rdi
  mov    %rbx,%r9
  mov    %r15,%r8
  mov    %rbx,%rcx
  push   0x18(%rsp)
  mov    0x28(%rsp),%rdx
  mov    %r14,%rsi
  mov    %rbp,%rdi
  call   <mmini_compress@plt>
  pop    %r8
  pop    %r9
  mov    %rax,%rdx
  test   %rax,%rax
  jne    L124
  jmp    L113
  push   %rax
  mov    %rbx,%rcx
  mov    %r14,%rsi
  mov    %rbx,%r9
  push   0x18(%rsp)
  mov    0x28(%rsp),%rdx
  mov    %r15,%r8
  mov    %rbp,%rdi
  call   <mmini_decompress@plt>
  pop    %rcx
  pop    %rsi
  mov    %rax,%rdx
  test   %rax,%rax
  jne    L124
L58:
  lea    D10(%rip),%rdi
  call   <puts@plt>
  or     $0xffffffff,%eax
  jmp    L74
  mov    0x10(%rsp),%r8
  mov    %r15,%rdx
  mov    %rbx,%rcx
  mov    %r14,%rsi
  mov    %rbp,%rdi
  call   <mmini_huffman_decompress@plt>
  mov    %rax,%rdx
  test   %rax,%rax
  jne    L124
  jmp    L58
  mov    %r15,%rdx
  mov    %rbx,%rcx
  mov    %r14,%rsi
  mov    %rbp,%rdi
  call   <mmini_lzl_decompress@plt>
  mov    %rax,%rdx
  test   %rax,%rax
  jne    L124
  jmp    L58
L114:
  call   <print_help@plt>
  or     $0xffffffff,%eax
  jmp    L74
L81:
  mov    %r12,%rdi
  call   <fclose@plt>
  mov    0x18(%r13),%rsi
  lea    D52(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  or     $0xffffffff,%eax
  jmp    L74
L27:
  mov    0x10(%r13),%rsi
  lea    D31(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  or     $0xffffffff,%eax
  jmp    L74
```

tool_calls: name: parse_data
arguments: tag: D35
data_type: string
name: parse_data
arguments: tag: D63
data_type: string
name: parse_data
arguments: tag: D8
data_type: string
name: parse_data
arguments: tag: D10
data_type: string
name: parse_data
arguments: tag: D52
data_type: string
name: parse_data
arguments: tag: D31
data_type: string

tool: D35: r

tool: D63: w

tool: D8: Compression failed!

tool: D10: Decompression failed!

tool: D52: Could not open %s for writing.


tool: D31: Could not open %s for reading.


assistant: ```c
int main(int argc, char **argv) {
  unsigned long r;
  long n, inptr = 0, insize = 65536;
  unsigned char *in, *out, *tmp, *huffheap;
  FILE *inf, *outf;
  if (argc != 4) {
    print_help(argc, argv);
    return -1;
  }
  inf = fopen(argv[2], "r");
  if (!inf) {
    printf("Could not open %s for reading.\n", argv[2]);
    return -1;
  }
  outf = fopen(argv[3], "w");
  if (!outf) {
    fclose(inf);
    printf("Could not open %s for writing.\n", argv[3]);
    return -1;
  }
  in = malloc(insize);
  while ((n = fread(in + inptr, 1, insize - inptr, inf)) > 0) {
    inptr += n;
    if ((insize - inptr) <= 16384)
      in = realloc(in, insize *= 2);
  }
  huffheap = malloc(((sizeof(double) * 257) + (((sizeof(void *) * 4) + sizeof(double) + sizeof(int)) * (257 * 3)) + ((sizeof(long) + sizeof(int)) * 257)));
  tmp = malloc(insize + 4096);
  out = malloc(insize + 4096);
  switch (*argv[1]) {
  case 'c':
    r = mmini_compress(in, (unsigned long)inptr, tmp, (unsigned long)insize + 4096, out, (unsigned long)insize + 4096, huffheap);
    if (!r) {
      printf("Compression failed!\n");
      return -1;
    } else
      fwrite(out, 1, r, outf);
    break;
  case 'd':
    r = mmini_decompress(in, (unsigned long)inptr, tmp, (unsigned long)insize + 4096, out, (unsigned long)insize + 4096, huffheap);
    if (!r) {
      printf("Decompression failed!\n");
      return -1;
    } else
      fwrite(out, 1, r, outf);
    break;
  case 'H':
    r = mmini_huffman_compress(in, (unsigned long)inptr, out, (unsigned long)insize + 4096, huffheap);
    if (!r) {
      printf("Compression failed!\n");
      return -1;
    } else
      fwrite(out, 1, r, outf);
    break;
  case 'h':
    r = mmini_huffman_decompress(in, (unsigned long)inptr, out, (unsigned long)insize + 4096, huffheap);
    if (!r) {
      printf("Decompression failed!\n");
      return -1;
    } else
      fwrite(out, 1, r, outf);
    break;
  case 'L':
    r = mmini_lzl_compress(in, (unsigned long)inptr, out, (unsigned long)insize + 4096);
    if (!r) {
      printf("Compression failed!\n");
      return -1;
    } else
      fwrite(out, 1, r, outf);
    break;
  case 'l':
    r = mmini_lzl_decompress(in, (unsigned long)inptr, out, (unsigned long)insize + 4096);
    if (!r) {
      printf("Decompression failed!\n");
      return -1;
    } else
      fwrite(out, 1, r, outf);
    break;
  default:
    print_help(argc, argv);
    return -1;
  }
  fclose(inf);
  fclose(outf);
  free(out);
  free(tmp);
  free(huffheap);
  free(in);
  return 0;
}
```