user: 请将以下的汇编代码转换成C语言代码：

```asm
<link_find_prioritized>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,%r15
  mov    %esi,%ebx
  mov    %esi,0x28(%rsp)
  mov    %rdx,%r13
  mov    %rcx,0x10(%rsp)
  mov    %r8,0x18(%rsp)
  call   <udev_device_get_udev@plt>
  mov    %rax,%r12
  movq   $0x0,0x8(%rsp)
  test   %ebx,%ebx
  jne    L113
L21:
  mov    %r13,%rdi
  call   <opendir@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L35
  lea    D17(%rip),%r14
  jmp    L61
L113:
  mov    %r15,%rdi
  call   <udev_device_get_devlink_priority@plt>
  mov    %eax,0x28(%rsp)
  mov    %r15,%rdi
  call   <udev_device_get_devnode@plt>
  mov    %rax,%rdx
  mov    0x18(%rsp),%rsi
  mov    0x10(%rsp),%rbx
  mov    %rbx,%rdi
  call   <util_strscpy@plt>
  mov    %rbx,0x8(%rsp)
  jmp    L21
L9:
  mov    %rbx,%rdi
  call   <udev_device_get_devlink_priority@plt>
  mov    %eax,0x8(%rsp)
  mov    %rbx,%rdi
  call   <udev_device_get_syspath@plt>
  movslq %eax,%rdx
  mov    %r13,%r8
  mov    0x8(%rsp),%ecx
  lea    D19(%rip),%rsi
  mov    %r12,%rdi
  mov    $0x0,%eax
  call   <udev_log_null@plt>
  mov    %rbx,%rdi
  call   <udev_device_get_devlink_priority@plt>
  mov    %eax,0x28(%rsp)
  mov    0x20(%rsp),%rdx
  mov    0x18(%rsp),%rsi
  mov    0x10(%rsp),%rdi
  call   <util_strscpy@plt>
  mov    0x10(%rsp),%rax
  mov    %rax,0x8(%rsp)
L106:
  mov    %rbx,%rdi
  call   <udev_device_unref@plt>
L61:
  mov    %rbp,%rdi
  call   <readdir@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L127
  mov    (%rax),%rdx
  movzbl (%rdx),%eax
  test   %al,%al
  je     L127
  cmp    $0x2e,%al
  je     L61
  mov    %r13,%rcx
  mov    %r14,%rsi
  mov    %r12,%rdi
  mov    $0x0,%eax
  call   <udev_log_null@plt>
  mov    %r15,%rdi
  call   <udev_device_get_id_filename@plt>
  mov    %eax,%esi
  mov    (%rbx),%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L61
  mov    (%rbx),%rsi
  mov    %r12,%rdi
  call   <udev_device_new_from_id_filename@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L61
  mov    %rax,%rdi
  call   <udev_device_get_devnode@plt>
  mov    %rax,0x20(%rsp)
  test   %rax,%rax
  je     L106
  mov    %rbx,%rdi
  call   <udev_device_get_devlink_priority@plt>
  mov    %eax,0x2c(%rsp)
  mov    %rbx,%rdi
  call   <udev_device_get_devnode@plt>
  mov    %rax,%r8
  mov    0x2c(%rsp),%r9d
  mov    0x28(%rsp),%ecx
  mov    0x8(%rsp),%rdx
  lea    D9(%rip),%rsi
  mov    %r12,%rdi
  mov    $0x0,%eax
  call   <udev_log_null@plt>
  cmpq   $0x0,0x8(%rsp)
  je     L9
  mov    %rbx,%rdi
  call   <udev_device_get_devlink_priority@plt>
  cmp    %eax,0x28(%rsp)
  jge    L106
  jmp    L9
L127:
  mov    %rbp,%rdi
  call   <closedir@plt>
L35:
  mov    0x8(%rsp),%rax
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: read_data
arguments: data_label: D17
data_type: string
name: read_data
arguments: data_label: D19
data_type: string
name: read_data
arguments: data_label: D9
data_type: string

tool: D17: found '%s' claiming '%s'


tool: D19: '%s' claims priority %i for '%s'


tool: D9: compare priority of '%s'(%i) > '%s'(%i)


assistant: ```c
const char *link_find_prioritized(struct udev_device *dev, bool add, const char *stackdir, char *buf, size_t bufsize) {
  struct udev *udev = udev_device_get_udev(dev);
  DIR *dir;
  int priority = 0;
  const char *target = NULL;
  if (add) {
    priority = udev_device_get_devlink_priority(dev);
    util_strscpy(buf, bufsize, udev_device_get_devnode(dev));
    target = buf;
  }
  dir = opendir(stackdir);
  if (dir == NULL)
    return target;
  for (;;) {
    struct udev_device *dev_db;
    struct dirent *dent;
    dent = readdir(dir);
    if (dent == NULL || dent->d_name[0] == '\0')
      break;
    if (dent->d_name[0] == '.')
      continue;
    udev_log_null(udev, "found '%s' claiming '%s'\n", dent->d_name, stackdir);
    if (strcmp(dent->d_name, udev_device_get_id_filename(dev)) == 0)
      continue;
    dev_db = udev_device_new_from_id_filename(udev, dent->d_name);
    if (dev_db != NULL) {
      const char *devnode;
      devnode = udev_device_get_devnode(dev_db);
      if (devnode != NULL) {
        udev_log_null(udev, "compare priority of '%s'(%i) > '%s'(%i)\n", target, priority, udev_device_get_devnode(dev_db), udev_device_get_devlink_priority(dev_db));
        if (target == NULL || udev_device_get_devlink_priority(dev_db) > priority) {
          udev_log_null(udev, "'%s' claims priority %i for '%s'\n", udev_device_get_syspath(dev_db), udev_device_get_devlink_priority(dev_db), stackdir);
          priority = udev_device_get_devlink_priority(dev_db);
          util_strscpy(buf, bufsize, devnode);
          target = buf;
        }
      }
      udev_device_unref(dev_db);
    }
  }
  closedir(dir);
  return target;
}
```