user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<main>:
  endbr64
  push   %r15
  lea    D47(%rip),%rdi
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xc8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0xb8(%rsp)
  xor    %eax,%eax
  call   <system@plt>
  cmp    $0xffffffff,%eax
  je     L159
L71:
  lea    D7(%rip),%rsi
  lea    D52(%rip),%rdi
  call   <fopen@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L139
L247:
  lea    D78(%rip),%rsi
  lea    D29(%rip),%rdi
  call   <fopen@plt>
  mov    %rax,0x18(%rsp)
  test   %rax,%rax
  je     L178
L148:
  mov    %r13,0x10(%rsp)
  lea    0x30(%rsp),%rbx
L133:
  mov    0x10(%rsp),%r13
  lea    0x28(%rsp),%r12
L18:
  mov    %r13,%rdx
  mov    $0x80,%esi
  mov    %rbx,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  je     L204
  mov    %rbx,%rdi
  call   <strlen@plt>
  lea    D103(%rip),%rsi
  lea    -0x4(%rax),%edi
  mov    %eax,%ebp
  movslq %edi,%rdi
  add    %rbx,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L18
  sub    $0x1,%ebp
  mov    %r12,%rsi
  mov    %rbx,%rdi
  movslq %ebp,%rbp
  movb   $0x0,0x30(%rsp,%rbp,1)
  call   <stat@plt>
  cmp    $0xffffffff,%eax
  je     L72
L38:
  mov    0x2c(%rsp),%edi
  call   <S_ISDIR@plt>
  test   %rax,%rax
  jne    L18
  mov    0x28(%rsp),%ebp
  mov    $0x400,%eax
  cmp    %eax,%ebp
  cmovle %ebp,%eax
  lea    0x1(%rax),%edi
  mov    %eax,0xc(%rsp)
  call   <malloc@plt>
  lea    D7(%rip),%rsi
  mov    %rbx,%rdi
  mov    %rax,%r14
  call   <fopen@plt>
  mov    %rax,%r15
  test   %rax,%rax
  je     L122
L242:
  xor    %ebp,%ebp
  mov    %rbx,%rax
  xor    %r13d,%r13d
  mov    %r15,%rbx
  xor    %r12d,%r12d
  mov    %r14,%r15
  mov    %ebp,%r14d
  mov    %rax,%rbp
  nopw   0x0(%rax,%rax,1)
L79:
  mov    0xc(%rsp),%edx
  mov    %rbx,%rcx
  mov    $0x1,%esi
  mov    %r15,%rdi
  call   <fread@plt>
  test   %eax,%eax
  jle    L123
  cltq
  movb   $0x0,(%r15,%rax,1)
  movzbl (%r15),%eax
  test   %al,%al
  je     L79
  mov    %r15,%rsi
  jmp    L134
  nopl   0x0(%rax)
L99:
  sub    $0x30,%eax
  cmp    $0xa,%al
  adc    $0x0,%r13d
L94:
  movzbl 0x1(%rsi),%eax
  add    $0x1,%rsi
  test   %al,%al
  je     L79
L134:
  mov    %eax,%edx
  and    $0xffffffdf,%edx
  sub    $0x41,%edx
  cmp    $0x1a,%dl
  adc    $0x0,%r12d
  cmp    $0x20,%al
  jne    L99
  add    $0x1,%r14d
  jmp    L94
  xchg   %ax,%ax
L123:
  mov    %rbp,%rcx
  mov    %r14d,%ebp
  mov    %r15,%r14
  mov    %rbx,%r15
  mov    %rcx,%rbx
  cmp    $0xffffffff,%eax
  je     L114
L12:
  mov    0x18(%rsp),%rdi
  mov    %ebp,%r9d
  mov    %r13d,%r8d
  mov    %r12d,%ecx
  mov    %rbx,%rdx
  lea    D153(%rip),%rsi
  call   <fprintf@plt>
  mov    %r15,%rdi
  call   <fclose@plt>
  mov    %r14,%rdi
  call   <free@plt>
  jmp    L133
  nopw   0x0(%rax,%rax,1)
L204:
  mov    %r13,%rdi
  call   <fclose@plt>
  mov    0x18(%rsp),%rdi
  call   <fclose@plt>
  lea    D52(%rip),%rdi
  call   <unlink@plt>
  cmp    $0xffffffff,%eax
  je     L210
L39:
  mov    0xb8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L188
  add    $0xc8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  xchg   %ax,%ax
L72:
  lea    D94(%rip),%rdi
  call   <perror@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L38
L114:
  lea    D33(%rip),%rdi
  call   <perror@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L12
L159:
  lea    D96(%rip),%rdi
  call   <perror@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L71
L210:
  lea    D43(%rip),%rdi
  call   <perror@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L39
L122:
  lea    D108(%rip),%rdi
  call   <perror@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L242
L139:
  lea    D108(%rip),%rdi
  call   <perror@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L247
L178:
  lea    D108(%rip),%rdi
  call   <perror@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L148
L188:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: tag: D47
data_type: string
name: extract_symbolic_data
arguments: tag: D7
data_type: string
name: extract_symbolic_data
arguments: tag: D52
data_type: string
name: extract_symbolic_data
arguments: tag: D78
data_type: string
name: extract_symbolic_data
arguments: tag: D29
data_type: string
name: extract_symbolic_data
arguments: tag: D103
data_type: string
name: extract_symbolic_data
arguments: tag: D153
data_type: string
name: extract_symbolic_data
arguments: tag: D94
data_type: string
name: extract_symbolic_data
arguments: tag: D33
data_type: string
name: extract_symbolic_data
arguments: tag: D96
data_type: string
name: extract_symbolic_data
arguments: tag: D43
data_type: string
name: extract_symbolic_data
arguments: tag: D108
data_type: string

tool: D47: ls > temp

tool: D7: rb

tool: D52: temp

tool: D78: wb

tool: D29: res

tool: D103: txt


tool: D153: %s, he sum of letter is : %d
the sum of number is : %d
the sum of blank is : %d


tool: D94: fail to get stat

tool: D33: fail to read

tool: D96: fail to exec command

tool: D43: fail to unlink

tool: D108: fail to open

assistant: ```c
int main(void) {
  FILE *in, *out;
  FILE *fp;
  struct stat statbuf;
  char file_name[128];
  char *buf;
  int n, len;
  char *p;
  int file_size = 0;
  int letter, number, blank;
  if (system("ls > temp") == -1) {
    perror("fail to exec command");
    exit(1);
  }
  fp = fopen("temp", "rb");
  if (fp == NULL) {
    perror("fail to open");
    exit(1);
  }
  out = fopen("res", "wb");
  if (out == NULL) {
    perror("fail to open");
    exit(1);
  }
  while (fgets(file_name, 128, fp) != NULL) {
    len = strlen(file_name);
    if (strcmp(&file_name[len - 4], "txt\n") != 0)
      continue;
    file_name[len - 1] = '\0';
    if (stat(file_name, &statbuf) == -1) {
      perror("fail to get stat");
      exit(1);
    }
    if (S_ISDIR(statbuf.st_mode))
      continue;
    if ((file_size = statbuf.st_size) > 1024)
      file_size = 1024;
    file_size++;
    buf = (char *)malloc(sizeof(char) * file_size);
    in = fopen(file_name, "rb");
    if (in == NULL) {
      perror("fail to open");
      exit(1);
    }
    letter = 0;
    number = 0;
    blank = 0;
    while ((n = fread(buf, sizeof(char), file_size - 1, in)) > 0) {
      buf[n] = '\0';
      p = buf;
      while (*p != '\0') {
        if (('a' <= *p && *p <= 'z') || ('A' <= *p && *p <= 'Z'))
          letter++;
        if (*p == ' ')
          blank++;
        if ('0' <= *p && *p <= '9')
          number++;
        p++;
      }
    }
    if (n == -1) {
      perror("fail to read");
      exit(1);
    }
    fprintf(out, "%s, he sum of letter is : %d\nthe sum of number is : %d\nthe sum of blank is : %d\n", file_name, letter, number, blank);
    fclose(in);
    free(buf);
  }
  fclose(fp);
  fclose(out);
  if (unlink("temp") == -1) {
    perror("fail to unlink");
    exit(1);
  }
  return 0;
}
```