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

```asm
<searchLoop>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    %rcx,-0x40(%rbp)
  mov    %r8,-0x48(%rbp)
  mov    -0x40(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  movq   $0x0,-0x10(%rbp)
  movq   $0x0,-0x8(%rbp)
  mov    -0x38(%rbp),%rax
  mov    $0x0,%edx
  divq   -0x48(%rbp)
  mov    %rdx,%rax
  add    %rax,-0x38(%rbp)
  jmp    L16
L47:
  mov    -0x38(%rbp),%rcx
  mov    %rcx,%rax
  shr    $0x3,%rax
  movabs $0x20c49ba5e353f7cf,%rdx
  mul    %rdx
  mov    %rdx,%rax
  shr    $0x4,%rax
  imul   $0x3e8,%rax,%rdx
  mov    %rcx,%rax
  sub    %rdx,%rax
  test   %rax,%rax
  jne    L139
  mov    -0x18(%rbp),%rdx
  mov    -0x38(%rbp),%rax
  mov    %rax,%rsi
  lea    D14(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L139:
  mov    -0x38(%rbp),%rax
  mov    $0x0,%edx
  divq   -0x48(%rbp)
  mov    %rdx,%rax
  test   %rax,%rax
  sete   %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <assert@plt>
  mov    -0x40(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x38(%rbp),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x8(%rbp)
  movq   $0x0,-0x10(%rbp)
  jmp    L110
L72:
  mov    -0x28(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  lea    (%rdx,%rax,1),%rsi
  mov    -0x28(%rbp),%rdx
  mov    -0x38(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdx
  mov    %rcx,%rdi
  call   <memcmp@plt>
  test   %eax,%eax
  jne    L2
  jmp    L141
L143:
  mov    -0x48(%rbp),%rax
  add    %rax,-0x18(%rbp)
L141:
  mov    -0x8(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  cmp    %rax,-0x30(%rbp)
  jbe    L34
  mov    -0x38(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  cmp    %rax,-0x8(%rbp)
  jbe    L34
  mov    -0x8(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rax,%rdx
  mov    -0x28(%rbp),%rax
  lea    (%rdx,%rax,1),%rsi
  mov    -0x38(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rax,%rdx
  mov    -0x28(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x48(%rbp),%rax
  mov    %rax,%rdx
  mov    %rcx,%rdi
  call   <memcmp@plt>
  test   %eax,%eax
  je     L143
L34:
  mov    -0x38(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  cmp    %rax,-0x8(%rbp)
  je     L84
  mov    -0x8(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  cmp    %rax,-0x30(%rbp)
  jne    L56
L84:
  mov    -0x8(%rbp),%rcx
  mov    -0x18(%rbp),%rdx
  mov    -0x38(%rbp),%rax
  mov    %rax,%rsi
  lea    D8(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  shlq   -0x18(%rbp)
  mov    -0x10(%rbp),%rax
  add    %rax,-0x8(%rbp)
  jmp    L110
L56:
  mov    -0x8(%rbp),%rcx
  mov    -0x38(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rax,%rsi
  lea    D39(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x8(%rbp),%rax
  sub    -0x38(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x10(%rbp),%rax
  add    %rax,-0x8(%rbp)
  jmp    L110
L2:
  mov    -0x48(%rbp),%rax
  add    %rax,-0x8(%rbp)
L110:
  mov    -0x30(%rbp),%rax
  sub    -0x18(%rbp),%rax
  cmp    %rax,-0x8(%rbp)
  jb     L72
  cmpq   $0x0,-0x10(%rbp)
  je     L158
  mov    -0x10(%rbp),%rax
  add    %rax,-0x38(%rbp)
  jmp    L16
L158:
  mov    -0x48(%rbp),%rax
  add    %rax,-0x38(%rbp)
L16:
  mov    -0x30(%rbp),%rax
  sub    -0x18(%rbp),%rax
  cmp    %rax,-0x38(%rbp)
  jb     L47
  lea    D22(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  nop
  leave
  ret
```

tool_calls: name: parse_data
arguments: tag: D14
type_guessed: string
name: parse_data
arguments: tag: D8
type_guessed: string
name: parse_data
arguments: tag: D39
type_guessed: string
name: parse_data
arguments: tag: D22
type_guessed: string

tool: D14: approaching startpos %d with samplesize %d


tool: D8: (possible) loop found at offset %d, length %d, repeats at %d!


tool: D39: match of length %d found at %d and %d


tool: D22: no loops found :-/

assistant: ```c
void searchLoop(char *buf, size_t bufsize, size_t startpos, size_t minsize, size_t blocksize) {
  size_t samplesize = minsize;
  size_t save = 0;
  size_t scanpos = 0;
  startpos += startpos % blocksize;
  while (startpos < bufsize - samplesize) {
    if (startpos % 1000 == 0)
      printf("approaching startpos %d with samplesize %d\n", startpos, samplesize);
    assert(startpos % blocksize == 0);
    samplesize = minsize;
    scanpos = startpos + minsize;
    save = 0;
    while (scanpos < bufsize - samplesize) {
      if (!memcmp(buf + startpos, buf + scanpos, samplesize)) {
        while (scanpos + samplesize < bufsize && startpos + samplesize < scanpos && !memcmp(buf + startpos + samplesize, buf + scanpos + samplesize, blocksize))
          samplesize += blocksize;
        if (startpos + samplesize == scanpos || scanpos + samplesize == bufsize) {
          printf("(possible) loop found at offset %d, length %d, repeats at %d!\n", startpos, samplesize, scanpos);
          save = samplesize;
          samplesize *= 2;
          scanpos += save;
        } else {
          printf("match of length %d found at %d and %d\n", samplesize, startpos, scanpos);
          save = samplesize;
          samplesize = scanpos - startpos;
          scanpos += save;
        }
      } else
        scanpos += blocksize;
    }
    if (save)
      startpos += save;
    else
      startpos += blocksize;
  }
  printf("no loops found :-/\n");
}
```