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

```asm
<sort>:
  endbr64
  push   %r15
  lea    0x1(%rsi),%r15d
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x68,%rsp
  mov    %esi,0x4(%rsp)
  mov    %edx,0x58(%rsp)
  cmp    %r15d,%edx
  jle    L175
  mov    %r15d,%ebx
  mov    %r15d,%r13d
  mov    %rdi,%r15
L208:
  movslq 0x4(%rsp),%r14
  mov    0x58(%rsp),%eax
  mov    %r13d,0x8(%rsp)
  movslq %ebx,%r12
  lea    (%r15,%r14,4),%rbp
  mov    %r14,0x10(%rsp)
  mov    0x0(%rbp),%edx
  mov    %rbp,%r14
  mov    %eax,%ebp
  mov    %edx,%r13d
L360:
  lea    (%r15,%r12,4),%rdi
  cmp    %r13d,(%rdi)
  jg     L521
L50:
  add    $0x1,%ebx
  cmp    %ebp,%ebx
  jge    L497
  movslq %ebx,%r12
  lea    (%r15,%r12,4),%rdi
  cmp    %r13d,(%rdi)
  jle    L50
L521:
  sub    $0x1,%ebp
  movslq %ebp,%rax
  lea    (%r15,%rax,4),%rsi
  call   <swap@plt>
  cmp    %ebx,%ebp
  jg     L360
L497:
  lea    -0x1(%rbx),%r12d
  mov    %ebp,0x44(%rsp)
  mov    0x8(%rsp),%r13d
  mov    %r14,%rbp
  movslq %r12d,%rax
  mov    %rbp,%rsi
  mov    %r12d,0x30(%rsp)
  mov    0x10(%rsp),%r14
  lea    (%r15,%rax,4),%rdi
  mov    %r13d,%ebx
  call   <swap@plt>
  cmp    %r13d,%r12d
  jle    L246
L184:
  lea    (%r15,%r14,4),%rbp
  mov    0x30(%rsp),%eax
  mov    %r13d,0x8(%rsp)
  movslq %ebx,%r12
  mov    0x0(%rbp),%edx
  mov    %r14,0x10(%rsp)
  mov    %rbp,%r14
  mov    %ebx,%ebp
  mov    %eax,%ebx
  mov    %edx,%r13d
L61:
  lea    (%r15,%r12,4),%rdi
  cmp    (%rdi),%r13d
  jl     L89
L113:
  add    $0x1,%ebp
  cmp    %ebx,%ebp
  jge    L307
  movslq %ebp,%r12
  lea    (%r15,%r12,4),%rdi
  cmp    (%rdi),%r13d
  jge    L113
L89:
  sub    $0x1,%ebx
  movslq %ebx,%rax
  lea    (%r15,%rax,4),%rsi
  call   <swap@plt>
  cmp    %ebp,%ebx
  jg     L61
L307:
  mov    %ebx,0x34(%rsp)
  mov    %ebp,%ebx
  mov    0x8(%rsp),%r13d
  mov    %r14,%rbp
  lea    -0x1(%rbx),%r12d
  mov    %rbp,%rsi
  mov    0x10(%rsp),%r14
  movslq %r12d,%rax
  mov    %r12d,0x38(%rsp)
  mov    %r13d,%ebx
  lea    (%r15,%rax,4),%rdi
  call   <swap@plt>
  cmp    %r13d,%r12d
  jle    L374
L550:
  lea    (%r15,%r14,4),%rbp
  mov    0x38(%rsp),%eax
  mov    %r13d,0x8(%rsp)
  movslq %ebx,%r12
  mov    0x0(%rbp),%edx
  mov    %r14,0x10(%rsp)
  mov    %rbp,%r14
  mov    %eax,%ebp
  mov    %edx,%r13d
L2:
  lea    (%r15,%r12,4),%rdi
  cmp    (%rdi),%r13d
  jl     L288
L32:
  add    $0x1,%ebx
  cmp    %ebp,%ebx
  jge    L79
  movslq %ebx,%r12
  lea    (%r15,%r12,4),%rdi
  cmp    (%rdi),%r13d
  jge    L32
L288:
  sub    $0x1,%ebp
  movslq %ebp,%rax
  lea    (%r15,%rax,4),%rsi
  call   <swap@plt>
  cmp    %ebx,%ebp
  jg     L2
L79:
  lea    -0x1(%rbx),%r12d
  mov    %ebp,0x48(%rsp)
  mov    0x8(%rsp),%r13d
  mov    %r14,%rbp
  movslq %r12d,%rax
  mov    %rbp,%rsi
  mov    %r12d,0x3c(%rsp)
  mov    0x10(%rsp),%r14
  lea    (%r15,%rax,4),%rdi
  mov    %r13d,%ebx
  call   <swap@plt>
  cmp    %r13d,%r12d
  jle    L117
  mov    %r13d,0x10(%rsp)
L577:
  mov    0x3c(%rsp),%eax
  lea    (%r15,%r14,4),%rbp
  mov    %r14,0x8(%rsp)
  movslq %ebx,%r12
  mov    0x0(%rbp),%r13d
  mov    %rbp,%r14
  mov    %eax,%ebp
L391:
  lea    (%r15,%r12,4),%rdi
  cmp    (%rdi),%r13d
  jl     L375
L568:
  add    $0x1,%ebx
  cmp    %ebp,%ebx
  jge    L358
  movslq %ebx,%r12
  lea    (%r15,%r12,4),%rdi
  cmp    (%rdi),%r13d
  jge    L568
L375:
  sub    $0x1,%ebp
  movslq %ebp,%rax
  lea    (%r15,%rax,4),%rsi
  call   <swap@plt>
  cmp    %ebx,%ebp
  jg     L391
L358:
  lea    -0x1(%rbx),%r13d
  mov    %ebp,0x4c(%rsp)
  mov    %r14,%rbp
  mov    0x8(%rsp),%r14
  movslq %r13d,%rax
  mov    %rbp,%rsi
  mov    %r13d,0x40(%rsp)
  lea    (%r15,%rax,4),%rdi
  call   <swap@plt>
  mov    0x10(%rsp),%eax
  mov    %eax,%ebx
  cmp    %eax,%r13d
  jle    L56
L530:
  mov    0x40(%rsp),%eax
  lea    (%r15,%r14,4),%r12
  mov    (%r12),%r13d
  mov    %eax,0x8(%rsp)
  jmp    L532
L344:
  add    $0x1,%ebx
  cmp    0x8(%rsp),%ebx
  jge    L192
L532:
  movslq %ebx,%rbp
L60:
  lea    (%r15,%rbp,4),%rdi
  cmp    (%rdi),%r13d
  jge    L344
  subl   $0x1,0x8(%rsp)
  movslq 0x8(%rsp),%rax
  lea    (%r15,%rax,4),%rsi
  call   <swap@plt>
  cmp    %ebx,0x8(%rsp)
  jg     L60
L192:
  lea    -0x1(%rbx),%ebp
  mov    %r12,%rsi
  movslq %ebp,%rax
  mov    %ebp,0x1c(%rsp)
  lea    (%r15,%rax,4),%rdi
  call   <swap@plt>
  mov    0x10(%rsp),%eax
  mov    0x4(%rsp),%r12d
  mov    %eax,%ebx
  cmp    %eax,%ebp
  jle    L609
L610:
  mov    0x1c(%rsp),%eax
  lea    (%r15,%r14,4),%r13
  mov    0x0(%r13),%edx
  mov    %eax,0x4(%rsp)
L197:
  movslq %ebx,%rbp
L182:
  lea    (%r15,%rbp,4),%rdi
  cmp    (%rdi),%edx
  jl     L390
  add    $0x1,%ebx
  cmp    0x4(%rsp),%ebx
  jl     L197
L171:
  sub    $0x1,%ebx
  mov    %r13,%rsi
  movslq %ebx,%rax
  mov    %ebx,0x18(%rsp)
  lea    (%r15,%rax,4),%rdi
  call   <swap@plt>
  mov    0x10(%rsp),%eax
  mov    %r14,%rdx
  mov    %eax,%ebp
  mov    %eax,%r13d
  cmp    %eax,%ebx
  jle    L597
L468:
  lea    (%r15,%rdx,4),%rbx
  mov    0x18(%rsp),%r14d
  mov    (%rbx),%r9d
L17:
  movslq %ebp,%r8
L503:
  lea    (%r15,%r8,4),%rdi
  cmp    (%rdi),%r9d
  jl     L293
  add    $0x1,%ebp
  cmp    %r14d,%ebp
  jl     L17
L238:
  sub    $0x1,%ebp
  mov    %rbx,%rsi
  mov    %rdx,0x10(%rsp)
  mov    %r13d,%ebx
  movslq %ebp,%rax
  mov    %ebp,0x20(%rsp)
  lea    (%r15,%rax,4),%rdi
  call   <swap@plt>
  cmp    %r13d,%ebp
  mov    0x10(%rsp),%rdx
  jle    L151
  mov    %r14d,0x28(%rsp)
  mov    %rdx,%r14
L233:
  lea    (%r15,%r14,4),%r9
  mov    0x20(%rsp),%ecx
  mov    (%r9),%r8d
L477:
  movslq %ebx,%rbp
L376:
  lea    (%r15,%rbp,4),%rdi
  cmp    (%rdi),%r8d
  jl     L170
  add    $0x1,%ebx
  cmp    %ecx,%ebx
  jl     L477
L37:
  sub    $0x1,%ebx
  mov    %r9,%rsi
  mov    %ecx,0x10(%rsp)
  mov    %r13d,%ebp
  movslq %ebx,%rax
  lea    (%r15,%rax,4),%rdi
  call   <swap@plt>
  cmp    %ebx,%r13d
  mov    0x10(%rsp),%ecx
  jge    L65
L40:
  lea    (%r15,%r14,4),%r8
  mov    %ebx,%r14d
  mov    (%r8),%edx
L255:
  movslq %ebp,%r13
L371:
  lea    (%r15,%r13,4),%rdi
  cmp    (%rdi),%edx
  jl     L215
  add    $0x1,%ebp
  cmp    %r14d,%ebp
  jl     L255
L22:
  lea    -0x1(%rbp),%r13d
  mov    %r8,%rsi
  mov    %ecx,0x10(%rsp)
  lea    0x1(%r14),%ebp
  movslq %r13d,%rax
  lea    (%r15,%rax,4),%rdi
  call   <swap@plt>
  mov    %r13d,%edx
  mov    %r12d,%esi
  mov    %r15,%rdi
  call   <sort>
  cmp    %ebp,%ebx
  mov    0x10(%rsp),%ecx
  jle    L65
  movslq %r14d,%r14
  mov    %r14,%r12
  jmp    L40
L175:
  add    $0x68,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L440:
  mov    0x28(%rsp),%r14d
L151:
  lea    0x1(%r14),%ebp
  cmp    %ebp,0x18(%rsp)
  jle    L597
  movslq %r14d,%rdx
  mov    %ebp,%r13d
  mov    %rdx,%r12
  jmp    L468
  nopw   0x0(%rax,%rax,1)
L293:
  sub    $0x1,%r14d
  mov    %rdx,0x28(%rsp)
  movslq %r14d,%rax
  mov    %r8,0x20(%rsp)
  lea    (%r15,%rax,4),%rsi
  mov    %r9d,0x10(%rsp)
  call   <swap@plt>
  cmp    %ebp,%r14d
  mov    0x10(%rsp),%r9d
  mov    0x20(%rsp),%r8
  mov    0x28(%rsp),%rdx
  jle    L238
  jmp    L503
L597:
  mov    0x4(%rsp),%eax
  lea    0x1(%rax),%ebx
  cmp    %ebx,0x1c(%rsp)
  jle    L609
  movslq %eax,%r14
  mov    %ebx,0x10(%rsp)
  mov    %r14,%r12
  jmp    L610
  nopl   0x0(%rax)
L215:
  sub    $0x1,%r14d
  mov    %edx,0x5c(%rsp)
  movslq %r14d,%rax
  mov    %r8,0x50(%rsp)
  lea    (%r15,%rax,4),%rsi
  mov    %ecx,0x10(%rsp)
  call   <swap@plt>
  cmp    %ebp,%r14d
  mov    0x10(%rsp),%ecx
  mov    0x5c(%rsp),%edx
  mov    0x50(%rsp),%r8
  jle    L22
  jmp    L371
L390:
  subl   $0x1,0x4(%rsp)
  movslq 0x4(%rsp),%rax
  mov    %edx,0x18(%rsp)
  lea    (%r15,%rax,4),%rsi
  call   <swap@plt>
  cmp    %ebx,0x4(%rsp)
  mov    0x18(%rsp),%edx
  jle    L171
  jmp    L182
  nopw   0x0(%rax,%rax,1)
L170:
  sub    $0x1,%ecx
  mov    %r8d,0x5c(%rsp)
  movslq %ecx,%rax
  mov    %r9,0x50(%rsp)
  lea    (%r15,%rax,4),%rsi
  mov    %ecx,0x10(%rsp)
  call   <swap@plt>
  mov    0x10(%rsp),%ecx
  mov    0x50(%rsp),%r9
  mov    0x5c(%rsp),%r8d
  cmp    %ebx,%ecx
  jle    L37
  jmp    L376
L609:
  mov    0x8(%rsp),%eax
  lea    0x1(%rax),%ebx
  cmp    %ebx,0x40(%rsp)
  jle    L56
  mov    %eax,0x4(%rsp)
  movslq %eax,%r14
  mov    %ebx,0x10(%rsp)
  jmp    L530
  nopl   (%rax)
L65:
  lea    0x1(%rcx),%ebx
  cmp    %ebx,0x20(%rsp)
  jle    L440
  movslq %ecx,%r14
  mov    %ebx,%r13d
  mov    %r14,%r12
  jmp    L233
L56:
  mov    0x4c(%rsp),%eax
  lea    0x1(%rax),%ebx
  cmp    %ebx,0x3c(%rsp)
  jle    L117
  mov    %eax,0x4(%rsp)
  movslq %eax,%r14
  mov    %ebx,0x10(%rsp)
  jmp    L577
L117:
  mov    0x48(%rsp),%eax
  lea    0x1(%rax),%ebx
  cmp    %ebx,0x38(%rsp)
  jle    L374
  mov    %eax,0x4(%rsp)
  mov    %ebx,%r13d
  movslq %eax,%r14
  jmp    L550
L374:
  mov    0x34(%rsp),%eax
  lea    0x1(%rax),%ebx
  cmp    %ebx,0x30(%rsp)
  jle    L246
  mov    %eax,0x4(%rsp)
  mov    %ebx,%r13d
  movslq %eax,%r14
  jmp    L184
L246:
  mov    0x44(%rsp),%eax
  lea    0x1(%rax),%ebx
  cmp    0x58(%rsp),%ebx
  jge    L175
  mov    %eax,0x4(%rsp)
  mov    %ebx,%r13d
  jmp    L208
```

assistant: ```c
void sort(int arr[], int beg, int end) {
  if (end > beg + 1) {
    int piv = arr[beg], l = beg + 1, r = end;
    while (l < r) {
      if (arr[l] <= piv)
        l++;
      else
        swap(&arr[l], &arr[--r]);
    }
    swap(&arr[--l], &arr[beg]);
    sort(arr, beg, l);
    sort(arr, r, end);
  }
}
```