user: What is the c source code of the assembly code below?

```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    L163
  mov    %r9d,%ebp
  mov    %rsi,%r14
  mov    %edx,%r13d
  mov    %ecx,%ebx
  mov    %r8,%r12
  xor    %r15d,%r15d
  xor    %r9d,%r9d
  jmp    L50
  nopl   0x0(%rax)
L91:
  cmp    $0x64,%r9d
  jg     L111
  add    $0x2,%ebx
  add    $0x1,%r9d
  cmp    %r13d,%ebx
  ja     L66
  movzbl 0x1(%r14,%rdx,1),%ebx
  shl    $0x8,%eax
  or     %eax,%ebx
  and    $0x3fff,%ebx
L11:
  cmp    %r13d,%ebx
  jae    L56
L50:
  mov    %ebx,%edx
  movzbl (%r14,%rdx,1),%eax
  test   %al,%al
  je     L56
  test   $0xc0,%al
  jne    L91
  lea    0x1(%rbx),%esi
  movzbl %al,%edx
  cmp    %esi,%r13d
  jbe    L66
  lea    (%rsi,%rdx,1),%ebx
  cmp    %r13d,%ebx
  ja     L66
  test   %r15d,%r15d
  je     L102
  lea    0x1(%r15),%eax
  cmp    %ebp,%eax
  jae    L57
  movb   $0x2e,(%r12,%r15,1)
  lea    (%rax,%rdx,1),%ecx
  mov    %eax,%r15d
L118:
  lea    0x1(%rcx),%eax
  mov    %r9d,0x4(%rsp)
  mov    %ecx,(%rsp)
  cmp    %ebp,%eax
  jae    L57
  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    L11
  nopl   (%rax)
L102:
  mov    %edx,%ecx
  jmp    L118
  nopl   0x0(%rax)
L66:
  lea    D24(%rip),%rsi
L54:
  mov    0x8(%rsp),%rdi
  xor    %eax,%eax
  mov    $0x5,%r15d
  call   <FRAMERR@plt>
  lea    D25(%rip),%rdx
  mov    %ebp,%esi
  mov    %r12,%rdi
  call   <strcpy_s@plt>
L56:
  add    $0x18,%rsp
  mov    %r15d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L57:
  lea    D0(%rip),%rsi
  jmp    L54
L111:
  mov    0x8(%rsp),%rdi
  mov    %r9d,%edx
  lea    D4(%rip),%rsi
  xor    %eax,%eax
  call   <FRAMERR@plt>
  jmp    L56
L163:
  xor    %r15d,%r15d
  jmp    L56
```

tool_calls: name: disassemble_data
arguments: label: D24
data_type: string
name: disassemble_data
arguments: label: D25
data_type: string
name: disassemble_data
arguments: label: D0
data_type: string
name: disassemble_data
arguments: label: D4
data_type: string

tool: D24: dns: name: not enough bytes


tool: D25: (err)

tool: D0: dns: name: too long


tool: D4: 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;
}
```