user: Translate the below assembly code into C programming language:

```asm
<link_find_prioritized>:
  endbr64
  push   %r15
  push   %r14
  mov    %esi,%r14d
  push   %r13
  mov    %rdx,%r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %esi,0x28(%rsp)
  mov    %rcx,0x10(%rsp)
  mov    %r8,0x20(%rsp)
  call   <udev_device_get_udev@plt>
  movq   $0x0,0x8(%rsp)
  mov    %rax,%rbx
  test   %r14d,%r14d
  jne    L93
L18:
  mov    %r13,%rdi
  call   <opendir@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L65
  lea    D11(%rip),%r14
  xchg   %ax,%ax
L40:
  mov    %rbp,%rdi
  call   <readdir@plt>
  mov    %rax,%r15
  test   %rax,%rax
  je     L30
L87:
  mov    (%rax),%rdx
  movzbl (%rdx),%eax
  test   %al,%al
  je     L30
  cmp    $0x2e,%al
  je     L40
  mov    %r14,%rsi
  mov    %r13,%rcx
  mov    %rbx,%rdi
  xor    %eax,%eax
  call   <udev_log_null@plt>
  mov    %r12,%rdi
  call   <udev_device_get_id_filename@plt>
  mov    (%r15),%rdi
  mov    %eax,%esi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L40
  mov    (%r15),%rsi
  mov    %rbx,%rdi
  call   <udev_device_new_from_id_filename@plt>
  mov    %rax,%r15
  test   %rax,%rax
  je     L40
  mov    %rax,%rdi
  call   <udev_device_get_devnode@plt>
  test   %rax,%rax
  mov    %rax,0x18(%rsp)
  je     L115
  mov    %r15,%rdi
  call   <udev_device_get_devlink_priority@plt>
  mov    %r15,%rdi
  mov    %eax,0x2c(%rsp)
  call   <udev_device_get_devnode@plt>
  mov    0x2c(%rsp),%r9d
  mov    0x28(%rsp),%ecx
  lea    D13(%rip),%rsi
  mov    0x8(%rsp),%rdx
  mov    %rax,%r8
  mov    %rbx,%rdi
  xor    %eax,%eax
  call   <udev_log_null@plt>
  cmpq   $0x0,0x8(%rsp)
  mov    0x18(%rsp),%r10
  je     L16
  mov    %r15,%rdi
  mov    %r10,0x18(%rsp)
  call   <udev_device_get_devlink_priority@plt>
  cmp    %eax,0x28(%rsp)
  mov    0x18(%rsp),%r10
  jge    L115
L16:
  mov    %r15,%rdi
  mov    %r10,0x18(%rsp)
  call   <udev_device_get_devlink_priority@plt>
  mov    %r15,%rdi
  mov    %eax,0x8(%rsp)
  call   <udev_device_get_syspath@plt>
  mov    0x8(%rsp),%ecx
  mov    %r13,%r8
  mov    %rbx,%rdi
  movslq %eax,%rdx
  lea    D4(%rip),%rsi
  xor    %eax,%eax
  call   <udev_log_null@plt>
  mov    %r15,%rdi
  call   <udev_device_get_devlink_priority@plt>
  mov    0x18(%rsp),%rdx
  mov    0x20(%rsp),%rsi
  mov    0x10(%rsp),%rdi
  mov    %eax,0x28(%rsp)
  call   <util_strscpy@plt>
  mov    0x10(%rsp),%rax
  mov    %rax,0x8(%rsp)
L115:
  mov    %r15,%rdi
  call   <udev_device_unref@plt>
  mov    %rbp,%rdi
  call   <readdir@plt>
  mov    %rax,%r15
  test   %rax,%rax
  jne    L87
  nopl   0x0(%rax,%rax,1)
L30:
  mov    %rbp,%rdi
  call   <closedir@plt>
L65:
  mov    0x8(%rsp),%rax
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L93:
  mov    %r12,%rdi
  call   <udev_device_get_devlink_priority@plt>
  mov    %r12,%rdi
  mov    %eax,0x28(%rsp)
  call   <udev_device_get_devnode@plt>
  mov    0x10(%rsp),%r14
  mov    0x20(%rsp),%rsi
  mov    %rax,%rdx
  mov    %r14,%rdi
  call   <util_strscpy@plt>
  mov    %r14,0x8(%rsp)
  jmp    L18
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D11
type: string
name: extract_symbolic_data
arguments: data_label: D13
type: string
name: extract_symbolic_data
arguments: data_label: D4
type: string

tool: D11: found '%s' claiming '%s'


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


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


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