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
  mov    %rsi,%rbx
  sub    $0x128,%rsp
  movdqa D21(%rip),%xmm0
  mov    %fs:0x28,%rax
  mov    %rax,0x118(%rsp)
  xor    %eax,%eax
  mov    $0x7265,%eax
  movb   $0x0,0x62(%rsp)
  movaps %xmm0,0x40(%rsp)
  movdqa D97(%rip),%xmm0
  mov    %ax,0x60(%rsp)
  movaps %xmm0,0x50(%rsp)
  cmp    $0x3,%rdi
  je     L182
  mov    $0xa,%edi
  call   <putchar@plt>
  lea    D3(%rip),%rdi
  call   <puts@plt>
  mov    $0x1,%edi
  call   <exit@plt>
L182:
  mov    0x8(%rbx),%rsi
  lea    0x70(%rsp),%r14
  mov    %r14,%rdi
  mov    %r14,0x10(%rsp)
  call   <strcpy@plt>
  lea    0xc0(%rsp),%rax
  mov    0x10(%rbx),%rsi
  mov    %rax,%rdi
  mov    %rax,%rbx
  mov    %rax,0x18(%rsp)
  call   <strcpy@plt>
  lea    D58(%rip),%rsi
  mov    %rbx,%rdi
  call   <fopen@plt>
  lea    D94(%rip),%rsi
  mov    %r14,%rdi
  mov    %rax,%r12
  call   <fopen@plt>
  mov    %rax,0x8(%rsp)
  test   %rax,%rax
  je     L26
L100:
  xor    %r8d,%r8d
  xor    %ebx,%ebx
  lea    0x20(%rsp),%rbp
  lea    D73(%rip),%r13
  nopl   0x0(%rax)
L138:
  mov    0x8(%rsp),%rcx
  mov    $0x10,%edx
  mov    $0x1,%esi
  mov    %rbp,%rdi
  mov    %r8d,0x4(%rsp)
  call   <fread@plt>
  mov    0x4(%rsp),%r8d
  test   %rax,%rax
  mov    %rax,%r14
  jle    L54
  xor    %r15d,%r15d
  test   %r8d,%r8d
  je     L183
L101:
  movzbl 0x0(%rbp,%r15,1),%edx
  mov    %r13,%rsi
  mov    %r12,%rdi
  add    $0x1,%r15
  call   <fprintf@plt>
  cmp    %r15,%r14
  jg     L101
  mov    $0x1,%r8d
  jmp    L138
  nopw   0x0(%rax,%rax,1)
L183:
  xor    %eax,%eax
  mov    $0x1,%edi
  jmp    L11
  nopl   0x0(%rax)
L49:
  xor    %ebx,%ebx
  cmp    %r14,%rax
  je     L188
L11:
  movzbl 0x0(%rbp,%rax,1),%edx
  movsbl 0x40(%rsp,%rbx,1),%esi
  add    $0x1,%rax
  cmp    %edx,%esi
  jne    L49
  add    $0x1,%rbx
  cmp    $0x22,%rbx
  cmovge %rax,%r15
  cmovge %edi,%r8d
  cmp    %r14,%rax
  jne    L11
L188:
  test   %r8d,%r8d
  je     L138
  cmp    %r15,%r14
  jle    L138
  jmp    L101
  nopw   0x0(%rax,%rax,1)
L54:
  mov    0x8(%rsp),%rdi
  call   <ferror@plt>
  test   %rax,%rax
  jne    L31
L60:
  mov    %r12,%rdi
  call   <ferror@plt>
  test   %rax,%rax
  jne    L114
L149:
  mov    0x8(%rsp),%rdi
  call   <fclose@plt>
  mov    %r12,%rdi
  call   <fclose@plt>
  mov    0x118(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L38
  add    $0x128,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L31:
  mov    0x10(%rsp),%rsi
  lea    D12(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L60
L114:
  mov    0x18(%rsp),%rsi
  lea    D72(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L149
L26:
  mov    $0xa,%edi
  call   <putchar@plt>
  lea    D64(%rip),%rdi
  call   <puts@plt>
  mov    0x10(%rsp),%rsi
  lea    D32(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L100
L38:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: tag: D21
type_guessed: byte[16]
name: unpack_data
arguments: tag: D97
type_guessed: byte[16]
name: unpack_data
arguments: tag: D3
type_guessed: string
name: unpack_data
arguments: tag: D58
type_guessed: string
name: unpack_data
arguments: tag: D94
type_guessed: string
name: unpack_data
arguments: tag: D73
type_guessed: string
name: unpack_data
arguments: tag: D12
type_guessed: string
name: unpack_data
arguments: tag: D72
type_guessed: string
name: unpack_data
arguments: tag: D64
type_guessed: string
name: unpack_data
arguments: tag: D32
type_guessed: string

tool: {"D21": [0x54,0x68,0x69,0x73,0x20,0x74,0x65,0x78,0x74,0x20,0x69,0x73,0x20,0x61,0x6e,0x20]}

tool: {"D97": [0x45,0x43,0x2d,0x45,0x61,0x72,0x74,0x68,0x20,0x64,0x65,0x6c,0x69,0x6d,0x69,0x74]}

tool: D3: Usage: tag-dump <infile> <outfile>

tool: D58: wb

tool: D94: rb

tool: D73: %c

tool: D12: There was an error reading %s


tool: D72: There was an error writing to %s


tool: D64: tag-dump - Fatal error!

tool: D32:   Cannot open the input file %s.


assistant: ```c
int main(long argc, char **argv) {
  long int file_addr;
  unsigned char buf[20];
  long int read_length;
  FILE *filein;
  char filein_name[80];
  FILE *fileout;
  char fileout_name[80];
  long m;
  long no_match, start_index;
  int write_to_outfile;
  const char delimiter[] = "This text is an EC-Earth delimiter";
  if (argc != 3) {
    printf("\n");
    printf("Usage: tag-dump <infile> <outfile>\n");
    exit(1);
  }
  strcpy(filein_name, argv[1]);
  strcpy(fileout_name, argv[2]);
  fileout = fopen(fileout_name, "wb");
  filein = fopen(filein_name, "rb");
  if (filein == NULL) {
    printf("\n");
    printf("tag-dump - Fatal error!\n");
    printf("  Cannot open the input file %s.\n", filein_name);
    exit(1);
  }
  write_to_outfile = 0;
  file_addr = 0;
  no_match = 0;
  start_index = 0;
  while ((read_length = (long)fread(buf, sizeof(unsigned char), 16, filein)) > 0) {
    file_addr = file_addr + 16;
    if (!write_to_outfile) {
      for (m = 0; m < read_length; m++) {
        if (buf[m] == delimiter[no_match]) {
          no_match = no_match + 1;
          if (no_match > sizeof(delimiter) - 2) {
            write_to_outfile = 1;
            start_index = m + 1;
          }
        } else
          no_match = 0;
      }
    }
    if (write_to_outfile) {
      for (m = start_index; m < read_length; m++) {
        fprintf(fileout, "%c", buf[m]);
      }
    }
    start_index = 0;
  }
  if (ferror(filein)) {
    printf("There was an error reading %s\n", filein_name);
    exit(1);
  }
  if (ferror(fileout)) {
    printf("There was an error writing to %s\n", fileout_name);
    exit(1);
  }
  fclose(filein);
  fclose(fileout);
  return (0);
}
```