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

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  add    $0xffffffffffffff80,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    D44(%rip),%rax
  mov    %rax,%rsi
  lea    D132(%rip),%rax
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x80(%rbp)
  lea    D78(%rip),%rax
  mov    %rax,%rsi
  lea    D90(%rip),%rax
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x78(%rbp)
  lea    D78(%rip),%rax
  mov    %rax,%rsi
  lea    D100(%rip),%rax
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x70(%rbp)
  lea    D78(%rip),%rax
  mov    %rax,%rsi
  lea    D93(%rip),%rax
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x68(%rbp)
  jmp    L15
L65:
  lea    -0x60(%rbp),%rax
  lea    D29(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L11
  lea    -0x60(%rbp),%rdx
  mov    -0x78(%rbp),%rax
  lea    D126(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <fprintf@plt>
  jmp    L15
L11:
  lea    -0x60(%rbp),%rax
  lea    D101(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L54
  lea    -0x60(%rbp),%rdx
  mov    -0x70(%rbp),%rax
  lea    D126(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <fprintf@plt>
  jmp    L15
L54:
  lea    -0x60(%rbp),%rdx
  mov    -0x68(%rbp),%rax
  lea    D126(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <fprintf@plt>
L15:
  lea    -0x60(%rbp),%rax
  mov    %rax,%rsi
  lea    D56(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  cmp    $0x1,%eax
  je     L65
  mov    -0x80(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    -0x78(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    -0x70(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    -0x68(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L45
  call   <__stack_chk_fail@plt>
L45:
  leave
  ret
```

tool_calls: name: unpack_data
arguments: data_tag: D44
datatype: string
name: unpack_data
arguments: data_tag: D132
datatype: string
name: unpack_data
arguments: data_tag: D78
datatype: string
name: unpack_data
arguments: data_tag: D90
datatype: string
name: unpack_data
arguments: data_tag: D100
datatype: string
name: unpack_data
arguments: data_tag: D93
datatype: string
name: unpack_data
arguments: data_tag: D29
datatype: string
name: unpack_data
arguments: data_tag: D126
datatype: string
name: unpack_data
arguments: data_tag: D101
datatype: string
name: unpack_data
arguments: data_tag: D56
datatype: string

tool: D44: r

tool: D132: spooky.csv

tool: D78: w

tool: D90: ufo.csv

tool: D100: disappearance.csv

tool: D93: other.csv

tool: D29: UFO

tool: D126: %s


tool: D101: Disappearance

tool: D56: %79[^
]


assistant: ```c
int main() {
  char line[80];
  FILE *in = fopen("spooky.csv", "r");
  FILE *f_ufo = fopen("ufo.csv", "w");
  FILE *f_disap = fopen("disappearance.csv", "w");
  FILE *f_other = fopen("other.csv", "w");
  while (scanf("%79[^\n]\n", line) == 1) {
    if (strstr(line, "UFO")) {
      fprintf(f_ufo, "%s\n", line);
    } else if (strstr(line, "Disappearance")) {
      fprintf(f_disap, "%s\n", line);
    } else {
      fprintf(f_other, "%s\n", line);
    }
  }
  fclose(in);
  fclose(f_ufo);
  fclose(f_disap);
  fclose(f_other);
  return 0;
}
```