user: 下面的汇编指令对应的C源代码是什么:

```asm
<simple_memmem>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    %rcx,-0x40(%rbp)
  cmpq   $0x0,-0x40(%rbp)
  je     L69
  cmpq   $0x1,-0x40(%rbp)
  je     L116
  jmp    L169
L69:
  mov    -0x28(%rbp),%rax
  jmp    L17
L116:
  mov    -0x38(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%ecx
  mov    -0x30(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <memchr@plt>
  jmp    L17
L169:
  mov    -0x38(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%ecx
  mov    -0x30(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <memchr@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L127
  mov    $0x0,%eax
  jmp    L17
L127:
  mov    -0x8(%rbp),%rax
  sub    -0x28(%rbp),%rax
  sub    %rax,-0x30(%rbp)
  mov    -0x30(%rbp),%rax
  cmp    -0x40(%rbp),%rax
  jae    L88
  mov    $0x0,%eax
  jmp    L17
L88:
  mov    -0x8(%rbp),%rax
  mov    %rax,-0x28(%rbp)
  movl   $0x0,-0x14(%rbp)
  mov    -0x38(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,-0x10(%rbp)
  addq   $0x1,-0x8(%rbp)
  mov    -0x40(%rbp),%rax
  add    %rax,-0x38(%rbp)
  jmp    L23
L13:
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movzbl (%rax),%eax
  movzbl %al,%eax
  add    %eax,-0x14(%rbp)
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movzbl (%rax),%eax
  movzbl %al,%eax
  sub    %eax,-0x14(%rbp)
L23:
  mov    -0x10(%rbp),%rax
  cmp    -0x38(%rbp),%rax
  jne    L13
  mov    -0x40(%rbp),%rax
  neg    %rax
  add    %rax,-0x38(%rbp)
  cmpl   $0x0,-0x14(%rbp)
  jne    L176
  mov    -0x40(%rbp),%rax
  lea    -0x2(%rax),%rdx
  mov    -0x38(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    -0x28(%rbp),%rax
  add    $0x1,%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcmp@plt>
  test   %rax,%rax
  jne    L176
  mov    -0x28(%rbp),%rax
  jmp    L17
L176:
  mov    -0x28(%rbp),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x10(%rbp)
  jmp    L165
L135:
  mov    -0x28(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x28(%rbp)
  movzbl (%rax),%eax
  movzbl %al,%eax
  sub    %eax,-0x14(%rbp)
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movzbl (%rax),%eax
  movzbl %al,%eax
  add    %eax,-0x14(%rbp)
  cmpl   $0x0,-0x14(%rbp)
  jne    L165
  mov    -0x40(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    -0x38(%rbp),%rcx
  mov    -0x28(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcmp@plt>
  test   %rax,%rax
  jne    L165
  mov    -0x28(%rbp),%rax
  jmp    L17
L165:
  mov    -0x8(%rbp),%rax
  cmp    -0x10(%rbp),%rax
  jne    L135
  mov    $0x0,%eax
L17:
  leave
  ret
```

assistant: ```c
char *simple_memmem(const char *haystack, size_t haystacklen, const char *needle, size_t needlelen) {
  const char *needle_ptr;
  const char *haystack_ptr;
  int sums_diff;
  switch (needlelen) {
  case (0):
    return (char *)haystack;
    break;
  case (1):
    return memchr(haystack, *((unsigned char *)needle), haystacklen);
    break;
  }
  haystack_ptr = memchr(haystack, *((unsigned char *)needle), haystacklen);
  if (!haystack_ptr) {
    return NULL;
  }
  haystacklen -= (haystack_ptr - haystack);
  if (haystacklen < needlelen) {
    return NULL;
  }
  haystack = haystack_ptr;
  sums_diff = 0;
  needle_ptr = needle + 1;
  haystack_ptr++;
  needle += needlelen;
  while (needle_ptr != needle) {
    sums_diff += *((unsigned char *)haystack_ptr++);
    sums_diff -= *((unsigned char *)needle_ptr++);
  }
  needle -= needlelen;
  if (sums_diff == 0 && memcmp(haystack + 1, needle + 1, needlelen - 2) == 0) {
    return (char *)haystack;
  }
  needle_ptr = haystack + haystacklen;
  while (haystack_ptr != needle_ptr) {
    sums_diff -= *((unsigned char *)haystack++);
    sums_diff += *((unsigned char *)haystack_ptr++);
    if (sums_diff == 0 && memcmp(haystack, needle, needlelen - 1) == 0) {
      return (char *)haystack;
    }
  }
  return NULL;
}
```