user: Translate the below assembly code into C programming language:

```asm
<DMedSelect>:
  endbr64
  push   %r13
  movslq %edi,%r11
  mov    %rdx,%r8
  push   %r12
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  cmp    $0x2,%esi
  jle    L98
  mov    $0x1,%r12d
  mov    $0x2,%eax
  cs nopw 0x0(%rax,%rax,1)
L13:
  movslq %r12d,%rcx
  lea    (%r12,%rbp,1),%edx
  lea    0x8(,%rcx,8),%r10
  sar    %edx
  movslq %ebp,%rcx
  lea    (%r8,%r10,1),%rbx
  movslq %edx,%rdx
  lea    (%r8,%rcx,8),%rcx
  sub    $0x8,%r10
  movsd  (%rbx),%xmm0
  lea    (%r8,%rdx,8),%rdx
  movsd  (%rdx),%xmm1
  movsd  %xmm0,(%rdx)
  lea    (%r8,%r10,1),%rdx
  movsd  %xmm1,(%rbx)
  movsd  (%rdx),%xmm2
  movsd  (%rcx),%xmm0
  comisd %xmm0,%xmm2
  jbe    L74
  movsd  %xmm0,(%rdx)
  movapd %xmm2,%xmm0
  movsd  %xmm2,(%rcx)
  movsd  (%rbx),%xmm1
L74:
  comisd %xmm0,%xmm1
  jbe    L134
  movsd  %xmm0,(%rbx)
  movsd  %xmm1,(%rcx)
  movsd  (%rbx),%xmm1
L134:
  movsd  (%rdx),%xmm0
  movapd %xmm1,%xmm2
  comisd %xmm1,%xmm0
  unpcklpd %xmm0,%xmm2
  jbe    L48
  movups %xmm2,(%rdx)
  movapd %xmm0,%xmm1
L48:
  add    $0x1,%eax
  mov    %ebp,%edx
  movslq %eax,%rcx
  nopl   0x0(%rax)
L104:
  movsd  (%r8,%rcx,8),%xmm2
  mov    %ecx,%r13d
  lea    0x0(,%rcx,8),%r9
  comisd %xmm2,%xmm1
  ja     L66
  movslq %edx,%rax
  lea    -0x8(%r8,%rax,8),%rax
  nop
L132:
  mov    %rax,%rsi
  movsd  (%rax),%xmm0
  sub    $0x8,%rax
  mov    %edx,%edi
  sub    $0x1,%edx
  comisd %xmm1,%xmm0
  ja     L132
  cmp    %ecx,%edx
  jl     L93
  movsd  %xmm0,(%r8,%rcx,8)
  movsd  %xmm2,(%rsi)
L66:
  add    $0x1,%rcx
  jmp    L104
  nopw   0x0(%rax,%rax,1)
L93:
  movsd  %xmm0,(%rbx)
  movsd  %xmm1,(%rsi)
  cmp    %r11d,%edx
  jl     L60
  cmovne %r10,%r9
  cmove  %r13d,%r12d
  lea    -0x2(%rdi),%ebp
L109:
  lea    0x1(%r12),%eax
  cmp    %ebp,%eax
  jl     L13
L35:
  cmp    %ebp,%eax
  je     L129
L36:
  pop    %rbx
  movsd  (%r8,%r11,8),%xmm0
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L60:
  mov    %r13d,%r12d
  jmp    L109
L129:
  cltq
  add    %r8,%r9
  lea    (%r8,%rax,8),%rax
  movsd  (%r9),%xmm0
  movsd  (%rax),%xmm1
  comisd %xmm1,%xmm0
  jbe    L36
  movsd  %xmm1,(%r9)
  movsd  %xmm0,(%rax)
  pop    %rbx
  movsd  (%r8,%r11,8),%xmm0
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L98:
  mov    $0x8,%r9d
  mov    $0x2,%eax
  jmp    L35
```

assistant: ```c
double DMedSelect(int k, int n, double arr[]) {
  double a, temp;
  int i, ir, j, mid, l;
  l = 1;
  ir = n;
  for (;;) {
    if (ir <= l + 1) {
      if (ir == l + 1 && arr[ir] < arr[l]) {
        temp = (arr[l]);
        (arr[l]) = (arr[ir]);
        (arr[ir]) = temp;
      }
      return arr[k];
    } else {
      mid = (l + ir) >> 1;
      temp = (arr[mid]);
      (arr[mid]) = (arr[l + 1]);
      (arr[l + 1]) = temp;
      if (arr[l] > arr[ir]) {
        temp = (arr[l]);
        (arr[l]) = (arr[ir]);
        (arr[ir]) = temp;
      }
      if (arr[l + 1] > arr[ir]) {
        temp = (arr[l + 1]);
        (arr[l + 1]) = (arr[ir]);
        (arr[ir]) = temp;
      }
      if (arr[l] > arr[l + 1]) {
        temp = (arr[l]);
        (arr[l]) = (arr[l + 1]);
        (arr[l + 1]) = temp;
      }
      i = l + 1;
      j = ir;
      a = arr[l + 1];
      for (;;) {
        do
          i++;
        while (arr[i] < a);
        do
          j--;
        while (arr[j] > a);
        if (j < i)
          break;
        temp = (arr[i]);
        (arr[i]) = (arr[j]);
        (arr[j]) = temp;
      }
      arr[l + 1] = arr[j];
      arr[j] = a;
      if (j >= k)
        ir = j - 1;
      if (j <= k)
        l = i;
    }
  }
}
```