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

```asm
<HA_ExtractTemplateAndLines>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  lea    D1(%rip),%r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x38,%rsp
  mov    %rsi,0x18(%rsp)
  mov    %rdx,0x20(%rsp)
  mov    %rcx,0x28(%rsp)
  jmp    L91
  nop
L10:
  add    $0x1,%ebx
  lea    0x3(%rax),%rdi
L91:
  mov    %r13,%rsi
  call   <strstr@plt>
  test   %rax,%rax
  jne    L10
  sub    $0x1,%ebx
  movslq %ebx,%rdi
  shl    $0x3,%rdi
  call   <malloc@plt>
  mov    %r13,%rsi
  mov    %rbp,%rdi
  mov    %rax,0x8(%rsp)
  call   <strstr@plt>
  movq   $0x0,0x10(%rsp)
  mov    %rax,%r15
  test   %rax,%rax
  je     L92
  mov    %rax,%r14
  sub    %rbp,%r14
  add    $0x1,%r14
  mov    %r14,%rdi
  call   <malloc@plt>
  mov    %r14,%rdx
  mov    %rbp,%rsi
  mov    %rax,%r14
  mov    %rax,%rdi
  mov    %rax,0x10(%rsp)
  call   <my_strlcpy@plt>
  mov    %r14,%rdx
  mov    $0x4,%edi
  xor    %eax,%eax
  lea    D23(%rip),%rsi
  call   <diagnostics@plt>
L92:
  add    $0x3,%r15
  jmp    L42
  nopl   0x0(%rax,%rax,1)
L82:
  add    $0x1,%r15
L42:
  movsbl (%r15),%edi
  call   <isspace@plt>
  test   %rax,%rax
  jne    L82
  test   %ebx,%ebx
  jle    L47
  mov    0x8(%rsp),%r12
  xor    %ebp,%ebp
  nopl   0x0(%rax)
L24:
  mov    %r13,%rsi
  mov    %r15,%rdi
  call   <strstr@plt>
  mov    %rax,%r14
  test   %rax,%rax
  je     L4
  mov    %rax,%rdx
  sub    %r15,%rdx
  add    $0x1,%rdx
  mov    %rdx,%rdi
  mov    %rdx,(%rsp)
  call   <malloc@plt>
  mov    (%rsp),%rdx
  mov    %r15,%rsi
  mov    %rax,(%r12)
  mov    %rax,%rdi
  call   <my_strlcpy@plt>
  mov    (%r12),%rcx
  mov    %ebp,%edx
  mov    $0x4,%edi
  lea    D13(%rip),%rsi
  xor    %eax,%eax
  call   <diagnostics@plt>
L4:
  lea    0x3(%r14),%r15
  jmp    L85
  nopl   0x0(%rax,%rax,1)
L88:
  add    $0x1,%r15
L85:
  movsbl (%r15),%edi
  call   <isspace@plt>
  test   %rax,%rax
  jne    L88
  add    $0x1,%ebp
  add    $0x8,%r12
  cmp    %ebp,%ebx
  jne    L24
L47:
  mov    0x28(%rsp),%rax
  mov    0x8(%rsp),%rcx
  mov    %ebx,(%rax)
  mov    0x20(%rsp),%rax
  mov    %rcx,(%rax)
  mov    0x18(%rsp),%rax
  mov    0x10(%rsp),%rcx
  mov    %rcx,(%rax)
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: retrieve_data
arguments: data_tag: D1
type_guessed: string
name: retrieve_data
arguments: data_tag: D23
type_guessed: string
name: retrieve_data
arguments: data_tag: D13
type_guessed: string

tool: D1: \cr

tool: D23: HA_template = '%s'

tool: D13: line[%2d] = '%s'

assistant: ```c
void HA_ExtractTemplateAndLines(const char *s, char **thetemplate, char ***thelines, int *nl) {
  char *p, *ss, *HA_template = NULL;
  char **lines;
  int nlines, i;
  ss = (char *)s;
  nlines = 0;
  while ((p = strstr(ss, "\\cr"))) {
    nlines++;
    ss = p + 3;
  }
  nlines--;
  lines = (char **)malloc(nlines * sizeof(char *));
  p = strstr(s, "\\cr");
  if (p) {
    size_t n = p - s + 1;
    HA_template = (char *)malloc(n * sizeof(char));
    my_strlcpy(HA_template, s, n);
    diagnostics(4, "HA_template = '%s'", HA_template);
  }
  ss = p + 3;
  while (isspace(*ss))
    ss++;
  for (i = 0; i < nlines; i++) {
    p = strstr(ss, "\\cr");
    if (p) {
      size_t n = p - ss + 1;
      lines[i] = (char *)malloc(n * sizeof(char));
      my_strlcpy(lines[i], ss, n);
      diagnostics(4, "line[%2d] = '%s'", i, lines[i]);
    }
    ss = p + 3;
    while (isspace(*ss))
      ss++;
  }
  *nl = nlines;
  *thelines = lines;
  *thetemplate = HA_template;
}
```