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

```asm
<udev_device_new_from_subsystem_sysname>:
  endbr64
  push   %r15
  mov    %rdx,%r15
  push   %r14
  push   %r13
  mov    %rdi,%r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  push   %rbx
  sub    $0x638,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x628(%rsp)
  xor    %eax,%eax
  lea    0x220(%rsp),%rbp
  call   <udev_get_sys_path@plt>
  mov    %rbp,%rdi
  mov    $0x400,%edx
  mov    %rax,%rsi
  call   <util_strlcpy@plt>
  lea    D58(%rip),%rsi
  mov    %r12,%rdi
  mov    %rax,%rbx
  lea    0x0(%rbp,%rax,1),%r14
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L131
  mov    $0x400,%r12d
  lea    D66(%rip),%rsi
  mov    %r14,%rdi
  sub    %ebx,%r12d
  lea    0x1c(%rsp),%rbx
  mov    %r12d,%edx
  call   <util_strlcpy@plt>
  mov    %r15,%rsi
  mov    %r14,%rdi
  mov    %r12d,%edx
  call   <util_strlcat@plt>
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  call   <stat@plt>
  test   %rax,%rax
  jne    L68
L112:
  mov    %rbp,%rsi
  mov    %r13,%rdi
  call   <udev_device_new_from_syspath@plt>
L141:
  mov    0x628(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L24
  add    $0x638,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L68:
  mov    %r12d,%edx
  lea    D46(%rip),%rsi
  mov    %r14,%rdi
  call   <util_strlcpy@plt>
  mov    %r15,%rsi
  mov    %r14,%rdi
  mov    %r12d,%edx
  call   <util_strlcat@plt>
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  call   <stat@plt>
  test   %rax,%rax
  je     L112
  mov    %r12d,%edx
  lea    D47(%rip),%rsi
  mov    %r14,%rdi
  call   <util_strlcpy@plt>
L144:
  mov    %r12d,%edx
  mov    %r15,%rsi
  jmp    L17
  nopl   (%rax)
L131:
  lea    D108(%rip),%rsi
  mov    %r12,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L88
  mov    $0x400,%r12d
  lea    D102(%rip),%rsi
  mov    %r14,%rdi
  sub    %ebx,%r12d
  mov    %r12d,%edx
  call   <util_strlcpy@plt>
  mov    %r15,%rsi
  mov    %r14,%rdi
  mov    %r12d,%edx
  call   <util_strlcat@plt>
  lea    0x1c(%rsp),%rsi
  mov    %rbp,%rdi
  call   <stat@plt>
  test   %rax,%rax
  je     L112
L102:
  xor    %eax,%eax
  jmp    L141
  nopw   0x0(%rax,%rax,1)
L88:
  lea    D92(%rip),%rsi
  mov    %r12,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L5
  lea    0x20(%rsp),%r12
  mov    %r15,%rsi
  mov    $0x200,%edx
  mov    %r12,%rdi
  call   <util_strlcpy@plt>
  mov    $0x3a,%esi
  mov    %r12,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L102
  movb   $0x0,(%rax)
  mov    $0x400,%edx
  add    $0x1,%rax
  mov    %r14,%rdi
  sub    %ebx,%edx
  lea    D66(%rip),%rsi
  mov    %rax,0x8(%rsp)
  lea    0x1c(%rsp),%rbx
  mov    %edx,%r15d
  call   <util_strlcpy@plt>
  mov    %r15d,%edx
  mov    %r12,%rsi
  mov    %r14,%rdi
  call   <util_strlcat@plt>
  lea    D111(%rip),%r8
  mov    %r15d,%edx
  mov    %r14,%rdi
  mov    %r8,%rsi
  call   <util_strlcat@plt>
  mov    0x8(%rsp),%rsi
  mov    %r14,%rdi
  mov    %r15d,%edx
  call   <util_strlcat@plt>
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  call   <stat@plt>
  test   %rax,%rax
  je     L112
  mov    %r15d,%edx
  lea    D46(%rip),%rsi
  mov    %r14,%rdi
  call   <util_strlcpy@plt>
  mov    %r15d,%edx
  mov    %r12,%rsi
  mov    %r14,%rdi
  call   <util_strlcat@plt>
  lea    D111(%rip),%r8
  mov    %r15d,%edx
  mov    %r14,%rdi
  mov    %r8,%rsi
  call   <util_strlcat@plt>
  mov    0x8(%rsp),%rsi
  mov    %r15d,%edx
L17:
  mov    %r14,%rdi
  call   <util_strlcat@plt>
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  call   <stat@plt>
  test   %rax,%rax
  je     L112
  xor    %eax,%eax
  jmp    L141
L5:
  mov    $0x400,%eax
  lea    D66(%rip),%rsi
  mov    %r14,%rdi
  sub    %ebx,%eax
  mov    %eax,%ebx
  mov    %eax,%edx
  call   <util_strlcpy@plt>
  mov    %ebx,%edx
  mov    %r12,%rsi
  mov    %r14,%rdi
  call   <util_strlcat@plt>
  lea    D118(%rip),%r8
  mov    %ebx,%edx
  mov    %r14,%rdi
  mov    %r8,%rsi
  call   <util_strlcat@plt>
  mov    %ebx,0x8(%rsp)
  mov    %ebx,%edx
  mov    %r15,%rsi
  mov    %r14,%rdi
  lea    0x1c(%rsp),%rbx
  call   <util_strlcat@plt>
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  call   <stat@plt>
  test   %rax,%rax
  je     L112
  mov    0x8(%rsp),%edx
  lea    D46(%rip),%rsi
  mov    %r14,%rdi
  call   <util_strlcpy@plt>
  mov    0x8(%rsp),%edx
  mov    %r12,%rsi
  mov    %r14,%rdi
  call   <util_strlcat@plt>
  lea    D118(%rip),%r8
  mov    0x8(%rsp),%edx
  mov    %r14,%rdi
  mov    %r8,%rsi
  call   <util_strlcat@plt>
  mov    0x8(%rsp),%edx
  mov    %r15,%rsi
  mov    %r14,%rdi
  call   <util_strlcat@plt>
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  call   <stat@plt>
  test   %rax,%rax
  je     L112
  mov    0x8(%rsp),%edx
  mov    %r14,%rdi
  lea    D47(%rip),%rsi
  call   <util_strlcpy@plt>
  mov    0x8(%rsp),%edx
  mov    %r12,%rsi
  mov    %r14,%rdi
  call   <util_strlcat@plt>
  mov    0x8(%rsp),%r12d
  lea    D69(%rip),%rsi
  mov    %r14,%rdi
  mov    %r12d,%edx
  call   <util_strlcat@plt>
  jmp    L144
L24:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: label: D58
type: string
name: read_data
arguments: label: D66
type: string
name: read_data
arguments: label: D46
type: string
name: read_data
arguments: label: D47
type: string
name: read_data
arguments: label: D108
type: string
name: read_data
arguments: label: D102
type: string
name: read_data
arguments: label: D92
type: string
name: read_data
arguments: label: D111
type: string
name: read_data
arguments: label: D118
type: string
name: read_data
arguments: label: D69
type: string

tool: D58: subsystem

tool: D66: /subsystem/

tool: D46: /bus/

tool: D47: /class/

tool: D108: module

tool: D102: /module/

tool: D92: drivers

tool: D111: /drivers/

tool: D118: /devices/

tool: D69: /

assistant: ```c
struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *udev, const char *subsystem, const char *sysname) {
  size_t sys_path_len;
  char path_full[1024];
  char *path;
  struct stat statbuf;
  sys_path_len = util_strlcpy(path_full, udev_get_sys_path(udev), sizeof(path_full));
  path = &path_full[sys_path_len];
  if (strcmp(subsystem, "subsystem") == 0) {
    util_strlcpy(path, "/subsystem/", sizeof(path_full) - sys_path_len);
    util_strlcat(path, sysname, sizeof(path_full) - sys_path_len);
    if (stat(path_full, &statbuf) == 0)
      goto found;
    util_strlcpy(path, "/bus/", sizeof(path_full) - sys_path_len);
    util_strlcat(path, sysname, sizeof(path_full) - sys_path_len);
    if (stat(path_full, &statbuf) == 0)
      goto found;
    util_strlcpy(path, "/class/", sizeof(path_full) - sys_path_len);
    util_strlcat(path, sysname, sizeof(path_full) - sys_path_len);
    if (stat(path_full, &statbuf) == 0)
      goto found;
    goto out;
  }
  if (strcmp(subsystem, "module") == 0) {
    util_strlcpy(path, "/module/", sizeof(path_full) - sys_path_len);
    util_strlcat(path, sysname, sizeof(path_full) - sys_path_len);
    if (stat(path_full, &statbuf) == 0)
      goto found;
    goto out;
  }
  if (strcmp(subsystem, "drivers") == 0) {
    char subsys[512];
    char *driver;
    util_strlcpy(subsys, sysname, sizeof(subsys));
    driver = strchr(subsys, ':');
    if (driver != NULL) {
      driver[0] = '\0';
      driver = &driver[1];
      util_strlcpy(path, "/subsystem/", sizeof(path_full) - sys_path_len);
      util_strlcat(path, subsys, sizeof(path_full) - sys_path_len);
      util_strlcat(path, "/drivers/", sizeof(path_full) - sys_path_len);
      util_strlcat(path, driver, sizeof(path_full) - sys_path_len);
      if (stat(path_full, &statbuf) == 0)
        goto found;
      util_strlcpy(path, "/bus/", sizeof(path_full) - sys_path_len);
      util_strlcat(path, subsys, sizeof(path_full) - sys_path_len);
      util_strlcat(path, "/drivers/", sizeof(path_full) - sys_path_len);
      util_strlcat(path, driver, sizeof(path_full) - sys_path_len);
      if (stat(path_full, &statbuf) == 0)
        goto found;
    }
    goto out;
  }
  util_strlcpy(path, "/subsystem/", sizeof(path_full) - sys_path_len);
  util_strlcat(path, subsystem, sizeof(path_full) - sys_path_len);
  util_strlcat(path, "/devices/", sizeof(path_full) - sys_path_len);
  util_strlcat(path, sysname, sizeof(path_full) - sys_path_len);
  if (stat(path_full, &statbuf) == 0)
    goto found;
  util_strlcpy(path, "/bus/", sizeof(path_full) - sys_path_len);
  util_strlcat(path, subsystem, sizeof(path_full) - sys_path_len);
  util_strlcat(path, "/devices/", sizeof(path_full) - sys_path_len);
  util_strlcat(path, sysname, sizeof(path_full) - sys_path_len);
  if (stat(path_full, &statbuf) == 0)
    goto found;
  util_strlcpy(path, "/class/", sizeof(path_full) - sys_path_len);
  util_strlcat(path, subsystem, sizeof(path_full) - sys_path_len);
  util_strlcat(path, "/", sizeof(path_full) - sys_path_len);
  util_strlcat(path, sysname, sizeof(path_full) - sys_path_len);
  if (stat(path_full, &statbuf) == 0)
    goto found;
out:
  return NULL;
found:
  return udev_device_new_from_syspath(udev, path_full);
}
```