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

```asm
<sprstp>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x58,%rsp
  mov    0x8(%rsi),%rbp
  mov    %rdx,0x30(%rsp)
  mov    %rbp,%r13
  mov    %rcx,0x28(%rsp)
  sub    $0x2,%r13
  je     L283
  mov    %rdx,%rax
  sub    %rdi,%rax
  sub    $0x4,%rax
  cmp    $0x8,%rax
  jbe    L222
  lea    -0x3(%rbp),%rax
  cmp    $0x2,%rax
  jbe    L222
  mov    %r13,%rdx
  mov    $0x4,%eax
  shr    $0x2,%rdx
  shl    $0x4,%rdx
  add    $0x4,%rdx
L358:
  movups (%r12,%rax,1),%xmm2
  mov    0x30(%rsp),%rsi
  movups %xmm2,(%rsi,%rax,1)
  add    $0x10,%rax
  cmp    %rdx,%rax
  jne    L358
  mov    %r13,%rax
  and    $0xfffffffffffffffc,%rax
  lea    0x1(%rax),%rcx
  cmp    %r13,%rax
  je     L76
  movss  (%r12,%rcx,4),%xmm0
  lea    0x0(,%rcx,4),%rdx
  movss  %xmm0,(%rsi,%rcx,4)
  lea    0x2(%rax),%rcx
  cmp    %r13,%rcx
  ja     L76
  movss  0x4(%r12,%rdx,1),%xmm0
  add    $0x3,%rax
  movss  %xmm0,0x4(%rsi,%rdx,1)
  cmp    %r13,%rax
  ja     L76
  movss  0x8(%r12,%rdx,1),%xmm0
  movss  %xmm0,0x8(%rsi,%rdx,1)
L76:
  lea    0x0(,%rbp,8),%r14
  mov    0x28(%rsp),%rdx
  lea    -0x8(%r14),%rax
  lea    (%rbx,%rax,1),%r15
  add    %rax,%rdx
  mov    (%r15),%rdi
  mov    %r15,%rsi
  sub    %rbp,%rdi
  call   <iindexx@plt>
  mov    (%r15),%rax
  mov    0x8(%rbx),%r8
  lea    -0x1(%rax),%rdx
  cmp    %rdx,%r8
  ja     L59
L367:
  mov    0x28(%rsp),%r10
  lea    -0x1(%rbp),%r9
  xor    %edi,%edi
L365:
  mov    (%r10,%r8,8),%rsi
  mov    0x30(%rsp),%rax
  add    %r9,%rsi
  movss  (%r12,%rsi,4),%xmm0
  lea    (%rbx,%rsi,8),%rdx
  movss  %xmm0,(%rax,%r8,4)
  lea    0x1(%rdi),%rax
  mov    (%rdx),%rdi
  cmp    %rdi,%rax
  ja     L73
  nopl   0x0(%rax)
L14:
  mov    %r8,(%r10,%rax,8)
  mov    (%rdx),%rdi
  add    $0x1,%rax
  cmp    %rax,%rdi
  jae    L14
L73:
  mov    %r9,%rcx
  mov    $0x1,%edx
  jmp    L176
  nopw   0x0(%rax,%rax,1)
L31:
  lea    (%rdx,%rcx,1),%rax
  shr    %rax
  cmp    %rsi,(%rbx,%rax,8)
  cmovbe %rax,%rdx
  cmova  %rax,%rcx
L176:
  mov    %rcx,%rax
  sub    %rdx,%rax
  cmp    $0x1,%rax
  ja     L31
  mov    %rdx,(%r10,%r8,8)
  mov    (%r15),%rax
  add    $0x1,%r8
  lea    -0x1(%rax),%rdx
  cmp    %r8,%rdx
  jae    L365
  add    $0x1,%rdi
  cmp    %rdi,%rbp
  jbe    L373
L44:
  mov    0x28(%rsp),%r11
  lea    0x1(%rdi),%rsi
  lea    0x0(,%rdi,8),%rcx
  mov    %rax,(%r11,%rdi,8)
  cmp    %rsi,%rbp
  jbe    L373
  lea    0x8(%r11,%rcx,1),%rax
  mov    %rbp,%rdx
  lea    (%r11,%r14,1),%rcx
  sub    %rdi,%rdx
  cmp    %rcx,%r15
  setae  %dil
  add    %rbx,%r14
  cmp    %r14,%rax
  setae  %r8b
  or     %r8b,%dil
  je     L377
  lea    -0x2(%rdx),%rdi
  cmp    $0x2,%rdi
  jbe    L377
  sub    $0x1,%rdx
  movq   (%r15),%xmm0
  mov    %rdx,%rcx
  shr    %rcx
  punpcklqdq %xmm0,%xmm0
  shl    $0x4,%rcx
  add    %rax,%rcx
L161:
  movups %xmm0,(%rax)
  add    $0x10,%rax
  cmp    %rcx,%rax
  jne    L161
  mov    %rdx,%rax
  and    $0xfffffffffffffffe,%rax
  add    %rax,%rsi
  cmp    %rdx,%rax
  je     L373
  mov    (%r15),%rax
  mov    0x28(%rsp),%rdx
  mov    %rax,(%rdx,%rsi,8)
L373:
  test   %r13,%r13
  je     L338
L220:
  mov    0x28(%rsp),%rax
  add    $0x8,%rax
  mov    %rax,0x40(%rsp)
  lea    (%rax,%r13,8),%rax
  mov    %rax,0x48(%rsp)
L306:
  mov    0x40(%rsp),%rax
  mov    $0x1,%ecx
  mov    0x8(%rax),%rdx
  mov    (%rax),%rax
  mov    %rdx,%rbx
  mov    %rax,0x38(%rsp)
  sub    %rax,%rbx
  mov    %rbx,%rax
  nopl   0x0(%rax)
L154:
  lea    0x1(%rcx,%rcx,2),%rcx
  cmp    %rcx,%rax
  jae    L154
  lea    -0x1(%rdx),%rax
  mov    %rcx,0x18(%rsp)
  mov    $0x1,%r14d
  sub    0x38(%rsp),%r14
  mov    %rax,0x10(%rsp)
  nopl   0x0(%rax,%rax,1)
L234:
  movabs $0xaaaaaaaaaaaaaaab,%rax
  mov    0x18(%rsp),%rbx
  mul    %rbx
  mov    0x38(%rsp),%rax
  mov    %rbx,0x20(%rsp)
  shr    %rdx
  add    %rdx,%rax
  mov    %rdx,0x18(%rsp)
  mov    %rax,(%rsp)
  cmp    0x10(%rsp),%rax
  ja     L201
  mov    0x28(%rsp),%rbx
  lea    (%rbx,%rax,8),%r15
  mov    0x30(%rsp),%rbx
  lea    (%rbx,%rax,4),%rax
  mov    %rdx,%rbx
  mov    %rax,0x8(%rsp)
  neg    %rbx
  lea    0x0(,%rbx,8),%rbp
  shl    $0x2,%rbx
  nop
L130:
  mov    0x8(%rsp),%r8
  mov    (%r15),%r12
  lea    (%r15,%rbp,1),%rax
  mov    %r15,%rdi
  mov    (%rsp),%rsi
  movss  (%r8),%xmm1
  lea    (%rbx,%r8,1),%rcx
  jmp    L352
  xchg   %ax,%ax
L274:
  movss  (%rcx),%xmm0
  mov    %r9,(%rdi)
  add    %rbp,%rax
  mov    %rcx,%r9
  lea    (%r11,%rbp,1),%rdi
  add    %rbx,%rcx
  movss  %xmm0,(%r8)
  lea    (%r10,%rbx,1),%r8
  lea    (%r14,%rsi,1),%r10
  cmp    %rdx,%r10
  jbe    L238
L352:
  mov    (%rax),%r9
  sub    %rdx,%rsi
  mov    %rax,%r13
  mov    %rdi,%r11
  mov    %r8,%r10
  cmp    %r12,%r9
  ja     L274
L299:
  addq   $0x1,(%rsp)
  add    $0x8,%r15
  mov    (%rsp),%rax
  mov    %r12,(%r11)
  addq   $0x4,0x8(%rsp)
  movss  %xmm1,(%r10)
  cmp    0x10(%rsp),%rax
  jbe    L130
L201:
  cmpq   $0x5,0x20(%rsp)
  ja     L234
  addq   $0x8,0x40(%rsp)
  mov    0x40(%rsp),%rax
  cmp    0x48(%rsp),%rax
  jne    L306
L338:
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L377:
  mov    (%r15),%rdx
  add    $0x8,%rax
  mov    %rdx,-0x8(%rax)
  cmp    %rcx,%rax
  je     L373
  mov    (%r15),%rdx
  add    $0x8,%rax
  mov    %rdx,-0x8(%rax)
  cmp    %rcx,%rax
  jne    L377
  jmp    L373
  nopw   0x0(%rax,%rax,1)
L238:
  mov    %r9,%r10
  mov    %r13,%r11
  jmp    L299
L222:
  lea    -0x1(%rbp),%rdx
  mov    $0x1,%eax
L198:
  movss  (%r12,%rax,4),%xmm0
  mov    0x30(%rsp),%rsi
  movss  %xmm0,(%rsi,%rax,4)
  add    $0x1,%rax
  cmp    %rdx,%rax
  jne    L198
  jmp    L76
L59:
  mov    $0x1,%edi
  cmp    $0x1,%rbp
  ja     L44
  jmp    L220
  cs nopw 0x0(%rax,%rax,1)
L283:
  lea    0x8(%rsi),%r15
  lea    0x8(%rcx),%rdx
  xor    %edi,%edi
  mov    $0x10,%r14d
  mov    %r15,%rsi
  call   <iindexx@plt>
  mov    0x8(%rbx),%r8
  test   %r8,%r8
  je     L367
  mov    0x28(%rsp),%rax
  mov    %r8,0x8(%rax)
  jmp    L338
```

assistant: ```c
void sprstp(float sa[], unsigned long ija[], float sb[], unsigned long ijb[]) {
  void iindexx(unsigned long n, long arr[], unsigned long indx[]);
  unsigned long j, jl, jm, jp, ju, k, m, n2, noff, inc, iv;
  float v;
  n2 = ija[1];
  for (j = 1; j <= n2 - 2; j++)
    sb[j] = sa[j];
  iindexx(ija[n2 - 1] - ija[1], (long *)&ija[n2 - 1], &ijb[n2 - 1]);
  jp = 0;
  for (k = ija[1]; k <= ija[n2 - 1] - 1; k++) {
    m = ijb[k] + n2 - 1;
    sb[k] = sa[m];
    for (j = jp + 1; j <= ija[m]; j++)
      ijb[j] = k;
    jp = ija[m];
    jl = 1;
    ju = n2 - 1;
    while (ju - jl > 1) {
      jm = (ju + jl) / 2;
      if (ija[jm] > m)
        ju = jm;
      else
        jl = jm;
    }
    ijb[k] = jl;
  }
  for (j = jp + 1; j < n2; j++)
    ijb[j] = ija[n2 - 1];
  for (j = 1; j <= n2 - 2; j++) {
    jl = ijb[j + 1] - ijb[j];
    noff = ijb[j] - 1;
    inc = 1;
    do {
      inc *= 3;
      inc++;
    } while (inc <= jl);
    do {
      inc /= 3;
      for (k = noff + inc + 1; k <= noff + jl; k++) {
        iv = ijb[k];
        v = sb[k];
        m = k;
        while (ijb[m - inc] > iv) {
          ijb[m] = ijb[m - inc];
          sb[m] = sb[m - inc];
          m -= inc;
          if (m - noff <= inc)
            break;
        }
        ijb[m] = iv;
        sb[m] = v;
      }
    } while (inc > 1);
  }
}
```