user: 请将以下的汇编代码转换成C语言代码:

```asm
<readText>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %edx,-0x34(%rbp)
  mov    $0x29,%edi
  call   <malloc@plt>
  mov    %rax,-0x10(%rbp)
  movl   $0x0,-0x18(%rbp)
  mov    $0x28,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rsi
  lea    D2(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <stringLength@plt>
  mov    %eax,-0x14(%rbp)
  jmp    L6
L8:
  mov    -0x18(%rbp),%edx
  mov    -0x14(%rbp),%eax
  add    %edx,%eax
  cmp    $0x28,%eax
  jg     L41
  mov    -0x18(%rbp),%edx
  mov    -0x8(%rbp),%rcx
  mov    -0x10(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <copyString@plt>
  mov    -0x14(%rbp),%eax
  add    %eax,-0x18(%rbp)
  cmpl   $0x28,-0x18(%rbp)
  je     L14
  mov    -0x18(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  movb   $0x20,(%rax)
  addl   $0x1,-0x18(%rbp)
  jmp    L14
L41:
  mov    -0x18(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x30(%rbp),%rax
  mov    (%rax),%eax
  lea    0x1(%rax),%ecx
  mov    -0x30(%rbp),%rdx
  mov    %ecx,(%rdx)
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rax,%rdx
  mov    -0x10(%rbp),%rax
  mov    %rax,(%rdx)
  mov    -0x30(%rbp),%rax
  mov    (%rax),%eax
  add    $0x1,%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edx
  mov    -0x28(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <realloc@plt>
  mov    %rax,-0x28(%rbp)
  mov    $0x29,%edi
  call   <malloc@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x8(%rbp),%rcx
  mov    -0x10(%rbp),%rax
  mov    $0x0,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <copyString@plt>
  mov    -0x14(%rbp),%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x18(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  movb   $0x20,(%rax)
  addl   $0x1,-0x18(%rbp)
L14:
  mov    -0x8(%rbp),%rax
  mov    %rax,%rsi
  lea    D2(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <stringLength@plt>
  mov    %eax,-0x14(%rbp)
L6:
  mov    -0x8(%rbp),%rax
  lea    D29(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L8
  mov    -0x30(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x34(%rbp),%ecx
  mov    -0x28(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <printText@plt>
  nop
  leave
  ret
```

tool_calls: name: read_data
arguments: data_tag: D2
datatype: string
name: read_data
arguments: data_tag: D29
datatype: string

tool: D2: %s

tool: D29: xxx

assistant: ```c
void readText(char **text, int *lines, int columns) {
  char *line = malloc(sizeof(char) * 41);
  int charIndex = 0;
  char *word = malloc(sizeof(char) * 40);
  scanf("%s", word);
  int length = stringLength(word);
  while (strcmp(word, "xxx") != 0) {
    if (charIndex + length <= 40) {
      copyString(line, word, charIndex);
      charIndex += length;
      if (charIndex != 40) {
        *(line + charIndex) = ' ';
        charIndex++;
      }
    } else {
      *(line + charIndex) = '\0';
      *(text + (*lines)++) = line;
      text = realloc(text, sizeof(char *) * (*lines + 1));
      line = malloc(sizeof(char) * 41);
      copyString(line, word, 0);
      charIndex = length;
      *(line + charIndex) = ' ';
      charIndex++;
    }
    scanf("%s", word);
    length = stringLength(word);
  }
  printText(text, columns, *lines);
}
```