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

```asm
<RandomFunc>:
  endbr64
  sub    $0x18,%rsp
  mov    0x4(%rdi),%ecx
  mov    %rsi,%rdx
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  mov    (%rdi),%eax
  add    $0x136ff696,%eax
  mov    %eax,0x4(%rsp)
  test   %ecx,%ecx
  je     L84
  test   %eax,%eax
  jne    L44
  cmp    $0x2,%ecx
  jbe    L84
L78:
  add    %eax,%eax
  mov    %eax,%esi
  mov    %eax,0xc(%rsp)
  sar    $0x18,%esi
  mov    %ah,0xf(%rsp)
  mov    0x4(%rsp),%eax
  mov    %sil,0xd(%rsp)
L101:
  cmp    $0x4,%ecx
  jbe    L84
  mov    $0x4,%esi
  lea    0x4(%rsp),%r8
L65:
  cmp    %eax,%esi
  jbe    L143
  add    %eax,%eax
  mov    %esi,%edi
  mov    %eax,%r11d
  mov    %eax,0x4(%rsp,%rdi,4)
  lea    (%r8,%rdi,4),%rdi
  shr    $0x18,%r11d
  mov    %ah,0x3(%rdi)
  mov    %r11b,0x1(%rdi)
  mov    0x4(%rsp),%eax
L106:
  add    $0x2,%esi
  cmp    %ecx,%esi
  jb     L65
  nopl   0x0(%rax)
L84:
  imul   $0xde594d51,%eax,%eax
  sub    $0x1e5ad0d1,%eax
  mov    %eax,(%rdx)
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L12
  add    $0x18,%rsp
  ret
  cs nopw 0x0(%rax,%rax,1)
L44:
  mov    %eax,%esi
  mov    %al,0x7(%rsp)
  sar    $0x18,%esi
  mov    %sil,0x4(%rsp)
  mov    0x4(%rsp),%eax
  add    %eax,%eax
  mov    %eax,0x4(%rsp)
  cmp    $0x2,%ecx
  jbe    L84
  cmp    $0x1,%eax
  jbe    L78
  cmp    $0x2,%eax
  je     L14
  movzbl 0xc(%rsp),%eax
  movzbl 0xf(%rsp),%esi
  mov    %al,0xf(%rsp)
  mov    %sil,0xc(%rsp)
  mov    0xc(%rsp),%eax
  add    %eax,%eax
  mov    %eax,0x4(%rsp)
  jmp    L101
  nopl   (%rax)
L143:
  jne    L109
  lea    (%rsi,%rsi,1),%eax
  mov    %esi,%edi
  mov    %eax,0x4(%rsp,%rdi,4)
  jmp    L106
L14:
  movl   $0x4,0xc(%rsp)
  mov    $0x4,%eax
  jmp    L101
  nopw   0x0(%rax,%rax,1)
L109:
  mov    %esi,%edi
  lea    (%r8,%rdi,4),%rax
  movzbl (%rax),%r9d
  movzbl 0x3(%rax),%r10d
  mov    %r9b,0x3(%rax)
  mov    %r10b,(%rax)
  mov    0x4(%rsp,%rdi,4),%eax
  add    %eax,%eax
  mov    %eax,0x4(%rsp)
  jmp    L106
L12:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void RandomFunc(unsigned int input[1], unsigned int output[1]) {
  unsigned int state[1];
  unsigned int local1;
  unsigned short copy11;
  char copy12;
  char copy14;
  {
    state[0UL] = (input[0UL] + 51238316UL) + 274866410U;
    local1 = 0UL;
    while (local1 < input[1UL]) {
      if (state[0UL] < local1) {
        if (state[0UL] == local1) {
          state[0UL] = state[local1] + state[0UL];
          copy11 = *((unsigned short *)(&state[0UL]) + 0);
          *((unsigned short *)(&state[0UL]) + 0) = *((unsigned short *)(&state[0UL]) + 1);
          *((unsigned short *)(&state[0UL]) + 1) = copy11;
        } else {
          state[local1] = state[0UL] + state[local1];
          copy12 = *((char *)(&state[local1]) + 1);
          *((char *)(&state[local1]) + 1) = *((char *)(&state[local1]) + 3);
          *((char *)(&state[local1]) + 3) = copy12;
        }
      } else if (state[0UL] <= local1) {
        state[local1] += state[0UL];
      } else {
        copy14 = *((char *)(&state[local1]) + 0);
        *((char *)(&state[local1]) + 0) = *((char *)(&state[local1]) + 3);
        *((char *)(&state[local1]) + 3) = copy14;
        state[0UL] = state[local1] + state[local1];
      }
      local1 += 2UL;
    }
    output[0UL] = (state[0UL] + 722834559UL) * 3730394449U;
  }
}
```