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

```asm
<res_nmkquery>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xe8,%rsp
  mov    %rdx,0x8(%rsp)
  mov    0x130(%rsp),%rbp
  mov    %r9,(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0xd8(%rsp)
  xor    %eax,%eax
  test   %rbp,%rbp
  je     L31
  mov    D49(%rip),%rax
  mov    (%rax),%edx
  cmp    0x138(%rsp),%edx
  jg     L31
  mov    %rdi,%r13
  mov    %esi,%r12d
  mov    %rbp,%rdi
  xor    %esi,%esi
  mov    %ecx,%r14d
  mov    %r8d,%r15d
  lea    0x28(%rsp),%rbx
  call   <memset@plt>
  nopl   0x0(%rax,%rax,1)
L60:
  xor    %esi,%esi
  mov    %rbx,%rdi
  call   <__gettimeofday@plt>
  mov    0x28(%rsp),%eax
  shl    $0x8,%eax
  xor    0x2c(%rsp),%eax
  test   %ax,%ax
  je     L60
  add    0x0(%r13),%eax
  movd   %r12d,%xmm1
  mov    %rbp,0x30(%rsp)
  movzwl %ax,%eax
  mov    D50(%rip),%rdx
  movq   $0x0,0x38(%rsp)
  movd   %eax,%xmm0
  mov    %eax,0x0(%r13)
  punpckldq %xmm1,%xmm0
  movq   %xmm0,0x0(%rbp)
  mov    0x4(%r13),%eax
  and    (%rdx),%eax
  setne  %al
  movzbl %al,%eax
  mov    %eax,0x8(%rbp)
  mov    D26(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,0x28(%rbp)
  mov    D49(%rip),%rax
  movslq (%rax),%rdx
  mov    %rdx,%rax
  lea    0x0(%rbp,%rdx,4),%r13
  mov    0x138(%rsp),%edx
  sub    %eax,%edx
  cmp    $0x81,%r12d
  je     L8
  cmp    $0x82,%r12d
  je     L167
  cmp    $0x80,%r12d
  je     L122
L31:
  mov    $0xffffffff,%eax
L184:
  mov    0xd8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L96
  add    $0xe8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L8:
  xor    %eax,%eax
  cmpq   $0x0,(%rsp)
  je     L124
  mov    D69(%rip),%rax
  mov    (%rax),%eax
L124:
  mov    D63(%rip),%rcx
  add    (%rcx),%eax
  sub    %eax,%edx
  mov    %edx,0x14(%rsp)
  js     L31
  lea    0x30(%rsp),%rax
  mov    0x8(%rsp),%rdi
  lea    0xd0(%rsp),%rbx
  mov    %r13,%rsi
  mov    %rax,%rcx
  mov    %rbx,%r8
  mov    %rax,0x18(%rsp)
  call   <ns_name_compress@plt>
  mov    %eax,%ecx
  test   %eax,%eax
  js     L31
  cltq
  mov    %r15d,%edi
  mov    %ecx,0x8(%rsp)
  lea    0x0(%r13,%rax,4),%r12
  mov    %r12,%rsi
  call   <NS_PUT16@plt>
  mov    %r12,%rsi
  mov    %r14d,%edi
  call   <NS_PUT16@plt>
  mov    $0x1,%edi
  call   <htons@plt>
  mov    (%rsp),%rdi
  mov    %rax,0x20(%rbp)
  test   %rdi,%rdi
  je     L19
  mov    0x8(%rsp),%ecx
  mov    0x14(%rsp),%edx
  mov    %rbx,%r8
  mov    %r12,%rsi
  sub    %ecx,%edx
  mov    0x18(%rsp),%rcx
  call   <ns_name_compress@plt>
  xor    %esi,%esi
  movslq %eax,%rbx
  mov    %ebx,%edi
  shr    $0x1f,%edi
  call   <__builtin_expect@plt>
  test   %eax,%eax
  jne    L31
  mov    D18(%rip),%rax
  lea    (%r12,%rbx,4),%r12
  mov    %r12,%rsi
  mov    (%rax),%edi
  call   <NS_PUT16@plt>
  mov    %r12,%rsi
  mov    %r14d,%edi
  call   <NS_PUT16@plt>
  mov    %r12,%rsi
  xor    %edi,%edi
  call   <NS_PUT32@plt>
  mov    %r12,%rsi
  xor    %edi,%edi
  call   <NS_PUT16@plt>
  mov    $0x1,%edi
  call   <htons@plt>
  mov    %rax,0x18(%rbp)
L19:
  mov    %r12,%rax
  sub    %rbp,%rax
  sar    $0x2,%rax
  jmp    L184
  nopl   0x0(%rax)
L122:
  mov    D63(%rip),%rax
  sub    (%rax),%edx
  js     L31
  mov    0x8(%rsp),%rdi
  lea    0x30(%rsp),%rcx
  lea    0xd0(%rsp),%r8
  mov    %r13,%rsi
  call   <ns_name_compress@plt>
  test   %eax,%eax
  js     L31
  cltq
  mov    %r15d,%edi
  lea    0x0(%r13,%rax,4),%r12
  mov    %r12,%rsi
  call   <NS_PUT16@plt>
  mov    %r12,%rsi
  mov    %r14d,%edi
  call   <NS_PUT16@plt>
  mov    $0x1,%edi
  call   <htons@plt>
  mov    %rax,0x20(%rbp)
  mov    %r12,%rax
  sub    %rbp,%rax
  sar    $0x2,%rax
  jmp    L184
  nopl   0x0(%rax,%rax,1)
L167:
  mov    D69(%rip),%rax
  mov    0x120(%rsp),%ecx
  xor    %edi,%edi
  mov    (%rax),%eax
  lea    0x1(%rcx,%rax,1),%eax
  cmp    %edx,%eax
  setg   %dil
  xor    %esi,%esi
  call   <__builtin_expect@plt>
  test   %eax,%eax
  jne    L31
  movl   $0x0,0x0(%r13)
  lea    0x4(%r13),%r12
  mov    %r15d,%edi
  mov    %r12,%rsi
  call   <NS_PUT16@plt>
  mov    %r12,%rsi
  mov    %r14d,%edi
  call   <NS_PUT16@plt>
  mov    %r12,%rsi
  xor    %edi,%edi
  call   <NS_PUT32@plt>
  mov    0x120(%rsp),%edi
  mov    %r12,%rsi
  call   <NS_PUT16@plt>
  mov    0x120(%rsp),%eax
  test   %eax,%eax
  jne    L13
L194:
  mov    $0x1,%edi
  call   <htons@plt>
  mov    %rax,0x10(%rbp)
  mov    %r12,%rax
  sub    %rbp,%rax
  sar    $0x2,%rax
  jmp    L184
L13:
  mov    0x120(%rsp),%edx
  mov    (%rsp),%rsi
  mov    %r12,%rdi
  call   <memcpy@plt>
  movslq 0x120(%rsp),%rax
  lea    (%r12,%rax,4),%r12
  jmp    L194
L96:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int res_nmkquery(res_state statp, int op, const char *dname, int class, int type, const u_char *data, int datalen, const u_char *newrr_in, u_char *buf, int buflen) {
  HEADER *hp;
  u_char *cp;
  int n;
  u_char *dnptrs[20], **dpp, **lastdnptr;
  if ((buf == NULL) || (buflen < HFIXEDSZ))
    return (-1);
  memset(buf, 0, HFIXEDSZ);
  hp = (HEADER *)buf;
  int randombits;
  do {
    struct timeval tv;
    __gettimeofday(&tv, NULL);
    randombits = (tv.tv_sec << 8) ^ tv.tv_usec;
  } while ((randombits & 0xffff) == 0);
  statp->id = (statp->id + randombits) & 0xffff;
  hp->id = statp->id;
  hp->opcode = op;
  hp->rd = (statp->options & RES_RECURSE) != 0;
  hp->rcode = NOERROR;
  cp = buf + HFIXEDSZ;
  buflen -= HFIXEDSZ;
  dpp = dnptrs;
  *dpp++ = buf;
  *dpp++ = NULL;
  lastdnptr = dnptrs + sizeof dnptrs / sizeof dnptrs[0];
  switch (op) {
  case NS_NOTIFY_OP:
    if ((buflen -= QFIXEDSZ + (data == NULL ? 0 : RRFIXEDSZ)) < 0)
      return (-1);
    goto compose;
  case QUERY:
    if ((buflen -= QFIXEDSZ) < 0)
      return (-1);
  compose:
    n = ns_name_compress(dname, cp, buflen, (const u_char **)dnptrs, (const u_char **)lastdnptr);
    if (n < 0)
      return (-1);
    cp += n;
    buflen -= n;
    NS_PUT16(type, cp);
    NS_PUT16(class, cp);
    hp->qdcount = htons(1);
    if (op == QUERY || data == NULL)
      break;
    n = ns_name_compress((char *)data, cp, buflen, (const u_char **)dnptrs, (const u_char **)lastdnptr);
    if (__builtin_expect(n < 0, 0))
      return (-1);
    cp += n;
    buflen -= n;
    NS_PUT16(T_NULL, cp);
    NS_PUT16(class, cp);
    NS_PUT32(0, cp);
    NS_PUT16(0, cp);
    hp->arcount = htons(1);
    break;
  case IQUERY:
    if (__builtin_expect(buflen < 1 + RRFIXEDSZ + datalen, 0))
      return (-1);
    *cp++ = '\0';
    NS_PUT16(type, cp);
    NS_PUT16(class, cp);
    NS_PUT32(0, cp);
    NS_PUT16(datalen, cp);
    if (datalen) {
      memcpy(cp, data, datalen);
      cp += datalen;
    }
    hp->ancount = htons(1);
    break;
  default:
    return (-1);
  }
  return (cp - buf);
}
```