user: What is the c source code of the assembly code below?

```asm
<udev_device_new_from_syspath>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x820,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x818(%rsp)
  xor    %eax,%eax
  test   %rsi,%rsi
  je     L132
  mov    %rdi,%rbp
  test   %rdi,%rdi
  je     L132
  mov    %rsi,%r12
  call   <udev_get_sys_path@plt>
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rbp,%rdi
  mov    %rax,%rbx
  call   <udev_get_sys_path@plt>
  mov    %ebx,%edx
  mov    %r12,%rdi
  mov    %rax,%rsi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L52
  lea    0x1(%r12,%rbx,1),%r13
  mov    $0x2f,%esi
  mov    %r13,%rdi
  call   <strrchr@plt>
  test   %rax,%rax
  je     L101
  cmpb   $0x0,0x1(%rax)
  je     L101
  add    $0x2,%r13
  cmp    %r13,%rax
  jb     L101
  lea    0x10(%rsp),%r13
  mov    %r12,%rdx
  mov    $0x400,%esi
  mov    %r13,%rdi
  call   <util_strscpy@plt>
  mov    $0x400,%edx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <util_resolve_sys_link@plt>
  lea    0x0(%r13,%rbx,1),%rdi
  mov    $0x9,%edx
  lea    D14(%rip),%rsi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L153
  lea    0xc(%rsp),%rsi
  mov    %r13,%rdi
  call   <stat@plt>
  test   %rax,%rax
  jne    L33
  mov    0xc(%rsp),%edi
  call   <S_ISDIR@plt>
  test   %eax,%eax
  je     L33
L120:
  mov    %rbp,%rdi
  call   <udev_device_new@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L104
  mov    %r13,%rsi
  mov    %rax,%rdi
  call   <udev_device_set_syspath@plt>
  mov    %r12,%rdi
  call   <udev_device_get_devpath@plt>
  mov    %r12,%rdx
  lea    D68(%rip),%rsi
  mov    %rbp,%rdi
  mov    %eax,%ecx
  xor    %eax,%eax
  call   <udev_log_null@plt>
  jmp    L104
  nopl   0x0(%rax)
L101:
  mov    %r12,%rdx
  lea    D63(%rip),%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <udev_log_null@plt>
  xor    %r12d,%r12d
L104:
  mov    0x818(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L111
  add    $0x820,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax)
L132:
  xor    %r12d,%r12d
  jmp    L104
  nopl   (%rax)
L153:
  lea    0x410(%rsp),%r14
  xor    %r8d,%r8d
  mov    $0x400,%esi
  mov    %r13,%rdx
  mov    %r14,%rdi
  lea    D30(%rip),%rcx
  call   <util_strscpyl@plt>
  lea    0xc(%rsp),%rsi
  mov    %r14,%rdi
  call   <stat@plt>
  test   %rax,%rax
  je     L120
  mov    %r12,%rdx
  lea    D57(%rip),%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <udev_log_null@plt>
  xor    %r12d,%r12d
  jmp    L104
  nopl   0x0(%rax)
L52:
  mov    %r12,%rdx
  lea    D16(%rip),%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <udev_log_null@plt>
  xor    %r12d,%r12d
  jmp    L104
  nopl   0x0(%rax)
L33:
  mov    %r12,%rdx
  lea    D8(%rip),%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <udev_log_null@plt>
  xor    %r12d,%r12d
  jmp    L104
L111:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: tag: D14
datatype: string
name: unpack_data
arguments: tag: D68
datatype: string
name: unpack_data
arguments: tag: D63
datatype: string
name: unpack_data
arguments: tag: D30
datatype: string
name: unpack_data
arguments: tag: D57
datatype: string
name: unpack_data
arguments: tag: D16
datatype: string
name: unpack_data
arguments: tag: D8
datatype: string

tool: D14: /devices/

tool: D68: device %p has devpath '%s'


tool: D63: not a subdir :%s


tool: D30: /uevent

tool: D57: not a device: %s


tool: D16: not in sys :%s


tool: D8: directory not found: %s


assistant: ```c
struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath) {
  size_t len;
  const char *subdir;
  char path[1024];
  char *pos;
  struct stat statbuf;
  struct udev_device *udev_device;
  if (udev == NULL)
    return NULL;
  if (syspath == NULL)
    return NULL;
  len = strlen(udev_get_sys_path(udev));
  if (strncmp(syspath, udev_get_sys_path(udev), len) != 0) {
    udev_log_null(udev, "not in sys :%s\n", syspath);
    return NULL;
  }
  subdir = &syspath[len + 1];
  pos = strrchr(subdir, '/');
  if (pos == NULL || pos[1] == '\0' || pos < &subdir[2]) {
    udev_log_null(udev, "not a subdir :%s\n", syspath);
    return NULL;
  }
  util_strscpy(path, sizeof(path), syspath);
  util_resolve_sys_link(udev, path, sizeof(path));
  if (strncmp(&path[len], "/devices/", 9) == 0) {
    char file[1024];
    util_strscpyl(file, sizeof(file), path, "/uevent", NULL);
    if (stat(file, &statbuf) != 0) {
      udev_log_null(udev, "not a device: %s\n", syspath);
      return NULL;
    }
  } else {
    if (stat(path, &statbuf) != 0 || !S_ISDIR(statbuf.st_mode)) {
      udev_log_null(udev, "directory not found: %s\n", syspath);
      return NULL;
    }
  }
  udev_device = udev_device_new(udev);
  if (udev_device == NULL)
    return NULL;
  udev_device_set_syspath(udev_device, path);
  udev_log_null(udev, "device %p has devpath '%s'\n", udev_device, udev_device_get_devpath(udev_device));
  return udev_device;
}
```