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

```asm
<dns_extract_name>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  movb   $0x0,(%r8)
  mov    %rdi,0x8(%rsp)
  cmp    %edx,%ecx
  jae    L115
  mov    %r9d,%ebp
  mov    %rsi,%r14
  mov    %edx,%r13d
  mov    %ecx,%ebx
  mov    %r8,%r12
  xor    %r15d,%r15d
  xor    %r9d,%r9d
  jmp    L45
  nopl   0x0(%rax)
L134:
  cmp    $0x64,%r9d
  jg     L163
  add    $0x2,%ebx
  add    $0x1,%r9d
  cmp    %r13d,%ebx
  ja     L119
  movzbl 0x1(%r14,%rdx,1),%ebx
  shl    $0x8,%eax
  or     %eax,%ebx
  and    $0x3fff,%ebx
L29:
  cmp    %r13d,%ebx
  jae    L129
L45:
  mov    %ebx,%edx
  movzbl (%r14,%rdx,1),%eax
  test   %al,%al
  je     L129
  test   $0xc0,%al
  jne    L134
  lea    0x1(%rbx),%esi
  movzbl %al,%edx
  cmp    %esi,%r13d
  jbe    L119
  lea    (%rsi,%rdx,1),%ebx
  cmp    %r13d,%ebx
  ja     L119
  test   %r15d,%r15d
  je     L124
  lea    0x1(%r15),%eax
  cmp    %ebp,%eax
  jae    L48
  movb   $0x2e,(%r12,%r15,1)
  lea    (%rax,%rdx,1),%ecx
  mov    %eax,%r15d
L138:
  lea    0x1(%rcx),%eax
  mov    %r9d,0x4(%rsp)
  mov    %ecx,(%rsp)
  cmp    %ebp,%eax
  jae    L48
  mov    %r15d,%edi
  add    %r14,%rsi
  add    %r12,%rdi
  call   <memcpy@plt>
  mov    (%rsp),%eax
  mov    0x4(%rsp),%r9d
  movb   $0x0,(%r12,%rax,1)
  mov    %eax,%r15d
  jmp    L29
  nopl   (%rax)
L124:
  mov    %edx,%ecx
  jmp    L138
  nopl   0x0(%rax)
L119:
  lea    D2(%rip),%rsi
L73:
  mov    0x8(%rsp),%rdi
  xor    %eax,%eax
  mov    $0x5,%r15d
  call   <FRAMERR@plt>
  lea    D33(%rip),%rdx
  mov    %ebp,%esi
  mov    %r12,%rdi
  call   <strcpy_s@plt>
L129:
  add    $0x18,%rsp
  mov    %r15d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L48:
  lea    D15(%rip),%rsi
  jmp    L73
L163:
  mov    0x8(%rsp),%rdi
  mov    %r9d,%edx
  lea    D35(%rip),%rsi
  xor    %eax,%eax
  call   <FRAMERR@plt>
  jmp    L129
L115:
  xor    %r15d,%r15d
  jmp    L129
```

tool_calls: name: disassemble_data
arguments: data_tag: D2
data_type: string
name: disassemble_data
arguments: data_tag: D33
data_type: string
name: disassemble_data
arguments: data_tag: D15
data_type: string
name: disassemble_data
arguments: data_tag: D35
data_type: string

tool: D2: dns: name: not enough bytes


tool: D33: (err)

tool: D15: dns: name: too long


tool: D35: dns: name: recursion exceeded %d


assistant: ```c
unsigned dns_extract_name(struct NetFrame *frame, const unsigned char *px, unsigned length, unsigned offset, char *name, unsigned sizeof_name) {
  int recurse_count = 0;
  unsigned name_offset = 0;
  name[0] = '\0';
  while (offset < length) {
    unsigned len;
    if (px[offset] == 0x00)
      break;
    if (px[offset] & 0xC0) {
      if (recurse_count > 100) {
        FRAMERR(frame, "dns: name: recursion exceeded %d\n", recurse_count);
        break;
      }
      recurse_count++;
      if (offset + 2 > length) {
        FRAMERR(frame, "dns: name: not enough bytes\n");
        strcpy_s(name, sizeof_name, "(err)");
        return 5;
      }
      offset = (*((unsigned char *)(px + offset) + 0) << 8 | *((unsigned char *)(px + offset) + 1) << 0) & 0x3FFF;
      continue;
    }
    len = px[offset++];
    if (offset >= length) {
      FRAMERR(frame, "dns: name: not enough bytes\n");
      strcpy_s(name, sizeof_name, "(err)");
      return 5;
    }
    if (offset + len > length) {
      FRAMERR(frame, "dns: name: not enough bytes\n");
      strcpy_s(name, sizeof_name, "(err)");
      return 5;
    }
    if (name_offset > 0) {
      if (name_offset + 1 >= sizeof_name) {
        FRAMERR(frame, "dns: name: too long\n");
        strcpy_s(name, sizeof_name, "(err)");
        return 5;
      }
      name[name_offset++] = '.';
    }
    if (name_offset + len + 1 >= sizeof_name) {
      FRAMERR(frame, "dns: name: too long\n");
      strcpy_s(name, sizeof_name, "(err)");
      return 5;
    }
    memcpy(name + name_offset, px + offset, len);
    name_offset += len;
    name[name_offset] = '\0';
    offset += len;
  }
  return name_offset;
}
```