user: What is the c source code of the assembly code below?

```asm
<formalBMStrstr>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x3b8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x13a8(%rsp)
  xor    %eax,%eax
  cmp    %ecx,%esi
  jl     L188
  mov    %rdx,%rbx
  mov    %ecx,%r13d
  mov    %esi,%r14d
  mov    %rsp,%rdx
  mov    %ecx,%esi
  mov    %rdi,%r12
  mov    %rbx,%rdi
  mov    %r8d,%ebp
  sub    %ecx,%r14d
  call   <makeBMTable1@plt>
  lea    0x400(%rsp),%rdx
  mov    %r13d,%esi
  mov    %rbx,%rdi
  call   <makeBMTable2@plt>
  mov    $0xffffffff,%r11d
  xor    %r9d,%r9d
  mov    $0x1,%r10d
  cmp    %ebp,%r14d
  jl     L188
L96:
  test   %r13d,%r13d
  jle    L70
L179:
  movslq %ebp,%r15
  movslq %r13d,%rax
  xor    %edi,%edi
  xor    %r8d,%r8d
  add    %r12,%r15
  jmp    L132
  nop
L118:
  cmp    $0x78,%dl
  jne    L163
L169:
  sub    $0x1,%rax
  mov    $0x1,%r8d
  lea    -0x1(%rsi),%ecx
  test   %eax,%eax
  jle    L97
L132:
  movsbq -0x1(%r15,%rax,1),%rdx
  mov    %eax,%esi
  mov    %eax,%ecx
  cmp    %dl,-0x1(%rbx,%rax,1)
  jne    L118
  cmp    $0x78,%dl
  je     L169
  sub    $0x1,%rax
  add    $0x1,%edi
  lea    -0x1(%rsi),%ecx
  test   %eax,%eax
  jg     L132
L97:
  test   %ecx,%ecx
  jne    L47
  cmp    %r9d,%edi
  jle    L20
  mov    %ebp,%r11d
  mov    %edi,%r9d
L20:
  add    $0x1,%ebp
  cmp    %r14d,%ebp
  jle    L96
L7:
  mov    0x13a8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L178
  add    $0x13b8,%rsp
  mov    %r11d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L47:
  lea    0x0(%rbp,%rcx,1),%eax
  cltq
  movsbq -0x1(%r12,%rax,1),%rdx
L163:
  mov    (%rsp,%rdx,4),%edx
  mov    %ecx,%eax
  test   %edx,%edx
  jle    L12
  mov    %r13d,%esi
  mov    %edx,%eax
  sub    %ecx,%esi
  sub    %esi,%eax
  cmp    %esi,%edx
  cmovl  %r10d,%eax
L12:
  test   %r8d,%r8d
  jne    L124
L38:
  sub    $0x1,%ecx
  movslq %ecx,%rcx
  mov    0x400(%rsp,%rcx,4),%r8d
L124:
  cmp    %eax,%r8d
  cmovl  %eax,%r8d
  add    %r8d,%ebp
  cmp    %r14d,%ebp
  jg     L7
  test   %r13d,%r13d
  jg     L179
L70:
  je     L20
  lea    0x0(%r13,%rbp,1),%eax
  mov    %r13d,%ecx
  cltq
  movsbq -0x1(%r12,%rax,1),%rax
  mov    (%rsp,%rax,4),%eax
  test   %eax,%eax
  cmovle %r13d,%eax
  jmp    L38
L188:
  mov    $0xffffffff,%r11d
  jmp    L7
L178:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int formalBMStrstr(char *text, int txtLen, char *pattern, int patLen, int txtIdx) {
  int bmTable1[256], bmTable2[1000], patIdx, shtIdx, shtIdx1, shtIdx2, i1, i2, includeX, maxMatch, match, maxIdx;
  if (txtLen < patLen)
    return -1;
  txtLen -= patLen;
  makeBMTable1(pattern, patLen, bmTable1);
  makeBMTable2(pattern, patLen, bmTable2);
  maxMatch = 0;
  maxIdx = -1;
  while (txtIdx <= txtLen) {
    match = 0;
    includeX = 0;
    patIdx = patLen;
    for (; patIdx > 0; --patIdx) {
      if (text[txtIdx + patIdx - 1] != pattern[patIdx - 1] && text[txtIdx + patIdx - 1] != 'x')
        break;
      if (text[txtIdx + patIdx - 1] == 'x')
        includeX = 1;
      else
        ++match;
    }
    if (patIdx == 0) {
      if (maxMatch < match) {
        maxMatch = match;
        maxIdx = txtIdx;
      }
      ++txtIdx;
      continue;
    }
    i1 = bmTable1[(int)text[txtIdx + patIdx - 1]];
    shtIdx1 = patIdx;
    if (i1 > 0) {
      i2 = patLen - patIdx;
      shtIdx1 = (i1 < i2) ? 1 : i1 - i2;
    }
    shtIdx2 = (includeX == 0) ? bmTable2[patIdx - 1] : 1;
    shtIdx = (shtIdx1 > shtIdx2) ? shtIdx1 : shtIdx2;
    txtIdx += shtIdx;
  }
  return maxIdx;
}
```