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

```asm
<__dns_get_rr>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x148,%rsp
  mov    %rdi,0x10(%rsp)
  mov    %rsi,0x20(%rsp)
  mov    %rdx,0x8(%rsp)
  mov    %rcx,0x18(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x138(%rsp)
  xor    %eax,%eax
  mov    $0x0,%r13d
  testb  $0xf,0x3(%r8)
  jne    L423
  mov    %r8,%rbp
  mov    %r9d,%edi
  lea    0xc(%r8),%rax
  movzbl 0x4(%r8),%edx
  shl    $0x8,%edx
  movzbl 0x5(%r8),%ecx
  add    %ecx,%edx
  movzbl 0x6(%r8),%r13d
  shl    $0x8,%r13d
  movzbl 0x7(%r8),%ecx
  add    %ecx,%r13d
  lea    (%rdx,%r13,1),%ecx
  cmp    $0x40,%ecx
  jg     L13
  lea    -0x1(%rdx),%ecx
  lea    0x1fa(%r8),%rsi
  test   %edx,%edx
  jne    L183
L136:
  lea    -0x1(%r13),%r14d
  test   %r13d,%r13d
  je     L423
  mov    $0x0,%r13d
  lea    0x1fa(%rbp),%r15
  mov    %rax,%rbx
  mov    %r13d,0x2c(%rsp)
  mov    %edi,%r13d
  jmp    L195
L242:
  movzbl (%rax),%edx
  cmp    $0xc1,%dl
  ja     L405
  je     L365
  cmp    %rsi,%rax
  ja     L98
  cmp    $0x1,%dl
  mov    $0x5,%edx
  sbb    $0xffffffffffffffff,%rdx
L263:
  add    %rdx,%rax
  sub    $0x1,%ecx
  cmp    $0xffffffff,%ecx
  je     L136
L183:
  mov    %rax,%rdx
  sub    %rbp,%rdx
  cmp    $0x1ff,%rdx
  jg     L242
L52:
  movzbl (%rax),%edx
  sub    $0x1,%edx
  cmp    $0x7e,%edx
  ja     L242
  add    $0x1,%rax
  mov    %rax,%rdx
  sub    %rbp,%rdx
  cmp    $0x1ff,%rdx
  jle    L52
  jmp    L242
L365:
  cmpb   $0xff,0x1(%rax)
  je     L134
  cmp    %rsi,%rax
  ja     L12
  mov    $0x6,%edx
  jmp    L263
L264:
  cmpb   $0xff,0x1(%rbx)
  je     L393
  cmp    %r15,%rbx
  ja     L34
  mov    $0x2,%eax
  jmp    L209
L43:
  lea    0x30(%rsp),%rcx
  lea    0xa(%rbx),%rdx
  mov    $0x100,%r8d
  mov    %rbp,%rdi
  call   <__dn_expand@plt>
  test   %rax,%rax
  js     L77
  cmpq   $0x0,0x18(%rsp)
  je     L25
  cmpq   $0x0,0x10(%rsp)
  je     L25
  lea    0x30(%rsp),%rsi
  mov    0x10(%rsp),%rdi
  call   <strcpy@plt>
L295:
  mov    0x20(%rsp),%rdi
  add    %rdi,0x10(%rsp)
  subq   $0x1,0x18(%rsp)
L25:
  addl   $0x1,0x2c(%rsp)
L214:
  add    $0xa,%r12d
  movslq %r12d,%r12
  add    %r12,%rbx
  sub    $0x1,%r14d
  cmp    $0xffffffff,%r14d
  je     L328
L195:
  mov    %rbx,%rax
  sub    %rbp,%rax
  cmp    $0x1ff,%rax
  jg     L65
L302:
  movzbl (%rbx),%eax
  sub    $0x1,%eax
  cmp    $0x7e,%eax
  ja     L65
  add    $0x1,%rbx
  mov    %rbx,%rax
  sub    %rbp,%rax
  cmp    $0x1ff,%rax
  jle    L302
L65:
  movzbl (%rbx),%eax
  cmp    $0xc1,%al
  ja     L420
  je     L264
  cmp    %r15,%rbx
  ja     L457
  cmp    $0x1,%al
  mov    $0x1,%eax
  sbb    $0xffffffffffffffff,%rax
L209:
  add    %rax,%rbx
  movzbl 0x8(%rbx),%r12d
  shl    $0x8,%r12d
  movzbl 0x9(%rbx),%eax
  add    %eax,%r12d
  movslq %r12d,%rax
  lea    0x200(%rbp),%rsi
  lea    (%rbx,%rax,1),%rdx
  cmp    %rdx,%rsi
  jb     L466
  movzbl 0x1(%rbx),%edx
  cmp    %r13d,%edx
  jne    L214
  cmp    0x8(%rsp),%rax
  ja     L214
  cmpl   $0x0,0x180(%rsp)
  jne    L43
  cmpq   $0x0,0x18(%rsp)
  je     L25
  cmpq   $0x0,0x10(%rsp)
  je     L25
  lea    0xa(%rbx),%rsi
  mov    %r12d,%edx
  mov    0x10(%rsp),%rdi
  call   <memcpy@plt>
  jmp    L295
L328:
  mov    0x2c(%rsp),%r13d
  jmp    L423
L13:
  mov    $0xffffffff,%r13d
  jmp    L423
L405:
  mov    $0xffffffff,%r13d
L423:
  mov    0x138(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L180
  mov    %r13d,%eax
  add    $0x148,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L134:
  mov    $0xffffffff,%r13d
  jmp    L423
L98:
  mov    $0xffffffff,%r13d
  jmp    L423
L420:
  mov    $0xffffffff,%r13d
  jmp    L423
L393:
  mov    $0xffffffff,%r13d
  jmp    L423
L457:
  mov    $0xffffffff,%r13d
  jmp    L423
L466:
  mov    $0xffffffff,%r13d
  jmp    L423
L77:
  mov    $0xffffffff,%r13d
  jmp    L423
L34:
  mov    $0xffffffff,%r13d
  jmp    L423
L12:
  mov    $0xffffffff,%r13d
  jmp    L423
L180:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int __dns_get_rr(void *dest, size_t stride, size_t maxlen, size_t limit, const unsigned char *r, int rr, int dec) {
  int qdcount, ancount;
  const unsigned char *p;
  char tmp[256];
  int found = 0;
  int len;
  if ((r[3] & 15))
    return 0;
  p = r + 12;
  qdcount = r[4] * 256 + r[5];
  ancount = r[6] * 256 + r[7];
  if (qdcount + ancount > 64)
    return -1;
  while (qdcount--) {
    while (p - r < 512 && *p - 1U < 127)
      p++;
    if (*p > 193 || (*p == 193 && p[1] > 254) || p > r + 506)
      return -1;
    p += 5 + !!*p;
  }
  while (ancount--) {
    while (p - r < 512 && *p - 1U < 127)
      p++;
    if (*p > 193 || (*p == 193 && p[1] > 254) || p > r + 506)
      return -1;
    p += 1 + !!*p;
    len = p[8] * 256 + p[9];
    if (p + len > r + 512)
      return -1;
    if (p[1] == rr && len <= maxlen) {
      if (dec && __dn_expand(r, r + 512, p + 10, tmp, sizeof tmp) < 0)
        return -1;
      if (dest && limit) {
        if (dec)
          strcpy(dest, tmp);
        else
          memcpy(dest, p + 10, len);
        dest = (char *)dest + stride;
        limit--;
      }
      found++;
    }
    p += 10 + len;
  }
  return found;
}
```