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

```asm
<simultaneous_sort>:
  endbr64
  cmp    $0x1,%edx
  jle    L28
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%rbp
  mov    %rsi,%r13
  mov    %edx,%r12d
  cmp    $0x2,%edx
  je     L40
  cmp    $0x3,%edx
  je     L216
  mov    %edx,%ebx
  shr    $0x1f,%ebx
  add    %edx,%ebx
  sar    %ebx
  movslq %edx,%rax
  lea    -0x8(%rdi,%rax,8),%r14
  movsd  (%rdi),%xmm0
  comisd (%r14),%xmm0
  ja     L14
L67:
  movslq %ebx,%rax
  movsd  (%r14),%xmm0
  comisd 0x0(%rbp,%rax,8),%xmm0
  ja     L178
L130:
  movsd  (%r14),%xmm2
  movsd  %xmm2,(%rsp)
  lea    -0x1(%r12),%eax
  mov    %eax,0xc(%rsp)
  mov    %eax,%r15d
  mov    $0x0,%ebx
  mov    $0x0,%r14d
  jmp    L159
L40:
  movsd  (%rdi),%xmm0
  comisd 0x8(%rdi),%xmm0
  jbe    L149
  mov    $0x1,%ecx
  mov    $0x0,%edx
  call   <dual_swap@plt>
  jmp    L149
L216:
  movsd  (%rdi),%xmm0
  comisd 0x8(%rdi),%xmm0
  ja     L203
L193:
  movsd  0x8(%rbp),%xmm0
  comisd 0x10(%rbp),%xmm0
  jbe    L149
  mov    $0x2,%ecx
  mov    $0x1,%edx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <dual_swap@plt>
  movsd  0x0(%rbp),%xmm0
  comisd 0x8(%rbp),%xmm0
  jbe    L149
  mov    $0x1,%ecx
  mov    $0x0,%edx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <dual_swap@plt>
  jmp    L149
L203:
  mov    $0x1,%ecx
  mov    $0x0,%edx
  call   <dual_swap@plt>
  jmp    L193
L14:
  lea    -0x1(%rdx),%ecx
  mov    $0x0,%edx
  call   <dual_swap@plt>
  jmp    L67
L178:
  lea    -0x1(%r12),%r15d
  mov    %ebx,%ecx
  mov    %r15d,%edx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <dual_swap@plt>
  movsd  0x0(%rbp),%xmm0
  comisd (%r14),%xmm0
  jbe    L130
  mov    %r15d,%ecx
  mov    $0x0,%edx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <dual_swap@plt>
  jmp    L130
L142:
  add    $0x1,%rbx
  cmp    %rbx,%r15
  je     L181
L159:
  mov    %ebx,%edx
  movsd  (%rsp),%xmm1
  comisd 0x0(%rbp,%rbx,8),%xmm1
  jbe    L142
  mov    %r14d,%ecx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <dual_swap@plt>
  add    $0x1,%r14d
  jmp    L142
L181:
  mov    0xc(%rsp),%ecx
  mov    %r14d,%edx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <dual_swap@plt>
  cmp    $0x1,%r14d
  jg     L88
L144:
  lea    (%r14,%r14,1),%eax
  cmp    %r12d,%eax
  jl     L189
L149:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L88:
  mov    %r14d,%edx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <simultaneous_sort>
  jmp    L144
L189:
  movslq %r14d,%rax
  add    $0x1,%rax
  sub    %r14d,%r12d
  lea    -0x1(%r12),%edx
  lea    0x0(%r13,%rax,4),%rsi
  lea    0x0(%rbp,%rax,8),%rdi
  call   <simultaneous_sort>
  jmp    L149
L28:
  ret
```

assistant: ```c
void simultaneous_sort(double *dist, int *idx, int size) {
  int pivot_idx, i, store_idx;
  double pivot_val;
  if (size <= 1)
    ;
  else if (size == 2) {
    if (dist[0] > dist[1])
      dual_swap(dist, idx, 0, 1);
  } else if (size == 3) {
    if (dist[0] > dist[1])
      dual_swap(dist, idx, 0, 1);
    if (dist[1] > dist[2]) {
      dual_swap(dist, idx, 1, 2);
      if (dist[0] > dist[1])
        dual_swap(dist, idx, 0, 1);
    }
  } else {
    pivot_idx = size / 2;
    if (dist[0] > dist[size - 1])
      dual_swap(dist, idx, 0, size - 1);
    if (dist[size - 1] > dist[pivot_idx]) {
      dual_swap(dist, idx, size - 1, pivot_idx);
      if (dist[0] > dist[size - 1])
        dual_swap(dist, idx, 0, size - 1);
    }
    pivot_val = dist[size - 1];
    store_idx = 0;
    for (i = 0; i < size - 1; i++) {
      if (dist[i] < pivot_val) {
        dual_swap(dist, idx, i, store_idx);
        store_idx++;
      }
    }
    dual_swap(dist, idx, store_idx, size - 1);
    pivot_idx = store_idx;
    if (pivot_idx > 1)
      simultaneous_sort(dist, idx, pivot_idx);
    if (pivot_idx * 2 < size)
      simultaneous_sort(dist + pivot_idx + 1, idx + pivot_idx + 1, size - pivot_idx - 1);
  }
}
```