user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<rfc1035NameUnpack>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,0x8(%rsp)
  mov    %rcx,0x10(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  cmpl   $0x2,D19(%rip)
  jg     L131
  mov    %rsi,%r14
  mov    %rdx,%rbp
  mov    %r8d,%r15d
  test   %r8d,%r8d
  jle    L131
  mov    $0x0,%edx
  lea    -0x1(%r8),%eax
  mov    %eax,0x1c(%rsp)
L196:
  mov    0x0(%rbp),%rsi
  cmp    %r14,%rsi
  jae    L194
  mov    0x8(%rsp),%rax
  lea    (%rax,%rsi,1),%rcx
  movzbl (%rcx),%eax
  cmp    $0xbf,%al
  ja     L79
  cmp    $0x3f,%al
  ja     L74
  add    $0x1,%rsi
  mov    %rsi,0x0(%rbp)
  movzbl %al,%eax
  test   %rax,%rax
  je     L194
  movslq 0x1c(%rsp),%rbx
  cmp    %rax,%rbx
  cmova  %rax,%rbx
  lea    (%rbx,%rsi,1),%rax
  cmp    %r14,%rax
  ja     L2
  lea    (%rbx,%rdx,1),%r13
  lea    0x1(%r13),%r12
  movslq %r15d,%rax
  cmp    %rax,%r12
  ja     L55
  add    0x8(%rsp),%rsi
  mov    0x10(%rsp),%rax
  lea    (%rax,%rdx,1),%rdi
  mov    %rbx,%rdx
  call   <memcpy@plt>
  add    %rbx,0x0(%rbp)
  mov    0x10(%rsp),%rax
  movb   $0x2e,(%rax,%r13,1)
  mov    %r12,%rdx
  jmp    L196
L79:
  mov    (%rcx),%ecx
  mov    0x8(%rsp),%rax
  mov    0x4(%rax,%rsi,1),%edi
  add    $0x2,%rsi
  mov    %rsi,0x0(%rbp)
  mov    $0x1,%eax
  cmp    %r14,%rsi
  jae    L143
  mov    %ecx,%eax
  shl    $0x8,%eax
  or     %edi,%eax
  and    $0x3fff,%eax
  mov    %rax,0x20(%rsp)
  cmp    $0xb,%rax
  jbe    L133
  cmp    %r14,%rax
  jb     L147
L133:
  mov    $0x2,%eax
  jmp    L143
L147:
  addl   $0x1,D19(%rip)
  mov    0x10(%rsp),%rcx
  add    %rdx,%rcx
  lea    0x20(%rsp),%rax
  mov    %r15d,%r8d
  sub    %edx,%r8d
  mov    %rax,%rdx
  mov    %r14,%rsi
  mov    0x8(%rsp),%rdi
  call   <rfc1035NameUnpack>
  subl   $0x1,D19(%rip)
  jmp    L143
L194:
  test   %rdx,%rdx
  je     L37
  mov    0x10(%rsp),%rax
  movb   $0x0,-0x1(%rax,%rdx,1)
L37:
  movslq %r15d,%r15
  cmp    %rdx,%r15
  setae  %dil
  movzbl %dil,%edi
  call   <assert@plt>
  mov    $0x0,%eax
  jmp    L143
L131:
  mov    $0x4,%eax
L143:
  mov    0x28(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L109
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L74:
  mov    $0x3,%eax
  jmp    L143
L2:
  mov    $0x4,%eax
  jmp    L143
L55:
  mov    $0x5,%eax
  jmp    L143
L109:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int rfc1035NameUnpack(const u_char *buf, size_t sz, off_t *off, char *name, int ns) {
  off_t no = 0;
  unsigned char c;
  size_t len;
  static int loop_detect = 0;
  if (loop_detect > 2)
    return 4;
  if (ns <= 0)
    return 4;
  do {
    if ((*off) >= sz)
      break;
    c = *(buf + (*off));
    if (c > 191) {
      int rc;
      unsigned short s;
      off_t ptr;
      s = ((((uint8_t *)(buf + (*off)))[0] << 8) | ((uint8_t *)(buf + (*off)))[1]);
      (*off) += sizeof(s);
      if ((*off) >= sz)
        return 1;
      ptr = s & 0x3FFF;
      if (ptr >= sz)
        return 2;
      if (ptr < 12)
        return 2;
      loop_detect++;
      rc = rfc1035NameUnpack(buf, sz, &ptr, name + no, ns - no);
      loop_detect--;
      return rc;
    } else if (c > 63) {
      return 3;
      break;
    } else {
      (*off)++;
      len = (size_t)c;
      if (len == 0)
        break;
      if (len > (ns - 1))
        len = ns - 1;
      if ((*off) + len > sz)
        return 4;
      if (no + len + 1 > ns)
        return 5;
      memcpy(name + no, buf + (*off), len);
      (*off) += len;
      no += len;
      *(name + (no++)) = '.';
    }
  } while (c > 0);
  if (no > 0)
    *(name + no - 1) = '\0';
  assert(no <= ns);
  return 0;
}
```