user: Please show me the C implementation that matches the assembly code listed below:

```asm
<RandomFunc>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x18(%rbp),%rax
  movzwl (%rax),%eax
  add    $0x7296,%ax
  mov    %ax,-0xa(%rbp)
  movw   $0x0,-0xc(%rbp)
  jmp    L46
L56:
  movzwl -0xa(%rbp),%eax
  cmp    %ax,-0xc(%rbp)
  jae    L7
  movzwl -0xc(%rbp),%eax
  cltq
  movzwl -0xa(%rbp,%rax,2),%eax
  movzwl %ax,%edx
  movzwl -0xc(%rbp),%eax
  cltq
  movzwl -0xa(%rbp,%rax,2),%eax
  movzwl %ax,%eax
  and    $0xe,%eax
  or     $0x1,%eax
  mov    %eax,%ecx
  sar    %cl,%edx
  mov    %edx,%eax
  mov    %eax,%esi
  movzwl -0xc(%rbp),%eax
  cltq
  movzwl -0xa(%rbp,%rax,2),%eax
  movzwl %ax,%edx
  movzwl -0xc(%rbp),%eax
  cltq
  movzwl -0xa(%rbp,%rax,2),%eax
  movzwl %ax,%eax
  and    $0xe,%eax
  or     $0x1,%eax
  mov    %eax,%ecx
  mov    $0x10,%eax
  sub    %ecx,%eax
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  or     %esi,%eax
  mov    %ax,-0xa(%rbp)
  movzwl -0xc(%rbp),%eax
  cltq
  movzwl -0xa(%rbp,%rax,2),%eax
  movzwl %ax,%edx
  movzwl -0xc(%rbp),%eax
  cltq
  movzwl -0xa(%rbp,%rax,2),%eax
  shr    $0x2,%ax
  movzwl %ax,%eax
  and    $0xe,%eax
  or     $0x1,%eax
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  mov    %eax,%esi
  movzwl -0xc(%rbp),%eax
  cltq
  movzwl -0xa(%rbp,%rax,2),%eax
  movzwl %ax,%edx
  movzwl -0xc(%rbp),%eax
  cltq
  movzwl -0xa(%rbp,%rax,2),%eax
  shr    $0x2,%ax
  movzwl %ax,%eax
  and    $0xe,%eax
  or     $0x1,%eax
  mov    %eax,%ecx
  mov    $0x10,%eax
  sub    %ecx,%eax
  mov    %eax,%ecx
  sar    %cl,%edx
  mov    %edx,%eax
  or     %esi,%eax
  mov    %ax,-0xa(%rbp)
  jmp    L51
L7:
  movzwl -0xc(%rbp),%eax
  lea    -0xa(%rbp),%rdx
  cltq
  add    %rax,%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0xd(%rbp)
  movzwl -0xc(%rbp),%eax
  lea    -0xa(%rbp),%rdx
  cltq
  add    %rax,%rax
  add    %rdx,%rax
  add    $0x1,%rax
  movzwl -0xc(%rbp),%edx
  lea    -0xa(%rbp),%rcx
  movslq %edx,%rdx
  add    %rdx,%rdx
  add    %rcx,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  movzwl -0xc(%rbp),%eax
  lea    -0xa(%rbp),%rdx
  cltq
  add    %rax,%rax
  add    %rdx,%rax
  lea    0x1(%rax),%rdx
  movzbl -0xd(%rbp),%eax
  mov    %al,(%rdx)
  movzwl -0xc(%rbp),%eax
  cltq
  movzwl -0xa(%rbp,%rax,2),%eax
  mov    %eax,%edi
  movzwl -0xc(%rbp),%eax
  cltq
  movzwl -0xa(%rbp,%rax,2),%eax
  movzwl %ax,%edx
  movzwl -0xa(%rbp),%eax
  shr    $0x2,%ax
  movzwl %ax,%eax
  and    $0xe,%eax
  or     $0x1,%eax
  mov    %edx,%esi
  mov    %eax,%ecx
  shl    %cl,%esi
  movzwl -0xc(%rbp),%eax
  cltq
  movzwl -0xa(%rbp,%rax,2),%eax
  movzwl %ax,%edx
  movzwl -0xa(%rbp),%eax
  shr    $0x2,%ax
  movzwl %ax,%eax
  and    $0xe,%eax
  or     $0x1,%eax
  mov    %eax,%ecx
  mov    $0x10,%eax
  sub    %ecx,%eax
  mov    %eax,%ecx
  sar    %cl,%edx
  mov    %edx,%eax
  or     %esi,%eax
  shl    $0x4,%eax
  and    $0x3f0,%ax
  or     %eax,%edi
  mov    %edi,%edx
  movzwl -0xc(%rbp),%eax
  cltq
  mov    %dx,-0xa(%rbp,%rax,2)
L51:
  movzwl -0xa(%rbp),%eax
  cmp    %ax,-0xc(%rbp)
  jne    L43
  movzwl -0xc(%rbp),%eax
  cltq
  movzwl -0xa(%rbp,%rax,2),%eax
  mov    %eax,%edx
  movzwl -0xc(%rbp),%eax
  cltq
  movzwl -0xa(%rbp,%rax,2),%eax
  movzwl %ax,%eax
  add    %eax,%eax
  shl    $0x2,%eax
  and    $0x38,%eax
  or     %eax,%edx
  movzwl -0xc(%rbp),%eax
  cltq
  mov    %dx,-0xa(%rbp,%rax,2)
  jmp    L37
L43:
  movzwl -0xc(%rbp),%eax
  cltq
  movzwl -0xa(%rbp,%rax,2),%eax
  mov    %eax,%ecx
  movzwl -0xc(%rbp),%eax
  cltq
  movzwl -0xa(%rbp,%rax,2),%eax
  movzwl %ax,%edx
  movzwl -0xc(%rbp),%eax
  cltq
  movzwl -0xa(%rbp,%rax,2),%eax
  movzwl %ax,%eax
  imul   %edx,%eax
  shl    $0x4,%eax
  and    $0x3f0,%ax
  or     %eax,%ecx
  mov    %ecx,%edx
  movzwl -0xc(%rbp),%eax
  cltq
  mov    %dx,-0xa(%rbp,%rax,2)
L37:
  movzwl -0xc(%rbp),%eax
  add    $0x1,%eax
  mov    %ax,-0xc(%rbp)
L46:
  mov    -0x18(%rbp),%rax
  add    $0x2,%rax
  movzwl (%rax),%eax
  cmp    %ax,-0xc(%rbp)
  jb     L56
  movzwl -0xa(%rbp),%eax
  imul   $0x274,%ax,%dx
  mov    -0x20(%rbp),%rax
  mov    %dx,(%rax)
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L57
  call   <__stack_chk_fail@plt>
L57:
  leave
  ret
```

assistant: ```c
void RandomFunc(unsigned short input[1], unsigned short output[1]) {
  unsigned short state[1];
  unsigned short local1;
  char copy11;
  {
    state[0UL] = (input[0UL] - 51238316UL) - (unsigned short)47038;
    local1 = 0UL;
    while (local1 < input[1UL]) {
      if (state[0UL] > local1) {
        state[0UL] = (state[local1] >> ((state[local1] & (unsigned short)15) | 1UL)) | (state[local1] << (16 - ((state[local1] & (unsigned short)15) | 1UL)));
        state[0UL] = (state[local1] << (((state[local1] >> (unsigned short)2) & (unsigned short)15) | 1UL)) | (state[local1] >> (16 - (((state[local1] >> (unsigned short)2) & (unsigned short)15) | 1UL)));
      } else {
        copy11 = *((char *)(&state[local1]) + 0);
        *((char *)(&state[local1]) + 0) = *((char *)(&state[local1]) + 1);
        *((char *)(&state[local1]) + 1) = copy11;
        state[local1] |= (((state[local1] << (((state[0UL] >> (unsigned short)2) & (unsigned short)15) | 1UL)) | (state[local1] >> (16 - (((state[0UL] >> (unsigned short)2) & (unsigned short)15) | 1UL)))) & (unsigned short)63) << 4UL;
      }
      if (state[0UL] == local1) {
        state[local1] |= ((state[local1] + state[local1]) & (unsigned short)15) << 2UL;
      } else {
        state[local1] |= (state[local1] * state[local1] & (unsigned short)63) << 4UL;
      }
      local1++;
    }
    output[0UL] = state[0UL] * 1062470260UL;
  }
}
```