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

```asm
<fdt_get_path>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %esi,-0x3c(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %ecx,-0x40(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x20(%rbp)
  movl   $0x0,-0x1c(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <fdt_check_header@plt>
  mov    %eax,-0x14(%rbp)
  cmpl   $0x0,-0x14(%rbp)
  je     L141
  mov    -0x14(%rbp),%eax
  jmp    L210
L141:
  cmpl   $0x1,-0x40(%rbp)
  jg     L182
  mov    $0xfffffffd,%eax
  jmp    L210
L182:
  movl   $0x0,-0x18(%rbp)
  movl   $0x0,-0x28(%rbp)
  jmp    L80
L161:
  subl   $0x1,-0x1c(%rbp)
  mov    -0x1c(%rbp),%eax
  cltq
  lea    -0x1(%rax),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jne    L161
  subl   $0x1,-0x20(%rbp)
L46:
  mov    -0x28(%rbp),%eax
  cmp    %eax,-0x20(%rbp)
  jg     L161
  mov    -0x28(%rbp),%eax
  cmp    %eax,-0x20(%rbp)
  jl     L72
  lea    -0x24(%rbp),%rdx
  mov    -0x18(%rbp),%ecx
  mov    -0x38(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <fdt_get_name@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L33
  mov    -0x24(%rbp),%eax
  jmp    L210
L33:
  mov    -0x24(%rbp),%edx
  mov    -0x1c(%rbp),%eax
  add    %edx,%eax
  cmp    %eax,-0x40(%rbp)
  jle    L72
  mov    -0x24(%rbp),%edx
  mov    -0x1c(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x48(%rbp),%rax
  add    %rax,%rcx
  mov    -0x10(%rbp),%rax
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <memcpy@plt>
  mov    -0x24(%rbp),%eax
  add    %eax,-0x1c(%rbp)
  mov    -0x1c(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x1c(%rbp)
  movslq %eax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movb   $0x2f,(%rax)
  addl   $0x1,-0x20(%rbp)
L72:
  mov    -0x18(%rbp),%eax
  cmp    -0x3c(%rbp),%eax
  jne    L112
  mov    -0x28(%rbp),%eax
  cmp    %eax,-0x20(%rbp)
  jg     L125
  mov    $0xfffffffd,%eax
  jmp    L210
L125:
  cmpl   $0x1,-0x1c(%rbp)
  jle    L180
  subl   $0x1,-0x1c(%rbp)
L180:
  mov    -0x1c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    $0x0,%eax
  jmp    L210
L112:
  lea    -0x28(%rbp),%rdx
  mov    -0x18(%rbp),%ecx
  mov    -0x38(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <fdt_next_node@plt>
  mov    %eax,-0x18(%rbp)
L80:
  cmpl   $0x0,-0x18(%rbp)
  js     L55
  mov    -0x18(%rbp),%eax
  cmp    -0x3c(%rbp),%eax
  jle    L46
L55:
  cmpl   $0xffffffff,-0x18(%rbp)
  je     L214
  cmpl   $0x0,-0x18(%rbp)
  js     L2
L214:
  mov    $0xfffffffc,%eax
  jmp    L210
L2:
  cmpl   $0xfffffffc,-0x18(%rbp)
  jne    L95
  mov    $0xfffffff5,%eax
  jmp    L210
L95:
  mov    -0x18(%rbp),%eax
L210:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L179
  call   <__stack_chk_fail@plt>
L179:
  leave
  ret
```

assistant: ```c
int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen) {
  int pdepth = 0, p = 0;
  int offset, depth, namelen;
  const char *name;
  {
    int err_;
    if ((err_ = fdt_check_header(fdt)) != 0)
      return err_;
  };
  if (buflen < 2)
    return -3;
  for (offset = 0, depth = 0; (offset >= 0) && (offset <= nodeoffset); offset = fdt_next_node(fdt, offset, &depth)) {
    while (pdepth > depth) {
      do {
        p--;
      } while (buf[p - 1] != '/');
      pdepth--;
    }
    if (pdepth >= depth) {
      name = fdt_get_name(fdt, offset, &namelen);
      if (!name)
        return namelen;
      if ((p + namelen + 1) <= buflen) {
        memcpy(buf + p, name, namelen);
        p += namelen;
        buf[p++] = '/';
        pdepth++;
      }
    }
    if (offset == nodeoffset) {
      if (pdepth < (depth + 1))
        return -3;
      if (p > 1)
        p--;
      buf[p] = '\0';
      return 0;
    }
  }
  if ((offset == -1) || (offset >= 0))
    return -4;
  else if (offset == -4)
    return -11;
  return offset;
}
```