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

```asm
<fquickSortIdx>:
  endbr64
  push   %r15
  mov    %edx,%r11d
  xor    %ecx,%ecx
  push   %r14
  push   %r13
  lea    D5(%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    L107
  nopl   (%rax)
L28:
  sub    $0x1,%r12d
  jb     L19
L36:
  cmp    $0x12a,%r12d
  jle    L191
  mov    %r13,%rdi
  call   <error@plt>
L191:
  movslq %r12d,%rax
  mov    0x4b0(%rsp,%rax,4),%r11d
  mov    (%rsp,%rax,4),%ecx
L107:
  lea    -0x1(%r11),%edx
  cmp    %ecx,%edx
  jle    L28
  movslq %ecx,%rsi
  movss  (%rbx,%rsi,4),%xmm1
  mov    0x0(%rbp,%rsi,4),%r14d
  xchg   %ax,%ax
L25:
  movslq %edx,%rdi
  lea    0x0(,%rdi,4),%r9
  lea    (%rbx,%r9,1),%r10
  movss  (%r10),%xmm0
  cmp    %edx,%ecx
  jge    L97
  comiss %xmm1,%xmm0
  jb     L97
  lea    -0x1(%rdx),%eax
  lea    -0x4(%rbx,%rdi,4),%rdi
  cltq
  nopw   0x0(%rax,%rax,1)
L39:
  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    L39
L97:
  cmp    %ecx,%edx
  jle    L117
  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     L189
  cmp    %ecx,%edx
  jle    L69
  add    $0x4,%rax
  jmp    L153
  nopw   0x0(%rax,%rax,1)
L162:
  lea    0x4(%rax),%rsi
  cmp    %edx,%ecx
  je     L139
  mov    %rsi,%rax
L153:
  movss  (%rbx,%rax,1),%xmm0
  add    $0x1,%ecx
  lea    (%rbx,%rax,1),%rdi
  comiss %xmm0,%xmm1
  jae    L162
L189:
  cmp    %edx,%ecx
  jge    L69
  mov    0x0(%rbp,%rax,1),%esi
  sub    $0x1,%edx
  mov    %esi,0x0(%rbp,%r9,1)
  movss  %xmm0,(%r10)
  cmp    %ecx,%edx
  jle    L69
  movslq %ecx,%rsi
  jmp    L25
  nopl   (%rax)
L117:
  lea    0x0(,%rsi,4),%rax
  lea    (%rbx,%rax,1),%rdi
  movss  (%rdi),%xmm0
  comiss %xmm0,%xmm1
  jb     L189
L69:
  mov    %ecx,%edx
  nop
L139:
  lea    0x1(%r12),%esi
  movss  %xmm1,(%rdi)
  movslq %r12d,%r12
  lea    0x1(%rdx),%ecx
  mov    %r14d,0x0(%rbp,%rax,1)
  movslq %esi,%rax
  mov    %edx,%r9d
  mov    %r11d,0x4b0(%rsp,%rax,4)
  mov    %edx,0x4b0(%rsp,%r12,4)
  mov    0x4b0(%rsp,%rax,4),%edi
  mov    %ecx,(%rsp,%rax,4)
  mov    (%rsp,%r12,4),%r8d
  mov    %edi,%r10d
  sub    %ecx,%r10d
  sub    %r8d,%r9d
  cmp    %r9d,%r10d
  jle    L164
  mov    %r8d,(%rsp,%rax,4)
  mov    %edx,0x4b0(%rsp,%rax,4)
  mov    %ecx,(%rsp,%r12,4)
  mov    %edi,0x4b0(%rsp,%r12,4)
L164:
  mov    %esi,%r12d
  jmp    L36
L19:
  mov    0x968(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L41
  add    $0x978,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L41:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: tag: D5
type_guessed: string

tool: D5: 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--;
    }
  }
}
```