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

```asm
<zrpc_util_proc_find>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x250,%rsp
  mov    %rdi,-0x248(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    D16(%rip),%rax
  mov    %rax,%rdi
  call   <opendir@plt>
  mov    %rax,-0x238(%rbp)
  cmpq   $0x0,-0x238(%rbp)
  jne    L29
  lea    D11(%rip),%rax
  mov    %rax,%rdi
  call   <perror@plt>
  mov    $0xffffffff,%eax
  jmp    L76
L13:
  mov    -0x230(%rbp),%rax
  mov    (%rax),%eax
  lea    -0x240(%rbp),%rcx
  mov    $0xa,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <strtol@plt>
  mov    %rax,-0x228(%rbp)
  mov    -0x240(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L73
  jmp    L29
L73:
  mov    $0x0,%eax
  call   <getpid@plt>
  cmp    %rax,-0x228(%rbp)
  jne    L107
  jmp    L29
L107:
  mov    -0x228(%rbp),%rdx
  lea    -0x210(%rbp),%rax
  mov    %rdx,%rcx
  lea    D4(%rip),%rdx
  mov    $0x200,%esi
  mov    %rax,%rdi
  call   <snprintf@plt>
  lea    -0x210(%rbp),%rax
  lea    D40(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x220(%rbp)
  cmpq   $0x0,-0x220(%rbp)
  je     L29
  mov    -0x220(%rbp),%rdx
  lea    -0x210(%rbp),%rax
  mov    $0x200,%esi
  mov    %rax,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  je     L75
  lea    -0x210(%rbp),%rax
  lea    D3(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strtok@plt>
  mov    %rax,-0x218(%rbp)
  mov    -0x248(%rbp),%rdx
  mov    -0x218(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L75
  mov    -0x220(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    -0x238(%rbp),%rax
  mov    %rax,%rdi
  call   <closedir@plt>
  mov    -0x228(%rbp),%rax
  jmp    L76
L75:
  mov    -0x220(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
L29:
  mov    -0x238(%rbp),%rax
  mov    %rax,%rdi
  call   <readdir@plt>
  mov    %rax,-0x230(%rbp)
  cmpq   $0x0,-0x230(%rbp)
  jne    L13
  mov    -0x238(%rbp),%rax
  mov    %rax,%rdi
  call   <closedir@plt>
  mov    $0xffffffff,%eax
L76:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L102
  call   <__stack_chk_fail@plt>
L102:
  leave
  ret
```

tool_calls: name: unpack_data
arguments: tag: D16
type_guessed: string
name: unpack_data
arguments: tag: D11
type_guessed: string
name: unpack_data
arguments: tag: D4
type_guessed: string
name: unpack_data
arguments: tag: D40
type_guessed: string
name: unpack_data
arguments: tag: D3
type_guessed: string

tool: D16: /proc

tool: D11: can't open /proc

tool: D4: /proc/%ld/cmdline

tool: D40: r

tool: D3:  

assistant: ```c
uint32_t zrpc_util_proc_find(const char *name) {
  DIR *dir;
  struct dirent *ent;
  char *endptr;
  char buf[512];
  if (!(dir = opendir("/proc"))) {
    perror("can't open /proc");
    return -1;
  }
  while ((ent = readdir(dir)) != NULL) {
    long lpid = strtol(ent->d_name, &endptr, 10);
    if (*endptr != '\0') {
      continue;
    }
    if (lpid == getpid())
      continue;
    snprintf(buf, sizeof(buf), "/proc/%ld/cmdline", lpid);
    FILE *fp = fopen(buf, "r");
    if (fp) {
      if (fgets(buf, sizeof(buf), fp) != NULL) {
        char *first = strtok(buf, " ");
        if (!strcmp(first, name)) {
          fclose(fp);
          closedir(dir);
          return lpid;
        }
      }
      fclose(fp);
    }
  }
  closedir(dir);
  return -1;
}
```