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

```asm
<longest_substring>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  mov    %rdi,%r15
  push   %r14
  push   %r13
  push   %r12
  movslq %esi,%r12
  push   %rbx
  lea    0x0(,%r12,4),%edi
  mov    %r12,%rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  call   <malloc@plt>
  mov    %rax,%r13
  test   %r12d,%r12d
  jle    L136
  lea    0x0(,%r12,4),%rdx
  mov    $0xff,%esi
  mov    %rax,%rdi
  call   <memset@plt>
L136:
  mov    %r13,%rdx
  mov    %ebx,%esi
  lea    -0x1(%rbx),%r14d
  mov    %r15,%rdi
  call   <buildSuffixArray@plt>
  movslq %r14d,%rax
  mov    %rsp,%rcx
  lea    0xf(,%rax,4),%rax
  mov    %rax,%rdx
  and    $0xfffffffffffff000,%rax
  sub    %rax,%rcx
  and    $0xfffffffffffffff0,%rdx
  cmp    %rcx,%rsp
  je     L130
L189:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rcx,%rsp
  jne    L189
L130:
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  jne    L178
L23:
  mov    %rsp,%r12
  mov    %ebx,%ecx
  mov    %r13,%rdx
  mov    %r15,%rdi
  mov    %r12,%rsi
  call   <kasai_lcp@plt>
  test   %r14d,%r14d
  jle    L55
  lea    -0x2(%rbx),%esi
  xor    %eax,%eax
  mov    $0xffffffff,%ecx
  mov    $0xffffffffffffffff,%rdi
  jmp    L113
  nopl   0x0(%rax)
L191:
  mov    %rdx,%rax
L113:
  mov    (%r12,%rax,4),%edx
  cmp    %ecx,%edx
  jle    L127
  movslq %eax,%rdi
  mov    %edx,%ecx
L127:
  lea    0x1(%rax),%rdx
  cmp    %rsi,%rax
  jne    L191
  mov    0x0(%r13,%rdi,4),%ebx
  test   %ecx,%ecx
  jne    L36
  lea    D21(%rip),%rdi
  call   <puts@plt>
L110:
  mov    %r13,%rdi
  call   <free@plt>
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L42
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L36:
  lea    -0x1(%rcx,%rbx,1),%eax
  mov    %eax,-0x44(%rbp)
  sub    %ebx,%eax
  cltq
L91:
  add    $0xf,%rax
  mov    %rsp,%rcx
  mov    %rsp,-0x50(%rbp)
  mov    %rax,%rdx
  and    $0xfffffffffffff000,%rax
  sub    %rax,%rcx
  and    $0xfffffffffffffff0,%rdx
  cmp    %rcx,%rsp
  je     L86
L17:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rcx,%rsp
  jne    L17
L86:
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  je     L134
  orq    $0x0,-0x8(%rsp,%rdx,1)
L134:
  movslq %ebx,%rax
  lea    D30(%rip),%rsi
  mov    %rsp,%rdi
  mov    %rsp,%r12
  movsbl (%r15,%rax,1),%edx
  call   <sprintf@plt>
  lea    0x1(%rbx),%eax
  lea    -0x3a(%rbp),%rbx
  movslq %eax,%r14
  cmp    -0x44(%rbp),%eax
  jg     L196
  nopl   (%rax)
L92:
  movsbl (%r15,%r14,1),%edx
  lea    D30(%rip),%rsi
  mov    %rbx,%rdi
  add    $0x1,%r14
  call   <sprintf@plt>
  mov    %rbx,%rsi
  mov    %r12,%rdi
  call   <strcat@plt>
  cmp    %r14d,-0x44(%rbp)
  jge    L92
L196:
  xor    %r14d,%r14d
  jmp    L149
  xchg   %ax,%ax
L174:
  add    $0x1,%r14d
  lea    0x1(%rax),%r15
L149:
  mov    %r12,%rsi
  mov    %r15,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  jne    L174
  mov    %r14d,%edx
  mov    %r12,%rsi
  lea    D11(%rip),%rdi
  call   <printf@plt>
  mov    -0x50(%rbp),%rsp
  jmp    L110
  nopl   0x0(%rax,%rax,1)
L178:
  orq    $0x0,-0x8(%rsp,%rdx,1)
  jmp    L23
L55:
  mov    -0x4(%r13),%ebx
  lea    -0x2(%rbx),%eax
  mov    %eax,-0x44(%rbp)
  mov    $0xfffffffffffffffe,%rax
  jmp    L91
L42:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D21
type_guessed: string
name: extract_symbolic_data
arguments: data_tag: D30
type_guessed: string
name: extract_symbolic_data
arguments: data_tag: D11
type_guessed: string

tool: D21: No repetitions found!

tool: D30: %c

tool: D11: %s %d


assistant: ```c
void longest_substring(char *string, int len) {
  int i;
  int *suffArr = malloc(sizeof(int) * len);
  for (i = 0; i < len; i++) {
    suffArr[i] = -1;
  }
  buildSuffixArray(string, len, suffArr);
  int lcp_len = len - 1;
  int lcp[lcp_len];
  kasai_lcp(string, lcp, suffArr, len);
  int max_val = -1;
  int max_i = -1;
  for (i = 0; i < lcp_len; i++) {
    if (lcp[i] > max_val) {
      max_val = lcp[i];
      max_i = i;
    }
  }
  int start_idx = suffArr[max_i];
  int end_idx = suffArr[max_i] + max_val - 1;
  int sub_len = end_idx - start_idx;
  if (max_val == 0) {
    printf("No repetitions found!\n");
  } else {
    char substring[sub_len];
    char temp[2];
    sprintf(substring, "%c", string[start_idx]);
    for (i = start_idx + 1; i < end_idx + 1; i++) {
      sprintf(temp, "%c", string[i]);
      strcat(substring, temp);
    }
    int count = 0;
    const char *tmp = string;
    while (tmp = strstr(tmp, substring)) {
      count++;
      tmp++;
    }
    printf("%s %d\n", substring, count);
  }
  free(suffArr);
  return;
}
```