user: Please show me the C implementation that matches the assembly code listed below:

```asm
<flutes_wl_RDP>:
  endbr64
  push   %r15
  mov    %edi,%r11d
  mov    %rdx,%r10
  push   %r14
  mov    %rsi,%r14
  push   %r13
  push   %r12
  mov    %rcx,%r12
  lea    -0x1(%rdi),%ecx
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %r8d,0x10(%rsp)
  test   %ecx,%ecx
  jle    L6
  xor    %ebx,%ebx
  mov    %ecx,%r15d
  jmp    L24
  nopl   (%rax)
L3:
  add    $0x1,%ebx
  cmp    %ebx,%r15d
  jle    L6
L24:
  movslq %ebx,%rdx
  lea    0x0(,%rdx,4),%rsi
  lea    0x4(%rsi),%rdi
  lea    (%r12,%rsi,1),%rcx
  lea    (%r12,%rdi,1),%r13
  movslq (%rcx),%r9
  movslq 0x0(%r13),%r8
  mov    %r9,%rax
  mov    %r8,%rbp
  mov    (%r14,%r8,4),%r8d
  cmp    %r8d,(%r14,%r9,4)
  jne    L3
  add    %r10,%rdi
  mov    (%rdi),%r9d
  cmp    %r9d,(%r10,%rdx,4)
  jne    L3
  cmp    %ebp,%eax
  jl     L143
  mov    %ebp,(%rcx)
  mov    %eax,%ebp
L143:
  lea    0x2(%rbx),%eax
  cmp    %r11d,%eax
  jge    L74
  mov    %r11d,%eax
  add    $0x8,%rsi
  sub    %ebx,%eax
  mov    %rsi,0x8(%rsp)
  lea    -0x3(%rax),%ecx
  lea    0x2(%rdx),%rax
  lea    0x3(%rdx,%rcx,1),%rdx
  lea    (%rcx,%rax,1),%r8
  shl    $0x2,%rdx
  lea    0x0(,%r8,4),%r9
  lea    (%r10,%rsi,1),%r8
  lea    (%r12,%rdx,1),%rsi
  cmp    %rsi,%rdi
  lea    (%r10,%r9,1),%rsi
  setae  (%rsp)
  cmp    %rsi,%r13
  setae  %sil
  or     (%rsp),%sil
  je     L151
  add    %r10,%rdx
  lea    (%r12,%r9,1),%rsi
  cmp    %rdx,%r13
  setae  %dl
  cmp    %rsi,%r8
  setae  %sil
  or     %dl,%sil
  je     L151
  lea    0x4(,%rcx,4),%rdx
  mov    %r8,%rsi
  mov    %r10,0x18(%rsp)
  mov    %r11d,0x14(%rsp)
  mov    %rdx,(%rsp)
  call   <memmove@plt>
  mov    0x8(%rsp),%rsi
  mov    (%rsp),%rdx
  mov    %r13,%rdi
  add    %r12,%rsi
  call   <memmove@plt>
  mov    0x14(%rsp),%r11d
  mov    0x18(%rsp),%r10
L74:
  lea    0x1(%rbp),%eax
  cmp    %r11d,%eax
  jge    L67
  cltq
  sub    $0x2,%r11d
  mov    %r10,(%rsp)
  shl    $0x2,%rax
  sub    %ebp,%r11d
  lea    0x4(,%r11,4),%rdx
  lea    (%r14,%rax,1),%rsi
  lea    -0x4(%r14,%rax,1),%rdi
  call   <memmove@plt>
  mov    (%rsp),%r10
L67:
  xor    %eax,%eax
  xchg   %ax,%ax
L127:
  mov    (%r12,%rax,4),%edx
  cmp    %ebp,%edx
  jle    L22
  sub    $0x1,%edx
  mov    %edx,(%r12,%rax,4)
L22:
  add    $0x1,%rax
  cmp    %eax,%r15d
  jg     L127
  mov    %r15d,%r11d
  sub    $0x1,%r15d
  cmp    %ebx,%r15d
  jg     L24
  nopl   0x0(%rax,%rax,1)
L6:
  cmp    $0x9,%r11d
  jg     L118
  add    $0x28,%rsp
  mov    %r12,%rcx
  mov    %r14,%rsi
  mov    %r10,%rdx
  pop    %rbx
  mov    %r11d,%edi
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1070 <flutes_wl_LD@plt>
  nopl   (%rax)
L118:
  mov    0x10(%rsp),%r8d
  add    $0x28,%rsp
  mov    %r12,%rcx
  mov    %r14,%rsi
  pop    %rbx
  mov    %r10,%rdx
  pop    %rbp
  mov    %r11d,%edi
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1080 <flutes_wl_MD@plt>
  nopl   0x0(%rax)
L151:
  mov    (%r10,%rax,4),%edx
  mov    %edx,-0x4(%r10,%rax,4)
  mov    (%r12,%rax,4),%edx
  mov    %edx,-0x4(%r12,%rax,4)
  add    $0x1,%rax
  cmp    %eax,%r11d
  jg     L151
  jmp    L74
```

assistant: ```c
int flutes_wl_RDP(int d, int xs[], int ys[], int s[], int acc) {
  int i, j, ss;
  for (i = 0; i < d - 1; i++) {
    if (xs[s[i]] == xs[s[i + 1]] && ys[i] == ys[i + 1]) {
      if (s[i] < s[i + 1])
        ss = s[i + 1];
      else {
        ss = s[i];
        s[i] = s[i + 1];
      }
      for (j = i + 2; j < d; j++) {
        ys[j - 1] = ys[j];
        s[j - 1] = s[j];
      }
      for (j = ss + 1; j < d; j++)
        xs[j - 1] = xs[j];
      for (j = 0; j <= d - 2; j++)
        if (s[j] > ss)
          s[j]--;
      i--;
      d--;
    }
  }
  return (d <= 9 ? flutes_wl_LD(d, xs, ys, s) : flutes_wl_MD(d, xs, ys, s, acc));
}
```