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

```asm
<twoway_wcsstr>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdi,%r14
  push   %r13
  push   %r12
  push   %rbp
  xor    %ebp,%ebp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x38,%rsp
  mov    (%rsi),%r9
  test   %r9,%r9
  jne    L198
  jmp    L176
  nopw   0x0(%rax,%rax,1)
L115:
  add    $0x1,%rbp
  cmpq   $0x0,(%rbx,%rbp,8)
  je     L26
L198:
  cmpq   $0x0,(%r14,%rbp,8)
  jne    L115
L177:
  xor    %r12d,%r12d
L303:
  add    $0x38,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L26:
  mov    %rbp,%rax
  or     $0x3f,%rax
  mov    %rax,0x20(%rsp)
  shl    $0x3,%rax
  mov    %rax,0x28(%rsp)
  cmp    $0x1,%rbp
  je     L151
  mov    %r9,%r11
  mov    $0x1,%esi
  mov    $0x1,%edx
  xor    %edi,%edi
  mov    $0xffffffffffffffff,%rcx
  mov    $0x1,%eax
  jmp    L52
  nopl   0x0(%rax,%rax,1)
L205:
  jge    L354
  mov    %rax,%rsi
  mov    %rax,%rdi
  mov    $0x1,%edx
  sub    %rcx,%rsi
L285:
  lea    (%rdi,%rdx,1),%rax
  cmp    %rbp,%rax
  jae    L219
L4:
  lea    (%rcx,%rdx,1),%r11
  mov    (%rbx,%r11,8),%r11
L52:
  cmp    %r11,(%rbx,%rax,8)
  jne    L205
  cmp    %rsi,%rdx
  je     L272
  add    $0x1,%rdx
  lea    (%rdi,%rdx,1),%rax
  cmp    %rbp,%rax
  jb     L4
L219:
  mov    $0x1,%r12d
  mov    $0x1,%edx
  xor    %edi,%edi
  mov    $0xffffffffffffffff,%r15
  mov    $0x1,%eax
  jmp    L81
  nopl   0x0(%rax)
L210:
  jle    L22
  mov    %rax,%r12
  mov    %rax,%rdi
  mov    $0x1,%edx
  sub    %r15,%r12
L108:
  lea    (%rdx,%rdi,1),%rax
  cmp    %rbp,%rax
  jae    L171
L245:
  lea    (%rdx,%r15,1),%r9
  mov    (%rbx,%r9,8),%r9
L81:
  cmp    %r9,(%rbx,%rax,8)
  jne    L210
  cmp    %r12,%rdx
  je     L146
  add    $0x1,%rdx
  lea    (%rdx,%rdi,1),%rax
  cmp    %rbp,%rax
  jb     L245
L171:
  lea    0x1(%r15),%r13
  lea    0x1(%rcx),%rax
  cmp    %rax,%r13
  jbe    L48
  lea    0x0(,%r12,8),%rax
  mov    %rax,0x10(%rsp)
L402:
  mov    %rbx,%rdi
  lea    (%rbx,%rax,1),%rsi
  mov    %r13,%rdx
  call   <wmemcmp@plt>
  mov    %rbp,%rdi
  sub    %r12,%rdi
  mov    %rdi,0x18(%rsp)
  test   %rax,%rax
  je     L70
  movq   $0x0,0x18(%rsp)
  lea    -0x1(%rbp),%rax
  sub    %r15,%rax
  cmp    %r15,%rax
  cmovb  %r15,%rax
  lea    0x8(,%rax,8),%rax
  mov    %rax,0x10(%rsp)
L70:
  mov    %r14,%r12
  xor    %ecx,%ecx
  nop
L23:
  mov    %r14,%rax
  sub    %r12,%rax
  sar    $0x3,%rax
  cmp    %rbp,%rax
  jb     L256
L162:
  cmp    %r13,%rcx
  mov    %r13,%rax
  cmovae %rcx,%rax
  mov    (%rbx,%rax,8),%rdx
  test   %rdx,%rdx
  jne    L358
  jmp    L14
  nopw   0x0(%rax,%rax,1)
L29:
  add    $0x1,%rax
  mov    (%rbx,%rax,8),%rdx
  test   %rdx,%rdx
  je     L14
L358:
  cmp    %rdx,(%r12,%rax,8)
  je     L29
  sub    %r15,%rax
  xor    %ecx,%ecx
  lea    (%r12,%rax,8),%r12
  mov    %r14,%rax
  sub    %r12,%rax
  sar    $0x3,%rax
  cmp    %rbp,%rax
  jae    L162
L256:
  mov    0x20(%rsp),%rdx
  xor    %esi,%esi
  mov    %r14,%rdi
  mov    %rcx,0x8(%rsp)
  call   <wmemchr@plt>
  mov    0x8(%rsp),%rcx
  test   %rax,%rax
  je     L400
  mov    %rax,%rdx
  sub    %r12,%rdx
  sar    $0x3,%rdx
  cmp    %rbp,%rdx
  jb     L177
  mov    %rax,%r14
  jmp    L162
  nopl   0x0(%rax)
L354:
  mov    %rdi,%rcx
  mov    $0x1,%esi
  add    $0x1,%rdi
  mov    $0x1,%edx
  jmp    L285
  cs nopw 0x0(%rax,%rax,1)
L22:
  mov    %rdi,%r15
  mov    $0x1,%r12d
  add    $0x1,%rdi
  mov    $0x1,%edx
  jmp    L108
L272:
  add    %rdx,%rdi
  mov    $0x1,%edx
  jmp    L285
L146:
  add    %rdx,%rdi
  mov    $0x1,%edx
  jmp    L108
  nopl   0x0(%rax)
L14:
  mov    %r13,%rax
  cmp    %r13,%rcx
  jb     L240
  jmp    L279
  nopw   0x0(%rax,%rax,1)
L382:
  sub    $0x1,%rax
  cmp    %rax,%rcx
  jae    L279
L240:
  mov    -0x8(%r12,%rax,8),%rsi
  cmp    %rsi,-0x8(%rbx,%rax,8)
  je     L382
  mov    0x18(%rsp),%rcx
  add    0x10(%rsp),%r12
  jmp    L23
  nopl   0x0(%rax)
L279:
  cmp    %rax,%rcx
  je     L303
  mov    0x18(%rsp),%rcx
  add    0x10(%rsp),%r12
  jmp    L23
  nopl   0x0(%rax,%rax,1)
L400:
  add    0x28(%rsp),%r14
  jmp    L162
L48:
  lea    0x0(,%rsi,8),%rdi
  mov    %rax,%r13
  mov    %rcx,%r15
  mov    %rsi,%r12
  mov    %rdi,0x10(%rsp)
  mov    %rdi,%rax
  jmp    L402
L176:
  movq   $0x1f8,0x28(%rsp)
  movq   $0x3f,0x20(%rsp)
L151:
  xor    %r13d,%r13d
  mov    $0xffffffffffffffff,%r15
  movq   $0x8,0x10(%rsp)
  mov    $0x1,%r12d
  mov    0x10(%rsp),%rax
  jmp    L402
```

assistant: ```c
wchar_t *twoway_wcsstr(const wchar_t *h, const wchar_t *n) {
  const wchar_t *z;
  size_t l, ip, jp, k, p, ms, p0, mem, mem0;
  for (l = 0; n[l] && h[l]; l++)
    ;
  if (n[l])
    return 0;
  ip = -1;
  jp = 0;
  k = p = 1;
  while (jp + k < l) {
    if (n[ip + k] == n[jp + k]) {
      if (k == p) {
        jp += p;
        k = 1;
      } else
        k++;
    } else if (n[ip + k] > n[jp + k]) {
      jp += k;
      k = 1;
      p = jp - ip;
    } else {
      ip = jp++;
      k = p = 1;
    }
  }
  ms = ip;
  p0 = p;
  ip = -1;
  jp = 0;
  k = p = 1;
  while (jp + k < l) {
    if (n[ip + k] == n[jp + k]) {
      if (k == p) {
        jp += p;
        k = 1;
      } else
        k++;
    } else if (n[ip + k] < n[jp + k]) {
      jp += k;
      k = 1;
      p = jp - ip;
    } else {
      ip = jp++;
      k = p = 1;
    }
  }
  if (ip + 1 > ms + 1)
    ms = ip;
  else
    p = p0;
  if (wmemcmp(n, n + p, ms + 1)) {
    mem0 = 0;
    p = ((ms) > (l - ms - 1) ? (ms) : (l - ms - 1)) + 1;
  } else
    mem0 = l - p;
  mem = 0;
  z = h;
  for (;;) {
    if (z - h < l) {
      size_t grow = l | 63;
      const wchar_t *z2 = wmemchr(z, 0, grow);
      if (z2) {
        z = z2;
        if (z - h < l)
          return 0;
      } else
        z += grow;
    }
    for (k = ((ms + 1) > (mem) ? (ms + 1) : (mem)); n[k] && n[k] == h[k]; k++)
      ;
    if (n[k]) {
      h += k - ms;
      mem = 0;
      continue;
    }
    for (k = ms + 1; k > mem && n[k - 1] == h[k - 1]; k--)
      ;
    if (k == mem)
      return (wchar_t *)h;
    h += p;
    mem = mem0;
  }
}
```