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

```asm
<search_pattern>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %ecx,%ebx
  sub    $0x8,%rsp
  sub    %ecx,%edx
  js     L237
  mov    %ecx,%eax
  lea    -0x1(%rcx),%r11d
  mov    %ebx,%r9d
  mov    %edx,%r10d
  shr    $0x4,%eax
  and    $0xfffffff0,%r9d
  xor    %r8d,%r8d
  mov    $0xffffffff,%r13d
  lea    -0x1(%rax),%ecx
  pxor   %xmm4,%xmm4
  pxor   %xmm3,%xmm3
  xor    %r12d,%r12d
  add    $0x1,%rcx
  movdqa D16(%rip),%xmm5
  shl    $0x4,%rcx
  cs nopw 0x0(%rax,%rax,1)
L20:
  mov    %r8d,%ebp
  xor    %eax,%eax
  test   %ebx,%ebx
  jle    L36
  cmp    $0xe,%r11d
  jbe    L198
  lea    (%rdi,%r8,1),%rdx
  xor    %eax,%eax
  pxor   %xmm1,%xmm1
  nopl   0x0(%rax)
L57:
  movdqu (%rsi,%rax,1),%xmm7
  movdqu (%rdx,%rax,1),%xmm0
  movdqa %xmm4,%xmm6
  add    $0x10,%rax
  pcmpeqb %xmm7,%xmm0
  pand   %xmm5,%xmm0
  pcmpgtb %xmm0,%xmm6
  movdqa %xmm0,%xmm2
  punpcklbw %xmm6,%xmm2
  punpckhbw %xmm6,%xmm0
  movdqa %xmm3,%xmm6
  pcmpgtw %xmm2,%xmm6
  movdqa %xmm2,%xmm7
  punpcklwd %xmm6,%xmm7
  punpckhwd %xmm6,%xmm2
  movdqa %xmm0,%xmm6
  paddd  %xmm7,%xmm1
  paddd  %xmm2,%xmm1
  movdqa %xmm3,%xmm2
  pcmpgtw %xmm0,%xmm2
  punpcklwd %xmm2,%xmm6
  punpckhwd %xmm2,%xmm0
  paddd  %xmm6,%xmm1
  paddd  %xmm0,%xmm1
  cmp    %rax,%rcx
  jne    L57
  movdqa %xmm1,%xmm0
  psrldq $0x8,%xmm0
  paddd  %xmm0,%xmm1
  movdqa %xmm1,%xmm0
  psrldq $0x4,%xmm0
  paddd  %xmm0,%xmm1
  movd   %xmm1,%eax
  cmp    %r9d,%ebx
  je     L36
  mov    %r9d,%edx
L228:
  lea    0x0(%rbp,%rdx,1),%r14d
  movslq %edx,%r15
  movslq %r14d,%r14
  movzbl (%rsi,%r15,1),%r15d
  cmp    %r15b,(%rdi,%r14,1)
  sete   %r14b
  movzbl %r14b,%r14d
  add    %r14d,%eax
  lea    0x1(%rdx),%r14d
  cmp    %ebx,%r14d
  jge    L36
  lea    (%r14,%rbp,1),%r15d
  movslq %r14d,%r14
  movslq %r15d,%r15
  movzbl (%rsi,%r14,1),%r14d
  cmp    %r14b,(%rdi,%r15,1)
  sete   %r14b
  movzbl %r14b,%r14d
  add    %r14d,%eax
  lea    0x2(%rdx),%r14d
  cmp    %r14d,%ebx
  jle    L36
  lea    0x0(%rbp,%r14,1),%r15d
  movslq %r14d,%r14
  movslq %r15d,%r15
  movzbl (%rsi,%r14,1),%r14d
  cmp    %r14b,(%rdi,%r15,1)
  sete   %r14b
  movzbl %r14b,%r14d
  add    %r14d,%eax
  lea    0x3(%rdx),%r14d
  cmp    %r14d,%ebx
  jle    L36
  lea    0x0(%rbp,%r14,1),%r15d
  movslq %r14d,%r14
  movslq %r15d,%r15
  movzbl (%rsi,%r14,1),%r14d
  cmp    %r14b,(%rdi,%r15,1)
  sete   %r14b
  movzbl %r14b,%r14d
  add    %r14d,%eax
  lea    0x4(%rdx),%r14d
  cmp    %r14d,%ebx
  jle    L36
  lea    0x0(%rbp,%r14,1),%r15d
  movslq %r14d,%r14
  movslq %r15d,%r15
  movzbl (%rsi,%r14,1),%r14d
  cmp    %r14b,(%rdi,%r15,1)
  sete   %r14b
  movzbl %r14b,%r14d
  add    %r14d,%eax
  lea    0x5(%rdx),%r14d
  cmp    %r14d,%ebx
  jle    L36
  lea    0x0(%rbp,%r14,1),%r15d
  movslq %r14d,%r14
  movslq %r15d,%r15
  movzbl (%rsi,%r14,1),%r14d
  cmp    %r14b,(%rdi,%r15,1)
  sete   %r14b
  movzbl %r14b,%r14d
  add    %r14d,%eax
  lea    0x6(%rdx),%r14d
  cmp    %r14d,%ebx
  jle    L36
  lea    0x0(%rbp,%r14,1),%r15d
  movslq %r14d,%r14
  movslq %r15d,%r15
  movzbl (%rsi,%r14,1),%r14d
  cmp    %r14b,(%rdi,%r15,1)
  sete   %r14b
  movzbl %r14b,%r14d
  add    %r14d,%eax
  lea    0x7(%rdx),%r14d
  cmp    %r14d,%ebx
  jle    L36
  lea    0x0(%rbp,%r14,1),%r15d
  movslq %r14d,%r14
  movslq %r15d,%r15
  movzbl (%rsi,%r14,1),%r14d
  cmp    %r14b,(%rdi,%r15,1)
  sete   %r14b
  movzbl %r14b,%r14d
  add    %r14d,%eax
  lea    0x8(%rdx),%r14d
  cmp    %r14d,%ebx
  jle    L36
  lea    0x0(%rbp,%r14,1),%r15d
  movslq %r14d,%r14
  movslq %r15d,%r15
  movzbl (%rsi,%r14,1),%r14d
  cmp    %r14b,(%rdi,%r15,1)
  sete   %r14b
  movzbl %r14b,%r14d
  add    %r14d,%eax
  lea    0x9(%rdx),%r14d
  cmp    %r14d,%ebx
  jle    L36
  lea    0x0(%rbp,%r14,1),%r15d
  movslq %r14d,%r14
  movslq %r15d,%r15
  movzbl (%rsi,%r14,1),%r14d
  cmp    %r14b,(%rdi,%r15,1)
  sete   %r14b
  movzbl %r14b,%r14d
  add    %r14d,%eax
  lea    0xa(%rdx),%r14d
  cmp    %r14d,%ebx
  jle    L36
  lea    0x0(%rbp,%r14,1),%r15d
  movslq %r14d,%r14
  movslq %r15d,%r15
  movzbl (%rsi,%r14,1),%r14d
  cmp    %r14b,(%rdi,%r15,1)
  sete   %r14b
  movzbl %r14b,%r14d
  add    %r14d,%eax
  lea    0xb(%rdx),%r14d
  cmp    %r14d,%ebx
  jle    L36
  lea    0x0(%rbp,%r14,1),%r15d
  movslq %r14d,%r14
  movslq %r15d,%r15
  movzbl (%rsi,%r14,1),%r14d
  cmp    %r14b,(%rdi,%r15,1)
  sete   %r14b
  movzbl %r14b,%r14d
  add    %r14d,%eax
  lea    0xc(%rdx),%r14d
  cmp    %r14d,%ebx
  jle    L36
  lea    0x0(%rbp,%r14,1),%r15d
  movslq %r14d,%r14
  movslq %r15d,%r15
  movzbl (%rsi,%r14,1),%r14d
  cmp    %r14b,(%rdi,%r15,1)
  sete   %r14b
  movzbl %r14b,%r14d
  add    %r14d,%eax
  lea    0xd(%rdx),%r14d
  cmp    %r14d,%ebx
  jle    L36
  lea    0x0(%rbp,%r14,1),%r15d
  movslq %r14d,%r14
  movslq %r15d,%r15
  movzbl (%rsi,%r14,1),%r14d
  cmp    %r14b,(%rdi,%r15,1)
  sete   %r14b
  add    $0xe,%edx
  movzbl %r14b,%r14d
  add    %r14d,%eax
  cmp    %edx,%ebx
  jle    L36
  lea    0x0(%rbp,%rdx,1),%r14d
  movslq %edx,%rdx
  movslq %r14d,%r14
  movzbl (%rsi,%rdx,1),%edx
  cmp    %dl,(%rdi,%r14,1)
  sete   %dl
  movzbl %dl,%edx
  add    %edx,%eax
  nopl   (%rax)
L36:
  cmp    %r12d,%eax
  jle    L196
  cmp    %eax,%ebx
  je     L42
  mov    %ebp,%r13d
  mov    %eax,%r12d
L196:
  add    $0x1,%r8
  cmp    %r8d,%r10d
  jge    L20
  imul   $0x64,%r12d,%eax
  cltd
  idiv   %ebx
  mov    %eax,%r8d
L121:
  mov    %r13d,%ecx
  mov    $0x20,%esi
  mov    $0x1,%edi
  lea    D9(%rip),%rdx
  call   <report@plt>
  cmp    %ebx,%r12d
  mov    $0xffffffff,%eax
  cmovne %eax,%r13d
L217:
  add    $0x8,%rsp
  mov    %r13d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L198:
  xor    %eax,%eax
  xor    %edx,%edx
  jmp    L228
L42:
  mov    $0x64,%r8d
  mov    %ebp,%ecx
  mov    $0x20,%esi
  mov    %ebp,%r13d
  lea    D9(%rip),%rdx
  mov    $0x1,%edi
  call   <report@plt>
  jmp    L217
L237:
  xor    %r8d,%r8d
  mov    $0xffffffff,%r13d
  xor    %r12d,%r12d
  jmp    L121
```

tool_calls: name: unpack_data
arguments: tag: D16
data_type: byte[16]
name: unpack_data
arguments: tag: D9
data_type: string

tool: {"D16": [0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01]}

tool: D9: Best offset %6d with probability %3d%%


assistant: ```c
int search_pattern(const unsigned char *buffer, const unsigned char *pattern, const int buffer_length, const int pattern_length) {
  int best_match = 0;
  int best_offset = -1;
  int potential_length = (buffer_length - pattern_length + 1);
  int cur_offset;
  for (cur_offset = 0; cur_offset < potential_length; cur_offset++) {
    int i;
    int cur_match;
    for (i = 0, cur_match = 0; i < pattern_length; i++)
      if (buffer[cur_offset + i] == pattern[i])
        cur_match++;
    if (cur_match > best_match) {
      best_offset = cur_offset;
      best_match = cur_match;
      if (best_match == pattern_length)
        break;
    }
  }
  report(1, ((unsigned int)0x00000020), "Best offset %6d with probability %3d%%\n", best_offset, (100 * best_match) / pattern_length);
  return ((best_match == pattern_length) ? best_offset : -1);
}
```