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
  lea    -0x8c000(%rsp),%r11
L54:
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  cmp    %r11,%rsp
  jne    L54
  sub    $0xa48,%rsp
  movdqa D88(%rip),%xmm0
  mov    %fs:0x28,%rax
  mov    %rax,0x8ca38(%rsp)
  xor    %eax,%eax
  movaps %xmm0,0x8ca10(%rsp)
  mov    $0x2d,%eax
  mov    %rsi,%r13
  movdqa D65(%rip),%xmm0
  lea    0x8ca10(%rsp),%rdi
  lea    D66(%rip),%rsi
  movl   $0x20303030,0x8ca30(%rsp)
  mov    %ax,0x8ca34(%rsp)
  movaps %xmm0,0x8ca20(%rsp)
  call   <popen@plt>
  mov    %rax,%r14
  test   %rax,%rax
  je     L75
L22:
  xor    %ebp,%ebp
  lea    0x10(%rsp),%rbx
  mov    $0x23280,%r12d
  nopl   0x0(%rax)
L78:
  movslq %ebp,%rax
  mov    %r12d,%edx
  mov    %r14,%rcx
  mov    $0x4,%esi
  sub    %ebp,%edx
  lea    (%rbx,%rax,4),%rdi
  call   <fread@plt>
  add    %eax,%ebp
  cmp    $0x2327f,%ebp
  jle    L78
  lea    D103(%rip),%r15
  mov    %r15,%rdi
  call   <strlen@plt>
  mov    0x8(%r13),%rdi
  mov    %eax,%r12d
  call   <strlen@plt>
  lea    D43(%rip),%r9
  mov    %r9,%rdi
  add    %r12d,%eax
  mov    %eax,0x8(%rsp)
  call   <strlen@plt>
  mov    %r15,%rdi
  mov    %eax,%r12d
  call   <strlen@plt>
  mov    0x8(%r13),%rdi
  mov    %eax,%ebp
  call   <strlen@plt>
  lea    D116(%rip),%r8
  mov    %r8,%rdi
  lea    0x0(%rbp,%rax,1),%ecx
  mov    %ecx,0xc(%rsp)
  call   <strlen@plt>
  mov    %eax,%ebp
  mov    0x8(%rsp),%eax
  lea    0x1(%rax,%r12,1),%edi
  call   <malloc@plt>
  mov    0xc(%rsp),%ecx
  mov    %rax,%r12
  lea    0x1(%rcx,%rbp,1),%edi
  call   <malloc@plt>
  mov    %r15,%rsi
  mov    %r12,%rdi
  mov    %rax,%rbp
  call   <strcpy@plt>
  mov    %r15,%rsi
  mov    %rbp,%rdi
  lea    D104(%rip),%r15
  call   <strcpy@plt>
  mov    0x8(%r13),%rsi
  mov    %r12,%rdi
  call   <strcat@plt>
  mov    0x8(%r13),%rsi
  mov    %rbp,%rdi
  call   <strcat@plt>
  lea    D43(%rip),%r9
  mov    %r12,%rdi
  mov    %r9,%rsi
  call   <strcat@plt>
  lea    D116(%rip),%r8
  mov    %rbp,%rdi
  mov    %r8,%rsi
  call   <strcat@plt>
  mov    %r15,%rsi
  mov    %r12,%rdi
  call   <fopen@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L88
L9:
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <fopen@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L67
L37:
  xor    %ebp,%ebp
  lea    D4(%rip),%r15
  nopl   0x0(%rax)
L14:
  mov    (%rbx),%ecx
  mov    %ebp,%edx
  mov    %r15,%rsi
  mov    %r13,%rdi
  add    $0x1,%ebp
  call   <fprintf@plt>
  mov    %rbx,%rdi
  mov    %r12,%rcx
  mov    $0x1,%edx
  mov    $0x4,%esi
  add    $0x4,%rbx
  call   <fwrite@plt>
  cmp    $0x23280,%ebp
  jne    L14
  mov    %r13,%rdi
  call   <fclose@plt>
  mov    %r12,%rdi
  call   <fclose@plt>
  mov    %r14,%rdi
  call   <pclose@plt>
  mov    0x8ca38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L25
  add    $0x8ca48,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L75:
  lea    D121(%rip),%rdi
  call   <perror@plt>
  jmp    L22
L88:
  lea    D42(%rip),%rdi
  call   <perror@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L9
L67:
  lea    D42(%rip),%rdi
  call   <perror@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L37
L25:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_label: D88
type: byte[16]
name: parse_data
arguments: data_label: D65
type: byte[16]
name: parse_data
arguments: data_label: D66
type: string
name: parse_data
arguments: data_label: D103
type: string
name: parse_data
arguments: data_label: D43
type: string
name: parse_data
arguments: data_label: D116
type: string
name: parse_data
arguments: data_label: D104
type: string
name: parse_data
arguments: data_label: D4
type: string
name: parse_data
arguments: data_label: D121
type: string
name: parse_data
arguments: data_label: D42
type: string

tool: {"D88": [0x72,0x65,0x63,0x20,0x2d,0x74,0x20,0x72,0x61,0x77,0x20,0x2d,0x62,0x20,0x31,0x36]}

tool: {"D65": [0x20,0x2d,0x63,0x20,0x31,0x20,0x2d,0x65,0x20,0x73,0x20,0x2d,0x72,0x20,0x34,0x38]}

tool: D66: r

tool: D103: data/

tool: D43: .txt

tool: D116: .raw

tool: D104: w

tool: D4: %d %d


tool: D121: rec

tool: D42: fopen

assistant: ```c
int main(int ARGC, char *ARGV[]) {
  FILE *rec;
  char cmd[] = "rec -t raw -b 16 -c 1 -e s -r 48000 -";
  if ((rec = popen(cmd, "r")) == NULL) {
    perror("rec");
  }
  int n = 0;
  int16_t buf[144000];
  while (1) {
    n += fread(buf + n, sizeof(int16_t), 144000 - n, rec);
    if (n >= 144000) {
      break;
    }
  }
  char *text_file_name, *raw_file_name;
  int text_file_name_len = strlen("data/") + strlen(ARGV[1]) + strlen(".txt") + 1;
  int raw_file_name_len = strlen("data/") + strlen(ARGV[1]) + strlen(".raw") + 1;
  text_file_name = (char *)malloc(sizeof(char) * text_file_name_len);
  raw_file_name = (char *)malloc(sizeof(char) * raw_file_name_len);
  strcpy(text_file_name, "data/");
  strcpy(raw_file_name, "data/");
  strcat(text_file_name, ARGV[1]);
  strcat(raw_file_name, ARGV[1]);
  strcat(text_file_name, ".txt");
  strcat(raw_file_name, ".raw");
  FILE *text, *raw;
  if ((text = fopen(text_file_name, "w")) == NULL) {
    perror("fopen");
    exit(1);
  }
  if ((raw = fopen(raw_file_name, "w")) == NULL) {
    perror("fopen");
    exit(1);
  }
  for (int i = 0; i < 144000; i++) {
    fprintf(text, "%d %d\n", i, buf[i]);
    fwrite(&buf[i], sizeof(int16_t), 1, raw);
  }
  fclose(text);
  fclose(raw);
  pclose(rec);
  return 0;
}
```