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

```asm
<ShuffleSortedArray>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x230,%rsp
  mov    %rdi,-0x228(%rbp)
  mov    %esi,-0x22c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x21c(%rbp)
  movl   $0x0,-0x218(%rbp)
  jmp    L38
L71:
  cmpl   $0x1,-0x22c(%rbp)
  jg     L42
  subl   $0x1,-0x21c(%rbp)
  mov    -0x21c(%rbp),%eax
  cltq
  mov    -0x210(%rbp,%rax,8),%eax
  mov    %eax,-0x218(%rbp)
  mov    -0x21c(%rbp),%eax
  cltq
  mov    -0x20c(%rbp,%rax,8),%eax
  mov    %eax,-0x22c(%rbp)
L42:
  cmpl   $0x8,-0x22c(%rbp)
  ja     L44
  mov    -0x22c(%rbp),%eax
  lea    0x0(,%rax,4),%rdx
  lea    D12(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D12(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
  mov    -0x218(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x228(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x214(%rbp)
  mov    -0x218(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x228(%rbp),%rax
  add    %rdx,%rax
  mov    -0x218(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x228(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  mov    -0x218(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x228(%rbp),%rax
  add    %rax,%rdx
  mov    -0x214(%rbp),%eax
  mov    %eax,(%rdx)
  movl   $0x0,-0x22c(%rbp)
  jmp    L38
  mov    -0x218(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x228(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x214(%rbp)
  mov    -0x218(%rbp),%eax
  cltq
  add    $0x2,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x228(%rbp),%rax
  add    %rdx,%rax
  mov    -0x218(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x228(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  mov    -0x218(%rbp),%eax
  cltq
  add    $0x2,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x228(%rbp),%rax
  add    %rax,%rdx
  mov    -0x214(%rbp),%eax
  mov    %eax,(%rdx)
  movl   $0x0,-0x22c(%rbp)
  jmp    L38
  mov    -0x218(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x228(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x214(%rbp)
  mov    -0x218(%rbp),%eax
  cltq
  add    $0x2,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x228(%rbp),%rax
  add    %rdx,%rax
  mov    -0x218(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x228(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  mov    -0x218(%rbp),%eax
  cltq
  add    $0x2,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x228(%rbp),%rax
  add    %rax,%rdx
  mov    -0x214(%rbp),%eax
  mov    %eax,(%rdx)
  mov    -0x218(%rbp),%eax
  cltq
  add    $0x3,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x228(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x214(%rbp)
  mov    -0x218(%rbp),%eax
  cltq
  add    $0x4,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x228(%rbp),%rax
  add    %rdx,%rax
  mov    -0x218(%rbp),%edx
  movslq %edx,%rdx
  add    $0x3,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x228(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  mov    -0x218(%rbp),%eax
  cltq
  add    $0x4,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x228(%rbp),%rax
  add    %rax,%rdx
  mov    -0x214(%rbp),%eax
  mov    %eax,(%rdx)
  movl   $0x0,-0x22c(%rbp)
  jmp    L38
  mov    -0x218(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x228(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x214(%rbp)
  mov    -0x218(%rbp),%eax
  cltq
  add    $0x3,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x228(%rbp),%rax
  add    %rdx,%rax
  mov    -0x218(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x228(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  mov    -0x218(%rbp),%eax
  cltq
  add    $0x2,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x228(%rbp),%rax
  add    %rdx,%rax
  mov    -0x218(%rbp),%edx
  movslq %edx,%rdx
  add    $0x3,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x228(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  mov    -0x218(%rbp),%eax
  cltq
  add    $0x2,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x228(%rbp),%rax
  add    %rax,%rdx
  mov    -0x214(%rbp),%eax
  mov    %eax,(%rdx)
  mov    -0x218(%rbp),%eax
  cltq
  add    $0x4,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x228(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x214(%rbp)
  mov    -0x218(%rbp),%eax
  cltq
  add    $0x5,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x228(%rbp),%rax
  add    %rdx,%rax
  mov    -0x218(%rbp),%edx
  movslq %edx,%rdx
  add    $0x4,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x228(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  mov    -0x218(%rbp),%eax
  cltq
  add    $0x5,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x228(%rbp),%rax
  add    %rax,%rdx
  mov    -0x214(%rbp),%eax
  mov    %eax,(%rdx)
  movl   $0x0,-0x22c(%rbp)
  jmp    L38
  mov    -0x218(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x228(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x214(%rbp)
  mov    -0x218(%rbp),%eax
  cltq
  add    $0x4,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x228(%rbp),%rax
  add    %rdx,%rax
  mov    -0x218(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x228(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  mov    -0x218(%rbp),%eax
  cltq
  add    $0x3,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x228(%rbp),%rax
  add    %rdx,%rax
  mov    -0x218(%rbp),%edx
  movslq %edx,%rdx
  add    $0x4,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x228(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  mov    -0x218(%rbp),%eax
  cltq
  add    $0x3,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x228(%rbp),%rax
  add    %rax,%rdx
  mov    -0x214(%rbp),%eax
  mov    %eax,(%rdx)
  mov    -0x218(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x228(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x214(%rbp)
  mov    -0x218(%rbp),%eax
  cltq
  add    $0x2,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x228(%rbp),%rax
  add    %rdx,%rax
  mov    -0x218(%rbp),%edx
  movslq %edx,%rdx
  add    $0x1,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x228(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  mov    -0x218(%rbp),%eax
  cltq
  add    $0x2,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x228(%rbp),%rax
  add    %rax,%rdx
  mov    -0x214(%rbp),%eax
  mov    %eax,(%rdx)
  mov    -0x218(%rbp),%eax
  cltq
  add    $0x5,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x228(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x214(%rbp)
  mov    -0x218(%rbp),%eax
  cltq
  add    $0x6,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x228(%rbp),%rax
  add    %rdx,%rax
  mov    -0x218(%rbp),%edx
  movslq %edx,%rdx
  add    $0x5,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x228(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  mov    -0x218(%rbp),%eax
  cltq
  add    $0x6,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x228(%rbp),%rax
  add    %rax,%rdx
  mov    -0x214(%rbp),%eax
  mov    %eax,(%rdx)
  movl   $0x0,-0x22c(%rbp)
  jmp    L38
L44:
  mov    -0x22c(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,%edx
  mov    -0x218(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x228(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x214(%rbp)
  mov    -0x22c(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edx
  mov    -0x218(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x228(%rbp),%rax
  add    %rax,%rcx
  mov    -0x218(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rsi
  mov    -0x228(%rbp),%rax
  add    %rsi,%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memmove@plt>
  mov    -0x218(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x228(%rbp),%rax
  add    %rax,%rdx
  mov    -0x214(%rbp),%eax
  mov    %eax,(%rdx)
  addl   $0x1,-0x218(%rbp)
  mov    -0x22c(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,%edx
  mov    -0x218(%rbp),%eax
  add    %eax,%edx
  mov    -0x21c(%rbp),%eax
  cltq
  mov    %edx,-0x210(%rbp,%rax,8)
  mov    -0x22c(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,%edx
  mov    -0x21c(%rbp),%eax
  cltq
  mov    %edx,-0x20c(%rbp,%rax,8)
  addl   $0x1,-0x21c(%rbp)
  mov    -0x22c(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0x22c(%rbp)
  nop
L38:
  cmpl   $0x1,-0x22c(%rbp)
  jg     L71
  cmpl   $0x0,-0x21c(%rbp)
  jne    L71
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L26
  call   <__stack_chk_fail@plt>
L26:
  leave
  ret
```

assistant: ```c
void ShuffleSortedArray(int *array, int count) {
  struct {
    int first, count;
  } aStack[64];
  int stk = 0;
  int first = 0;
  int tmp;
  while (count > 1 || stk) {
    if (count <= 1) {
      stk--;
      first = aStack[stk].first;
      count = aStack[stk].count;
    }
    switch (count) {
    case 2:
    case 3:
      tmp = array[first];
      array[first] = array[first + 1];
      array[first + 1] = tmp;
      count = 0;
      break;
    case 4:
      tmp = array[first];
      array[first] = array[first + 2];
      array[first + 2] = tmp;
      count = 0;
      break;
    case 5:
      tmp = array[first];
      array[first] = array[first + 2];
      array[first + 2] = tmp;
      tmp = array[first + 3];
      array[first + 3] = array[first + 4];
      array[first + 4] = tmp;
      count = 0;
      break;
    case 6:
    case 7:
      tmp = array[first];
      array[first] = array[first + 3];
      array[first + 3] = array[first + 2];
      array[first + 2] = tmp;
      tmp = array[first + 4];
      array[first + 4] = array[first + 5];
      array[first + 5] = tmp;
      count = 0;
      break;
    case 8:
      tmp = array[first];
      array[first] = array[first + 4];
      array[first + 4] = array[first + 3];
      array[first + 3] = tmp;
      tmp = array[first + 1];
      array[first + 1] = array[first + 2];
      array[first + 2] = tmp;
      tmp = array[first + 5];
      array[first + 5] = array[first + 6];
      array[first + 6] = tmp;
      count = 0;
      break;
    default:
      tmp = array[first + count / 2];
      memmove(&array[first + 1], &array[first], sizeof(array[0]) * (count / 2));
      array[first] = tmp;
      first++;
      aStack[stk].first = first + count / 2;
      aStack[stk].count = (count - 1) / 2;
      stk++;
      count = count / 2;
      break;
    }
  }
}
```