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

```asm
<fdt_path_offset_namelen>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %edx,-0x44(%rbp)
  mov    -0x44(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x40(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  movl   $0x0,-0x28(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <fdt_check_header@plt>
  mov    %eax,-0x24(%rbp)
  cmpl   $0x0,-0x24(%rbp)
  je     L109
  mov    -0x24(%rbp),%eax
  jmp    L100
L109:
  mov    -0x40(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  je     L139
  mov    -0x8(%rbp),%rax
  sub    -0x20(%rbp),%rax
  mov    %eax,%edx
  mov    -0x40(%rbp),%rax
  mov    $0x2f,%esi
  mov    %rax,%rdi
  call   <memchr@plt>
  mov    %rax,-0x18(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  jne    L87
  mov    -0x8(%rbp),%rax
  mov    %rax,-0x18(%rbp)
L87:
  mov    -0x18(%rbp),%rax
  sub    -0x20(%rbp),%rax
  mov    %eax,%edx
  mov    -0x20(%rbp),%rcx
  mov    -0x38(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <fdt_get_alias_namelen@plt>
  mov    %rax,-0x20(%rbp)
  cmpq   $0x0,-0x20(%rbp)
  jne    L67
  mov    $0xfffffffb,%eax
  jmp    L100
L67:
  mov    -0x20(%rbp),%rdx
  mov    -0x38(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fdt_path_offset@plt>
  mov    %eax,-0x28(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  jmp    L139
L34:
  addq   $0x1,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  jne    L11
  mov    -0x28(%rbp),%eax
  jmp    L100
L11:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  je     L34
  mov    -0x8(%rbp),%rax
  sub    -0x20(%rbp),%rax
  mov    %eax,%edx
  mov    -0x20(%rbp),%rax
  mov    $0x2f,%esi
  mov    %rax,%rdi
  call   <memchr@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L10
  mov    -0x8(%rbp),%rax
  mov    %rax,-0x10(%rbp)
L10:
  mov    -0x10(%rbp),%rax
  sub    -0x20(%rbp),%rax
  mov    %eax,%ecx
  mov    -0x20(%rbp),%rdx
  mov    -0x28(%rbp),%esi
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <fdt_subnode_offset_namelen@plt>
  mov    %eax,-0x28(%rbp)
  cmpl   $0x0,-0x28(%rbp)
  jns    L99
  mov    -0x28(%rbp),%eax
  jmp    L100
L99:
  mov    -0x10(%rbp),%rax
  mov    %rax,-0x20(%rbp)
L139:
  mov    -0x20(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  jb     L11
  mov    -0x28(%rbp),%eax
L100:
  leave
  ret
```

assistant: ```c
int fdt_path_offset_namelen(const void *fdt, const char *path, int namelen) {
  const char *end = path + namelen;
  const char *p = path;
  int offset = 0;
  {
    int err_;
    if ((err_ = fdt_check_header(fdt)) != 0)
      return err_;
  };
  if (*path != '/') {
    const char *q = memchr(path, '/', end - p);
    if (!q)
      q = end;
    p = fdt_get_alias_namelen(fdt, p, q - p);
    if (!p)
      return -5;
    offset = fdt_path_offset(fdt, p);
    p = q;
  }
  while (p < end) {
    const char *q;
    while (*p == '/') {
      p++;
      if (p == end)
        return offset;
    }
    q = memchr(p, '/', end - p);
    if (!q)
      q = end;
    offset = fdt_subnode_offset_namelen(fdt, offset, p, q - p);
    if (offset < 0)
      return offset;
    p = q;
  }
  return offset;
}
```