user: Translate the below assembly code into C programming language:

```asm
<mn_encode>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    %ecx,-0x30(%rbp)
  mov    %r8,-0x40(%rbp)
  mov    -0x30(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x40(%rbp)
  je     L169
  mov    -0x40(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L32
L169:
  lea    D1(%rip),%rax
  mov    %rax,-0x40(%rbp)
L32:
  mov    -0x40(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  movl   $0x0,-0x1c(%rbp)
  jmp    L98
L234:
  mov    -0x18(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x38(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x38(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
L72:
  mov    -0x38(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  jae    L153
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L153
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isletter@plt>
  test   %rax,%rax
  je     L234
L153:
  mov    -0x38(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  jb     L46
  mov    $0xfffffffe,%eax
  jmp    L222
L46:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L231
  mov    -0x18(%rbp),%rax
  sub    $0x1,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isletter@plt>
  test   %rax,%rax
  je     L57
  mov    -0x40(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isletter@plt>
  test   %rax,%rax
  je     L57
  mov    $0xfffffff8,%eax
  jmp    L222
L57:
  mov    -0x40(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  jmp    L60
L134:
  mov    -0x18(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x38(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x38(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
L60:
  mov    -0x38(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  jae    L268
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L268
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isletter@plt>
  test   %rax,%rax
  je     L134
L268:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isletter@plt>
  test   %rax,%rax
  jne    L231
  mov    $0xfffffff8,%eax
  jmp    L222
L231:
  mov    -0x1c(%rbp),%edx
  mov    -0x2c(%rbp),%ecx
  mov    -0x28(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <mn_encode_word@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L107
  mov    $0xfffffffe,%eax
  jmp    L222
L135:
  addq   $0x1,-0x18(%rbp)
L107:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isletter@plt>
  test   %rax,%rax
  jne    L135
  jmp    L116
L220:
  mov    -0x10(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x38(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x38(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
L116:
  mov    -0x38(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  jae    L84
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L220
L84:
  addl   $0x1,-0x1c(%rbp)
L98:
  mov    -0x2c(%rbp),%eax
  mov    %eax,%edi
  call   <mn_words_required@plt>
  cmp    %eax,-0x1c(%rbp)
  jl     L72
  mov    -0x38(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  jae    L115
  mov    -0x38(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x38(%rbp)
  movb   $0x0,(%rax)
  mov    $0x0,%eax
  jmp    L222
L115:
  mov    $0xfffffffe,%eax
L222:
  leave
  ret
```

tool_calls: name: unpack_data
arguments: data_label: D1
datatype: string

tool: D1: 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;
}
```