user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<SortInt>:
  endbr64
  push   %r15
  mov    %rsi,%r15
  mov    $0x4,%esi
  push   %r14
  push   %r13
  mov    %rcx,%r13
  push   %r12
  mov    %edi,%r12d
  push   %rbp
  lea    0x0(,%r12,4),%r14d
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x28,%rsp
  call   <calloc@plt>
  mov    %r14d,%edi
  mov    %rax,%rbp
  call   <malloc@plt>
  mov    %r13,%rcx
  mov    %rbx,%rdx
  mov    %r15,%rsi
  mov    %r12d,%edi
  mov    %rax,(%rsp)
  call   <SortUnstableInt@plt>
  cmp    $0x1,%r12d
  jle    L62
  lea    -0x1(%r12),%ecx
  xor    %eax,%eax
  xor    %edx,%edx
  xor    %r12d,%r12d
  jmp    L112
  nopl   0x0(%rax,%rax,1)
L90:
  xor    %edx,%edx
L12:
  add    $0x1,%rax
  cmp    %rax,%rcx
  je     L61
L112:
  mov    (%rbx,%rax,4),%edi
  cmp    %edi,0x4(%rbx,%rax,4)
  jne    L90
  test   %edx,%edx
  je     L54
  movslq %r12d,%rsi
  add    $0x1,%rax
  addl   $0x1,-0x4(%rbp,%rsi,4)
  cmp    %rax,%rcx
  jne    L112
  nopl   (%rax)
L61:
  mov    %r14d,%edi
  call   <malloc@plt>
  mov    %r14d,%edx
  mov    %r13,%rsi
  mov    %rax,%rdi
  mov    %rax,%rbx
  call   <memcpy@plt>
  test   %r12d,%r12d
  je     L46
  lea    -0x1(%r12),%eax
  mov    %rbp,%r15
  lea    0x4(%rbp,%rax,4),%r14
  mov    (%rsp),%rax
  sub    %rbp,%rax
  mov    %rax,0x10(%rsp)
L56:
  mov    (%r15),%eax
  lea    0x0(,%rax,4),%edi
  call   <malloc@plt>
  mov    %rax,0x8(%rsp)
  mov    (%r15),%eax
  lea    0x0(,%rax,4),%edi
  call   <malloc@plt>
  mov    0x8(%rsp),%rcx
  mov    (%r15),%edi
  mov    %rax,%r12
  mov    0x10(%rsp),%rax
  mov    %r12,%rdx
  lea    (%rax,%r15,1),%r10
  movslq (%r10),%rax
  mov    %r10,0x18(%rsp)
  lea    0x0(%r13,%rax,4),%rsi
  call   <SortInt>
  mov    (%r15),%eax
  mov    0x8(%rsp),%r11
  test   %eax,%eax
  jle    L65
  mov    0x18(%rsp),%r10
  mov    %r11,%rcx
  xor    %edx,%edx
  nopl   (%rax)
L99:
  mov    (%r10),%eax
  mov    (%rcx),%esi
  add    $0x4,%rcx
  add    %eax,%esi
  add    %edx,%eax
  add    $0x1,%edx
  movslq %esi,%rsi
  cltq
  mov    (%rbx,%rsi,4),%esi
  mov    %esi,0x0(%r13,%rax,4)
  cmp    %edx,(%r15)
  jg     L99
L65:
  mov    %r11,%rdi
  add    $0x4,%r15
  call   <free@plt>
  mov    %r12,%rdi
  call   <free@plt>
  cmp    %r15,%r14
  jne    L56
L46:
  mov    %rbx,%rdi
  call   <free@plt>
  mov    (%rsp),%rdi
  call   <free@plt>
  add    $0x28,%rsp
  mov    %rbp,%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1090 <free@plt>
  cs nopw 0x0(%rax,%rax,1)
L54:
  add    $0x1,%r12d
  mov    (%rsp),%rdi
  movslq %r12d,%rdx
  shl    $0x2,%rdx
  mov    %eax,-0x4(%rdi,%rdx,1)
  movl   $0x2,-0x4(%rbp,%rdx,1)
  mov    $0x1,%edx
  jmp    L12
L62:
  mov    %r14d,%edi
  call   <malloc@plt>
  mov    %r14d,%edx
  mov    %r13,%rsi
  mov    %rax,%rdi
  mov    %rax,%rbx
  call   <memcpy@plt>
  jmp    L46
```

assistant: ```c
void SortInt(int N, int *A, int *C, int *idx) {
  int u, n, j, U;
  int *run_length, *run_start, *run_idx, *run_sort;
  int run_flag;
  int *idx_temp;
  run_length = (int *)calloc(N, sizeof(int));
  run_start = (int *)malloc(N * sizeof(int));
  SortUnstableInt(N, A, C, idx);
  u = 0;
  run_flag = 0;
  for (n = 1; n < N; n++)
    if (C[n] == C[n - 1])
      if (run_flag)
        run_length[u - 1]++;
      else {
        u++;
        run_start[u - 1] = n - 1;
        run_length[u - 1] = 2;
        run_flag = 1;
      }
    else
      run_flag = 0;
  U = u;
  idx_temp = (int *)malloc(N * sizeof(int));
  memcpy(idx_temp, idx, N * sizeof(int));
  for (u = 0; u < U; u++) {
    run_idx = (int *)malloc(run_length[u] * sizeof(int));
    run_sort = (int *)malloc(run_length[u] * sizeof(int));
    SortInt(run_length[u], &idx[run_start[u]], run_sort, run_idx);
    for (j = 0; j < run_length[u]; j++)
      idx[run_start[u] + j] = idx_temp[run_start[u] + run_idx[j]];
    free(run_idx);
    free(run_sort);
  }
  free(idx_temp);
  free(run_start);
  free(run_length);
}
```