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

```asm
<fquickSortIdx>:
  endbr64
  push   %r15
  mov    %edx,%r11d
  xor    %ecx,%ecx
  push   %r14
  push   %r13
  lea    D8(%rip),%r13
  push   %r12
  xor    %r12d,%r12d
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x978,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x968(%rsp)
  xor    %eax,%eax
  movl   $0x0,(%rsp)
  mov    %edx,0x4b0(%rsp)
  jmp    L172
  nopl   (%rax)
L51:
  sub    $0x1,%r12d
  jb     L1
L24:
  cmp    $0x12a,%r12d
  jle    L182
  mov    %r13,%rdi
  call   <error@plt>
L182:
  movslq %r12d,%rax
  mov    0x4b0(%rsp,%rax,4),%r11d
  mov    (%rsp,%rax,4),%ecx
L172:
  lea    -0x1(%r11),%edx
  cmp    %ecx,%edx
  jle    L51
  movslq %ecx,%rsi
  movss  (%rbx,%rsi,4),%xmm1
  mov    0x0(%rbp,%rsi,4),%r14d
  xchg   %ax,%ax
L149:
  movslq %edx,%rdi
  lea    0x0(,%rdi,4),%r9
  lea    (%rbx,%r9,1),%r10
  movss  (%r10),%xmm0
  cmp    %edx,%ecx
  jge    L16
  comiss %xmm1,%xmm0
  jb     L16
  lea    -0x1(%rdx),%eax
  lea    -0x4(%rbx,%rdi,4),%rdi
  cltq
  nopw   0x0(%rax,%rax,1)
L123:
  movss  (%rdi),%xmm0
  cmp    %eax,%ecx
  mov    %eax,%edx
  lea    0x0(,%rax,4),%r9
  setl   %r15b
  mov    %rdi,%r10
  comiss %xmm1,%xmm0
  setae  %r8b
  sub    $0x1,%rax
  sub    $0x4,%rdi
  test   %r8b,%r15b
  jne    L123
L16:
  cmp    %ecx,%edx
  jle    L177
  mov    0x0(%rbp,%r9,1),%eax
  add    $0x1,%ecx
  mov    %eax,0x0(%rbp,%rsi,4)
  movss  %xmm0,(%rbx,%rsi,4)
  movslq %ecx,%rsi
  lea    0x0(,%rsi,4),%rax
  lea    (%rbx,%rax,1),%rdi
  movss  (%rdi),%xmm0
  comiss %xmm0,%xmm1
  jb     L127
  cmp    %ecx,%edx
  jle    L3
  add    $0x4,%rax
  jmp    L9
  nopw   0x0(%rax,%rax,1)
L81:
  lea    0x4(%rax),%rsi
  cmp    %edx,%ecx
  je     L167
  mov    %rsi,%rax
L9:
  movss  (%rbx,%rax,1),%xmm0
  add    $0x1,%ecx
  lea    (%rbx,%rax,1),%rdi
  comiss %xmm0,%xmm1
  jae    L81
L127:
  cmp    %edx,%ecx
  jge    L3
  mov    0x0(%rbp,%rax,1),%esi
  sub    $0x1,%edx
  mov    %esi,0x0(%rbp,%r9,1)
  movss  %xmm0,(%r10)
  cmp    %ecx,%edx
  jle    L3
  movslq %ecx,%rsi
  jmp    L149
  nopl   (%rax)
L177:
  lea    0x0(,%rsi,4),%rax
  lea    (%rbx,%rax,1),%rdi
  movss  (%rdi),%xmm0
  comiss %xmm0,%xmm1
  jb     L127
L3:
  mov    %ecx,%edx
  nop
L167:
  lea    0x1(%r12),%esi
  movd   %edx,%xmm0
  movslq %r12d,%r12
  movss  %xmm1,(%rdi)
  movd   %r11d,%xmm2
  lea    0x1(%rdx),%ecx
  movd   %edx,%xmm3
  mov    %r14d,0x0(%rbp,%rax,1)
  punpckldq %xmm2,%xmm0
  movslq %esi,%rax
  lea    0x4b0(%rsp,%r12,4),%rdi
  mov    %ecx,(%rsp,%rax,4)
  movd   %ecx,%xmm1
  movq   %xmm0,(%rdi)
  mov    0x4b0(%rsp,%rax,4),%eax
  movd   (%rsp,%r12,4),%xmm4
  sub    (%rsp,%r12,4),%edx
  movd   %eax,%xmm0
  sub    %ecx,%eax
  punpckldq %xmm4,%xmm1
  punpckldq %xmm3,%xmm0
  cmp    %edx,%eax
  jle    L161
  movq   %xmm1,(%rsp,%r12,4)
  movq   %xmm0,(%rdi)
L161:
  mov    %esi,%r12d
  jmp    L24
L1:
  mov    0x968(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L50
  add    $0x978,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L50:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D8
type: string

tool: D8: sort overflow

assistant: ```c
void fquickSortIdx(float *arr, int *idx, int elements) {
  int beg[(300)], end[(300)], i = 0, L, R, swap;
  float piv;
  int ipiv;
  beg[0] = 0;
  end[0] = elements;
  while (i >= 0) {
    if (i > (300) - 2)
      error("sort overflow");
    L = beg[i];
    R = end[i] - 1;
    if (L < R) {
      piv = arr[L];
      ipiv = idx[L];
      while (L < R) {
        while (arr[R] >= piv && L < R)
          R--;
        if (L < R) {
          idx[L] = idx[R];
          arr[L++] = arr[R];
        }
        while (arr[L] <= piv && L < R)
          L++;
        if (L < R) {
          idx[R] = idx[L];
          arr[R--] = arr[L];
        }
      }
      arr[L] = piv;
      idx[L] = ipiv;
      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--;
    }
  }
}
```