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

```asm
<KnuthMorrisPratt>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  mov    %ecx,%r15d
  push   %r14
  mov    %rdi,%r14
  push   %r13
  mov    %edx,%r13d
  push   %r12
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  cmp    %ecx,%edx
  setl   %r12b
  cmpb   $0x0,(%rdi)
  je     L94
  test   %r12b,%r12b
  jne    L94
L69:
  cmpb   $0x0,(%rbx)
  je     L9
  test   %r15d,%r15d
  je     L9
L278:
  lea    0x1(%r15),%ecx
  mov    %rsp,%rsi
  movslq %ecx,%rax
  lea    0xf(,%rax,4),%rax
  mov    %rax,%rdx
  and    $0xfffffffffffff000,%rax
  sub    %rax,%rsi
  and    $0xfffffffffffffff0,%rdx
  cmp    %rsi,%rsp
  je     L304
L305:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rsi,%rsp
  jne    L305
L304:
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  jne    L2
L191:
  mov    %ecx,-0x44(%rbp)
  mov    %rsp,%r12
  test   %r15d,%r15d
  js     L214
  movslq %r15d,%rax
  xor    %esi,%esi
  mov    %r12,%rdi
  lea    0x4(,%rax,4),%rdx
  call   <memset@plt>
  cmp    $0x1,%r15d
  mov    -0x44(%rbp),%ecx
  jle    L214
  mov    %ecx,%edi
  mov    $0x2,%esi
  nopl   0x0(%rax,%rax,1)
L208:
  mov    (%r12,%rsi,4),%eax
  movzbl -0x1(%rbx,%rsi,1),%ecx
  test   %eax,%eax
  jg     L157
  jmp    L184
  nopw   0x0(%rax,%rax,1)
L181:
  mov    (%r12,%rdx,4),%eax
  test   %eax,%eax
  jle    L184
L157:
  movslq %eax,%rdx
  cmp    %cl,(%rbx,%rdx,1)
  jne    L181
L168:
  add    $0x1,%eax
  mov    %eax,(%r12,%rsi,4)
L167:
  add    $0x1,%rsi
  cmp    %rdi,%rsi
  jne    L208
L214:
  xor    %ecx,%ecx
  xor    %edx,%edx
  lea    D37(%rip),%rdi
  test   %r13d,%r13d
  jg     L293
  jmp    L266
  xchg   %ax,%ax
L142:
  test   %ecx,%ecx
  jle    L268
  mov    (%r12,%rsi,4),%ecx
L269:
  cmp    %edx,%r13d
  jle    L266
L293:
  movslq %ecx,%rsi
  movslq %edx,%rax
  movzbl (%rbx,%rsi,1),%r9d
  cmp    %r9b,(%r14,%rax,1)
  jne    L142
  add    $0x1,%ecx
  lea    0x1(%rdx),%r8d
  cmp    %ecx,%r15d
  je     L113
  mov    %r8d,%edx
  cmp    %edx,%r13d
  jg     L293
L266:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L225
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L9:
  lea    D4(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L278
L94:
  lea    D31(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  cmpb   $0x0,(%r14)
  lea    D31(%rip),%rdi
  je     L187
  test   %r12b,%r12b
  je     L69
L187:
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L69
  nop
L184:
  movslq %eax,%rdx
  cmp    %cl,(%rbx,%rdx,1)
  jne    L167
  jmp    L168
  nopl   0x0(%rax)
L268:
  add    $0x1,%edx
  jmp    L269
L113:
  sub    %r15d,%edx
  xor    %eax,%eax
  mov    %ecx,-0x44(%rbp)
  lea    0x1(%rdx),%esi
  mov    %r8d,-0x48(%rbp)
  call   <printf@plt>
  mov    -0x48(%rbp),%edx
  mov    -0x44(%rbp),%ecx
  lea    D37(%rip),%rdi
  jmp    L269
L2:
  orq    $0x0,-0x8(%rsp,%rdx,1)
  jmp    L191
L225:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: tag: D37
datatype: string
name: disassemble_data
arguments: tag: D4
datatype: string
name: disassemble_data
arguments: tag: D31
datatype: string

tool: D37: Pattern occurs with shift %d


tool: D4: Pattern with shift 0

tool: D31: Pattern is not found

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--;
    }
  }
}
```