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

```asm
<proc_find>:
  endbr64
  push   %r15
  pxor   %xmm0,%xmm0
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x2a8,%rsp
  mov    %rdi,0x8(%rsp)
  lea    D13(%rip),%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x298(%rsp)
  xor    %eax,%eax
  movaps %xmm0,0x20(%rsp)
  movl   $0x0,0x80(%rsp)
  movaps %xmm0,0x30(%rsp)
  movaps %xmm0,0x40(%rsp)
  movaps %xmm0,0x50(%rsp)
  movaps %xmm0,0x60(%rsp)
  movaps %xmm0,0x70(%rsp)
  call   <opendir@plt>
  test   %rax,%rax
  je     L94
  mov    %rax,%rbp
  lea    D2(%rip),%r13
  lea    D48(%rip),%r12
  jmp    L25
  nopw   0x0(%rax,%rax,1)
L22:
  mov    (%rax),%edi
  call   <atol@plt>
  mov    %rax,%r14
  test   %rax,%rax
  js     L108
  mov    %rax,%rcx
  mov    %r13,%rdx
  mov    $0x200,%esi
  mov    %rbx,%rdi
  call   <snprintf@plt>
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <fopen@plt>
  mov    %rax,%r15
  test   %rax,%rax
  je     L108
  lea    0x20(%rsp),%rbx
  lea    0x18(%rsp),%rdx
  mov    %rax,%rdi
  lea    0x17(%rsp),%r8
  mov    %rbx,%rcx
  lea    D27(%rip),%rsi
  call   <fscanf@plt>
  cmp    $0x3,%eax
  jne    L37
  mov    0x8(%rsp),%rsi
  mov    %rbx,%rdi
  call   <strcmp@plt>
  mov    %r15,%rdi
  test   %eax,%eax
  je     L70
  call   <fclose@plt>
L25:
  lea    0x90(%rsp),%rbx
L108:
  mov    %rbp,%rdi
  call   <readdir@plt>
  test   %rax,%rax
  jne    L22
  mov    %rbp,%rdi
  call   <closedir@plt>
  mov    $0xffffffff,%eax
L39:
  mov    0x298(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L46
  add    $0x2a8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L37:
  lea    D57(%rip),%rsi
  mov    $0x2,%edi
  call   <ac_log@plt>
  mov    %r15,%rdi
  call   <fclose@plt>
  mov    %rbp,%rdi
  call   <closedir@plt>
  mov    $0xffffffff,%eax
  jmp    L39
  nopl   0x0(%rax,%rax,1)
L70:
  call   <fclose@plt>
  mov    %rbp,%rdi
  call   <closedir@plt>
  mov    %r14d,%eax
  jmp    L39
L94:
  lea    D5(%rip),%rdi
  call   <perror@plt>
  mov    $0xffffffff,%eax
  jmp    L39
L46:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: tag: D13
type_infered: string
name: retrieve_data
arguments: tag: D2
type_infered: string
name: retrieve_data
arguments: tag: D48
type_infered: string
name: retrieve_data
arguments: tag: D27
type_infered: string
name: retrieve_data
arguments: tag: D57
type_infered: string
name: retrieve_data
arguments: tag: D5
type_infered: string

tool: D13: /proc

tool: D2: /proc/%ld/stat

tool: D48: r

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

tool: D57: fscanf failed 


tool: D5: can't open /proc

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;
}
```