user: What would the C source look like for the assembly code provided here:

```asm
<qsi>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x9a0,%rsp
  mov    %rdi,-0x998(%rbp)
  mov    %esi,-0x99c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x984(%rbp)
  movl   $0x0,-0x970(%rbp)
  mov    -0x99c(%rbp),%eax
  mov    %eax,-0x4c0(%rbp)
  jmp    L38
L35:
  mov    -0x984(%rbp),%eax
  cltq
  mov    -0x970(%rbp,%rax,4),%eax
  mov    %eax,-0x980(%rbp)
  mov    -0x984(%rbp),%eax
  cltq
  mov    -0x4c0(%rbp,%rax,4),%eax
  sub    $0x1,%eax
  mov    %eax,-0x97c(%rbp)
  mov    -0x980(%rbp),%eax
  cmp    -0x97c(%rbp),%eax
  jge    L133
  mov    -0x980(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x998(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x978(%rbp)
  jmp    L9
L106:
  subl   $0x1,-0x97c(%rbp)
L109:
  mov    -0x97c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x998(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    %eax,-0x978(%rbp)
  jg     L64
  mov    -0x980(%rbp),%eax
  cmp    -0x97c(%rbp),%eax
  jl     L106
L64:
  mov    -0x980(%rbp),%eax
  cmp    -0x97c(%rbp),%eax
  jge    L42
  mov    -0x97c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x998(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x980(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x980(%rbp)
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x998(%rbp),%rax
  add    %rax,%rdx
  mov    (%rcx),%eax
  mov    %eax,(%rdx)
  jmp    L42
L60:
  addl   $0x1,-0x980(%rbp)
L42:
  mov    -0x980(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x998(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    %eax,-0x978(%rbp)
  jl     L23
  mov    -0x980(%rbp),%eax
  cmp    -0x97c(%rbp),%eax
  jl     L60
L23:
  mov    -0x980(%rbp),%eax
  cmp    -0x97c(%rbp),%eax
  jge    L9
  mov    -0x980(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x998(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x97c(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,-0x97c(%rbp)
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x998(%rbp),%rax
  add    %rax,%rdx
  mov    (%rcx),%eax
  mov    %eax,(%rdx)
L9:
  mov    -0x980(%rbp),%eax
  cmp    -0x97c(%rbp),%eax
  jl     L109
  mov    -0x980(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x998(%rbp),%rax
  add    %rax,%rdx
  mov    -0x978(%rbp),%eax
  mov    %eax,(%rdx)
  mov    -0x984(%rbp),%eax
  lea    0x1(%rax),%ecx
  mov    -0x980(%rbp),%eax
  lea    0x1(%rax),%edx
  movslq %ecx,%rax
  mov    %edx,-0x970(%rbp,%rax,4)
  mov    -0x984(%rbp),%eax
  lea    0x1(%rax),%ecx
  mov    -0x984(%rbp),%eax
  cltq
  mov    -0x4c0(%rbp,%rax,4),%edx
  movslq %ecx,%rax
  mov    %edx,-0x4c0(%rbp,%rax,4)
  mov    -0x984(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x984(%rbp)
  cltq
  mov    -0x980(%rbp),%edx
  mov    %edx,-0x4c0(%rbp,%rax,4)
  mov    -0x984(%rbp),%eax
  cltq
  mov    -0x4c0(%rbp,%rax,4),%edx
  mov    -0x984(%rbp),%eax
  cltq
  mov    -0x970(%rbp,%rax,4),%eax
  mov    %edx,%ecx
  sub    %eax,%ecx
  mov    -0x984(%rbp),%eax
  sub    $0x1,%eax
  cltq
  mov    -0x4c0(%rbp,%rax,4),%edx
  mov    -0x984(%rbp),%eax
  sub    $0x1,%eax
  cltq
  mov    -0x970(%rbp,%rax,4),%esi
  mov    %edx,%eax
  sub    %esi,%eax
  cmp    %eax,%ecx
  jle    L38
  mov    -0x984(%rbp),%eax
  cltq
  mov    -0x970(%rbp,%rax,4),%eax
  mov    %eax,-0x974(%rbp)
  mov    -0x984(%rbp),%eax
  sub    $0x1,%eax
  cltq
  mov    -0x970(%rbp,%rax,4),%edx
  mov    -0x984(%rbp),%eax
  cltq
  mov    %edx,-0x970(%rbp,%rax,4)
  mov    -0x984(%rbp),%eax
  sub    $0x1,%eax
  cltq
  mov    -0x974(%rbp),%edx
  mov    %edx,-0x970(%rbp,%rax,4)
  mov    -0x984(%rbp),%eax
  cltq
  mov    -0x4c0(%rbp,%rax,4),%eax
  mov    %eax,-0x974(%rbp)
  mov    -0x984(%rbp),%eax
  sub    $0x1,%eax
  cltq
  mov    -0x4c0(%rbp,%rax,4),%edx
  mov    -0x984(%rbp),%eax
  cltq
  mov    %edx,-0x4c0(%rbp,%rax,4)
  mov    -0x984(%rbp),%eax
  sub    $0x1,%eax
  cltq
  mov    -0x974(%rbp),%edx
  mov    %edx,-0x4c0(%rbp,%rax,4)
  jmp    L38
L133:
  subl   $0x1,-0x984(%rbp)
L38:
  cmpl   $0x0,-0x984(%rbp)
  jns    L35
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L49
  call   <__stack_chk_fail@plt>
L49:
  leave
  ret
```

assistant: ```c
void qsi(int *a, int elements) {
  int piv, 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 = a[L];
      while (L < R) {
        while (a[R] >= piv && L < R)
          R--;
        if (L < R)
          a[L++] = a[R];
        while (a[L] <= piv && L < R)
          L++;
        if (L < R)
          a[R--] = a[L];
      }
      a[L] = piv;
      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--;
    }
  }
}
```