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

```asm
<qsort_twin>:
  endbr64
  push   %r15
  mov    %rdi,%r8
  mov    %edx,%r15d
  xor    %ecx,%ecx
  push   %r14
  xor    %r14d,%r14d
  push   %r13
  mov    %rsi,%r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x988,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x978(%rsp)
  xor    %eax,%eax
  lea    0x4c0(%rsp),%rax
  mov    %edx,0x4c0(%rsp)
  movl   $0x0,0x10(%rsp)
  mov    %rax,0x8(%rsp)
L5:
  lea    -0x1(%r15),%edx
  cmp    %ecx,%edx
  jg     L77
L55:
  sub    $0x1,%r14d
  jb     L58
  movslq %r14d,%rax
  mov    0x4c0(%rsp,%rax,4),%r15d
  mov    0x10(%rsp,%rax,4),%ecx
  lea    -0x1(%r15),%edx
  cmp    %ecx,%edx
  jle    L55
L77:
  movslq %ecx,%rsi
  mov    0x0(%r13,%rsi,4),%eax
  mov    (%r8,%rsi,4),%r10d
  mov    %eax,0x4(%rsp)
  nopl   0x0(%rax,%rax,1)
L145:
  movslq %edx,%rdi
  lea    0x0(,%rdi,4),%r11
  lea    (%r8,%r11,1),%rbx
  mov    (%rbx),%r9d
  cmp    %edx,%ecx
  jge    L149
  cmp    %r10d,%r9d
  jl     L149
  lea    -0x1(%rdx),%eax
  lea    -0x4(%r8,%rdi,4),%rdi
  cltq
  nopl   (%rax)
L114:
  mov    (%rdi),%r9d
  cmp    %eax,%ecx
  mov    %eax,%edx
  lea    0x0(,%rax,4),%r11
  setl   %r12b
  mov    %rdi,%rbx
  cmp    %r10d,%r9d
  setge  %bpl
  sub    $0x1,%rax
  sub    $0x4,%rdi
  test   %bpl,%r12b
  jne    L114
L149:
  cmp    %ecx,%edx
  jle    L87
  mov    %r9d,(%r8,%rsi,4)
  mov    0x0(%r13,%r11,1),%eax
  add    $0x1,%ecx
  mov    %eax,0x0(%r13,%rsi,4)
  movslq %ecx,%rsi
  shl    $0x2,%rsi
  lea    (%r8,%rsi,1),%rdi
  mov    (%rdi),%eax
  cmp    %eax,%r10d
  jl     L61
  cmp    %ecx,%edx
  jle    L158
  add    $0x4,%rsi
  jmp    L6
  nopl   0x0(%rax,%rax,1)
L89:
  lea    0x4(%rsi),%rax
  cmp    %edx,%ecx
  je     L92
  mov    %rax,%rsi
L6:
  mov    (%r8,%rsi,1),%eax
  add    $0x1,%ecx
  lea    (%r8,%rsi,1),%rdi
  cmp    %r10d,%eax
  jle    L89
L61:
  cmp    %edx,%ecx
  jge    L158
  mov    %eax,(%rbx)
  mov    0x0(%r13,%rsi,1),%eax
  sub    $0x1,%edx
  mov    %eax,0x0(%r13,%r11,1)
  cmp    %ecx,%edx
  jle    L158
  movslq %ecx,%rsi
  jmp    L145
  nopw   0x0(%rax,%rax,1)
L87:
  shl    $0x2,%rsi
  lea    (%r8,%rsi,1),%rdi
  mov    (%rdi),%eax
  cmp    %r10d,%eax
  jg     L61
L158:
  mov    %ecx,%edx
  nopl   0x0(%rax)
L92:
  mov    0x4(%rsp),%eax
  mov    %r10d,(%rdi)
  movd   %edx,%xmm0
  lea    0x1(%r14),%edi
  movd   %r15d,%xmm2
  lea    0x1(%rdx),%ecx
  movd   %edx,%xmm3
  movslq %r14d,%r14
  mov    %eax,0x0(%r13,%rsi,1)
  punpckldq %xmm2,%xmm0
  movslq %edi,%rsi
  movd   %ecx,%xmm1
  mov    0x8(%rsp),%rax
  mov    %ecx,0x10(%rsp,%rsi,4)
  lea    (%rax,%r14,4),%r9
  movq   %xmm0,(%r9)
  mov    0x4c0(%rsp,%rsi,4),%r15d
  sub    0x10(%rsp,%r14,4),%edx
  movd   0x10(%rsp,%r14,4),%xmm4
  mov    %r15d,%eax
  movd   %r15d,%xmm0
  sub    %ecx,%eax
  punpckldq %xmm3,%xmm0
  punpckldq %xmm4,%xmm1
  cmp    %edx,%eax
  jle    L123
  movq   %xmm1,0x10(%rsp,%r14,4)
  movq   %xmm0,(%r9)
  mov    0x10(%rsp,%rsi,4),%ecx
  mov    0x4c0(%rsp,%rsi,4),%r15d
L123:
  mov    %edi,%r14d
  jmp    L5
L58:
  mov    0x978(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L57
  add    $0x988,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L57:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void qsort_twin(int *arr_pri, int *arr_sec, const int elements) {
  int piv_pri, piv_sec, beg[300], end[300], i = 0, L, R, swap;
  beg[0] = 0;
  end[0] = elements;
  while (i >= 0) {
    L = beg[i];
    R = end[i] - 1;
    if (L < R) {
      piv_pri = arr_pri[L];
      piv_sec = arr_sec[L];
      while (L < R) {
        while (arr_pri[R] >= piv_pri && L < R)
          R--;
        if (L < R) {
          arr_pri[L] = arr_pri[R];
          arr_sec[L++] = arr_sec[R];
        }
        while (arr_pri[L] <= piv_pri && L < R)
          L++;
        if (L < R) {
          arr_pri[R] = arr_pri[L];
          arr_sec[R--] = arr_sec[L];
        }
      }
      arr_pri[L] = piv_pri;
      arr_sec[L] = piv_sec;
      beg[i + 1] = L + 1;
      end[i + 1] = end[i];
      end[i++] = L;
      if (end[i] - beg[i] > end[i - 1] - beg[i - 1]) {
        swap = beg[i];
        beg[i] = beg[i - 1];
        beg[i - 1] = swap;
        swap = end[i];
        end[i] = end[i - 1];
        end[i - 1] = swap;
      }
    } else {
      i--;
    }
  }
}
```