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

```asm
<strstr>:
  endbr64
  mov    %rdi,%rax
  mov    %rsi,%rdi
  movzbl (%rsi),%esi
  test   %sil,%sil
  je     L170
  sub    $0x1,%rax
  jmp    L0
  nopl   0x0(%rax,%rax,1)
L246:
  cmp    %dl,%sil
  je     L193
L0:
  mov    %rax,%rcx
  movzbl 0x1(%rax),%edx
  add    $0x1,%rax
  test   %dl,%dl
  jne    L246
L114:
  xor    %eax,%eax
  ret
  nopw   0x0(%rax,%rax,1)
L193:
  movzbl 0x1(%rdi),%r8d
  test   %r8b,%r8b
  jne    L171
L170:
  ret
  nopl   0x0(%rax,%rax,1)
L171:
  lea    0x2(%rcx),%rdx
  movzbl 0x1(%rax),%ecx
  cmp    %cl,%r8b
  je     L270
  nopl   (%rax)
L3:
  cmp    %sil,%cl
  je     L256
L187:
  test   %cl,%cl
  je     L114
  movzbl 0x1(%rdx),%eax
  cmp    %al,%sil
  je     L280
  test   %al,%al
  je     L114
  movzbl 0x2(%rdx),%ecx
  add    $0x2,%rdx
  cmp    %sil,%cl
  jne    L187
L256:
  mov    %rdx,%rax
L27:
  movzbl 0x1(%rax),%ecx
  lea    0x1(%rax),%rdx
  cmp    %cl,%r8b
  jne    L3
L270:
  push   %rbp
  push   %rbx
L51:
  movsbl 0x2(%rdi),%r10d
  movzbl 0x1(%rdx),%r11d
  mov    %r10d,%r9d
  cmp    %r10d,%r11d
  je     L10
L261:
  test   %r9b,%r9b
  jne    L177
L37:
  pop    %rbx
  pop    %rbp
  ret
  nop
L280:
  lea    0x1(%rdx),%rax
  jmp    L27
L252:
  mov    %rdx,%rax
L164:
  movzbl 0x1(%rax),%ecx
  lea    0x1(%rax),%rdx
  cmp    %cl,%r8b
  je     L51
L177:
  cmp    %sil,%cl
  je     L252
L278:
  test   %cl,%cl
  je     L274
  movzbl 0x1(%rdx),%eax
  cmp    %al,%sil
  je     L294
  test   %al,%al
  je     L274
  movzbl 0x2(%rdx),%ecx
  add    $0x2,%rdx
  cmp    %sil,%cl
  jne    L278
  jmp    L252
L10:
  lea    0x2(%rdi),%r11
  lea    0x1(%rdx),%r10
  jmp    L215
  nopl   (%rax)
L12:
  test   %bl,%bl
  je     L37
  movsbl 0x2(%r11),%ebx
  movzbl 0x2(%r10),%ebp
  add    $0x2,%r10
  add    $0x2,%r11
  mov    %ebx,%r9d
  cmp    %ebx,%ebp
  jne    L261
L215:
  test   %r9b,%r9b
  je     L37
  movsbl 0x1(%r11),%ebx
  movzbl 0x1(%r10),%ebp
  mov    %ebx,%r9d
  cmp    %ebx,%ebp
  je     L12
  jmp    L261
L294:
  lea    0x1(%rdx),%rax
  jmp    L164
L274:
  xor    %eax,%eax
  jmp    L37
```

assistant: ```c
char *strstr(const char *phaystack, const char *pneedle) {
  const unsigned char *haystack, *needle;
  char b;
  const unsigned char *rneedle;
  haystack = (const unsigned char *)phaystack;
  if ((b = *(needle = (const unsigned char *)pneedle))) {
    char c;
    haystack--;
    {
      char a;
      do
        if (!(a = *++haystack))
          goto ret0;
      while (a != b);
    }
    if (!(c = *++needle))
      goto foundneedle;
    ++needle;
    goto jin;
    for (;;) {
      {
        char a;
        if (0)
        jin : {
          if ((a = *++haystack) == c)
            goto crest;
        }
          else a = *++haystack;
        do {
          for (; a != b; a = *++haystack) {
            if (!a)
              goto ret0;
            if ((a = *++haystack) == b)
              break;
            if (!a)
              goto ret0;
          }
        } while ((a = *++haystack) != c);
      }
    crest : {
      char a;
      {
        const unsigned char *rhaystack;
        if (*(rhaystack = haystack-- + 1) == (a = *(rneedle = needle)))
          do {
            if (!a)
              goto foundneedle;
            if (*++rhaystack != (a = *++needle))
              break;
            if (!a)
              goto foundneedle;
          } while (*++rhaystack == (a = *++needle));
        needle = rneedle;
      }
      if (!a)
        break;
    }
    }
  }
foundneedle:
  return (char *)haystack;
ret0:
  return 0;
}
```