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

```asm
<xpool2_ov>:
  endbr64
  push   %r15
  mov    %rdi,%r10
  mov    %ecx,%edi
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdx,-0x28(%rsp)
  mov    %r8d,%edx
  movslq 0x38(%rsp),%r8
  mov    %edx,%ebx
  mov    %rsi,-0x30(%rsp)
  mov    %r9d,%esi
  shr    $0x1f,%ebx
  mov    %ecx,-0x4(%rsp)
  shr    $0x1f,%esi
  mov    %ebx,%ecx
  add    %edx,%ecx
  mov    %ecx,%ebx
  mov    %esi,%ecx
  mov    %edx,%esi
  add    %r9d,%ecx
  sar    %ebx
  imul   %r9d,%esi
  mov    %ecx,%r12d
  mov    %ebx,-0x34(%rsp)
  sar    %r12d
  imul   %r12d,%ebx
  imul   %r8d,%esi
  mov    %ebx,%ecx
  imul   %r8d,%ecx
  test   %edi,%edi
  jle    L2
  movslq %ecx,%rcx
  lea    0x0(,%rcx,8),%rbx
  mov    %rbx,-0x20(%rsp)
  lea    0x0(,%rcx,4),%rbx
  movslq %esi,%rcx
  mov    %rbx,-0x18(%rsp)
  lea    0x0(,%rcx,8),%rbx
  mov    %rbx,-0x10(%rsp)
  cmp    $0x1,%edx
  jle    L2
  mov    %r9d,%eax
  cmp    $0x1,%r9d
  jle    L2
  test   %r8d,%r8d
  jle    L2
  imul   %r8d,%eax
  movl   $0x0,-0x8(%rsp)
  lea    (%r8,%r8,1),%ebp
  lea    0x0(,%r8,8),%r11
  add    %eax,%eax
  mov    %eax,-0x38(%rsp)
  mov    %r12d,%eax
  imul   %r8d,%eax
  cltq
  lea    0x0(,%rax,4),%rbx
  shl    $0x3,%rax
  mov    %rax,-0x40(%rsp)
  mov    %rbx,-0x48(%rsp)
  lea    0x0(,%r8,4),%rbx
L23:
  movl   $0x0,-0x4c(%rsp)
  mov    -0x30(%rsp),%r15
  xor    %r13d,%r13d
  mov    -0x28(%rsp),%r14
  nopl   (%rax)
L67:
  mov    %r14,%rdi
  mov    %r15,%rsi
  mov    %r13d,%ecx
  xor    %r9d,%r9d
  nopl   0x0(%rax)
L7:
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L13:
  movsd  (%rdi,%rax,8),%xmm0
  lea    (%rcx,%rax,1),%edx
  add    (%rsi,%rax,4),%edx
  add    $0x1,%rax
  movslq %edx,%rdx
  movsd  %xmm0,(%r10,%rdx,8)
  cmp    %rax,%r8
  jne    L13
  add    $0x1,%r9d
  add    %ebp,%ecx
  add    %rbx,%rsi
  add    %r11,%rdi
  cmp    %r9d,%r12d
  jg     L7
  addl   $0x1,-0x4c(%rsp)
  add    -0x38(%rsp),%r13d
  mov    -0x4c(%rsp),%eax
  add    -0x48(%rsp),%r15
  add    -0x40(%rsp),%r14
  cmp    %eax,-0x34(%rsp)
  jg     L67
  mov    -0x20(%rsp),%rsi
  addl   $0x1,-0x8(%rsp)
  add    %rsi,-0x28(%rsp)
  mov    -0x8(%rsp),%eax
  mov    -0x18(%rsp),%rsi
  add    -0x10(%rsp),%r10
  add    %rsi,-0x30(%rsp)
  cmp    %eax,-0x4(%rsp)
  jne    L23
L2:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void xpool2_ov(double *v, int *m, double *o, int n, int h, int w, int f) {
  int out_h = h / 2;
  int out_w = w / 2;
  double *v_ptr = v;
  double *o_ptr = o;
  int *m_ptr = m;
  int v_size = h * w * f;
  int o_size = out_h * out_w * f;
  int step1 = f;
  int step2 = w * f;
  int step3 = w * f + f;
  int ni, hi, wi, fi;
  for (ni = 0; ni < n; ++ni) {
    for (hi = 0; hi < out_h; ++hi) {
      for (wi = 0; wi < out_w; ++wi) {
        int off_o = f * (wi + out_w * hi);
        int off_v = f * (2 * wi + w * 2 * hi);
        for (fi = 0; fi < f; ++fi) {
          int idx_v = off_v + fi;
          int idx_o = off_o + fi;
          v_ptr[idx_v + m_ptr[idx_o]] = o_ptr[idx_o];
        }
      }
    }
    o_ptr += o_size;
    m_ptr += o_size;
    v_ptr += v_size;
  }
}
```