user: What would the C source look like for the assembly code provided here?

```asm
<__dns_get_rr>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  xor    %r13d,%r13d
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x148,%rsp
  mov    %rsi,0x8(%rsp)
  mov    %rcx,(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x138(%rsp)
  xor    %eax,%eax
  testb  $0xf,0x3(%r8)
  jne    L0
  mov    %rdx,%r10
  movzbl 0x4(%r8),%edx
  movzbl 0x5(%r8),%ecx
  mov    %r8,%rbp
  movzbl 0x6(%r8),%r13d
  lea    0xc(%r8),%rax
  shl    $0x8,%edx
  add    %ecx,%edx
  movzbl 0x7(%r8),%ecx
  shl    $0x8,%r13d
  add    %ecx,%r13d
  lea    (%rdx,%r13,1),%ecx
  cmp    $0x40,%ecx
  jg     L293
  mov    %rdi,%r11
  lea    -0x1(%rdx),%esi
  lea    0x1fa(%r8),%rdi
  mov    %r9d,%r15d
  test   %edx,%edx
  je     L244
  nopw   0x0(%rax,%rax,1)
L7:
  mov    %rax,%rdx
  movzbl (%rax),%ecx
  sub    %rbp,%rdx
  cmp    $0x1ff,%rdx
  jle    L32
  jmp    L120
  nopl   0x0(%rax)
L348:
  lea    0x1(%rax),%rdx
  mov    %rdx,%rcx
  sub    %rbp,%rcx
  cmp    $0x1ff,%rcx
  jg     L255
  mov    %rdx,%rax
L32:
  movzbl (%rax),%edx
  mov    %edx,%ecx
  sub    $0x1,%edx
  cmp    $0x7e,%edx
  jbe    L348
L120:
  cmp    $0xc1,%cl
  ja     L293
L194:
  je     L240
  cmp    %rdi,%rax
  ja     L293
  cmp    $0x1,%cl
  mov    $0x5,%edx
  sbb    $0xffffffffffffffff,%rdx
L92:
  add    %rdx,%rax
  sub    $0x1,%esi
  jae    L7
L244:
  lea    -0x1(%r13),%r14d
  test   %r13d,%r13d
  je     L0
  lea    0x1fa(%rbp),%r9
  xor    %r13d,%r13d
  mov    %r9,%rdi
  mov    %r13d,%r9d
  mov    %rdi,%r13
  nopl   0x0(%rax,%rax,1)
L235:
  mov    %rax,%rdx
  movzbl (%rax),%ecx
  sub    %rbp,%rdx
  cmp    $0x1ff,%rdx
  jle    L313
  jmp    L2
  nopl   0x0(%rax)
L22:
  lea    0x1(%rax),%rdx
  mov    %rdx,%rcx
  sub    %rbp,%rcx
  cmp    $0x1ff,%rcx
  jg     L35
  mov    %rdx,%rax
L313:
  movzbl (%rax),%edx
  mov    %edx,%ecx
  sub    $0x1,%edx
  cmp    $0x7e,%edx
  jbe    L22
L2:
  cmp    $0xc1,%cl
  ja     L293
  je     L220
  cmp    %r13,%rax
  ja     L293
  cmp    $0x1,%cl
  mov    $0x1,%r12d
  sbb    $0xffffffffffffffff,%r12
L190:
  add    %rax,%r12
  lea    0x200(%rbp),%rsi
  movzbl 0x8(%r12),%ebx
  movzbl 0x9(%r12),%eax
  shl    $0x8,%ebx
  add    %eax,%ebx
  movslq %ebx,%rax
  lea    (%r12,%rax,1),%rdx
  cmp    %rdx,%rsi
  jb     L293
  movzbl 0x1(%r12),%edx
  cmp    %r15d,%edx
  jne    L277
  cmp    %r10,%rax
  jbe    L71
L277:
  lea    0xa(%rbx),%eax
  cltq
  add    %r12,%rax
  sub    $0x1,%r14d
  jae    L235
  mov    %r9d,%r13d
  nopl   0x0(%rax)
L0:
  mov    0x138(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L407
  add    $0x148,%rsp
  mov    %r13d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L255:
  movzbl 0x1(%rax),%ecx
  mov    %rdx,%rax
  cmp    $0xc1,%cl
  jbe    L194
L293:
  mov    $0xffffffff,%r13d
  jmp    L0
L240:
  cmpb   $0xff,0x1(%rax)
  je     L293
  cmp    %rdi,%rax
  ja     L293
  mov    $0x6,%edx
  jmp    L92
  nopl   (%rax)
L35:
  movzbl 0x1(%rax),%ecx
  mov    %rdx,%rax
  jmp    L2
  nopl   0x0(%rax)
L220:
  cmpb   $0xff,0x1(%rax)
  je     L293
  cmp    %r13,%rax
  ja     L293
  mov    $0x2,%r12d
  jmp    L190
L71:
  mov    0x180(%rsp),%eax
  test   %eax,%eax
  jne    L5
  test   %r11,%r11
  je     L276
  cmpq   $0x0,(%rsp)
  je     L276
  mov    %r11,%rdi
  lea    0xa(%r12),%rsi
  mov    %ebx,%edx
  mov    %r10,0x20(%rsp)
  mov    %r9d,0x1c(%rsp)
  mov    %r11,0x10(%rsp)
  call   <memcpy@plt>
  mov    0x20(%rsp),%r10
  mov    0x1c(%rsp),%r9d
  mov    0x10(%rsp),%r11
L160:
  subq   $0x1,(%rsp)
  add    0x8(%rsp),%r11
L276:
  add    $0x1,%r9d
  jmp    L277
L5:
  lea    0x30(%rsp),%rcx
  lea    0xa(%r12),%rdx
  mov    %rbp,%rdi
  mov    %r10,0x28(%rsp)
  mov    $0x100,%r8d
  mov    %r11,0x20(%rsp)
  mov    %r9d,0x1c(%rsp)
  mov    %rcx,0x10(%rsp)
  call   <__dn_expand@plt>
  mov    0x10(%rsp),%rcx
  mov    0x1c(%rsp),%r9d
  test   %rax,%rax
  mov    0x20(%rsp),%r11
  mov    0x28(%rsp),%r10
  js     L293
  test   %r11,%r11
  je     L276
  cmpq   $0x0,(%rsp)
  je     L276
  mov    %r11,%rdi
  mov    %rcx,%rsi
  mov    %r10,0x20(%rsp)
  mov    %r9d,0x1c(%rsp)
  mov    %r11,0x10(%rsp)
  call   <strcpy@plt>
  mov    0x10(%rsp),%r11
  mov    0x1c(%rsp),%r9d
  mov    0x20(%rsp),%r10
  jmp    L160
L407:
  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;
}
```