user: Converte this assembly snippet into its equivalent C code:

```asm
<DVIVqsortDown>:
  endbr64
  push   %r15
  mov    %rsi,%r15
  push   %r14
  mov    %edi,%r14d
  push   %r13
  mov    %rdx,%r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x58,%rsp
  cmp    $0xa,%edi
  jle    L55
L271:
  mov    %r14d,%edi
  mov    %r15,%rsi
  lea    -0x1(%r14),%r12d
  mov    $0x1,%ebx
  call   <Dcentervalue@plt>
  mov    %r12d,%edx
  mov    %r12d,%eax
  xor    %r9d,%r9d
  movapd %xmm0,%xmm1
  xor    %edi,%edi
  nopw   0x0(%rax,%rax,1)
L280:
  movsd  (%r15,%r9,8),%xmm0
  comisd %xmm1,%xmm0
  jae    L299
  movslq %eax,%rsi
  mov    %r9d,(%rsp)
  lea    (%r15,%rsi,8),%r8
  jmp    L85
  nopl   (%rax)
L70:
  ucomisd %xmm1,%xmm0
  jp     L266
  jne    L266
  movslq %edx,%r10
  mov    0x0(%r13,%rsi,4),%ebp
  sub    $0x1,%edx
  lea    0x0(%r13,%r10,4),%r11
  lea    (%r15,%r10,8),%r10
  mov    (%r11),%ecx
  movsd  (%r10),%xmm2
  mov    %ecx,0x0(%r13,%rsi,4)
  mov    %ebp,(%r11)
  movsd  %xmm2,(%r8)
  movsd  %xmm0,(%r10)
L266:
  sub    $0x1,%rsi
  sub    $0x1,%eax
  sub    $0x8,%r8
  cmp    %esi,%r9d
  jg     L228
L85:
  movsd  (%r8),%xmm0
  mov    %esi,%eax
  comisd %xmm0,%xmm1
  jae    L70
  lea    0x0(%r13,%rsi,4),%rcx
  mov    0x0(%r13,%r9,4),%r10d
  movsd  (%r15,%r9,8),%xmm2
  sub    $0x1,%eax
  mov    (%rcx),%esi
  mov    %esi,0x0(%r13,%r9,4)
  mov    %r10d,(%rcx)
  mov    %ebx,%ecx
  movsd  %xmm0,(%r15,%r9,8)
  movsd  %xmm2,(%r8)
L282:
  add    $0x1,%r9
  add    $0x1,%ebx
  cmp    %ecx,%eax
  jge    L280
L94:
  mov    %ecx,%ebx
  sub    %edi,%ebx
  cmp    %edi,%ebx
  mov    %ebx,0x2c(%rsp)
  cmovle %ebx,%edi
  mov    %ecx,%ebx
  sub    %edi,%ebx
  mov    %ebx,0x20(%rsp)
  test   %edi,%edi
  je     L51
  movslq %edi,%rsi
  movslq %ecx,%r8
  mov    %edi,%r11d
  sub    %rsi,%r8
  lea    (%r8,%r11,1),%r9
  lea    0x0(,%r8,8),%rbp
  shl    $0x2,%r8
  lea    0x0(%r13,%r9,4),%rbx
  lea    (%r15,%r9,8),%r10
  mov    %r8,0x10(%rsp)
  add    %r13,%r8
  lea    0x0(%r13,%r11,4),%r9
  mov    %rbx,(%rsp)
  lea    (%r15,%r11,8),%rbx
  cmp    %r9,%r15
  mov    %r10,0x8(%rsp)
  lea    (%r15,%rbp,1),%rsi
  setae  %r10b
  cmp    %rbx,%r13
  mov    %r9,0x30(%rsp)
  setae  %r9b
  or     %r9d,%r10d
  lea    -0x1(%rdi),%r9d
  cmp    $0x2,%r9d
  seta   %r9b
  and    %r9d,%r10d
  cmp    %rsi,(%rsp)
  setbe  %r9b
  cmp    %r8,0x8(%rsp)
  setbe  0x18(%rsp)
  or     0x18(%rsp),%r9b
  and    %r10d,%r9d
  cmp    (%rsp),%r15
  setae  %r10b
  cmp    %rbx,%r8
  setae  %bl
  or     %ebx,%r10d
  mov    0x10(%rsp),%rbx
  and    %r9d,%r10d
  lea    0x10(%rbx),%r9
  lea    0x10(%r13),%rbx
  test   %r9,%r9
  setle  %r9b
  cmp    %rbx,%r8
  setae  %bl
  or     %ebx,%r9d
  lea    0x20(%r15),%rbx
  and    %r10d,%r9d
  lea    0x20(%rbp),%r10
  test   %r10,%r10
  setle  %r10b
  cmp    %rbx,%rsi
  setae  %bl
  or     %ebx,%r10d
  test   %r10b,%r9b
  je     L190
  cmp    0x30(%rsp),%rsi
  setae  %r9b
  cmp    0x8(%rsp),%r13
  setae  %r10b
  or     %r9b,%r10b
  je     L190
  mov    %edi,%r10d
  xor    %r9d,%r9d
  shr    $0x2,%r10d
  shl    $0x4,%r10
  nopl   (%rax)
L275:
  movdqu 0x0(%r13,%r9,1),%xmm0
  movdqu (%r8,%r9,1),%xmm3
  movupd (%r15,%r9,2),%xmm1
  movupd 0x10(%rsi,%r9,2),%xmm2
  movups %xmm3,0x0(%r13,%r9,1)
  movupd (%rsi,%r9,2),%xmm4
  movups %xmm0,(%r8,%r9,1)
  movupd 0x10(%r15,%r9,2),%xmm0
  movups %xmm4,(%r15,%r9,2)
  movups %xmm2,0x10(%r15,%r9,2)
  movups %xmm1,(%rsi,%r9,2)
  movups %xmm0,0x10(%rsi,%r9,2)
  add    $0x10,%r9
  cmp    %r10,%r9
  jne    L275
  mov    %edi,%esi
  mov    0x20(%rsp),%r8d
  mov    %edi,%r10d
  and    $0xfffffffc,%esi
  sub    %esi,%r10d
  add    %esi,%r8d
  mov    %r10d,(%rsp)
  cmp    %esi,%edi
  je     L51
  movslq %esi,%rsi
  movslq %r8d,%rdi
  lea    0x0(,%rsi,4),%r9
  lea    0x0(%r13,%rdi,4),%r11
  shl    $0x3,%rsi
  cmpl   $0x1,(%rsp)
  lea    0x0(%r13,%r9,1),%rbx
  mov    (%r11),%r10d
  lea    (%r15,%rdi,8),%rdi
  mov    (%rbx),%ebp
  movsd  (%rdi),%xmm1
  mov    %r10d,(%rbx)
  mov    %ebp,(%r11)
  lea    (%r15,%rsi,1),%r11
  movsd  (%r11),%xmm0
  movsd  %xmm1,(%r11)
  movsd  %xmm0,(%rdi)
  lea    0x1(%r8),%edi
  je     L51
  movslq %edi,%rdi
  lea    0x4(%r13,%r9,1),%rbx
  lea    0x0(,%rdi,4),%r8
  mov    (%rbx),%ebp
  shl    $0x3,%rdi
  cmpl   $0x2,(%rsp)
  lea    0x0(%r13,%r8,1),%r11
  mov    (%r11),%r10d
  mov    %r10d,(%rbx)
  lea    (%r15,%rdi,1),%rbx
  mov    %ebp,(%r11)
  lea    0x8(%r15,%rsi,1),%r11
  movsd  (%rbx),%xmm1
  movsd  (%r11),%xmm0
  movsd  %xmm1,(%r11)
  movsd  %xmm0,(%rbx)
  je     L51
  lea    0x4(%r13,%r8,1),%r8
  lea    0x8(%r13,%r9,1),%r9
  mov    (%r8),%r11d
  mov    (%r9),%r10d
  mov    %r11d,(%r9)
  mov    %r10d,(%r8)
  lea    0x10(%r15,%rsi,1),%r8
  lea    0x8(%r15,%rdi,1),%rsi
  movsd  (%r8),%xmm0
  movsd  (%rsi),%xmm1
  movsd  %xmm1,(%r8)
  movsd  %xmm0,(%rsi)
L51:
  mov    %edx,%ebx
  mov    %r12d,%r8d
  sub    %eax,%ebx
  sub    %edx,%r8d
  mov    %r14d,%eax
  cmp    %ebx,%r8d
  cmovg  %ebx,%r8d
  sub    %r8d,%eax
  mov    %eax,0x30(%rsp)
  movslq %r14d,%rax
  mov    %rax,0x20(%rsp)
  test   %r8d,%r8d
  je     L144
  movslq %r8d,%rdi
  movslq %ecx,%r10
  mov    %r8d,%edx
  sub    %rdi,%rax
  lea    0x0(,%r10,4),%r11
  mov    %rdi,0x48(%rsp)
  lea    (%rdx,%rax,1),%rsi
  add    %r10,%rdx
  lea    0x0(,%rax,4),%rbp
  mov    %rax,%r9
  lea    0x10(,%rax,4),%r12
  lea    (%r15,%rdx,8),%r14
  lea    0x0(%r13,%rsi,4),%rax
  mov    %r14,0x8(%rsp)
  lea    (%r15,%rsi,8),%rdi
  mov    %rax,0x18(%rsp)
  lea    0x10(%r11),%r14
  lea    0x0(%r13,%rdx,4),%rdx
  lea    0x0(,%r9,8),%rax
  lea    0x0(,%r10,8),%rsi
  mov    %rdi,0x10(%rsp)
  mov    %rax,0x40(%rsp)
  add    %r15,%rax
  lea    0x0(%r13,%rbp,1),%rdi
  mov    %rsi,0x38(%rsp)
  add    %r15,%rsi
  cmp    %r14,%rbp
  lea    -0x1(%r8),%r14d
  setge  %bpl
  cmp    %r12,%r11
  mov    %rdx,(%rsp)
  lea    0x0(%r13,%r11,1),%rdx
  setge  %r12b
  or     %ebp,%r12d
  cmp    0x10(%rsp),%rdi
  setae  %bpl
  cmp    0x18(%rsp),%rax
  setae  %r11b
  or     %ebp,%r11d
  and    %r12d,%r11d
  cmp    $0x2,%r14d
  seta   %bpl
  and    %ebp,%r11d
  cmp    %rdi,0x8(%rsp)
  setbe  %bpl
  cmp    0x18(%rsp),%rsi
  setae  %r12b
  or     %r12d,%ebp
  and    %r11d,%ebp
  cmp    0x10(%rsp),%rdx
  setae  %r11b
  cmp    %rax,(%rsp)
  setbe  %r12b
  or     %r12d,%r11d
  and    %ebp,%r11d
  cmp    0x8(%rsp),%rdx
  setae  %bpl
  cmp    %rsi,(%rsp)
  setbe  %r12b
  or     %r12d,%ebp
  test   %bpl,%r11b
  je     L227
  mov    0x40(%rsp),%r12
  mov    0x38(%rsp),%rbp
  lea    0x20(%r12),%r11
  cmp    %rbp,%r11
  setle  %r11b
  add    $0x20,%rbp
  cmp    %r12,%rbp
  setle  %bpl
  or     %r11b,%bpl
  je     L227
  mov    %r8d,%r10d
  xor    %r9d,%r9d
  shr    $0x2,%r10d
  shl    $0x4,%r10
L103:
  movdqu (%rdx,%r9,1),%xmm0
  movdqu (%rdi,%r9,1),%xmm5
  movupd (%rsi,%r9,2),%xmm1
  movupd 0x10(%rax,%r9,2),%xmm2
  movups %xmm5,(%rdx,%r9,1)
  movupd (%rax,%r9,2),%xmm6
  movups %xmm0,(%rdi,%r9,1)
  movupd 0x10(%rsi,%r9,2),%xmm0
  movups %xmm6,(%rsi,%r9,2)
  movups %xmm2,0x10(%rsi,%r9,2)
  movups %xmm1,(%rax,%r9,2)
  movups %xmm0,0x10(%rax,%r9,2)
  add    $0x10,%r9
  cmp    %r10,%r9
  jne    L103
  mov    0x30(%rsp),%eax
  mov    %r8d,%esi
  mov    %r8d,%edi
  and    $0xfffffffc,%esi
  lea    (%rcx,%rsi,1),%edx
  add    %esi,%eax
  sub    %esi,%edi
  cmp    %esi,%r8d
  je     L144
  movslq %edx,%rsi
  movslq %eax,%rcx
  add    $0x1,%edx
  add    $0x1,%eax
  lea    0x0(%r13,%rsi,4),%r9
  lea    0x0(%r13,%rcx,4),%r8
  lea    (%r15,%rsi,8),%rsi
  lea    (%r15,%rcx,8),%rcx
  mov    (%r9),%r10d
  mov    (%r8),%r11d
  movsd  (%rsi),%xmm0
  movsd  (%rcx),%xmm1
  mov    %r11d,(%r9)
  mov    %r10d,(%r8)
  movsd  %xmm1,(%rsi)
  movsd  %xmm0,(%rcx)
  cmp    $0x1,%edi
  je     L144
  movslq %edx,%rdx
  cltq
  lea    0x0(,%rdx,4),%rsi
  lea    0x0(,%rax,4),%rcx
  shl    $0x3,%rdx
  shl    $0x3,%rax
  lea    0x0(%r13,%rsi,1),%r9
  lea    0x0(%r13,%rcx,1),%r8
  mov    (%r9),%r10d
  mov    (%r8),%r11d
  mov    %r11d,(%r9)
  lea    (%r15,%rdx,1),%r9
  mov    %r10d,(%r8)
  lea    (%r15,%rax,1),%r8
  movsd  (%r9),%xmm0
  movsd  (%r8),%xmm1
  movsd  %xmm1,(%r9)
  movsd  %xmm0,(%r8)
  cmp    $0x2,%edi
  je     L144
  lea    0x4(%r13,%rsi,1),%rsi
  lea    0x4(%r13,%rcx,1),%rcx
  lea    0x8(%r15,%rdx,1),%rdx
  lea    0x8(%r15,%rax,1),%rax
  mov    (%rsi),%edi
  mov    (%rcx),%r8d
  movsd  (%rdx),%xmm0
  movsd  (%rax),%xmm1
  mov    %r8d,(%rsi)
  mov    %edi,(%rcx)
  movsd  %xmm1,(%rdx)
  movsd  %xmm0,(%rax)
L144:
  mov    0x2c(%rsp),%edi
  mov    %r13,%rdx
  mov    %r15,%rsi
  call   <DVIVqsortDown>
  mov    0x20(%rsp),%rax
  movslq %ebx,%rdx
  sub    %rdx,%rax
  lea    0x0(%r13,%rax,4),%r13
  lea    (%r15,%rax,8),%r15
  cmp    $0xa,%ebx
  jle    L251
  mov    %ebx,%r14d
  jmp    L271
  nopl   0x0(%rax)
L228:
  mov    (%rsp),%ecx
  jmp    L94
L299:
  ucomisd %xmm1,%xmm0
  jp     L200
  jne    L200
  movslq %edi,%rcx
  mov    0x0(%r13,%r9,4),%r10d
  add    $0x1,%edi
  lea    0x0(%r13,%rcx,4),%rsi
  lea    (%r15,%rcx,8),%rcx
  mov    (%rsi),%r8d
  movsd  (%rcx),%xmm2
  mov    %r10d,(%rsi)
  mov    %r8d,0x0(%r13,%r9,4)
  movsd  %xmm0,(%rcx)
  movsd  %xmm2,(%r15,%r9,8)
L200:
  mov    %ebx,%ecx
  jmp    L282
L251:
  mov    %ebx,%edi
L55:
  add    $0x58,%rsp
  mov    %r13,%rdx
  mov    %r15,%rsi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1070 <DVIVisortDown@plt>
L227:
  mov    %r14d,%ecx
  sub    %r10,%r9
  add    %r10,%rcx
  lea    0x4(%r13,%rcx,4),%rsi
  mov    0x48(%rsp),%rcx
  sub    0x20(%rsp),%rcx
  add    %r10,%rcx
  nopw   0x0(%rax,%rax,1)
L43:
  mov    (%rdx),%edi
  mov    (%rdx,%r9,4),%r8d
  movsd  (%rax,%rcx,8),%xmm0
  movsd  (%rax),%xmm1
  mov    %r8d,(%rdx)
  mov    %edi,(%rdx,%r9,4)
  add    $0x4,%rdx
  movsd  %xmm1,(%rax,%rcx,8)
  add    $0x8,%rax
  movsd  %xmm0,-0x8(%rax)
  cmp    %rsi,%rdx
  jne    L43
  jmp    L144
L190:
  xor    %edi,%edi
  nopl   0x0(%rax)
L15:
  mov    0x0(%r13,%rdi,4),%r9d
  mov    (%r8,%rdi,4),%r10d
  movsd  (%r15,%rdi,8),%xmm0
  movsd  (%rsi,%rdi,8),%xmm1
  mov    %r10d,0x0(%r13,%rdi,4)
  mov    %r9d,(%r8,%rdi,4)
  movsd  %xmm1,(%r15,%rdi,8)
  movsd  %xmm0,(%rsi,%rdi,8)
  add    $0x1,%rdi
  cmp    %r11,%rdi
  jne    L15
  jmp    L51
```

assistant: ```c
void DVIVqsortDown(int n, double dvec[], int ivec[]) {
  double dtemp, v;
  int a, b, c, d, itemp, l, h, s;
  if (n <= 10) {
    DVIVisortDown(n, dvec, ivec);
  } else {
    v = Dcentervalue(n, dvec);
    a = b = 0;
    c = d = n - 1;
    for (;;) {
      while (b <= c && dvec[b] >= v) {
        if (dvec[b] == v) {
          {
            itemp = ivec[(a)];
            ivec[(a)] = ivec[(b)];
            ivec[(b)] = itemp;
            dtemp = dvec[(a)];
            dvec[(a)] = dvec[(b)];
            dvec[(b)] = dtemp;
          }
          a++;
        }
        b++;
      }
      while (c >= b && dvec[c] <= v) {
        if (dvec[c] == v) {
          {
            itemp = ivec[(c)];
            ivec[(c)] = ivec[(d)];
            ivec[(d)] = itemp;
            dtemp = dvec[(c)];
            dvec[(c)] = dvec[(d)];
            dvec[(d)] = dtemp;
          }
          d--;
        }
        c--;
      }
      if (b > c) {
        break;
      }
      {
        itemp = ivec[(b)];
        ivec[(b)] = ivec[(c)];
        ivec[(c)] = itemp;
        dtemp = dvec[(b)];
        dvec[(b)] = dvec[(c)];
        dvec[(c)] = dtemp;
      }
      b++;
      c--;
    }
    s = (a <= b - a) ? a : b - a;
    for (l = 0, h = b - s; s != 0; s--) {
      {
        itemp = ivec[(l)];
        ivec[(l)] = ivec[(h)];
        ivec[(h)] = itemp;
        dtemp = dvec[(l)];
        dvec[(l)] = dvec[(h)];
        dvec[(h)] = dtemp;
      }
      l++;
      h++;
    }
    s = ((d - c) <= (n - 1 - d)) ? (d - c) : (n - 1 - d);
    for (l = b, h = n - s; s != 0; s--) {
      {
        itemp = ivec[(l)];
        ivec[(l)] = ivec[(h)];
        ivec[(h)] = itemp;
        dtemp = dvec[(l)];
        dvec[(l)] = dvec[(h)];
        dvec[(h)] = dtemp;
      }
      l++;
      h++;
    }
    DVIVqsortDown(b - a, dvec, ivec);
    DVIVqsortDown(d - c, dvec + n - (d - c), ivec + n - (d - c));
  }
  return;
}
```