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

```asm
<sort_helper>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %edx,0x24(%rsp)
  cmp    %esi,%edx
  jle    L624
  mov    %rdi,%r13
  mov    %esi,%r14d
L523:
  lea    0x1(%r14),%r15d
  cmp    %r15d,0x24(%rsp)
  jl     L104
  movslq %r14d,%rax
  movslq %r15d,%rbx
  mov    %r14d,%r12d
  lea    0x0(%r13,%rax,4),%rbp
  jmp    L305
L535:
  add    $0x1,%rbx
  cmp    %ebx,0x24(%rsp)
  jl     L629
L305:
  mov    0x0(%rbp),%eax
  mov    %ebx,%edx
  cmp    %eax,0x0(%r13,%rbx,4)
  jge    L535
  add    $0x1,%r12d
  mov    %r13,%rdi
  add    $0x1,%rbx
  mov    %r12d,%esi
  call   <swap@plt>
  cmp    %ebx,0x24(%rsp)
  jge    L305
L629:
  mov    %r12d,%edx
  mov    %r14d,%esi
  mov    %r13,%rdi
  mov    %r12d,0x2c(%rsp)
  call   <swap@plt>
  lea    -0x1(%r12),%eax
  mov    %eax,0x14(%rsp)
  cmp    %r14d,%eax
  jle    L362
  cmp    %r15d,0x14(%rsp)
  jl     L457
L486:
  movslq %r14d,%rax
  movslq %r15d,%rbx
  mov    %r14d,%r12d
  lea    0x0(%r13,%rax,4),%rbp
  jmp    L103
L645:
  add    $0x1,%rbx
  cmp    %ebx,0x14(%rsp)
  jl     L24
L103:
  mov    0x0(%rbp),%eax
  mov    %ebx,%edx
  cmp    %eax,0x0(%r13,%rbx,4)
  jge    L645
  add    $0x1,%r12d
  mov    %r13,%rdi
  add    $0x1,%rbx
  mov    %r12d,%esi
  call   <swap@plt>
  cmp    %ebx,0x14(%rsp)
  jge    L103
L24:
  mov    %r12d,%edx
  mov    %r14d,%esi
  mov    %r13,%rdi
  mov    %r12d,0x30(%rsp)
  call   <swap@plt>
  lea    -0x1(%r12),%eax
  mov    %eax,0x18(%rsp)
  cmp    %r14d,%eax
  jle    L455
  mov    %r14d,%eax
  mov    %r13,%r14
  mov    %eax,%r13d
  cmp    %r15d,0x18(%rsp)
  jl     L739
L390:
  movslq %r13d,%rax
  movslq %r15d,%rbx
  mov    %r13d,%r12d
  lea    (%r14,%rax,4),%rbp
  jmp    L41
L433:
  add    $0x1,%rbx
  cmp    %ebx,0x18(%rsp)
  jl     L561
L41:
  mov    0x0(%rbp),%eax
  mov    %ebx,%edx
  cmp    %eax,(%r14,%rbx,4)
  jge    L433
  add    $0x1,%r12d
  mov    %r14,%rdi
  add    $0x1,%rbx
  mov    %r12d,%esi
  call   <swap@plt>
  cmp    %ebx,0x18(%rsp)
  jge    L41
L561:
  mov    %r12d,%edx
  mov    %r13d,%esi
  mov    %r14,%rdi
  mov    %r12d,0x34(%rsp)
  call   <swap@plt>
  lea    -0x1(%r12),%eax
  mov    %eax,0x1c(%rsp)
  cmp    %r13d,%eax
  jle    L92
  mov    %r15d,%r12d
  mov    %r14,%r15
  mov    %r13d,%r14d
  cmp    %r12d,0x1c(%rsp)
  jl     L619
L423:
  movslq %r14d,%rax
  movslq %r12d,%rbx
  mov    %r14d,%r13d
  lea    (%r15,%rax,4),%rbp
  jmp    L211
L512:
  add    $0x1,%rbx
  cmp    %ebx,0x1c(%rsp)
  jl     L738
L211:
  mov    0x0(%rbp),%eax
  mov    %ebx,%edx
  cmp    %eax,(%r15,%rbx,4)
  jge    L512
  add    $0x1,%r13d
  mov    %r15,%rdi
  add    $0x1,%rbx
  mov    %r13d,%esi
  call   <swap@plt>
  cmp    %ebx,0x1c(%rsp)
  jge    L211
L738:
  mov    %r13d,%edx
  mov    %r14d,%esi
  mov    %r15,%rdi
  mov    %r13d,0x38(%rsp)
  call   <swap@plt>
  lea    -0x1(%r13),%eax
  mov    %eax,0x20(%rsp)
  cmp    %r14d,%eax
  jle    L710
  mov    %r12d,%ebx
  cmp    %ebx,0x20(%rsp)
  jl     L538
L356:
  movslq %r14d,%rax
  movslq %ebx,%rbp
  mov    %r14d,%r13d
  lea    (%r15,%rax,4),%r12
  jmp    L579
L570:
  add    $0x1,%rbp
  cmp    %ebp,0x20(%rsp)
  jl     L697
L579:
  mov    (%r12),%eax
  mov    %ebp,%edx
  cmp    %eax,(%r15,%rbp,4)
  jge    L570
  add    $0x1,%r13d
  mov    %r15,%rdi
  add    $0x1,%rbp
  mov    %r13d,%esi
  call   <swap@plt>
  cmp    %ebp,0x20(%rsp)
  jge    L579
L697:
  mov    %r13d,%edx
  mov    %r14d,%esi
  mov    %r15,%rdi
  mov    %r13d,0x3c(%rsp)
  call   <swap@plt>
  lea    -0x1(%r13),%eax
  mov    %eax,0xc(%rsp)
  cmp    %r14d,%eax
  jle    L265
  cmp    %ebx,0xc(%rsp)
  jl     L288
L51:
  movslq %r14d,%rax
  movslq %ebx,%rbp
  mov    %r14d,%r13d
  lea    (%r15,%rax,4),%r12
  jmp    L150
  nopl   0x0(%rax)
L525:
  add    $0x1,%rbp
  cmp    %ebp,0xc(%rsp)
  jl     L44
L150:
  mov    (%r12),%eax
  mov    %ebp,%edx
  cmp    %eax,(%r15,%rbp,4)
  jge    L525
  add    $0x1,%r13d
  mov    %r15,%rdi
  add    $0x1,%rbp
  mov    %r13d,%esi
  call   <swap@plt>
  cmp    %ebp,0xc(%rsp)
  jge    L150
L44:
  mov    %r13d,%edx
  mov    %r14d,%esi
  lea    -0x1(%r13),%r12d
  mov    %r15,%rdi
  call   <swap@plt>
  cmp    %r14d,%r12d
  jle    L543
  mov    %r12d,0x8(%rsp)
  mov    %r13d,0x28(%rsp)
  cmp    %ebx,0x8(%rsp)
  jl     L597
L297:
  movslq %r14d,%rax
  movslq %ebx,%r13
  mov    %r14d,%ebp
  lea    (%r15,%rax,4),%r8
  mov    %r8,%r12
  jmp    L397
L272:
  add    $0x1,%r13
  cmp    %r13d,0x8(%rsp)
  jl     L694
L397:
  mov    (%r12),%eax
  mov    %r13d,%edx
  cmp    %eax,(%r15,%r13,4)
  jge    L272
  add    $0x1,%ebp
  mov    %r15,%rdi
  add    $0x1,%r13
  mov    %ebp,%esi
  call   <swap@plt>
  cmp    %r13d,0x8(%rsp)
  jge    L397
L694:
  mov    %ebp,%edx
  mov    %r14d,%esi
  lea    -0x1(%rbp),%r13d
  mov    %r15,%rdi
  call   <swap@plt>
  cmp    %r14d,%r13d
  jle    L509
  mov    %ebp,0x10(%rsp)
  cmp    %ebx,%r13d
  jl     L161
  nopw   0x0(%rax,%rax,1)
L437:
  movslq %r14d,%rax
  movslq %ebx,%r12
  mov    %r14d,%ebp
  lea    (%r15,%rax,4),%r8
  jmp    L234
  nop
L273:
  add    $0x1,%r12
  cmp    %r12d,%r13d
  jl     L393
L234:
  mov    (%r8),%eax
  mov    %r12d,%edx
  cmp    %eax,(%r15,%r12,4)
  jge    L273
  add    $0x1,%ebp
  mov    %r15,%rdi
  add    $0x1,%r12
  mov    %r8,0x40(%rsp)
  mov    %ebp,%esi
  call   <swap@plt>
  mov    0x40(%rsp),%r8
  cmp    %r12d,%r13d
  jge    L234
L393:
  mov    %ebp,%edx
  mov    %r14d,%esi
  lea    -0x1(%rbp),%r12d
  mov    %r15,%rdi
  call   <swap@plt>
  cmp    %r14d,%r12d
  jle    L202
  mov    %ebp,%r8d
  mov    %r14d,%ebp
  mov    %r12d,%r14d
  mov    %r13d,%ecx
  cmp    %ebx,%r14d
  jl     L88
L627:
  movslq %ebp,%rax
  mov    %ebp,0x40(%rsp)
  mov    %ebp,%r12d
  movslq %ebx,%rbx
  lea    (%r15,%rax,4),%r13
  mov    %ecx,%ebp
  jmp    L16
  nopl   0x0(%rax)
L153:
  add    $0x1,%rbx
  cmp    %ebx,%r14d
  jl     L407
L16:
  mov    0x0(%r13),%eax
  mov    %ebx,%edx
  cmp    %eax,(%r15,%rbx,4)
  jge    L153
  add    $0x1,%r12d
  mov    %r15,%rdi
  add    $0x1,%rbx
  mov    %r8d,0x48(%rsp)
  mov    %r12d,%esi
  call   <swap@plt>
  mov    0x48(%rsp),%r8d
  cmp    %ebx,%r14d
  jge    L16
L407:
  mov    %ebp,0x4c(%rsp)
  mov    0x40(%rsp),%ebp
  mov    %r12d,%edx
  mov    %r15,%rdi
  mov    %r8d,0x48(%rsp)
  mov    %ebp,%esi
  call   <swap@plt>
  mov    %ebp,%esi
  lea    -0x1(%r12),%edx
  mov    %r15,%rdi
  call   <sort_helper>
  lea    0x1(%r12),%ebp
  mov    0x48(%rsp),%r8d
  mov    0x4c(%rsp),%ecx
  cmp    %ebp,%r14d
  jle    L665
  lea    0x2(%r12),%ebx
  cmp    %ebx,%r14d
  jge    L627
L88:
  mov    %ebp,%r14d
  mov    %r15,%rdi
  mov    %ecx,%r13d
  mov    %r8d,%ebp
  mov    %r14d,%edx
  mov    %r14d,%esi
  call   <swap@plt>
  lea    -0x1(%r14),%edx
  mov    %r14d,%esi
  mov    %r15,%rdi
  call   <sort_helper>
L202:
  lea    0x1(%rbp),%r14d
  cmp    %r14d,%r13d
  jle    L737
  lea    0x2(%rbp),%ebx
  cmp    %ebx,%r13d
  jge    L437
L161:
  mov    %r14d,%edx
  mov    %r14d,%esi
  mov    %r15,%rdi
  mov    0x10(%rsp),%ebp
  call   <swap@plt>
L509:
  lea    0x1(%rbp),%r14d
  cmp    %r14d,0x8(%rsp)
  jle    L237
  lea    0x2(%rbp),%ebx
  cmp    %ebx,0x8(%rsp)
  jge    L297
L597:
  mov    %r14d,%edx
  mov    %r14d,%esi
  mov    %r15,%rdi
  mov    0x28(%rsp),%r13d
  call   <swap@plt>
L543:
  lea    0x1(%r13),%r14d
  cmp    %r14d,0xc(%rsp)
  jle    L265
  lea    0x2(%r13),%ebx
  cmp    %ebx,0xc(%rsp)
  jge    L51
L288:
  mov    %r14d,%edx
  mov    %r14d,%esi
  mov    %r15,%rdi
  call   <swap@plt>
L265:
  mov    0x3c(%rsp),%eax
  lea    0x1(%rax),%r14d
  cmp    %r14d,0x20(%rsp)
  jle    L710
  lea    0x2(%rax),%ebx
  cmp    %ebx,0x20(%rsp)
  jge    L356
L538:
  mov    %r14d,%edx
  mov    %r14d,%esi
  mov    %r15,%rdi
  call   <swap@plt>
L710:
  mov    0x38(%rsp),%eax
  lea    0x1(%rax),%r14d
  cmp    %r14d,0x1c(%rsp)
  jle    L495
  lea    0x2(%rax),%r12d
  cmp    %r12d,0x1c(%rsp)
  jge    L423
L619:
  mov    %r14d,%r13d
  mov    %r15,%rdi
  mov    %r15,%r14
  mov    %r13d,%edx
  mov    %r13d,%esi
  call   <swap@plt>
L92:
  mov    0x34(%rsp),%eax
  lea    0x1(%rax),%r13d
  cmp    %r13d,0x18(%rsp)
  jle    L145
L347:
  lea    0x2(%rax),%r15d
  cmp    %r15d,0x18(%rsp)
  jge    L390
L739:
  mov    %r13d,%eax
  mov    %r14,%rdi
  mov    %r14,%r13
  mov    %eax,%edx
  mov    %eax,%esi
  call   <swap@plt>
L455:
  mov    0x30(%rsp),%eax
  lea    0x1(%rax),%r14d
  cmp    %r14d,0x14(%rsp)
  jle    L362
  lea    0x2(%rax),%r15d
  cmp    %r15d,0x14(%rsp)
  jge    L486
L457:
  mov    %r14d,%edx
  mov    %r14d,%esi
  mov    %r13,%rdi
  call   <swap@plt>
L362:
  mov    0x2c(%rsp),%r14d
  add    $0x1,%r14d
  cmp    0x24(%rsp),%r14d
  jl     L523
L624:
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L237:
  mov    0x28(%rsp),%r13d
  jmp    L543
L737:
  mov    0x10(%rsp),%ebp
  jmp    L509
L665:
  mov    %ecx,%r13d
  mov    %r8d,%ebp
  jmp    L202
L495:
  mov    0x34(%rsp),%eax
  mov    %r15,%r14
  lea    0x1(%rax),%r13d
  cmp    %r13d,0x18(%rsp)
  jg     L347
L145:
  mov    %r14,%r13
  jmp    L455
L104:
  add    $0x58,%rsp
  mov    %r14d,%edx
  mov    %r14d,%esi
  mov    %r13,%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1050 <swap@plt>
```

assistant: ```c
void sort_helper(int cards[], int left, int right) {
  int i, last;
  if (left >= right)
    return;
  last = left;
  for (i = left + 1; i <= right; i++)
    if (cards[i] < cards[left])
      swap(cards, ++last, i);
  swap(cards, left, last);
  sort_helper(cards, left, last - 1);
  sort_helper(cards, last + 1, right);
}
```