user: 请将以下的汇编代码转换成C语言代码:

```asm
<__boyer_moore>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x848,%rsp
  mov    %rdi,%r14
  mov    %rsi,0x18(%rsp)
  mov    %rdx,0x20(%rsp)
  mov    %rcx,%r13
  mov    %r8d,%r15d
  mov    %fs:0x28,%rax
  mov    %rax,0x838(%rsp)
  xor    %eax,%eax
  lea    -0x1(%rcx),%rax
  mov    %rax,0x28(%rsp)
  add    %rax,%rdx
  mov    %rdx,0x10(%rsp)
  lea    0x30(%rsp),%rax
  lea    0x830(%rsp),%rdx
L41:
  mov    %r13,(%rax)
  add    $0x8,%rax
  cmp    %rdx,%rax
  jne    L41
  mov    0x20(%rsp),%rax
  mov    0x10(%rsp),%rsi
  cmp    %rsi,%rax
  jae    L94
  mov    %rax,%rbx
  jmp    L196
L399:
  movzbl (%rbx),%eax
  jmp    L6
L235:
  movzbl (%rbx),%eax
L6:
  cltq
  mov    %rbp,0x30(%rsp,%rax,8)
  add    $0x1,%rbx
  cmp    %rbx,0x10(%rsp)
  je     L94
L196:
  mov    0x10(%rsp),%rbp
  sub    %rbx,%rbp
  test   %r15d,%r15d
  je     L235
  movzbl (%rbx),%edi
  call   <isupper@plt>
  test   %rax,%rax
  je     L399
  movzbl (%rbx),%edi
  call   <tolower@plt>
  jmp    L6
L94:
  cmp    0x18(%rsp),%r13
  jbe    L417
  mov    $0x0,%eax
  jmp    L305
L123:
  movzbl 0x0(%rbp),%eax
  mov    %eax,0xc(%rsp)
  jmp    L410
L415:
  movzbl (%rbx),%eax
  jmp    L116
L282:
  movzbl (%rbx),%eax
  cmp    %al,0x0(%rbp)
  setne  %al
L309:
  test   %al,%al
  jne    L276
  sub    $0x1,%rbp
  sub    $0x1,%rbx
  add    $0x1,%r12d
  cmp    %r14,%rbx
  je     L279
L124:
  test   %r15d,%r15d
  je     L282
  movzbl 0x0(%rbp),%edi
  call   <isupper@plt>
  test   %rax,%rax
  je     L123
  movzbl 0x0(%rbp),%edi
  call   <tolower@plt>
  mov    %eax,0xc(%rsp)
L410:
  movzbl (%rbx),%edi
  call   <isupper@plt>
  test   %rax,%rax
  je     L415
  movzbl (%rbx),%edi
  call   <tolower@plt>
L116:
  cmp    %eax,0xc(%rsp)
  setne  %al
  jmp    L309
L279:
  mov    %r14,%rbx
L276:
  test   %r15d,%r15d
  jne    L215
  movzbl (%rbx),%eax
  cmp    %al,0x0(%rbp)
  je     L306
  movzbl %al,%eax
  mov    0x30(%rsp,%rax,8),%rbx
  test   %r12d,%r12d
  je     L439
  cmp    %r13,%rbx
  jne    L439
  mov    0x10(%rsp),%rax
  mov    0x20(%rsp),%rsi
  movzbl (%rsi),%esi
  cmp    %sil,(%rax)
  jne    L439
L100:
  sub    $0x1,%rbx
L439:
  add    %rbx,%r14
  sub    %rbx,0x18(%rsp)
  mov    0x18(%rsp),%rax
  cmp    %rax,%r13
  ja     L120
L417:
  mov    0x28(%rsp),%rax
  lea    (%r14,%rax,1),%rbx
  mov    0x10(%rsp),%rax
  cmp    %rax,0x20(%rsp)
  jae    L201
  mov    %rax,%rbp
  mov    $0x0,%r12d
  jmp    L124
L201:
  mov    0x10(%rsp),%rbp
  mov    $0x0,%r12d
  jmp    L276
L215:
  movzbl 0x0(%rbp),%edi
  call   <isupper@plt>
  test   %rax,%rax
  je     L374
  movzbl 0x0(%rbp),%edi
  call   <tolower@plt>
  mov    %eax,%ebp
L162:
  movzbl (%rbx),%edi
  call   <isupper@plt>
  test   %rax,%rax
  je     L197
  movzbl (%rbx),%edi
  call   <tolower@plt>
L58:
  cmp    %eax,%ebp
  je     L277
  movzbl (%rbx),%edi
  call   <isupper@plt>
  test   %rax,%rax
  je     L411
  movzbl (%rbx),%edi
  call   <tolower@plt>
L50:
  cltq
  mov    0x30(%rsp,%rax,8),%rbx
  test   %r12d,%r12d
  je     L439
  cmp    %rbx,%r13
  jne    L439
  mov    0x10(%rsp),%rbp
  movzbl 0x0(%rbp),%edi
  call   <isupper@plt>
  test   %rax,%rax
  je     L64
  movzbl 0x0(%rbp),%edi
  call   <tolower@plt>
  mov    %eax,%ebp
L160:
  mov    0x20(%rsp),%r12
  movzbl (%r12),%edi
  call   <isupper@plt>
  test   %rax,%rax
  je     L139
  movzbl (%r12),%edi
  call   <tolower@plt>
L170:
  cmp    %eax,%ebp
  je     L100
  jmp    L439
L374:
  movzbl 0x0(%rbp),%ebp
  jmp    L162
L197:
  movzbl (%rbx),%eax
  jmp    L58
L277:
  mov    %r14,%rax
  jmp    L305
L306:
  mov    %r14,%rax
  jmp    L305
L411:
  movzbl (%rbx),%eax
  jmp    L50
L64:
  mov    0x10(%rsp),%rax
  movzbl (%rax),%ebp
  jmp    L160
L139:
  mov    0x20(%rsp),%rax
  movzbl (%rax),%eax
  jmp    L170
L120:
  mov    $0x0,%eax
L305:
  mov    0x838(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L154
  add    $0x848,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L154:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
unsigned char *__boyer_moore(const unsigned char *haystack, size_t haystacklen, const unsigned char *needle, size_t needlelen, int icase) {
  register unsigned char *hc_ptr, *nc_ptr;
  unsigned char *he_ptr, *ne_ptr, *h_ptr;
  size_t skiptable[256], n;
  register int i;
  ne_ptr = (unsigned char *)needle + needlelen - 1;
  he_ptr = (unsigned char *)haystack + haystacklen - 1;
  for (i = 0; i < 256; i++)
    skiptable[i] = needlelen;
  for (nc_ptr = (unsigned char *)needle; nc_ptr < ne_ptr; nc_ptr++)
    skiptable[((icase) ? (isupper((int)(*nc_ptr)) ? tolower((int)(*nc_ptr)) : (int)(*nc_ptr)) : (int)(*nc_ptr))] = (size_t)(ne_ptr - nc_ptr);
  h_ptr = (unsigned char *)haystack;
  while (haystacklen >= needlelen) {
    hc_ptr = h_ptr + needlelen - 1;
    nc_ptr = ne_ptr;
    for (i = 0; nc_ptr > (unsigned char *)needle; nc_ptr--, hc_ptr--, i++)
      if (!((icase) ? (isupper((int)(*nc_ptr)) ? tolower((int)(*nc_ptr)) : (int)(*nc_ptr)) == (isupper((int)(*hc_ptr)) ? tolower((int)(*hc_ptr)) : (int)(*hc_ptr)) : (*nc_ptr) == (*hc_ptr)))
        break;
    if (!((icase) ? (isupper((int)(*nc_ptr)) ? tolower((int)(*nc_ptr)) : (int)(*nc_ptr)) == (isupper((int)(*hc_ptr)) ? tolower((int)(*hc_ptr)) : (int)(*hc_ptr)) : (*nc_ptr) == (*hc_ptr))) {
      n = skiptable[((icase) ? (isupper((int)(*hc_ptr)) ? tolower((int)(*hc_ptr)) : (int)(*hc_ptr)) : (int)(*hc_ptr))];
      if (n == needlelen && i)
        if (((icase) ? (isupper((int)(*ne_ptr)) ? tolower((int)(*ne_ptr)) : (int)(*ne_ptr)) == (isupper((int)(((unsigned char *)needle)[0])) ? tolower((int)(((unsigned char *)needle)[0])) : (int)(((unsigned char *)needle)[0])) : (*ne_ptr) == (((unsigned char *)needle)[0])))
          n--;
      h_ptr += n;
      haystacklen -= n;
    } else
      return (unsigned char *)h_ptr;
  }
  return NULL;
}
```