user: 请从给定的汇编指令推导出C源代码:

```asm
<KnuthMorrisPratt>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,%r15
  mov    %rsi,%rbx
  mov    %edx,-0x44(%rbp)
  mov    %ecx,-0x48(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  cmp    %ecx,%edx
  setl   %r12b
  cmpb   $0x0,(%rdi)
  je     L236
  test   %r12b,%r12b
  je     L49
L236:
  lea    D35(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  cmpb   $0x0,(%r15)
  je     L71
  test   %r12b,%r12b
  je     L49
L71:
  lea    D35(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L49:
  cmpb   $0x0,(%rbx)
  je     L143
  cmpl   $0x0,-0x48(%rbp)
  jne    L181
L143:
  lea    D11(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L181:
  mov    -0x48(%rbp),%eax
  add    $0x1,%eax
  cltq
  lea    0xf(,%rax,4),%rax
  mov    %rax,%rcx
  and    $0xfffffffffffffff0,%rcx
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%rdx
  sub    %rax,%rdx
L182:
  cmp    %rdx,%rsp
  je     L23
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L182
L23:
  mov    %rcx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  je     L206
  orq    $0x0,-0x8(%rsp,%rax,1)
L206:
  mov    %rsp,%r12
  mov    -0x48(%rbp),%edi
  test   %edi,%edi
  js     L258
  mov    %r12,%rax
  lea    0x1(%rdi),%edx
  lea    (%r12,%rdx,4),%rdx
L60:
  movl   $0x0,(%rax)
  add    $0x4,%rax
  cmp    %rdx,%rax
  jne    L60
L258:
  mov    -0x48(%rbp),%eax
  cmp    $0x1,%eax
  jle    L22
  lea    0x1(%rax),%edi
  mov    $0x2,%esi
  jmp    L241
L67:
  add    $0x1,%eax
  mov    %eax,(%r12,%rsi,4)
L124:
  add    $0x1,%rsi
  cmp    %rsi,%rdi
  je     L22
L241:
  mov    (%r12,%rsi,4),%eax
  test   %eax,%eax
  jle    L246
  movzbl -0x1(%rbx,%rsi,1),%ecx
L66:
  movslq %eax,%rdx
  cmp    %cl,(%rbx,%rdx,1)
  je     L67
  cltq
  mov    (%r12,%rax,4),%eax
  test   %eax,%eax
  jg     L66
L246:
  movslq %eax,%rdx
  movzbl -0x1(%rbx,%rsi,1),%ecx
  cmp    %cl,(%rbx,%rdx,1)
  jne    L124
  jmp    L67
L22:
  cmpl   $0x0,-0x44(%rbp)
  jle    L30
  mov    $0x0,%r14d
  mov    $0x0,%r13d
  jmp    L185
L183:
  add    $0x1,%r14d
  cmp    %r14d,-0x48(%rbp)
  jne    L56
  mov    %r13d,%esi
  sub    %r14d,%esi
  add    $0x1,%esi
  lea    D25(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L56
L93:
  movslq %r14d,%r14
  mov    (%r12,%r14,4),%r14d
  sub    $0x1,%r13d
L56:
  add    $0x1,%r13d
  cmp    %r13d,-0x44(%rbp)
  jle    L30
L185:
  movslq %r13d,%rax
  movslq %r14d,%rdx
  movzbl (%rbx,%rdx,1),%edi
  cmp    %dil,(%r15,%rax,1)
  je     L183
  test   %r14d,%r14d
  jg     L93
  jmp    L56
L30:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L270
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L270:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: tag: D35
datatype: string
name: retrieve_data
arguments: tag: D11
datatype: string
name: retrieve_data
arguments: tag: D25
datatype: string

tool: D35: Pattern is not found

tool: D11: Pattern with shift 0

tool: D25: Pattern occurs with shift %d


assistant: ```c
void KnuthMorrisPratt(const char *X, const char *Y, int m, int n) {
  if (*X == '\0' || m < n)
    printf("Pattern is not found");
  if (*X == '\0' || m < n)
    printf("Pattern is not found");
  if (*Y == '\0' || n == 0)
    printf("Pattern with shift 0");
  int alternate[n + 1];
  for (int i = 0; i < n + 1; i++)
    alternate[i] = 0;
  for (int i = 1; i < n; i++) {
    int j = alternate[i + 1];
    while (j > 0 && Y[j] != Y[i])
      j = alternate[j];
    if (j > 0 || Y[j] == Y[i])
      alternate[i + 1] = j + 1;
  }
  for (int i = 0, j = 0; i < m; i++) {
    if (*(X + i) == *(Y + j)) {
      if (++j == n)
        printf("Pattern occurs with shift %d\n", i - j + 1);
    } else if (j > 0) {
      j = alternate[j];
      i--;
    }
  }
}
```