user: Please show me the C implementation that matches the assembly code listed below:

```asm
<xmlEncodeCdata>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    %ecx,-0x20(%rbp)
  movl   $0x0,-0x8(%rbp)
  movl   $0x0,-0x4(%rbp)
  jmp    L410
L163:
  cmpl   $0x0,-0x1c(%rbp)
  je     L69
  mov    -0x4(%rbp),%eax
  lea    D30(%rip),%rdx
  movzbl (%rax,%rdx,1),%ecx
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  subl   $0x1,-0x1c(%rbp)
L69:
  addl   $0x1,-0x4(%rbp)
  addl   $0x1,-0x8(%rbp)
L410:
  cmpl   $0x8,-0x4(%rbp)
  jbe    L163
  jmp    L82
L93:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  cmp    $0x7f,%eax
  je     L470
  cmp    $0x7f,%eax
  jg     L473
  cmp    $0x1f,%eax
  jg     L213
  test   %eax,%eax
  js     L473
  mov    %eax,%edx
  mov    $0xffffd9ff,%eax
  mov    %edx,%ecx
  shr    %cl,%rax
  and    $0x1,%eax
  test   %rax,%rax
  setne  %al
  test   %al,%al
  jne    L470
  jmp    L473
L213:
  cmp    $0x5d,%eax
  je     L732
  jmp    L473
L470:
  mov    $0xffffffff,%eax
  jmp    L765
L732:
  cmpl   $0x1,-0x20(%rbp)
  jbe    L285
  mov    -0x28(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x5d,%al
  jne    L285
  mov    -0x28(%rbp),%rax
  add    $0x2,%rax
  movzbl (%rax),%eax
  cmp    $0x3e,%al
  jne    L285
  cmpl   $0x0,-0x1c(%rbp)
  je     L55
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  mov    -0x28(%rbp),%rdx
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  subl   $0x1,-0x1c(%rbp)
L55:
  addq   $0x1,-0x28(%rbp)
  addl   $0x1,-0x8(%rbp)
  cmpl   $0x0,-0x1c(%rbp)
  je     L422
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  mov    -0x28(%rbp),%rdx
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  subl   $0x1,-0x1c(%rbp)
L422:
  addq   $0x1,-0x28(%rbp)
  addl   $0x1,-0x8(%rbp)
  movl   $0x0,-0x4(%rbp)
  jmp    L436
L538:
  cmpl   $0x0,-0x1c(%rbp)
  je     L171
  mov    -0x4(%rbp),%eax
  lea    D35(%rip),%rdx
  movzbl (%rax,%rdx,1),%ecx
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  subl   $0x1,-0x1c(%rbp)
L171:
  addl   $0x1,-0x4(%rbp)
  addl   $0x1,-0x8(%rbp)
L436:
  cmpl   $0x2,-0x4(%rbp)
  jbe    L538
  movl   $0x0,-0x4(%rbp)
  jmp    L32
L610:
  cmpl   $0x0,-0x1c(%rbp)
  je     L521
  mov    -0x4(%rbp),%eax
  lea    D30(%rip),%rdx
  movzbl (%rax,%rdx,1),%ecx
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  subl   $0x1,-0x1c(%rbp)
L521:
  addl   $0x1,-0x4(%rbp)
  addl   $0x1,-0x8(%rbp)
L32:
  cmpl   $0x8,-0x4(%rbp)
  jbe    L610
  cmpl   $0x0,-0x1c(%rbp)
  je     L703
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  mov    -0x28(%rbp),%rdx
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  subl   $0x1,-0x1c(%rbp)
L703:
  addq   $0x1,-0x28(%rbp)
  addl   $0x1,-0x8(%rbp)
  subl   $0x2,-0x20(%rbp)
  jmp    L767
L285:
  cmpl   $0x0,-0x1c(%rbp)
  je     L407
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  mov    -0x28(%rbp),%rdx
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  subl   $0x1,-0x1c(%rbp)
L407:
  addq   $0x1,-0x28(%rbp)
  addl   $0x1,-0x8(%rbp)
L767:
  jmp    L82
L473:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  js     L597
  cmpl   $0x0,-0x1c(%rbp)
  je     L115
  mov    -0x28(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x18(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  subl   $0x1,-0x1c(%rbp)
  jmp    L566
L115:
  addq   $0x1,-0x28(%rbp)
L566:
  addl   $0x1,-0x8(%rbp)
  jmp    L405
L597:
  cmpl   $0x0,-0x20(%rbp)
  je     L28
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xe0,%eax
  cmp    $0xc0,%eax
  jne    L28
  mov    -0x28(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xc0,%eax
  cmp    $0x80,%eax
  jne    L28
  cmpl   $0x1,-0x1c(%rbp)
  jbe    L29
  mov    -0x28(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x18(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  mov    -0x28(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x18(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  subl   $0x2,-0x1c(%rbp)
  jmp    L497
L29:
  addq   $0x2,-0x28(%rbp)
L497:
  addl   $0x2,-0x8(%rbp)
  subl   $0x1,-0x20(%rbp)
  jmp    L405
L28:
  cmpl   $0x1,-0x20(%rbp)
  jbe    L6
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xf0,%eax
  cmp    $0xe0,%eax
  jne    L6
  mov    -0x28(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xc0,%eax
  cmp    $0x80,%eax
  jne    L6
  mov    -0x28(%rbp),%rax
  add    $0x2,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xc0,%eax
  cmp    $0x80,%eax
  jne    L6
  cmpl   $0x2,-0x1c(%rbp)
  jbe    L61
  mov    -0x28(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x18(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  mov    -0x28(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x18(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  mov    -0x28(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x18(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  subl   $0x3,-0x1c(%rbp)
  jmp    L530
L61:
  addq   $0x3,-0x28(%rbp)
L530:
  addl   $0x3,-0x8(%rbp)
  subl   $0x2,-0x20(%rbp)
  jmp    L405
L6:
  cmpl   $0x2,-0x20(%rbp)
  jbe    L254
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xf8,%eax
  cmp    $0xf0,%eax
  jne    L254
  mov    -0x28(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xc0,%eax
  cmp    $0x80,%eax
  jne    L254
  mov    -0x28(%rbp),%rax
  add    $0x2,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xc0,%eax
  cmp    $0x80,%eax
  jne    L254
  mov    -0x28(%rbp),%rax
  add    $0x3,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xc0,%eax
  cmp    $0x80,%eax
  jne    L254
  cmpl   $0x3,-0x1c(%rbp)
  jbe    L204
  mov    -0x28(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x18(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  mov    -0x28(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x18(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  mov    -0x28(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x18(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  mov    -0x28(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x18(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  subl   $0x4,-0x1c(%rbp)
  jmp    L394
L204:
  addq   $0x4,-0x28(%rbp)
L394:
  addl   $0x4,-0x8(%rbp)
  subl   $0x3,-0x20(%rbp)
  jmp    L405
L254:
  cmpl   $0x3,-0x20(%rbp)
  jbe    L236
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xfc,%eax
  cmp    $0xf8,%eax
  jne    L236
  mov    -0x28(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xc0,%eax
  cmp    $0x80,%eax
  jne    L236
  mov    -0x28(%rbp),%rax
  add    $0x2,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xc0,%eax
  cmp    $0x80,%eax
  jne    L236
  mov    -0x28(%rbp),%rax
  add    $0x3,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xc0,%eax
  cmp    $0x80,%eax
  jne    L236
  mov    -0x28(%rbp),%rax
  add    $0x4,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xc0,%eax
  cmp    $0x80,%eax
  jne    L236
  cmpl   $0x4,-0x1c(%rbp)
  jbe    L340
  mov    -0x28(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x18(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  mov    -0x28(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x18(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  mov    -0x28(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x18(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  mov    -0x28(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x18(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  mov    -0x28(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x18(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  subl   $0x5,-0x1c(%rbp)
  jmp    L652
L340:
  addq   $0x5,-0x28(%rbp)
L652:
  addl   $0x5,-0x8(%rbp)
  subl   $0x4,-0x20(%rbp)
  jmp    L405
L236:
  cmpl   $0x4,-0x20(%rbp)
  jbe    L699
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xfe,%eax
  cmp    $0xfc,%eax
  jne    L699
  mov    -0x28(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xc0,%eax
  cmp    $0x80,%eax
  jne    L699
  mov    -0x28(%rbp),%rax
  add    $0x2,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xc0,%eax
  cmp    $0x80,%eax
  jne    L699
  mov    -0x28(%rbp),%rax
  add    $0x3,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xc0,%eax
  cmp    $0x80,%eax
  jne    L699
  mov    -0x28(%rbp),%rax
  add    $0x4,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xc0,%eax
  cmp    $0x80,%eax
  jne    L699
  mov    -0x28(%rbp),%rax
  add    $0x5,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xc0,%eax
  cmp    $0x80,%eax
  jne    L699
  cmpl   $0x5,-0x1c(%rbp)
  jbe    L100
  mov    -0x28(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x18(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  mov    -0x28(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x18(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  mov    -0x28(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x18(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  mov    -0x28(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x18(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  mov    -0x28(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x18(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  mov    -0x28(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x18(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  subl   $0x6,-0x1c(%rbp)
  jmp    L206
L100:
  addq   $0x6,-0x28(%rbp)
L206:
  addl   $0x6,-0x8(%rbp)
  subl   $0x5,-0x20(%rbp)
  jmp    L405
L699:
  mov    $0xffffffff,%eax
  jmp    L765
L405:
  nop
L82:
  mov    -0x20(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,-0x20(%rbp)
  test   %eax,%eax
  jne    L93
  movl   $0x0,-0x4(%rbp)
  jmp    L134
L552:
  cmpl   $0x0,-0x1c(%rbp)
  je     L662
  mov    -0x4(%rbp),%eax
  lea    D35(%rip),%rdx
  movzbl (%rax,%rdx,1),%ecx
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  subl   $0x1,-0x1c(%rbp)
L662:
  addl   $0x1,-0x4(%rbp)
  addl   $0x1,-0x8(%rbp)
L134:
  cmpl   $0x2,-0x4(%rbp)
  jbe    L552
  mov    -0x8(%rbp),%eax
L765:
  pop    %rbp
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D30
datatype: string
name: retrieve_data
arguments: tag: D35
datatype: string

tool: D30: <![CDATA[

tool: D35: ]]>

assistant: ```c
int xmlEncodeCdata(unsigned char *out, unsigned int olen, const unsigned char *in, unsigned int ilen) {
  static const char b[] = "<![CDATA[";
  static const char e[] = "]]>";
  int len;
  unsigned int i;
  len = 0;
  for (i = 0; i < sizeof(b) - 1; i++, len++)
    if (olen > 0) {
      *out++ = b[i];
      olen--;
    }
  for (; ilen--;)
    switch (*in) {
    case 0x00:
    case 0x01:
    case 0x02:
    case 0x03:
    case 0x04:
    case 0x05:
    case 0x06:
    case 0x07:
    case 0x08:
    case 0x0b:
    case 0x0c:
    case 0x0e:
    case 0x0f:
    case 0x10:
    case 0x11:
    case 0x12:
    case 0x13:
    case 0x14:
    case 0x15:
    case 0x16:
    case 0x17:
    case 0x18:
    case 0x19:
    case 0x1a:
    case 0x1b:
    case 0x1c:
    case 0x1d:
    case 0x1e:
    case 0x1f:
    case 0x7f:
      return (-1);
      break;
    case ']':
      if (ilen > 1 && *(in + 1) == ']' && *(in + 2) == '>') {
        if (olen > 0) {
          *out++ = *in;
          olen--;
        }
        in++, len++;
        if (olen > 0) {
          *out++ = *in;
          olen--;
        }
        in++, len++;
        for (i = 0; i < sizeof(e) - 1; i++, len++)
          if (olen > 0) {
            *out++ = e[i];
            olen--;
          }
        for (i = 0; i < sizeof(b) - 1; i++, len++)
          if (olen > 0) {
            *out++ = b[i];
            olen--;
          }
        if (olen > 0) {
          *out++ = *in;
          olen--;
        }
        in++, len++;
        ilen -= 2;
      } else {
        if (olen > 0) {
          *out++ = *in;
          olen--;
        }
        in++, len++;
      }
      break;
    default:
      if ((*in & 0x80) == 0x00) {
        if (olen > 0) {
          *out++ = *in++;
          olen--;
        } else
          in++;
        len++;
      } else if (ilen > 0 && (*in & 0xe0) == 0xc0 && (*(in + 1) & 0xc0) == 0x80) {
        if (olen > 1) {
          *out++ = *in++;
          *out++ = *in++;
          olen -= 2;
        } else
          in += 2;
        len += 2;
        ilen--;
      } else if (ilen > 1 && (*in & 0xf0) == 0xe0 && (*(in + 1) & 0xc0) == 0x80 && (*(in + 2) & 0xc0) == 0x80) {
        if (olen > 2) {
          *out++ = *in++;
          *out++ = *in++;
          *out++ = *in++;
          olen -= 3;
        } else
          in += 3;
        len += 3;
        ilen -= 2;
      } else if (ilen > 2 && (*in & 0xf8) == 0xf0 && (*(in + 1) & 0xc0) == 0x80 && (*(in + 2) & 0xc0) == 0x80 && (*(in + 3) & 0xc0) == 0x80) {
        if (olen > 3) {
          *out++ = *in++;
          *out++ = *in++;
          *out++ = *in++;
          *out++ = *in++;
          olen -= 4;
        } else
          in += 4;
        len += 4;
        ilen -= 3;
      } else if (ilen > 3 && (*in & 0xfc) == 0xf8 && (*(in + 1) & 0xc0) == 0x80 && (*(in + 2) & 0xc0) == 0x80 && (*(in + 3) & 0xc0) == 0x80 && (*(in + 4) & 0xc0) == 0x80) {
        if (olen > 4) {
          *out++ = *in++;
          *out++ = *in++;
          *out++ = *in++;
          *out++ = *in++;
          *out++ = *in++;
          olen -= 5;
        } else
          in += 5;
        len += 5;
        ilen -= 4;
      } else if (ilen > 4 && (*in & 0xfe) == 0xfc && (*(in + 1) & 0xc0) == 0x80 && (*(in + 2) & 0xc0) == 0x80 && (*(in + 3) & 0xc0) == 0x80 && (*(in + 4) & 0xc0) == 0x80 && (*(in + 5) & 0xc0) == 0x80) {
        if (olen > 5) {
          *out++ = *in++;
          *out++ = *in++;
          *out++ = *in++;
          *out++ = *in++;
          *out++ = *in++;
          *out++ = *in++;
          olen -= 6;
        } else
          in += 6;
        len += 6;
        ilen -= 5;
      } else
        return (-1);
      break;
    }
  for (i = 0; i < sizeof(e) - 1; i++, len++)
    if (olen > 0) {
      *out++ = e[i];
      olen--;
    }
  return (len);
}
```