user: Converte this assembly snippet into its equivalent C code:

```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     L116
  test   %eax,%eax
  jne    L115
  cmp    $0x2,%ecx
  jbe    L116
L85:
  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)
L75:
  cmp    $0x4,%ecx
  jbe    L116
  mov    $0x4,%esi
  lea    0x4(%rsp),%r8
L112:
  cmp    %esi,%eax
  jae    L25
  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
L31:
  add    $0x2,%esi
  cmp    %ecx,%esi
  jb     L112
  nopl   0x0(%rax)
L116:
  add    $0x56e01b14,%eax
  mov    %eax,(%rdx)
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L77
  add    $0x18,%rsp
  ret
L115:
  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    L116
  cmp    $0x1,%eax
  jbe    L85
  cmp    $0x2,%eax
  je     L18
  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    L75
  nopl   (%rax)
L25:
  jne    L12
  add    %eax,%eax
  mov    %esi,%edi
  mov    %eax,0x4(%rsp,%rdi,4)
  jmp    L31
  nop
L18:
  movl   $0x4,0xc(%rsp)
  mov    $0x4,%eax
  jmp    L75
  nopw   0x0(%rax,%rax,1)
L12:
  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    L31
L77:
  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) + 734693013U;
  }
}
```