user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<extract_quotes>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x5d8,%rsp
  mov    %rdi,0x18(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x5c8(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  je     L290
  lea    D68(%rip),%rsi
  call   <strstr@plt>
  test   %rax,%rax
  jne    L222
  mov    0x18(%rsp),%rbx
  lea    D89(%rip),%rdi
  mov    %rbx,%rsi
  call   <printf@plt>
  lea    D93(%rip),%rsi
  mov    %rbx,%rdi
  call   <fopen@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L97
  mov    0x18(%rsp),%rsi
  xor    %r13d,%r13d
  xor    %r14d,%r14d
  lea    0x30(%rsp),%rbx
  lea    D20(%rip),%rdi
  call   <str_unite@plt>
  lea    D95(%rip),%rsi
  mov    %rax,%rdi
  mov    %rax,0x20(%rsp)
  call   <fopen@plt>
  mov    %rax,0x28(%rsp)
  test   %rax,%rax
  je     L115
  nopl   0x0(%rax,%rax,1)
L157:
  mov    %r12,%rdx
  mov    $0x2c7,%esi
  mov    %rbx,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  je     L86
  mov    %rbx,%rdi
  call   <strlen@plt>
  movslq %eax,%r15
  add    %rbx,%r15
  jb     L157
  movzbl 0x30(%rsp),%edx
  test   %dl,%dl
  je     L157
  cmp    %rbx,%r15
  jbe    L157
  lea    0x300(%rsp),%rax
  mov    %rbx,0x10(%rsp)
  mov    %rbx,%rbp
  mov    %r15,%rbx
  mov    %rax,(%rsp)
  mov    %r14d,%r15d
  mov    %r12,0x8(%rsp)
  jmp    L220
  nopl   0x0(%rax,%rax,1)
L236:
  mov    %rbp,%r14
  xor    %r15d,%r15d
  cmp    $0x22,%dl
  je     L177
L279:
  movzbl 0x1(%r14),%edx
  add    $0x1,%rbp
  test   %dl,%dl
  je     L118
L44:
  cmp    %rbp,%rbx
  jbe    L118
L220:
  cmp    $0x1,%r15d
  jne    L236
  lea    0x1(%r13),%r12d
  cmp    $0xa,%dl
  je     L35
  mov    %dl,0x300(%rsp,%r13,1)
  cmp    $0x22,%dl
  je     L269
L183:
  movslq %r12d,%r13
  mov    %rbp,%r14
  cmp    $0x2c8,%r13d
  jle    L279
  mov    (%rsp),%rdi
  mov    $0x2c8,%edx
  xor    %esi,%esi
  lea    0x1(%rbp),%r14
  call   <_memset@plt>
  movzbl 0x1(%rbp),%edx
  test   %dl,%dl
  je     L338
  cmp    %r14,%rbx
  jbe    L338
  mov    %r14,%rbp
  xor    %r15d,%r15d
  mov    %rbp,%r14
  cmp    $0x22,%dl
  jne    L279
  nopw   0x0(%rax,%rax,1)
L177:
  movsbl -0x1(%rbp),%edi
  call   <isalnum@plt>
  test   %eax,%eax
  jne    L279
  mov    $0x1,%r13d
  lea    D91(%rip),%rdi
  mov    $0x1,%r15d
  add    $0x1,%rbp
  call   <puts@plt>
  mov    (%rsp),%rdi
  mov    $0x2c8,%edx
  xor    %esi,%esi
  call   <_memset@plt>
  movzbl -0x1(%rbp),%eax
  movzbl 0x1(%r14),%edx
  mov    %al,0x300(%rsp)
  test   %dl,%dl
  jne    L44
  nopl   (%rax)
L118:
  mov    0x8(%rsp),%r12
  mov    0x10(%rsp),%rbx
  mov    %r15d,%r14d
  jmp    L157
  nopw   0x0(%rax,%rax,1)
L86:
  mov    %r12,%rdi
  call   <fclose@plt>
  mov    0x28(%rsp),%rdi
  call   <fclose@plt>
L207:
  mov    0x20(%rsp),%rax
  test   %rax,%rax
  je     L290
  mov    %rax,%rdi
  call   <free@plt>
L290:
  mov    0x5c8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L156
  add    $0x5d8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L222:
  mov    0x5c8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L156
  mov    0x18(%rsp),%rsi
  add    $0x5d8,%rsp
  lea    D23(%rip),%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    11a0 <printf@plt>
  nopl   0x0(%rax)
L269:
  movsbl 0x1(%rbp),%edi
  call   <isalnum@plt>
  movslq %eax,%r13
  test   %r13d,%r13d
  jne    L183
  mov    (%rsp),%r15
  mov    %r15,%rdi
  call   <clean_quote@plt>
  mov    %r15,%rdi
  mov    %rax,%r14
  call   <count_words@plt>
  test   %eax,%eax
  jne    L261
L142:
  mov    (%rsp),%rdi
  mov    $0x2c8,%edx
  xor    %esi,%esi
  call   <_memset@plt>
  lea    0x1(%rbp),%rax
  movzbl 0x1(%rbp),%edx
  cmp    %rax,%rbx
  jbe    L88
  test   %dl,%dl
  je     L88
  mov    %rax,%rbp
  jmp    L236
  nopl   (%rax)
L35:
  movb   $0x20,0x300(%rsp,%r13,1)
  mov    %r12d,%r9d
  mov    0x10(%rsp),%rbx
  mov    %r15d,%r14d
  mov    0x8(%rsp),%r12
L179:
  movslq %r9d,%r13
  jmp    L157
L97:
  mov    0x5c8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L156
  add    $0x5d8,%rsp
  lea    D94(%rip),%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1200 <perror@plt>
L338:
  mov    %r12d,%r9d
  mov    0x10(%rsp),%rbx
  mov    0x8(%rsp),%r12
  xor    %r14d,%r14d
  jmp    L179
L261:
  mov    0x18(%rsp),%rcx
  mov    0x28(%rsp),%rdi
  mov    %r14,%r8
  mov    %eax,%edx
  lea    D21(%rip),%rsi
  call   <fprintf@plt>
  jmp    L142
L115:
  lea    D74(%rip),%rdi
  call   <perror@plt>
  mov    %r12,%rdi
  call   <fclose@plt>
  jmp    L207
L88:
  mov    0x8(%rsp),%r12
  mov    0x10(%rsp),%rbx
  xor    %r9d,%r9d
  xor    %r14d,%r14d
  jmp    L179
L156:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: label: D68
type: string
name: retrieve_data
arguments: label: D89
type: string
name: retrieve_data
arguments: label: D93
type: string
name: retrieve_data
arguments: label: D20
type: string
name: retrieve_data
arguments: label: D95
type: string
name: retrieve_data
arguments: label: D91
type: string
name: retrieve_data
arguments: label: D23
type: string
name: retrieve_data
arguments: label: D94
type: string
name: retrieve_data
arguments: label: D21
type: string
name: retrieve_data
arguments: label: D74
type: string

tool: D68: .eq

tool: D89: extract_quotes: Extracting quotes from %s


tool: D93: r

tool: D20: %s.eq

tool: D95: w

tool: D91: FOUND QUOTE

tool: D23: extract_quotes: Already extracted %s


tool: D94: fopen

tool: D21: %i %s %s


tool: D74: fopen(2) 

assistant: ```c
void extract_quotes(char *filename) {
  FILE *fp, *fp_out;
  char *ptr;
  char buf[712], *buf_ptr, *buf_end;
  char quote[712], *quote_ptr;
  int quote_begin, quote_end, quote_index, quote_word_count;
  int i, buf_index, buf_len;
  if (!filename)
    return;
  if (strstr(filename, ".eq")) {
    printf("extract_quotes: Already extracted %s\n", filename);
    return;
  }
  printf("extract_quotes: Extracting quotes from %s\n", filename);
  fp = fopen(filename, "r");
  if (!fp) {
    perror("fopen");
    return;
  }
  ptr = str_unite("%s.eq", filename);
  fp_out = fopen(ptr, "w");
  if (!fp_out) {
    perror("fopen(2) ");
    goto cleanup;
  }
  quote_begin = quote_end = quote_index = 0;
  while (1) {
  begin:
    if (fgets(buf, sizeof(buf) - 1, fp) == NULL)
      break;
    buf_ptr = buf;
    buf_len = strlen(buf_ptr);
    buf_end = buf_ptr + buf_len;
    if (buf_ptr > buf_end) {
      continue;
    }
    while (*buf_ptr && buf_ptr < buf_end) {
      if (quote_begin == 1) {
        if (*buf_ptr == '\n') {
          quote[quote_index] = ' ';
          quote_index++;
          buf_ptr++;
          break;
        }
        if (*buf_ptr != '\n') {
          quote[quote_index] = *buf_ptr;
          quote_index++;
        }
        if (*buf_ptr == '\"' && !isalnum(*(buf_ptr + 1))) {
          quote_ptr = clean_quote(quote);
          quote_word_count = count_words(quote);
          if (quote_word_count)
            fprintf(fp_out, "%i %s %s\n", quote_word_count, filename, quote_ptr);
          _memset(quote, 0, sizeof(quote));
          quote_begin = 0;
          quote_index = 0;
          buf_ptr++;
          continue;
        }
        if (quote_index > sizeof(quote)) {
          _memset(quote, 0, sizeof(quote));
          quote_begin = 0;
          buf_ptr++;
          continue;
        }
      } else if (quote_begin == 0) {
        if (*buf_ptr == '\"' && !isalnum(*(buf_ptr - 1))) {
          puts("FOUND QUOTE");
          quote_begin = 1;
          _memset(quote, 0, sizeof(quote));
          quote_index = 0;
          quote[quote_index] = *buf_ptr;
          quote_index++;
        }
      }
      buf_ptr++;
    }
  }
cleanup:
  if (fp)
    fclose(fp);
  if (fp_out)
    fclose(fp_out);
  if (ptr)
    free(ptr);
  return;
}
```