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

```asm
<mc64ed_>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %rcx,-0x50(%rbp)
  mov    %r8,-0x58(%rbp)
  mov    %r9,-0x60(%rbp)
  subq   $0x4,-0x58(%rbp)
  subq   $0x8,-0x50(%rbp)
  subq   $0x4,-0x48(%rbp)
  mov    -0x38(%rbp),%rax
  mov    (%rax),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x20(%rbp)
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,-0x10(%rbp)
  mov    -0x38(%rbp),%rax
  mov    (%rax),%eax
  lea    -0x1(%rax),%edx
  mov    -0x38(%rbp),%rax
  mov    %edx,(%rax)
  movl   $0x1,-0x2c(%rbp)
  mov    -0x60(%rbp),%rax
  mov    (%rax),%eax
  cmp    $0x1,%eax
  jne    L176
  mov    -0x40(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,-0x1c(%rbp)
  movl   $0x1,-0x28(%rbp)
  jmp    L37
L82:
  mov    -0x2c(%rbp),%eax
  add    %eax,%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x38(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x24(%rbp)
  jg     L121
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,-0x18(%rbp)
  mov    -0x38(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x24(%rbp)
  jge    L179
  mov    -0x24(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,-0x8(%rbp)
  movsd  -0x8(%rbp),%xmm0
  comisd -0x18(%rbp),%xmm0
  jbe    L179
  addl   $0x1,-0x24(%rbp)
  movsd  -0x8(%rbp),%xmm0
  movsd  %xmm0,-0x18(%rbp)
L179:
  movsd  -0x10(%rbp),%xmm0
  comisd -0x18(%rbp),%xmm0
  jae    L16
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    -0x2c(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x48(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x58(%rbp),%rax
  add    %rax,%rdx
  mov    -0x2c(%rbp),%eax
  mov    %eax,(%rdx)
  mov    -0x24(%rbp),%eax
  mov    %eax,-0x2c(%rbp)
  addl   $0x1,-0x28(%rbp)
L37:
  mov    -0x28(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jle    L82
  jmp    L51
L176:
  mov    -0x40(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,-0x1c(%rbp)
  movl   $0x1,-0x28(%rbp)
  jmp    L78
L171:
  mov    -0x2c(%rbp),%eax
  add    %eax,%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x38(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x24(%rbp)
  jg     L83
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,-0x18(%rbp)
  mov    -0x38(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x24(%rbp)
  jge    L157
  mov    -0x24(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,-0x8(%rbp)
  movsd  -0x18(%rbp),%xmm0
  comisd -0x8(%rbp),%xmm0
  jbe    L157
  addl   $0x1,-0x24(%rbp)
  movsd  -0x8(%rbp),%xmm0
  movsd  %xmm0,-0x18(%rbp)
L157:
  movsd  -0x18(%rbp),%xmm0
  comisd -0x10(%rbp),%xmm0
  jae    L7
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    -0x2c(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x48(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x58(%rbp),%rax
  add    %rax,%rdx
  mov    -0x2c(%rbp),%eax
  mov    %eax,(%rdx)
  mov    -0x24(%rbp),%eax
  mov    %eax,-0x2c(%rbp)
  addl   $0x1,-0x28(%rbp)
L78:
  mov    -0x28(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jle    L171
  jmp    L51
L121:
  nop
  jmp    L51
L16:
  nop
  jmp    L51
L83:
  nop
  jmp    L51
L7:
  nop
L51:
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rax,%rdx
  mov    -0x20(%rbp),%eax
  mov    %eax,(%rdx)
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x58(%rbp),%rax
  add    %rax,%rdx
  mov    -0x2c(%rbp),%eax
  mov    %eax,(%rdx)
  mov    $0x0,%eax
  pop    %rbp
  ret
```

assistant: ```c
int mc64ed_(int *qlen, int *n, int *q, double *d__, int *l, int *iway) {
  int i__1;
  int i__;
  double di, dk, dr;
  int pos, idum, posk;
  --l;
  --d__;
  --q;
  i__ = q[*qlen];
  di = d__[i__];
  --(*qlen);
  pos = 1;
  if (*iway == 1) {
    i__1 = *n;
    for (idum = 1; idum <= i__1; ++idum) {
      posk = pos << 1;
      if (posk > *qlen) {
        goto L20;
      }
      dk = d__[q[posk]];
      if (posk < *qlen) {
        dr = d__[q[posk + 1]];
        if (dk < dr) {
          ++posk;
          dk = dr;
        }
      }
      if (di >= dk) {
        goto L20;
      }
      q[pos] = q[posk];
      l[q[pos]] = pos;
      pos = posk;
    }
  } else {
    i__1 = *n;
    for (idum = 1; idum <= i__1; ++idum) {
      posk = pos << 1;
      if (posk > *qlen) {
        goto L20;
      }
      dk = d__[q[posk]];
      if (posk < *qlen) {
        dr = d__[q[posk + 1]];
        if (dk > dr) {
          ++posk;
          dk = dr;
        }
      }
      if (di <= dk) {
        goto L20;
      }
      q[pos] = q[posk];
      l[q[pos]] = pos;
      pos = posk;
    }
  }
L20:
  q[pos] = i__;
  l[i__] = pos;
  return 0;
}
```