user: What would the C source look like for the assembly code provided here?

```asm
<twoway_strstr>:
  endbr64
  push   %r15
  mov    %rsi,%r15
  pxor   %xmm0,%xmm0
  push   %r14
  push   %r13
  mov    %rdi,%r13
  mov    $0x1,%edi
  push   %r12
  push   %rbp
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x858,%rsp
  movzbl (%rsi),%esi
  mov    %fs:0x28,%rax
  mov    %rax,0x848(%rsp)
  xor    %eax,%eax
  movaps %xmm0,0x20(%rsp)
  movaps %xmm0,0x30(%rsp)
  movzbl %sil,%ecx
  test   %sil,%sil
  jne    L367
  jmp    L175
  nopl   0x0(%rax)
L339:
  mov    %ecx,%eax
  add    $0x1,%rbx
  mov    %rdi,%rdx
  shl    %cl,%rdx
  mov    %rbx,0x40(%rsp,%rcx,8)
  shr    $0x6,%al
  movzbl (%r15,%rbx,1),%ecx
  movzbl %al,%eax
  or     %rdx,0x20(%rsp,%rax,8)
  test   %cl,%cl
  je     L199
L367:
  cmpb   $0x0,0x0(%r13,%rbx,1)
  jne    L339
L304:
  xor    %r12d,%r12d
L139:
  mov    0x848(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L334
  add    $0x858,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L199:
  cmp    $0x1,%rbx
  je     L175
  mov    %esi,%edi
  mov    $0x1,%r14d
  mov    $0x1,%edx
  xor    %ecx,%ecx
  movq   $0xffffffffffffffff,0x18(%rsp)
  mov    $0x1,%eax
  jmp    L331
  nopl   (%rax)
L102:
  jae    L10
  mov    %rax,%r14
  mov    %rax,%rcx
  sub    0x18(%rsp),%r14
  mov    $0x1,%edx
L195:
  lea    (%rcx,%rdx,1),%rax
  cmp    %rax,%rbx
  jbe    L67
L377:
  mov    0x18(%rsp),%rdi
  add    %r15,%rdi
  movzbl (%rdi,%rdx,1),%edi
L331:
  cmp    %dil,(%r15,%rax,1)
  jne    L102
  cmp    %rdx,%r14
  je     L155
  add    $0x1,%rdx
  lea    (%rcx,%rdx,1),%rax
  cmp    %rax,%rbx
  ja     L377
L67:
  mov    $0x1,%r8d
  mov    $0x1,%edx
  xor    %ecx,%ecx
  mov    $0xffffffffffffffff,%rdi
  mov    $0x1,%eax
  jmp    L41
  nopw   0x0(%rax,%rax,1)
L407:
  jbe    L0
  mov    %rax,%r8
  mov    %rax,%rcx
  mov    $0x1,%edx
  sub    %rdi,%r8
L361:
  lea    (%rdx,%rcx,1),%rax
  cmp    %rax,%rbx
  jbe    L16
L174:
  lea    (%r15,%rdx,1),%rsi
  movzbl (%rsi,%rdi,1),%esi
L41:
  cmp    %sil,(%r15,%rax,1)
  jne    L407
  cmp    %r8,%rdx
  je     L317
  add    $0x1,%rdx
  lea    (%rdx,%rcx,1),%rax
  cmp    %rax,%rbx
  ja     L174
L16:
  mov    0x18(%rsp),%rsi
  lea    0x1(%rdi),%rax
  lea    0x1(%rsi),%rbp
  cmp    %rbp,%rax
  jbe    L274
  mov    %rdi,0x18(%rsp)
  mov    %rax,%rbp
  mov    %r8,%r14
L274:
  lea    (%r15,%r14,1),%rsi
  mov    %rbp,%rdx
  mov    %r15,%rdi
  call   <memcmp@plt>
  mov    %rbx,%rsi
  sub    %r14,%rsi
  mov    %rsi,0x10(%rsp)
  test   %rax,%rax
  je     L3
  mov    0x18(%rsp),%rsi
  lea    -0x1(%rbx),%rax
  movq   $0x0,0x10(%rsp)
  sub    %rsi,%rax
  cmp    %rsi,%rax
  cmovb  %rsi,%rax
  lea    0x1(%rax),%r14
L3:
  mov    %rbx,%rdx
  mov    %r13,%r12
  xor    %r8d,%r8d
  or     $0x3f,%rdx
  nopw   0x0(%rax,%rax,1)
L130:
  mov    %r13,%rax
  sub    %r12,%rax
  cmp    %rbx,%rax
  jb     L13
L282:
  movzbl -0x1(%r12,%rbx,1),%ecx
  mov    %ecx,%eax
  shr    $0x6,%al
  movzbl %al,%eax
  mov    0x20(%rsp,%rax,8),%rax
  shr    %cl,%rax
  test   $0x1,%al
  je     L29
  mov    %rbx,%rax
  sub    0x40(%rsp,%rcx,8),%rax
  je     L237
  cmpq   $0x0,0x10(%rsp)
  setne  %sil
  test   %r8,%r8
  setne  %cl
  test   %cl,%sil
  je     L423
  cmp    %rax,%r14
  mov    %rbx,%rcx
  seta   %sil
  sub    %r14,%rcx
  test   %sil,%sil
  cmovne %rcx,%rax
L423:
  add    %rax,%r12
  mov    %r13,%rax
  xor    %r8d,%r8d
  sub    %r12,%rax
  cmp    %rbx,%rax
  jae    L282
L13:
  xor    %esi,%esi
  mov    %r13,%rdi
  mov    %r8,0x8(%rsp)
  mov    %rdx,(%rsp)
  call   <memchr@plt>
  mov    (%rsp),%rdx
  mov    0x8(%rsp),%r8
  test   %rax,%rax
  je     L105
  mov    %rax,%rcx
  sub    %r12,%rcx
  cmp    %rbx,%rcx
  jb     L304
  mov    %rax,%r13
  jmp    L282
  nopl   (%rax)
L10:
  mov    %rcx,0x18(%rsp)
  mov    $0x1,%r14d
  add    $0x1,%rcx
  mov    $0x1,%edx
  jmp    L195
  nopl   0x0(%rax)
L0:
  mov    %rcx,%rdi
  mov    $0x1,%r8d
  add    $0x1,%rcx
  mov    $0x1,%edx
  jmp    L361
L155:
  add    %r14,%rcx
  mov    $0x1,%edx
  jmp    L195
L317:
  add    %rdx,%rcx
  mov    $0x1,%edx
  jmp    L361
  nopl   0x0(%rax)
L29:
  add    %rbx,%r12
  xor    %r8d,%r8d
  jmp    L130
  nopl   0x0(%rax,%rax,1)
L237:
  cmp    %rbp,%r8
  mov    %rbp,%rax
  cmovae %r8,%rax
  movzbl (%r15,%rax,1),%ecx
  test   %cl,%cl
  jne    L152
  jmp    L166
  nopl   (%rax)
L181:
  add    $0x1,%rax
  movzbl (%r15,%rax,1),%ecx
  test   %cl,%cl
  je     L166
L152:
  cmp    (%r12,%rax,1),%cl
  je     L181
  sub    0x18(%rsp),%rax
  jmp    L423
  nopl   (%rax)
L166:
  mov    %rbp,%rax
  nopl   0x0(%rax,%rax,1)
L318:
  cmp    %r8,%rax
  jbe    L139
  sub    $0x1,%rax
  movzbl (%r12,%rax,1),%edi
  cmp    %dil,(%r15,%rax,1)
  je     L318
  mov    0x10(%rsp),%r8
  add    %r14,%r12
  jmp    L130
  nopl   (%rax)
L105:
  add    %rdx,%r13
  jmp    L282
L175:
  movq   $0xffffffffffffffff,0x18(%rsp)
  xor    %ebp,%ebp
  mov    $0x1,%r14d
  jmp    L274
L334:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
char *twoway_strstr(const unsigned char *h, const unsigned char *n) {
  const unsigned char *z;
  size_t l, ip, jp, k, p, ms, p0, mem, mem0;
  size_t byteset[32 / sizeof(size_t)] = {0};
  size_t shift[256];
  for (l = 0; n[l] && h[l]; l++)
    ((byteset)[(size_t)(n[l]) / (8 * sizeof *(byteset))] |= (size_t)1 << ((size_t)(n[l]) % (8 * sizeof *(byteset)))), shift[n[l]] = l + 1;
  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 (memcmp(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 unsigned char *z2 = memchr(z, 0, grow);
      if (z2) {
        z = z2;
        if (z - h < l)
          return 0;
      } else
        z += grow;
    }
    if (((byteset)[(size_t)(h[l - 1]) / (8 * sizeof *(byteset))] & (size_t)1 << ((size_t)(h[l - 1]) % (8 * sizeof *(byteset))))) {
      k = l - shift[h[l - 1]];
      if (k) {
        if (mem0 && mem && k < p)
          k = l - p;
        h += k;
        mem = 0;
        continue;
      }
    } else {
      h += l;
      mem = 0;
      continue;
    }
    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 (char *)h;
    h += p;
    mem = mem0;
  }
}
```