user: What is the c source code of the assembly code below?

```asm
<mn_encode>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,(%rsp)
  mov    %esi,%r15d
  mov    %rdx,%rbx
  movslq %ecx,%rcx
  lea    (%rdx,%rcx,1),%r13
  test   %r8,%r8
  je     L150
  cmpb   $0x0,(%r8)
  lea    D4(%rip),%rax
  cmovne %r8,%rax
  mov    %rax,0x8(%rsp)
L108:
  mov    0x8(%rsp),%rbp
  mov    $0x0,%r14d
  jmp    L292
L150:
  lea    D4(%rip),%rax
  mov    %rax,0x8(%rsp)
  jmp    L108
L287:
  cmp    %rbx,%r13
  jbe    L178
  cmpb   $0x0,0x0(%rbp)
  je     L288
L250:
  mov    %r14d,%edx
  mov    %r15d,%esi
  mov    (%rsp),%rdi
  call   <mn_encode_word@plt>
  mov    %rax,%r12
  test   %rax,%rax
  jne    L164
  mov    $0xfffffffe,%eax
  jmp    L28
L315:
  mov    0x8(%rsp),%rax
  movsbl (%rax),%edi
  call   <isletter@plt>
  test   %rax,%rax
  jne    L27
  mov    0x8(%rsp),%rbp
  cmp    %rbx,%r13
  ja     L215
  jmp    L8
L144:
  add    $0x1,%rbp
L164:
  movsbl 0x0(%rbp),%edi
  call   <isletter@plt>
  test   %rax,%rax
  jne    L144
  cmp    %r13,%rbx
  jae    L271
L5:
  movzbl (%r12),%eax
  test   %al,%al
  je     L271
  add    $0x1,%r12
  add    $0x1,%rbx
  mov    %al,-0x1(%rbx)
  cmp    %rbx,%r13
  jne    L5
  mov    %r13,%rbx
L271:
  add    $0x1,%r14d
L292:
  mov    %r15d,%edi
  call   <mn_words_required@plt>
  cmp    %r14d,%eax
  jle    L184
  cmp    %r13,%rbx
  jae    L138
L111:
  movzbl 0x0(%rbp),%edi
  test   %dil,%dil
  je     L141
  movsbl %dil,%edi
  call   <isletter@plt>
  test   %rax,%rax
  jne    L287
  add    $0x1,%rbp
  add    $0x1,%rbx
  movzbl -0x1(%rbp),%eax
  mov    %al,-0x1(%rbx)
  cmp    %rbx,%r13
  jne    L111
L138:
  mov    $0xfffffffe,%eax
  jmp    L28
L184:
  cmp    %r13,%rbx
  jae    L6
  movb   $0x0,(%rbx)
  mov    $0x0,%eax
L28:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L178:
  mov    $0xfffffffe,%eax
  jmp    L28
L27:
  mov    $0xfffffff8,%eax
  jmp    L28
L6:
  mov    $0xfffffffe,%eax
  jmp    L28
L281:
  mov    $0xfffffffe,%eax
  jmp    L28
L141:
  cmp    %rbx,%r13
  jbe    L281
L288:
  movsbl -0x1(%rbp),%edi
  call   <isletter@plt>
  test   %rax,%rax
  jne    L315
L215:
  mov    0x8(%rsp),%rbp
L11:
  movzbl 0x0(%rbp),%edi
  test   %dil,%dil
  je     L8
  movsbl %dil,%edi
  call   <isletter@plt>
  test   %rax,%rax
  jne    L8
  add    $0x1,%rbp
  add    $0x1,%rbx
  movzbl -0x1(%rbp),%eax
  mov    %al,-0x1(%rbx)
  cmp    %rbx,%r13
  jne    L11
  mov    %r13,%rbx
L8:
  movsbl 0x0(%rbp),%edi
  call   <isletter@plt>
  test   %rax,%rax
  jne    L250
  mov    $0xfffffff8,%eax
  jmp    L28
```

tool_calls: name: unpack_data
arguments: data_tag: D4
type: string

tool: D4: x-x-x--

assistant: ```c
int mn_encode(void *src, int srcsize, char *dest, int destsize, char *format) {
  int n;
  char *fmt;
  char *destend = dest + destsize;
  const char *word;
  if (format == 0 || format[0] == '\0')
    format = "x-x-x--";
  fmt = format;
  for (n = 0; n < mn_words_required(srcsize); n++) {
    while (dest < destend && *fmt != '\0' && !isletter(*fmt))
      *dest++ = *fmt++;
    if (dest >= destend)
      return -2;
    if (*fmt == '\0') {
      if (isletter(fmt[-1]) && isletter(format[0]))
        return -8;
      fmt = format;
      while (dest < destend && *fmt != '\0' && !isletter(*fmt))
        *dest++ = *fmt++;
      if (!isletter(*fmt))
        return -8;
    }
    word = mn_encode_word(src, srcsize, n);
    if (word == 0)
      return -2;
    while (isletter(*fmt))
      fmt++;
    while (dest < destend && *word != '\0')
      *dest++ = *word++;
  }
  if (dest < destend)
    *dest++ = '\0';
  else
    return -2;
  return 0;
}
```