user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<RandomFunc>:
  endbr64
  push   %rbx
  mov    %rsi,%rdx
  sub    $0x10,%rsp
  mov    0x8(%rdi),%rcx
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  mov    (%rdi),%rax
  add    $0x136ff696,%rax
  mov    %rax,(%rsp)
  test   %rcx,%rcx
  je     L139
  mov    %rax,%rsi
  mov    %ax,0x6(%rsp)
  shr    $0x30,%rsi
  mov    %si,(%rsp)
  test   %rax,%rax
  jne    L60
  movq   $0x0,(%rsp)
  xor    %esi,%esi
  cmp    $0x2,%rcx
  jbe    L139
L95:
  movzbl 0x13(%rsp),%eax
  movzbl 0x15(%rsp),%edi
  mov    %al,0x15(%rsp)
  xor    %eax,%eax
  mov    %dil,%al
  mov    0x12(%rsp),%ah
  mov    %ax,0x12(%rsp)
  cmp    $0x2,%rsi
  jbe    L41
L35:
  movzbl 0x4(%rsp),%eax
  movzbl (%rsp),%edi
  movzbl 0x5(%rsp),%esi
  mov    %al,(%rsp)
  xor    %eax,%eax
  mov    %dil,%al
  mov    0x7(%rsp),%ah
  mov    %sil,0x7(%rsp)
  mov    %ax,0x4(%rsp)
  mov    (%rsp),%rax
L98:
  cmp    $0x4,%rcx
  jbe    L139
  mov    %rsp,%rsi
  mov    $0x4,%edi
L147:
  cmp    %rax,%rdi
  jbe    L32
  movzbl 0x23(%rsi),%eax
  movzbl 0x25(%rsi),%r8d
  mov    %al,0x25(%rsi)
  xor    %eax,%eax
  mov    %r8b,%al
  mov    0x22(%rsi),%ah
  mov    %ax,0x22(%rsi)
  mov    (%rsp),%rax
L106:
  cmp    %rax,%rdi
  jb     L127
  add    %rax,%rax
  mov    %rax,0x20(%rsi)
L126:
  add    $0x2,%rdi
  add    $0x10,%rsi
  cmp    %rcx,%rdi
  jb     L147
  nop
L139:
  add    $0x32060f04,%rax
  mov    %rax,(%rdx)
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L61
  add    $0x10,%rsp
  pop    %rbx
  ret
  nopl   0x0(%rax,%rax,1)
L60:
  mov    %rax,%rsi
  xor    %ebx,%ebx
  shl    $0x18,%rsi
  sar    $0x38,%rsi
  mov    %sil,(%rsp)
  mov    %rax,%rsi
  shl    $0x8,%rsi
  sar    $0x38,%rsi
  mov    %sil,%bl
  mov    %ah,%bh
  shl    $0x10,%rax
  sar    $0x38,%rax
  mov    %bx,0x4(%rsp)
  mov    %al,0x7(%rsp)
  mov    (%rsp),%rsi
  mov    %rsi,%rax
  cmp    $0x2,%rcx
  jbe    L139
  cmp    $0x1,%rsi
  jbe    L95
  movzwl 0x10(%rsp),%eax
  movzwl 0x16(%rsp),%edi
  mov    %ax,0x16(%rsp)
  mov    %di,0x10(%rsp)
  cmp    $0x2,%rsi
  ja     L35
L41:
  lea    (%rsi,%rsi,1),%rax
  mov    %rax,0x10(%rsp)
  jmp    L98
  nopl   (%rax)
L32:
  movzwl 0x20(%rsi),%r8d
  movzwl 0x26(%rsi),%r9d
  mov    %r8w,0x26(%rsi)
  mov    %r9w,0x20(%rsi)
  jmp    L106
  nopl   0x0(%rax)
L127:
  movzbl 0x4(%rsp),%eax
  movzbl (%rsp),%r9d
  movzbl 0x5(%rsp),%r8d
  mov    %al,(%rsp)
  xor    %eax,%eax
  mov    %r9b,%al
  mov    0x7(%rsp),%ah
  mov    %r8b,0x7(%rsp)
  mov    %ax,0x4(%rsp)
  mov    (%rsp),%rax
  jmp    L126
L61:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void RandomFunc(unsigned long input[1], unsigned long output[1]) {
  unsigned long state[1];
  unsigned long local1;
  char copy11;
  unsigned short copy12;
  char copy13;
  {
    state[0UL] = (input[0UL] + 51238316UL) + 274866410UL;
    local1 = 0UL;
    while (local1 < input[1UL]) {
      if (state[0UL] < local1) {
        copy11 = *((char *)(&state[local1]) + 5);
        *((char *)(&state[local1]) + 5) = *((char *)(&state[local1]) + 3);
        *((char *)(&state[local1]) + 3) = copy11;
        copy11 = *((char *)(&state[local1]) + 3);
        *((char *)(&state[local1]) + 3) = *((char *)(&state[local1]) + 2);
        *((char *)(&state[local1]) + 2) = copy11;
      } else {
        copy12 = *((unsigned short *)(&state[local1]) + 0);
        *((unsigned short *)(&state[local1]) + 0) = *((unsigned short *)(&state[local1]) + 3);
        *((unsigned short *)(&state[local1]) + 3) = copy12;
      }
      if (state[0UL] <= local1) {
        state[local1] = state[0UL] + state[0UL];
      } else {
        copy13 = *((char *)(&state[0UL]) + 0);
        *((char *)(&state[0UL]) + 0) = *((char *)(&state[0UL]) + 4);
        *((char *)(&state[0UL]) + 4) = copy13;
        copy13 = *((char *)(&state[0UL]) + 5);
        *((char *)(&state[0UL]) + 5) = *((char *)(&state[0UL]) + 7);
        *((char *)(&state[0UL]) + 7) = copy13;
      }
      local1 += 2UL;
    }
    output[0UL] = state[0UL] + 839257860UL;
  }
}
```