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

```asm
<morse2text>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdi,%r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x28,%rsp
  mov    %rdi,0x10(%rsp)
  mov    %rsi,%rdi
  call   <strlen@plt>
  lea    0x1(%rax),%r13d
  mov    %rax,%rbp
  mov    %r13d,%edi
  call   <malloc@plt>
  mov    $0x6,%edi
  mov    %rax,%r12
  call   <malloc@plt>
  mov    %r13d,%edi
  mov    %rax,%r15
  call   <malloc@plt>
  lea    D1(%rip),%rsi
  mov    %rax,(%r14)
  mov    %rax,%rdi
  call   <strcpy@plt>
  test   %ebp,%ebp
  jle    L149
  lea    -0x1(%rbp),%eax
  mov    %rbx,%rsi
  xor    %edx,%edx
  lea    0x1(%rbx,%rax,1),%rdi
  nopl   0x0(%rax,%rax,1)
L68:
  movzbl (%rsi),%eax
  lea    -0x2d(%rax),%ecx
  cmp    $0x2,%cl
  jbe    L29
  cmp    $0x20,%al
  jne    L99
L29:
  movslq %edx,%rcx
  add    $0x1,%edx
  mov    %al,(%r12,%rcx,1)
L99:
  add    $0x1,%rsi
  cmp    %rsi,%rdi
  jne    L68
  movslq %edx,%rdx
  add    %r12,%rdx
L134:
  movb   $0x0,(%rdx)
  mov    %r12,%rdi
  call   <strlen@plt>
  test   %eax,%eax
  jle    L62
  lea    -0x1(%rax),%ebp
  lea    0x1(%r12),%rax
  xor    %r13d,%r13d
  xor    %esi,%esi
  mov    %rax,0x18(%rsp)
  lea    D26(%rip),%r14
  jmp    L77
  xchg   %ax,%ax
L48:
  lea    0x1(%r13),%rax
  cmp    %r13,%rbp
  je     L62
L4:
  mov    %rax,%r13
L77:
  mov    %r13d,%edx
  lea    0x1(%r13),%ebx
  testb  $0xdf,0x1(%r12,%r13,1)
  jne    L48
  cmp    %r13d,%esi
  jg     L25
  movslq %esi,%rdi
  sub    %esi,%edx
  xor    %esi,%esi
  lea    (%r12,%rdi,1),%rax
  add    0x18(%rsp),%rdi
  add    %rdx,%rdi
  nopl   0x0(%rax,%rax,1)
L153:
  movzbl (%rax),%edx
  test   $0xdf,%dl
  je     L107
  movslq %esi,%r10
  add    $0x1,%esi
  mov    %dl,(%r15,%r10,1)
L107:
  add    $0x1,%rax
  cmp    %rdi,%rax
  jne    L153
  movslq %esi,%rsi
  add    %r15,%rsi
L50:
  movb   $0x0,(%rsi)
  mov    %r15,%rdi
  mov    %r14,%rsi
  call   <strcmp@plt>
  mov    $0x20,%edx
  test   %rax,%rax
  jne    L1
L118:
  mov    0x10(%rsp),%rax
  mov    %edx,0xc(%rsp)
  mov    (%rax),%rdi
  mov    %rdi,(%rsp)
  call   <strlen@plt>
  mov    (%rsp),%rdi
  mov    0xc(%rsp),%edx
  lea    D4(%rip),%rsi
  add    %rax,%rdi
  call   <sprintf@plt>
  mov    %ebx,%esi
  lea    0x1(%r13),%rax
  cmp    %r13,%rbp
  jne    L4
L62:
  mov    %r12,%rdi
  call   <free@plt>
  test   %r15,%r15
  je     L94
  add    $0x28,%rsp
  mov    %r15,%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    10b0 <free@plt>
  nopw   0x0(%rax,%rax,1)
L1:
  mov    %r15,%rdi
  call   <word2ascii@plt>
  movsbl %al,%edx
  jmp    L118
  nopl   (%rax)
L94:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nop
L25:
  mov    %r15,%rsi
  jmp    L50
L149:
  mov    %r12,%rdx
  jmp    L134
```

tool_calls: name: read_data
arguments: label: D1
data_type: string
name: read_data
arguments: label: D26
data_type: string
name: read_data
arguments: label: D4
data_type: string

tool: 

tool: D26: /

tool: D4: %c

assistant: ```c
void morse2text(char **text, char *morse) {
  int rc = 0, counter = 0, start = 0, finish = 0, i = 0, j = 0, k = 0, l = 0;
  size_t length = 0, total = 0;
  char chr, ascii;
  char *clean_morse = NULL, *word = NULL;
  length = strlen(morse);
  clean_morse = malloc(sizeof(char) * length + 1);
  word = malloc(sizeof(char) * 5 + 1);
  *text = malloc(sizeof(char) * length + 1);
  strcpy(*text, "");
  for (i = 0, l = (int)length; i < l; i++) {
    chr = morse[i];
    if (chr == '.' || chr == '-' || chr == ' ' || chr == '/') {
      clean_morse[counter++] = chr;
    }
  }
  clean_morse[counter] = '\0';
  length = strlen(clean_morse);
  counter = 0;
  start = 0;
  finish = 0;
  for (i = 0, j = (int)length; i < j; i++) {
    if (clean_morse[i + 1] != ' ' && clean_morse[i + 1] != '\0') {
      finish++;
    } else {
      counter = 0;
      for (k = start, l = finish + 1; k < l; k++) {
        if (clean_morse[k] != ' ' && clean_morse[k] != '\0') {
          word[counter++] = clean_morse[k];
        }
      }
      word[counter] = '\0';
      if (strcmp(word, "/") == 0) {
        ascii = ' ';
      } else {
        ascii = word2ascii(word);
      }
      total = strlen(*text);
      sprintf(*text + total, "%c", ascii);
      start = finish + 1;
      finish = start;
    }
  }
  if (clean_morse) {
    free(clean_morse);
  }
  if (word) {
    free(word);
  }
  if (rc) {
    exit(EXIT_FAILURE);
  }
}
```