user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<rabin_karp_search>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %edx,-0x34(%rbp)
  mov    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x8(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x4(%rbp)
  movl   $0x0,-0x1c(%rbp)
  movl   $0x0,-0x18(%rbp)
  movl   $0x1,-0x14(%rbp)
  movl   $0x0,-0x10(%rbp)
  jmp    L18
L33:
  mov    -0x14(%rbp),%eax
  shl    $0x8,%eax
  cltd
  idivl  -0x34(%rbp)
  mov    %edx,-0x14(%rbp)
  addl   $0x1,-0x10(%rbp)
L18:
  mov    -0x4(%rbp),%eax
  sub    $0x1,%eax
  cmp    %eax,-0x10(%rbp)
  jl     L33
  movl   $0x0,-0x10(%rbp)
  jmp    L93
L31:
  mov    -0x1c(%rbp),%eax
  shl    $0x8,%eax
  mov    %eax,%ecx
  mov    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  add    %ecx,%eax
  cltd
  idivl  -0x34(%rbp)
  mov    %edx,-0x1c(%rbp)
  mov    -0x18(%rbp),%eax
  shl    $0x8,%eax
  mov    %eax,%ecx
  mov    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  add    %ecx,%eax
  cltd
  idivl  -0x34(%rbp)
  mov    %edx,-0x18(%rbp)
  addl   $0x1,-0x10(%rbp)
L93:
  mov    -0x10(%rbp),%eax
  cmp    -0x4(%rbp),%eax
  jl     L31
  movl   $0x0,-0xc(%rbp)
  jmp    L21
L78:
  mov    -0x1c(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  jne    L72
  mov    -0x4(%rbp),%ecx
  mov    -0xc(%rbp),%edx
  mov    -0x30(%rbp),%rsi
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <is_str_equal@plt>
  test   %rax,%rax
  je     L72
  mov    -0xc(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,%esi
  lea    D7(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
L72:
  mov    -0x8(%rbp),%eax
  sub    -0x4(%rbp),%eax
  cmp    %eax,-0xc(%rbp)
  jge    L87
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  imul   -0x14(%rbp),%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%eax
  sub    %edx,%eax
  shl    $0x8,%eax
  mov    %eax,%ecx
  mov    -0xc(%rbp),%edx
  mov    -0x4(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  add    %ecx,%eax
  cltd
  idivl  -0x34(%rbp)
  mov    %edx,-0x18(%rbp)
  cmpl   $0x0,-0x18(%rbp)
  jns    L87
  mov    -0x34(%rbp),%eax
  add    %eax,-0x18(%rbp)
L87:
  addl   $0x1,-0xc(%rbp)
L21:
  mov    -0x8(%rbp),%eax
  sub    -0x4(%rbp),%eax
  cmp    %eax,-0xc(%rbp)
  jl     L78
  nop
  nop
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D7
type_guessed: string

tool: D7: String found at location: %d


assistant: ```c
void rabin_karp_search(char pat[], char txt[], int q) {
  int n = strlen(txt);
  int m = strlen(pat);
  int p = 0;
  int t = 0;
  int h = 1;
  int i, s;
  for (i = 0; i < m - 1; i++) {
    h = (h * 256) % q;
  }
  for (i = 0; i < m; i++) {
    p = (256 * p + pat[i]) % q;
    t = (256 * t + txt[i]) % q;
  }
  for (s = 0; s < n - m; s++) {
    if ((p == t) && (is_str_equal(pat, txt, s, m))) {
      printf("String found at location: %d\n", s + 1);
    }
    if (s < n - m) {
      t = (256 * (t - txt[s] * h) + txt[s + m]) % q;
      if (t < 0)
        t += q;
    }
  }
}
```