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

```asm
<decode_dns_response>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  mov    %rdi,%rbp
  mov    %rsi,%rdi
  push   %rbx
  sub    $0x48,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  call   <strlen@plt>
  lea    0x6(%rbp),%rdi
  mov    %eax,%ebx
  call   <decode2short@plt>
  movslq %ebx,%rdx
  cwtl
  lea    0x2(%rdx),%rsi
  lea    0x12(%rbp,%rdx,1),%r13
  mov    %eax,0x4(%rsp)
  mov    %rsi,0x8(%rsp)
  test   %eax,%eax
  jle    L10
  xor    %ebx,%ebx
  lea    0x34(%rsp),%rbp
  lea    D11(%rip),%r14
  nopl   0x0(%rax,%rax,1)
L96:
  movsbl 0x0(%r13),%eax
  mov    0x8(%rsp),%rcx
  lea    0x2(%r13),%rdx
  and    $0xc0,%eax
  add    %r13,%rcx
  cmp    $0xc0,%eax
  cmovne %rcx,%rdx
  mov    %rdx,%r13
  mov    %rdx,%rdi
  call   <decode2short@plt>
  lea    0x8(%r13),%rdi
  add    $0xa,%r13
  mov    %rax,%r15
  call   <decode2short@plt>
  mov    %eax,0x28(%rsp)
  cmp    $0x1,%r15w
  je     L20
  movslq %eax,%r8
  add    %r8,%r13
L53:
  add    $0x1,%ebx
  cmp    0x4(%rsp),%ebx
  jne    L96
L10:
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L17
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nop
L20:
  mov    $0x100,%esi
  mov    %r12,%rdi
  mov    %rax,0x10(%rsp)
  call   <bzero@plt>
  mov    0x10(%rsp),%r8
  test   %r8d,%r8d
  jle    L53
  lea    -0x1(%r8),%eax
  mov    %r13,%r15
  mov    %eax,0x10(%rsp)
  mov    %eax,%r9d
  test   %eax,%eax
  je     L11
  mov    %r8,0x18(%rsp)
  xor    %r9d,%r9d
  mov    %r13,0x20(%rsp)
  mov    %r9d,%r15d
  mov    %ebx,0x2c(%rsp)
  mov    %eax,%ebx
  nopl   0x0(%rax)
L58:
  movsbl 0x0(%r13),%edx
  mov    %r14,%rsi
  mov    %rbp,%rdi
  test   %edx,%edx
  movzbl %dl,%eax
  cmovle %eax,%edx
  add    $0x1,%r15d
  add    $0x1,%r13
  call   <sprintf@plt>
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <strcat@plt>
  lea    D18(%rip),%rsi
  mov    %r12,%rdi
  call   <strcat@plt>
  cmp    %ebx,%r15d
  jl     L58
  mov    0x18(%rsp),%r8
  mov    %r15d,%r9d
  mov    0x2c(%rsp),%ebx
  mov    %r13,%r15
  mov    0x20(%rsp),%r13
  cmp    %r9d,%r8d
  jle    L47
L11:
  mov    %r9d,%eax
  mov    %r13,0x18(%rsp)
  mov    0x28(%rsp),%r13d
  sub    %r15d,%eax
  mov    %ebx,0x28(%rsp)
  mov    %r15,%rbx
  mov    %eax,%r15d
  nopw   0x0(%rax,%rax,1)
L83:
  movsbl (%rbx),%edx
  mov    %r14,%rsi
  mov    %rbp,%rdi
  test   %edx,%edx
  movzbl %dl,%eax
  cmovle %eax,%edx
  add    $0x1,%rbx
  call   <sprintf@plt>
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <strcat@plt>
  lea    (%r15,%rbx,1),%eax
  cmp    %r13d,%eax
  jl     L83
  mov    0x18(%rsp),%r13
  mov    0x28(%rsp),%ebx
L47:
  mov    0x10(%rsp),%eax
  lea    0x1(%r13,%rax,1),%r13
  jmp    L53
L17:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: label: D11
data_type: string
name: disassemble_data
arguments: label: D18
data_type: string

tool: D11: %d

tool: D18: .

assistant: ```c
void decode_dns_response(char *buffer, const char *hostna, char *ip) {
  int h_len = strlen(hostna);
  char *p = buffer + 6;
  short qncount = decode2short(p);
  p = buffer + 1 + 12 + h_len + 1 + 4;
  int i;
  for (i = 0; i < qncount; i++) {
    char flag = p[0];
    if ((flag & 0xc0) == 0xc0) {
      p += 2;
    } else {
      p += 1 + h_len + 1;
    }
    short query_type = decode2short(p);
    p += 8;
    int data_len = decode2short(p);
    p += 2;
    if (query_type == 0x0001) {
      bzero(ip, 256);
      int j;
      for (j = 0; j < data_len; j++) {
        int v = p[0];
        v = v > 0 ? v : 0x0ff & v;
        char tmp[4];
        sprintf(tmp, "%d", v);
        strcat(ip, tmp);
        if (j < data_len - 1) {
          strcat(ip, ".");
        }
        p++;
      }
    } else {
      p += data_len;
    }
  }
}
```