user: Translate the below assembly code into C programming language:

```asm
<Railgun7a>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x418,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x408(%rsp)
  xor    %eax,%eax
  cmp    %ecx,%esi
  jl     L179
  mov    %esi,%r9d
  mov    %rdx,%r10
  mov    (%rdx),%esi
  mov    %ecx,%r12d
  cmp    $0x1,%ecx
  je     L8
  movslq %r9d,%rax
  lea    (%rdi,%rax,4),%r8
  cmp    $0x2,%ecx
  je     L323
  cmp    $0x3,%ecx
  je     L309
  cmp    $0x3c0,%r9d
  jg     L141
  movslq %ecx,%rbx
  mov    %esi,%r11d
  lea    -0x1(%r12),%r9d
  mov    %esi,%ecx
  shl    $0x10,%ecx
  shl    $0x8,%r11d
  lea    0x0(,%rbx,4),%rdx
  or     %ecx,%r11d
  mov    %esi,%ecx
  lea    (%rdi,%rdx,1),%rax
  mov    %rdx,%rbp
  shl    $0x18,%ecx
  neg    %rbp
  or     %ecx,%r11d
  movslq %r9d,%rcx
  neg    %rcx
  lea    (%rdx,%rcx,4),%rdx
  lea    (%r10,%rdx,1),%rdi
  mov    $0x1,%edx
  mov    %r9d,%r10d
  sub    %r12d,%edx
  movslq %edx,%r12
  shl    $0x2,%r12
  jmp    L114
  nopl   (%rax)
L205:
  mov    %edx,%ecx
  mov    $0x4,%edx
  xor    %r11d,%ecx
  test   $0xff,%ch
  je     L375
  mov    $0x8,%edx
  test   $0xff0000,%ecx
  je     L375
  and    $0xff000000,%ecx
  cmp    $0x1,%ecx
  sbb    %rdx,%rdx
  and    $0xfffffffffffffffc,%rdx
  add    $0x10,%rdx
L375:
  add    %rdx,%rax
  cmp    %rax,%r8
  jb     L179
L114:
  mov    (%rax,%rbp,1),%edx
  cmp    %esi,%edx
  jne    L205
  lea    (%rax,%r12,1),%r15
  xor    %edx,%edx
  mov    $0x1,%ecx
  jmp    L308
  nopl   0x0(%rax)
L72:
  add    %ecx,%r13d
  cmp    %r9d,%r13d
  jne    L37
  cmp    %esi,%r14d
  setne  %r13b
  cmp    $0x1,%r13b
  sbb    $0xffffffff,%ecx
L37:
  add    $0x1,%rdx
  cmp    %r10,%rdx
  je     L396
L308:
  mov    %r9d,%r13d
  mov    (%r15,%rdx,4),%r14d
  sub    %edx,%r13d
  cmp    %r14d,(%rdi,%rdx,4)
  je     L72
  movslq %ecx,%rdx
  shl    $0x2,%rdx
  add    %rdx,%rax
  cmp    %rax,%r8
  jae    L114
  nopw   0x0(%rax,%rax,1)
L179:
  xor    %eax,%eax
L426:
  mov    0x408(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L62
  add    $0x418,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L323:
  shl    $0x8,%esi
  add    0x4(%rdx),%esi
  lea    0x8(%rdi),%rax
  mov    %esi,%edi
  sar    $0x8,%edi
L112:
  mov    -0x8(%rax),%edx
  mov    -0x4(%rax),%ecx
  shl    $0x8,%edx
  add    %ecx,%edx
  cmp    %esi,%edx
  je     L181
L158:
  cmp    %edi,%ecx
  je     L13
  add    $0x8,%rax
  cmp    %rax,%r8
  jb     L179
  mov    -0x8(%rax),%edx
  mov    -0x4(%rax),%ecx
  shl    $0x8,%edx
  add    %ecx,%edx
  cmp    %esi,%edx
  jne    L158
L181:
  sub    $0x2,%rax
  jmp    L426
  nopl   0x0(%rax,%rax,1)
L13:
  add    $0x4,%rax
  cmp    %rax,%r8
  jae    L112
  jmp    L179
L141:
  movd   %ecx,%xmm1
  mov    %rsp,%rax
  lea    0x400(%rsp),%rdx
  pshufd $0x0,%xmm1,%xmm0
  nopw   0x0(%rax,%rax,1)
L163:
  movaps %xmm0,(%rax)
  add    $0x10,%rax
  cmp    %rax,%rdx
  jne    L163
  lea    -0x1(%r12),%eax
  mov    %r10,%rdx
  test   %eax,%eax
  jle    L126
L202:
  movslq (%rdx),%rcx
  add    $0x4,%rdx
  mov    %eax,(%rsp,%rcx,4)
  sub    $0x1,%eax
  jne    L202
L126:
  lea    -0x4(%r12),%ebp
  movslq %r12d,%rax
  sub    %r12d,%r9d
  xor    %edx,%edx
  movslq %ebp,%rbx
  neg    %rbx
  shl    $0x2,%rbx
  lea    (%rbx,%rax,4),%r13
  add    %r10,%r13
  jmp    L66
  nop
L98:
  movslq -0x4(%rdi,%r8,4),%rax
  add    (%rsp,%rax,4),%edx
  cmp    %r9d,%edx
  jg     L179
L66:
  lea    (%r12,%rdx,1),%r8d
  movslq %edx,%r10
  movslq %r8d,%r8
  cmp    %esi,(%rdi,%r10,4)
  jne    L98
  test   %ebp,%ebp
  jle    L231
  lea    (%rbx,%r8,4),%r11
  mov    %ebp,%ecx
  xor    %eax,%eax
  add    %rdi,%r11
L328:
  mov    (%r11,%rax,1),%r15d
  cmp    %r15d,0x0(%r13,%rax,1)
  jne    L98
  add    $0x4,%rax
  sub    $0x1,%ecx
  jne    L328
L395:
  lea    (%rdi,%r10,1),%rax
  jmp    L426
L231:
  jne    L98
  jmp    L395
  nopl   0x0(%rax)
L309:
  shl    $0x8,%esi
  add    0x8(%rdx),%esi
  lea    0xc(%rdi),%rax
  mov    %esi,%edi
  sar    $0x8,%edi
  nopw   0x0(%rax,%rax,1)
L198:
  mov    -0xc(%rax),%edx
  mov    -0x8(%rax),%ecx
  shl    $0x8,%edx
  add    -0x4(%rax),%edx
  cmp    %esi,%edx
  je     L236
L218:
  cmp    %ecx,%edi
  je     L14
  add    $0x8,%rax
  cmp    %rax,%r8
  jb     L179
  mov    -0xc(%rax),%edx
  mov    -0x8(%rax),%ecx
  shl    $0x8,%edx
  add    -0x4(%rax),%edx
  cmp    %esi,%edx
  jne    L218
L236:
  cmp    %ecx,0x4(%r10)
  jne    L218
  sub    $0x3,%rax
  jmp    L426
L14:
  add    $0x4,%rax
  cmp    %rax,%r8
  jae    L198
  jmp    L179
L8:
  mov    0x408(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L62
  add    $0x418,%rsp
  mov    %r9d,%edx
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1070 <memchr@plt>
  nopw   0x0(%rax,%rax,1)
L396:
  sub    %rbx,%rax
  jmp    L426
L62:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
char *Railgun7a(char *target, int tgtlen, char *pattern, int patlen) {
  uint8_t *tgt = (uint8_t *)target, *pat = (uint8_t *)pattern;
  uint8_t *tgtMax = tgt + tgtlen;
  uint32_t patwin, tgtwin;
  int skip, count;
  int bm_bc[256];
  if (patlen > tgtlen)
    return NULL;
  if (patlen == 1)
    return memchr(tgt, *pat, tgtlen);
  if (patlen == 2) {
    tgt += 2;
    patwin = (pat[0] << 8) + pat[1];
    while (1) {
      if (patwin == ((uint32_t)tgt[-2] << 8) + tgt[-1])
        return (char *)tgt - 2;
      tgt += (uint8_t)(patwin >> 8) == tgt[-1] ? 1 : 2;
      if (tgt > tgtMax)
        return NULL;
    }
  } else if (patlen == 3) {
    tgt += 3;
    patwin = (pat[0] << 8) + pat[2];
    while (1) {
      if (patwin == ((uint32_t)tgt[-3] << 8) + tgt[-1]) {
        if (pat[1] == tgt[-2])
          return (char *)tgt - 3;
      }
      tgt += (uint8_t)(patwin >> 8) == tgt[-2] ? 1 : 2;
      if (tgt > tgtMax)
        return NULL;
    }
  } else if (tgtlen < 961) {
    tgt = tgt + patlen;
    patwin = *(uint32_t *)pat;
    uint8_t pat0 = (uint8_t)patwin;
    uint32_t ppp0 = (pat0 << 8) | (pat0 << 16) | (pat0 << 24);
    while (1) {
      tgtwin = *(uint32_t *)(tgt - patlen);
      if (patwin == tgtwin) {
        skip = 1;
        for (count = patlen - 1; count && pat[patlen - count] == tgt[-count]; count--) {
          if (patlen - 1 == skip + count && pat0 != tgt[-count])
            skip++;
        }
        if (count == 0)
          return (char *)tgt - patlen;
      } else {
        uint32_t diff = tgtwin ^ ppp0;
        skip = !(diff & 0x0000FF00) ? 1 : !(diff & 0x00FF0000) ? 2 : !(diff & 0xFF000000) ? 3 : 4;
      }
      tgt = tgt + skip;
      if (tgt > tgtMax)
        return NULL;
    }
  } else {
    int i;
    for (i = 0; i < 256; i++)
      bm_bc[i] = patlen;
    for (i = 0; i < patlen - 1; i++)
      bm_bc[pat[i]] = patlen - i - 1;
    patwin = *(uint32_t *)pat;
    for (i = 0; i <= tgtlen - patlen; i = i + bm_bc[tgt[i + patlen - 1]]) {
      if (*(uint32_t *)&tgt[i] == patwin) {
        count = patlen - 4;
        while (count > 0 && pat[patlen - count] == tgt[i + patlen - count])
          count--;
        if (count == 0)
          return (char *)tgt + i;
      }
    }
    return NULL;
  }
}
```