user: 请将以下的汇编代码转换成C语言代码：

```asm
<read_dns_name>:
  endbr64
  push   %r15
  movslq %ecx,%rcx
  mov    %rsi,%rax
  lea    0x100(%rdx),%r15
  push   %r14
  xor    %esi,%esi
  lea    (%rdi,%rcx,4),%r14
  push   %r13
  xor    %r13d,%r13d
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x8,%rsp
L430:
  movslq (%rax),%rdi
  mov    %edi,%edx
  and    $0xc0,%edx
  cmp    $0xc0,%edx
  je     L141
  test   %edi,%edi
  je     L122
  add    $0x4,%rax
  test   %esi,%esi
  jne    L355
  lea    0x1(%r13),%edx
  test   %edi,%edi
  jle    L301
  lea    (%rdi,%rdx,1),%r13d
  jmp    L79
  xchg   %ax,%ax
L126:
  add    $0x1,%rbx
  cmp    %rbx,%r12
  ja     L139
  cmp    %rbx,%r15
  jb     L139
  cmp    %edx,%r13d
  je     L168
L79:
  mov    (%rax),%ecx
  mov    %cl,(%rbx)
  cmp    %rax,%r14
  jb     L139
  cmp    %rax,%rbp
  ja     L139
  add    $0x1,%edx
  cmp    $0x100,%edx
  jg     L139
  cmp    %rbx,%r12
  ja     L139
  cmp    %rbx,%r15
  jb     L139
  add    $0x4,%rax
  cmp    %rax,%r14
  jb     L139
  cmp    %rax,%rbp
  jbe    L126
  nopl   0x0(%rax,%rax,1)
L139:
  xor    %r13d,%r13d
L27:
  add    $0x8,%rsp
  mov    %r13d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L141:
  call   <ntohs@plt>
  sub    $0xc000,%eax
  cltq
  lea    0x0(%rbp,%rax,4),%rax
  cmp    %rax,%rbp
  ja     L139
  cmp    %rax,%r14
  jb     L139
  add    $0x2,%r13d
  cmp    $0x100,%r13d
  jg     L139
  cmp    %r15,%rbx
  ja     L139
  cmp    %r12,%rbx
  jb     L139
  mov    $0x1,%esi
  jmp    L430
  nopl   0x0(%rax)
L355:
  test   %edi,%edi
  jle    L405
  add    %rbx,%rdi
  jmp    L158
  nopl   (%rax)
L365:
  add    $0x1,%rbx
  cmp    %r15,%rbx
  ja     L139
  cmp    %rbx,%r12
  ja     L139
  cmp    %rbx,%rdi
  je     L168
L158:
  mov    (%rax),%edx
  add    $0x4,%rax
  cmp    %rax,%r14
  mov    %dl,(%rbx)
  setb   %dl
  cmp    %rbp,%rax
  setb   %cl
  or     %cl,%dl
  jne    L139
  cmp    $0x101,%r13d
  jne    L365
  jmp    L139
  nopl   (%rax)
L168:
  movb   $0x2e,(%rbx)
L254:
  add    $0x1,%rbx
  cmp    %r15,%rbx
  ja     L139
  cmp    %rbx,%r12
  jbe    L430
  jmp    L139
L122:
  test   %r13d,%r13d
  je     L91
  movb   $0x0,-0x1(%rbx)
  test   %esi,%esi
  jne    L27
  cmp    %rax,%r14
  jb     L139
  cmp    %rbp,%rax
  jb     L139
  add    $0x1,%r13d
  cmp    $0x101,%r13d
  je     L139
  lea    0x100(%r12),%rax
  cmp    %rax,%rbx
  ja     L139
  cmp    %r12,%rbx
  jae    L27
  jmp    L139
  nopl   (%rax)
L301:
  mov    %edx,%r13d
L405:
  cmp    %rax,%r14
  movb   $0x2e,(%rbx)
  setb   %dl
  cmp    %rbp,%rax
  setb   %cl
  or     %cl,%dl
  jne    L139
  cmp    $0x101,%r13d
  jne    L254
  jmp    L139
L91:
  movb   $0x0,(%rbx)
  jmp    L27
```

assistant: ```c
int read_dns_name(u_char *base, u_char *ptr, char *name, int psize) {
  u_char c;
  int len;
  int count = 0, compressed = 0;
  char *base_name = name;
  for (;;) {
    int i;
    c = *ptr;
    if ((c & 0xc0) == 0xc0) {
      int offset;
      offset = (ntohs(*(u_short *)(ptr)) - 0xc000);
      ptr = base;
      do {
        ptr += offset;
        if ((ptr > (base + psize)) || (ptr < base))
          return 0;
        count += 2;
        if ((count > 256) || (count < 0))
          return 0;
        name += 0;
        if ((name > (base_name + 256)) || (name < base_name))
          return 0;
      } while (0);
      compressed = 1;
      continue;
    }
    len = c;
    if (len == 0) {
      if (count > 0) {
        *(name - 1) = '\0';
        if (!compressed)
          do {
            ptr += 0;
            if ((ptr > (base + psize)) || (ptr < base))
              return 0;
            count += 1;
            if ((count > 256) || (count < 0))
              return 0;
            name += 0;
            if ((name > (base_name + 256)) || (name < base_name))
              return 0;
          } while (0);
      } else {
        *name = '\0';
      }
      break;
    }
    ptr++;
    if (!compressed)
      count++;
    for (i = 0; i < len; i++) {
      *name = *ptr;
      if (!compressed)
        do {
          ptr += 0;
          if ((ptr > (base + psize)) || (ptr < base))
            return 0;
          count += 1;
          if ((count > 256) || (count < 0))
            return 0;
          name += 0;
          if ((name > (base_name + 256)) || (name < base_name))
            return 0;
        } while (0);
      do {
        ptr += 1;
        if ((ptr > (base + psize)) || (ptr < base))
          return 0;
        count += 0;
        if ((count > 256) || (count < 0))
          return 0;
        name += 1;
        if ((name > (base_name + 256)) || (name < base_name))
          return 0;
      } while (0);
    }
    *name = '.';
    do {
      ptr += 0;
      if ((ptr > (base + psize)) || (ptr < base))
        return 0;
      count += 0;
      if ((count > 256) || (count < 0))
        return 0;
      name += 1;
      if ((name > (base_name + 256)) || (name < base_name))
        return 0;
    } while (0);
  }
  return count;
}
```