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

```asm
<fqdn_read>:
  endbr64
  push   %r12
  xor    %eax,%eax
  mov    %rsi,%r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  mov    $0x4,%edi
  call   <alloc@plt>
  mov    $0x4,%esi
  movslq %eax,%rbp
  xor    %eax,%eax
  mov    %rbp,%rdi
  call   <byte_zero@plt>
  movl   $0xff,0x0(%rbp)
  movzbl (%r12),%eax
  test   %al,%al
  je     L54
  lea    0x1(%r12),%rdx
  movsbl %al,%r10d
  mov    $0x20,%r9d
  xor    %ecx,%ecx
  movabs $0xfffbffffffffe006,%r11
  nopl   0x0(%rax,%rax,1)
L133:
  lea    -0x1(%rax),%esi
  test   %al,%al
  je     L88
  movzbl %sil,%esi
  lea    0x1(%rdx,%rsi,1),%r8
  jmp    L24
  cs nopw 0x0(%rax,%rax,1)
L44:
  add    $0x20,%eax
L135:
  movslq %ecx,%rsi
  add    $0x1,%ecx
  mov    %al,(%rbx,%rsi,1)
  cmp    %rdx,%r8
  je     L118
L24:
  movzbl (%rdx),%eax
  add    $0x1,%rdx
  lea    -0x41(%rax),%esi
  cmp    $0x19,%sil
  jbe    L44
  lea    -0x61(%rax),%esi
  cmp    $0x19,%sil
  jbe    L135
  lea    -0x2d(%rax),%esi
  cmp    $0x32,%sil
  ja     L100
  bt     %rsi,%r11
  jae    L135
  nopl   0x0(%rax)
L100:
  movslq %ecx,%rdi
  lea    0x1(%rcx),%esi
  add    $0x5,%ecx
  movb   $0x5c,(%rbx,%rdi,1)
  mov    %eax,%edi
  movslq %esi,%rsi
  sar    $0x6,%dil
  and    $0x7,%edi
  add    $0x30,%edi
  mov    %dil,0x1(%rbx,%rsi,1)
  mov    %eax,%edi
  and    $0x7,%eax
  sar    $0x3,%dil
  add    $0x30,%eax
  and    $0x7,%edi
  mov    %al,0x3(%rbx,%rsi,1)
  add    $0x30,%edi
  mov    %dil,0x2(%rbx,%rsi,1)
  cmp    %rdx,%r8
  jne    L24
L118:
  movslq %ecx,%rax
  cmpb   $0x0,(%r8)
  lea    (%rbx,%rax,1),%rdx
  je     L84
L5:
  movb   $0x2e,(%rdx)
  add    $0x1,%ecx
  sub    $0x1,%r9d
  je     L57
  movsbl (%r8),%esi
  lea    0x1(%r8),%rdx
  lea    0x1(%r10,%rsi,1),%r10d
  mov    %esi,%eax
  cmp    $0xfe,%r10d
  jle    L133
  pop    %rbx
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  ret
  nopl   (%rax)
L88:
  mov    %rdx,%r8
  movslq %ecx,%rax
  cmpb   $0x0,(%r8)
  lea    (%rbx,%rax,1),%rdx
  jne    L5
L84:
  movb   $0x0,(%rbx,%rax,1)
  mov    %rbx,%rax
  mov    %r10d,0x0(%rbp)
L28:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L54:
  movb   $0x2e,(%rbx)
  mov    %rbx,%rax
  movl   $0x1,0x0(%rbp)
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L57:
  movslq %ecx,%rax
  movb   $0x0,(%rbx,%rax,1)
  mov    %rbx,%rax
  mov    %r10d,0x0(%rbp)
  jmp    L28
```

assistant: ```c
char *fqdn_read(out, q)
char *out;
const char *q;
{
  int *len;
  int label_idx[32];
  char ch;
  int maxlen;
  char ch2;
  int cur_len = 0;
  register int i = 0;
  register int j = 0;
  len = alloc(4);
  byte_zero(len, 4);
  *len = 255;
  maxlen = *len;
  if (!*q) {
    out[0] = '.';
    label_idx[0] = -1;
    *len = 1;
    return out;
  } else {
    label_idx[0] = 0;
    for (;;) {
      ch = *q++;
      cur_len += ch;
      if (cur_len >= maxlen)
        return (char *)0;
      while (ch--) {
        ch2 = *q++;
        if ((ch2 >= 'A') && (ch2 <= 'Z'))
          ch2 += 32;
        if (((ch2 >= 'a') && (ch2 <= 'z')) || ((ch2 >= '0') && (ch2 <= '9')) || (ch2 == '-') || (ch2 == '_')) {
          out[j++] = ch2;
        } else {
          out[j] = '\\';
          j++;
          out[j + 1] = '0' + ((ch2 >> 6) & 7);
          out[j + 2] = '0' + ((ch2 >> 3) & 7);
          out[j + 3] = '0' + (ch2 & 7);
          j += 4;
        }
      }
      if (!*q)
        break;
      out[j++] = '.';
      i += 1;
      if (i == 32)
        break;
      label_idx[i] = j;
      cur_len += 1;
    }
  }
  out[j] = '\0';
  *len = cur_len;
  return out;
}
```