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

```asm
<proc_find>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x2c0,%rsp
  mov    %rdi,-0x2b8(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movq   $0x0,-0x280(%rbp)
  movq   $0x0,-0x278(%rbp)
  movq   $0x0,-0x270(%rbp)
  movq   $0x0,-0x268(%rbp)
  movq   $0x0,-0x260(%rbp)
  movq   $0x0,-0x258(%rbp)
  movq   $0x0,-0x250(%rbp)
  movq   $0x0,-0x248(%rbp)
  movq   $0x0,-0x240(%rbp)
  movq   $0x0,-0x238(%rbp)
  movq   $0x0,-0x230(%rbp)
  movq   $0x0,-0x228(%rbp)
  movl   $0x0,-0x220(%rbp)
  movq   $0x0,-0x2a0(%rbp)
  lea    D30(%rip),%rax
  mov    %rax,%rdi
  call   <opendir@plt>
  mov    %rax,-0x298(%rbp)
  cmpq   $0x0,-0x298(%rbp)
  jne    L73
  lea    D53(%rip),%rax
  mov    %rax,%rdi
  call   <perror@plt>
  mov    $0xffffffff,%eax
  jmp    L26
L39:
  mov    -0x290(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,%edi
  call   <atol@plt>
  mov    %rax,-0x288(%rbp)
  cmpq   $0x0,-0x288(%rbp)
  jns    L76
  jmp    L73
L76:
  mov    -0x288(%rbp),%rdx
  lea    -0x210(%rbp),%rax
  mov    %rdx,%rcx
  lea    D43(%rip),%rdx
  mov    $0x200,%esi
  mov    %rax,%rdi
  call   <snprintf@plt>
  lea    -0x210(%rbp),%rax
  lea    D48(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x2a0(%rbp)
  cmpq   $0x0,-0x2a0(%rbp)
  je     L73
  lea    -0x2a9(%rbp),%rsi
  lea    -0x280(%rbp),%rcx
  lea    -0x2a8(%rbp),%rdx
  mov    -0x2a0(%rbp),%rax
  mov    %rsi,%r8
  lea    D4(%rip),%rsi
  mov    %rax,%rdi
  call   <fscanf@plt>
  cmp    $0x3,%eax
  je     L34
  lea    D52(%rip),%rax
  mov    %rax,%rsi
  mov    $0x2,%edi
  call   <ac_log@plt>
  mov    -0x2a0(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    -0x298(%rbp),%rax
  mov    %rax,%rdi
  call   <closedir@plt>
  mov    $0xffffffff,%eax
  jmp    L26
L34:
  mov    -0x2b8(%rbp),%rdx
  lea    -0x280(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L61
  mov    -0x2a0(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    -0x298(%rbp),%rax
  mov    %rax,%rdi
  call   <closedir@plt>
  mov    -0x288(%rbp),%rax
  jmp    L26
L61:
  mov    -0x2a0(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
L73:
  mov    -0x298(%rbp),%rax
  mov    %rax,%rdi
  call   <readdir@plt>
  mov    %rax,-0x290(%rbp)
  cmpq   $0x0,-0x290(%rbp)
  jne    L39
  mov    -0x298(%rbp),%rax
  mov    %rax,%rdi
  call   <closedir@plt>
  mov    $0xffffffff,%eax
L26:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L88
  call   <__stack_chk_fail@plt>
L88:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: data_tag: D30
data_type: string
name: retrieve_data
arguments: data_tag: D53
data_type: string
name: retrieve_data
arguments: data_tag: D43
data_type: string
name: retrieve_data
arguments: data_tag: D48
data_type: string
name: retrieve_data
arguments: data_tag: D4
data_type: string
name: retrieve_data
arguments: data_tag: D52
data_type: string

tool: D30: /proc

tool: D53: can't open /proc

tool: D43: /proc/%ld/stat

tool: D48: r

tool: D4: %ld (%[^)]) %c

tool: D52: fscanf failed 


assistant: ```c
pid_t proc_find(const char *name) {
  DIR *dir;
  struct dirent *ent;
  char buf[512];
  long pid;
  char pname[100] = {
      0,
  };
  char state;
  FILE *fp = NULL;
  if (!(dir = opendir("/proc"))) {
    perror("can't open /proc");
    return -1;
  }
  while ((ent = readdir(dir)) != NULL) {
    long lpid = atol(ent->d_name);
    if (lpid < 0)
      continue;
    snprintf(buf, sizeof(buf), "/proc/%ld/stat", lpid);
    fp = fopen(buf, "r");
    if (fp) {
      if ((fscanf(fp, "%ld (%[^)]) %c", &pid, pname, &state)) != 3) {
        ac_log(2, "fscanf failed \n");
        fclose(fp);
        closedir(dir);
        return -1;
      }
      if (!strcmp(pname, name)) {
        fclose(fp);
        closedir(dir);
        return (pid_t)lpid;
      }
      fclose(fp);
    }
  }
  closedir(dir);
  return -1;
}
```