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

```asm
<asn1_string_canon>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%r15
  mov    %rdi,0x8(%rsp)
  mov    %rsi,%rbx
  mov    0x10(%rsi),%edi
  call   <ASN1_tag2bit@plt>
  mov    %eax,%edx
  mov    D22(%rip),%rax
  mov    (%rax),%eax
  mov    D12(%rip),%rcx
  or     (%rcx),%eax
  mov    D37(%rip),%rcx
  or     (%rcx),%eax
  mov    D57(%rip),%rcx
  or     (%rcx),%eax
  mov    D63(%rip),%rcx
  or     (%rcx),%eax
  mov    D1(%rip),%rcx
  or     (%rcx),%eax
  mov    D23(%rip),%rcx
  or     (%rcx),%eax
  test   %edx,%eax
  jne    L193
  mov    %rbx,%rsi
  mov    %r15,%rdi
  call   <ASN1_STRING_copy@plt>
  test   %eax,%eax
  setne  %al
  movzbl %al,%eax
L110:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L193:
  mov    D66(%rip),%rax
  mov    (%rax),%eax
  mov    0x8(%rsp),%r14
  mov    %eax,0x10(%r14)
  lea    0x8(%r14),%rdi
  mov    %rbx,%rsi
  call   <ASN1_STRING_to_UTF8@plt>
  mov    %eax,%ebx
  mov    %eax,(%r14)
  mov    $0x0,%eax
  cmp    $0xffffffff,%ebx
  je     L110
  mov    0x8(%r14),%rbp
  test   %ebx,%ebx
  jle    L69
L20:
  movzbl 0x0(%rbp),%edi
  test   %dil,%dil
  js     L153
  movzbl %dil,%edi
  call   <isspace@plt>
  test   %rax,%rax
  je     L153
  add    $0x1,%rbp
  sub    $0x1,%ebx
  jne    L20
L69:
  mov    0x8(%rsp),%rax
  mov    0x8(%rax),%rax
  mov    %rax,(%rsp)
L11:
  mov    0x8(%rsp),%rdx
  mov    (%rsp),%rax
  sub    0x8(%rdx),%rax
  mov    %eax,(%rdx)
  mov    $0x1,%eax
  jmp    L110
L153:
  movslq %ebx,%rax
  lea    -0x1(%rbp,%rax,1),%r12
  test   %ebx,%ebx
  jle    L69
L21:
  movzbl (%r12),%edi
  test   %dil,%dil
  js     L141
  movzbl %dil,%edi
  call   <isspace@plt>
  test   %rax,%rax
  je     L141
  sub    $0x1,%r12
  sub    $0x1,%ebx
  jne    L21
  jmp    L69
L141:
  mov    0x8(%rsp),%rax
  mov    0x8(%rax),%rax
  mov    %rax,(%rsp)
  test   %ebx,%ebx
  jle    L11
  add    $0x1,%rax
  mov    %rax,%r15
  mov    $0x0,%r14d
  jmp    L132
L173:
  movzbl %dil,%edi
  call   <isspace@plt>
  test   %rax,%rax
  jne    L115
  movzbl 0x0(%rbp),%edi
  call   <tolower@plt>
  mov    %r15,(%rsp)
  mov    %al,-0x1(%r15)
  add    $0x1,%rbp
  add    $0x1,%r14d
L167:
  add    $0x1,%r15
  cmp    %ebx,%r14d
  jge    L11
L132:
  movzbl 0x0(%rbp),%edi
  test   %dil,%dil
  jns    L173
  add    $0x1,%rbp
  mov    %r15,(%rsp)
  mov    %dil,-0x1(%r15)
  add    $0x1,%r14d
  jmp    L167
L115:
  mov    %r15,(%rsp)
  movb   $0x20,-0x1(%r15)
  mov    %rbp,%r12
L211:
  add    $0x1,%r12
  lea    (%r14,%r12,1),%r13d
  sub    %ebp,%r13d
  movzbl (%r12),%edi
  test   %dil,%dil
  js     L65
  movzbl %dil,%edi
  call   <isspace@plt>
  test   %rax,%rax
  jne    L211
  mov    %r13d,%r14d
  mov    %r12,%rbp
  jmp    L167
L65:
  mov    %r13d,%r14d
  mov    %r12,%rbp
  jmp    L167
```

assistant: ```c
int asn1_string_canon(ASN1_STRING *out, ASN1_STRING *in) {
  unsigned char *to, *from;
  int len, i;
  if (!(ASN1_tag2bit(in->type) & (B_ASN1_UTF8STRING | B_ASN1_BMPSTRING | B_ASN1_UNIVERSALSTRING | B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | B_ASN1_IA5STRING | B_ASN1_VISIBLESTRING))) {
    if (!ASN1_STRING_copy(out, in))
      return 0;
    return 1;
  }
  out->type = V_ASN1_UTF8STRING;
  out->length = ASN1_STRING_to_UTF8(&out->data, in);
  if (out->length == -1)
    return 0;
  to = out->data;
  from = to;
  len = out->length;
  while ((len > 0) && !(*from & 0x80) && isspace(*from)) {
    from++;
    len--;
  }
  to = from + len - 1;
  while ((len > 0) && !(*to & 0x80) && isspace(*to)) {
    to--;
    len--;
  }
  to = out->data;
  i = 0;
  while (i < len) {
    if (*from & 0x80) {
      *to++ = *from++;
      i++;
    } else if (isspace(*from)) {
      *to++ = ' ';
      do {
        from++;
        i++;
      } while (!(*from & 0x80) && isspace(*from));
    } else {
      *to++ = tolower(*from);
      from++;
      i++;
    }
  }
  out->length = to - out->data;
  return 1;
}
```