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

```asm
<CountSortedRowsDouble>:
  endbr64
  push   %r15
  mov    %esi,%r10d
  mov    %rdx,%r11
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rcx,%rbp
  push   %rbx
  mov    0x38(%rsp),%r13
  mov    %r9,-0x28(%rsp)
  mov    0x40(%rsp),%r9
  mov    %r8,-0x20(%rsp)
  test   %esi,%esi
  jle    L199
  lea    -0x1(%rsi),%eax
  mov    (%rdx),%rdx
  mov    (%r8),%rcx
  cmp    $0x2,%eax
  jbe    L67
  lea    0x8(%rdx),%rax
  cmp    %rax,%rcx
  je     L67
  shr    %esi
  xor    %eax,%eax
  shl    $0x4,%rsi
  cs nopw 0x0(%rax,%rax,1)
L56:
  movupd (%rdx,%rax,1),%xmm2
  movups %xmm2,(%rcx,%rax,1)
  add    $0x10,%rax
  cmp    %rsi,%rax
  jne    L56
  mov    %r10d,%eax
  and    $0xfffffffe,%eax
  test   $0x1,%r10b
  je     L199
  movsd  (%rdx,%rax,8),%xmm0
  movsd  %xmm0,(%rcx,%rax,8)
L199:
  mov    0x0(%rbp),%eax
  mov    -0x28(%rsp),%rcx
  mov    %eax,(%rcx)
  addl   $0x1,(%r9)
  movslq 0x0(%rbp),%rax
  movl   $0x0,0x0(%r13,%rax,4)
  mov    $0x1,%eax
  cmp    $0x1,%edi
  jle    L13
  mov    %r10d,%eax
  lea    -0x1(%r10),%edx
  movslq %edi,%r15
  mov    $0x1,%ecx
  shr    %eax
  mov    %edx,-0x18(%rsp)
  xor    %edi,%edi
  lea    -0x1(%rax),%r12d
  mov    %r10d,%eax
  and    $0xfffffffe,%eax
  add    $0x1,%r12
  mov    %eax,-0x14(%rsp)
  movslq %eax,%r8
  shl    $0x4,%r12
  shl    $0x3,%r8
  nopl   (%rax)
L209:
  test   %r10d,%r10d
  jle    L121
  mov    (%r11,%rcx,8),%rax
  mov    -0x8(%r11,%rcx,8),%r14
  xor    %esi,%esi
  jmp    L72
  xchg   %ax,%ax
L15:
  lea    0x1(%rsi),%rbx
  cmp    %rsi,%rdx
  je     L121
  mov    %rbx,%rsi
L72:
  movsd  (%rax,%rsi,8),%xmm0
  ucomisd (%r14,%rsi,8),%xmm0
  jp     L186
  je     L15
L186:
  mov    -0x20(%rsp),%rbx
  add    $0x1,%edi
  movslq %edi,%r14
  mov    (%rbx,%r14,8),%rsi
  lea    0x8(%rax),%rbx
  cmp    %rbx,%rsi
  je     L62
  xor    %ebx,%ebx
  cmpl   $0x2,-0x18(%rsp)
  jbe    L62
L34:
  movupd (%rax,%rbx,1),%xmm1
  movups %xmm1,(%rsi,%rbx,1)
  add    $0x10,%rbx
  cmp    %r12,%rbx
  jne    L34
  cmp    %r10d,-0x14(%rsp)
  je     L196
  movsd  (%rax,%r8,1),%xmm0
  movsd  %xmm0,(%rsi,%r8,1)
L196:
  mov    0x0(%rbp,%rcx,4),%esi
  mov    -0x28(%rsp),%rbx
  lea    0x0(,%r14,4),%rax
  mov    %esi,(%rbx,%r14,4)
L82:
  addl   $0x1,(%r9,%rax,1)
  movslq 0x0(%rbp,%rcx,4),%rax
  add    $0x1,%rcx
  mov    %edi,0x0(%r13,%rax,4)
  cmp    %r15,%rcx
  jne    L209
  lea    0x1(%rdi),%eax
L13:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L121:
  movslq %edi,%rax
  shl    $0x2,%rax
  jmp    L82
L62:
  mov    %r14,-0x10(%rsp)
  xor    %ebx,%ebx
  nopl   0x0(%rax,%rax,1)
L87:
  movsd  (%rax,%rbx,8),%xmm0
  mov    %rbx,%r14
  movsd  %xmm0,(%rsi,%rbx,8)
  add    $0x1,%rbx
  cmp    %r14,%rdx
  jne    L87
  mov    -0x10(%rsp),%r14
  jmp    L196
L67:
  mov    %r10d,%esi
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L122:
  movsd  (%rdx,%rax,8),%xmm0
  movsd  %xmm0,(%rcx,%rax,8)
  add    $0x1,%rax
  cmp    %rsi,%rax
  jne    L122
  jmp    L199
```

assistant: ```c
int CountSortedRowsDouble(int M, int N, double **sorted, int *sort_idx, double **uni_list, int *uni_i, int *uni_j, int *cnt) {
  int m, u, n1, n;
  for (n1 = 0; n1 < N; n1++)
    uni_list[0][n1] = sorted[0][n1];
  uni_i[0] = sort_idx[0];
  cnt[0]++;
  uni_j[sort_idx[0]] = 0;
  u = 0;
  for (m = 1; m < M; m++) {
    for (n = 0; n < N; n++)
      if (sorted[m][n] != sorted[m - 1][n])
        break;
    if (n < N) {
      u++;
      for (n1 = 0; n1 < N; n1++)
        uni_list[u][n1] = sorted[m][n1];
      uni_i[u] = sort_idx[m];
    }
    cnt[u]++;
    uni_j[sort_idx[m]] = u;
  }
  u++;
  return u;
}
```