user: 请从给定的汇编指令推导出C源代码:

```asm
<asn1_string_canon>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x18,%rsp
  mov    %rdi,0x8(%rsp)
  mov    0x10(%rsi),%edi
  call   <ASN1_tag2bit@plt>
  mov    D66(%rip),%rdx
  mov    %eax,%r8d
  mov    D52(%rip),%rax
  mov    (%rax),%eax
  or     (%rdx),%eax
  mov    D67(%rip),%rdx
  or     (%rdx),%eax
  mov    D53(%rip),%rdx
  or     (%rdx),%eax
  mov    D14(%rip),%rdx
  or     (%rdx),%eax
  mov    D30(%rip),%rdx
  or     (%rdx),%eax
  mov    D18(%rip),%rdx
  or     (%rdx),%eax
  test   %r8d,%eax
  jne    L159
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <ASN1_STRING_copy@plt>
  test   %eax,%eax
  setne  %al
  movzbl %al,%eax
L132:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  xchg   %ax,%ax
L159:
  mov    D61(%rip),%rax
  mov    0x8(%rsp),%rbx
  mov    %rbp,%rsi
  mov    (%rax),%eax
  lea    0x8(%rbx),%rdi
  mov    %eax,0x10(%rbx)
  call   <ASN1_STRING_to_UTF8@plt>
  mov    %eax,%ebp
  mov    %eax,(%rbx)
  xor    %eax,%eax
  cmp    $0xffffffff,%ebp
  je     L132
  mov    0x8(%rbx),%rbx
  test   %ebp,%ebp
  jg     L57
  jmp    L173
  nopl   (%rax)
L12:
  call   <isspace@plt>
  test   %rax,%rax
  je     L0
  add    $0x1,%rbx
  sub    $0x1,%ebp
  je     L173
L57:
  movzbl (%rbx),%edi
  test   %dil,%dil
  jns    L12
L0:
  movslq %ebp,%rax
  lea    -0x1(%rbx,%rax,1),%r12
  jmp    L197
  nopl   0x0(%rax)
L21:
  call   <isspace@plt>
  test   %rax,%rax
  je     L124
  sub    $0x1,%r12
  sub    $0x1,%ebp
  je     L173
L197:
  movzbl (%r12),%edi
  test   %dil,%dil
  jns    L21
L124:
  mov    0x8(%rsp),%rax
  xor    %r14d,%r14d
  mov    0x8(%rax),%r13
  jmp    L139
  nopw   0x0(%rax,%rax,1)
L7:
  mov    %dil,-0x1(%r13)
  mov    %r15d,%r14d
  mov    %r12,%rbx
L10:
  cmp    %ebp,%r14d
  jge    L29
L139:
  movzbl (%rbx),%edi
  add    $0x1,%r13
  lea    0x1(%rbx),%r12
  lea    0x1(%r14),%r15d
  test   %dil,%dil
  js     L7
  call   <isspace@plt>
  test   %rax,%rax
  jne    L4
  movzbl (%rbx),%edi
  mov    %r15d,%r14d
  mov    %r12,%rbx
  call   <tolower@plt>
  mov    %al,-0x1(%r13)
  cmp    %ebp,%r14d
  jl     L139
L29:
  mov    0x8(%rsp),%rax
  sub    0x8(%rax),%r13d
L80:
  mov    0x8(%rsp),%rax
  mov    %r13d,(%rax)
  add    $0x18,%rsp
  mov    $0x1,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L4:
  movb   $0x20,-0x1(%r13)
  mov    %rbx,%r15
  jmp    L96
  nopw   0x0(%rax,%rax,1)
L92:
  call   <isspace@plt>
  test   %rax,%rax
  je     L119
L96:
  add    $0x1,%r15
  movzbl (%r15),%edi
  lea    (%r14,%r15,1),%r12d
  sub    %ebx,%r12d
  test   %dil,%dil
  jns    L92
L119:
  mov    %r12d,%r14d
  mov    %r15,%rbx
  jmp    L10
  nopl   0x0(%rax)
L173:
  xor    %r13d,%r13d
  jmp    L80
```

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;
}
```