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

```asm
<neuralops_avgpool2d_2x2_fwd>:
  endbr64
  push   %r15
  mov    %rcx,%r10
  lea    0x1(%rsi),%rax
  mov    %rdi,%r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x40,%rsp
  mov    %rcx,0x8(%rsp)
  lea    0x1(%rdx),%rcx
  mov    %rdi,0x30(%rsp)
  shr    %rcx
  mov    %rax,%rdi
  mov    %rsi,-0x50(%rsp)
  shr    %rdi
  mov    %rcx,-0x68(%rsp)
  test   %r15,%r15
  je     L148
  test   %r10,%r10
  je     L148
  imul   %rdx,%r10
  shr    $0x3,%rax
  mov    %r8,%rsi
  mov    %r9,%r14
  imul   %rbx,%rdx
  mov    %rax,%r15
  movq   $0x0,0x20(%rsp)
  movss  D12(%rip),%xmm4
  movq   $0x0,0x18(%rsp)
  movaps D12(%rip),%xmm3
  shl    $0x4,%r15
  mov    %r10,%rcx
  mov    %rdx,(%rsp)
  imul   %rbx,%rcx
  lea    (%rbx,%rbx,1),%rdx
  mov    %rdx,-0x60(%rsp)
  lea    0x0(,%rbx,8),%rdx
  lea    (%r8,%rbx,4),%rbx
  xor    %r8d,%r8d
  mov    %rbx,0x10(%rsp)
  lea    0x0(,%rdi,8),%rbx
  mov    %rbx,-0x70(%rsp)
  lea    0x0(,%rax,4),%rbx
  mov    %rdx,-0x58(%rsp)
  lea    0x0(,%rax,8),%rdx
  mov    %rbx,%rax
  mov    %rbx,-0x40(%rsp)
  lea    0x1(%rbx),%rbx
  add    $0x2,%rax
  mov    %rbx,-0x30(%rsp)
  mov    %rdx,%rbx
  mov    %rax,-0x20(%rsp)
  lea    0x4(%rbx),%rax
  mov    %rdx,-0x38(%rsp)
  lea    0x2(%rdx),%rdx
  mov    %rax,-0x18(%rsp)
  lea    -0x1(%rdi),%rax
  mov    %rcx,0x28(%rsp)
  mov    %rdx,-0x28(%rsp)
  mov    %rax,-0x48(%rsp)
L16:
  movq   $0x0,-0x10(%rsp)
  mov    0x20(%rsp),%rax
  mov    %rax,-0x8(%rsp)
  nopl   0x0(%rax,%rax,1)
L6:
  cmpq   $0x0,-0x68(%rsp)
  je     L41
  mov    -0x8(%rsp),%r9
  xor    %ebp,%ebp
  lea    0x0(,%r9,4),%rax
  lea    (%rsi,%rax,1),%rdx
  add    0x10(%rsp),%rax
  nopl   0x0(%rax)
L4:
  test   %rdi,%rdi
  je     L68
  mov    -0x50(%rsp),%rcx
  mov    -0x70(%rsp),%rbx
  lea    (%rdi,%r8,1),%r12
  lea    (%r14,%r12,4),%r13
  lea    (%rax,%rbx,1),%r11
  lea    (%rcx,%r9,1),%r10
  lea    (%r14,%r8,4),%rcx
  cmp    %r11,%rcx
  setae  %bl
  cmp    %r13,%rax
  setae  %r11b
  or     %r11d,%ebx
  mov    -0x70(%rsp),%r11
  add    %rdx,%r11
  cmp    %r11,%rcx
  setae  %r11b
  cmp    %r13,%rdx
  setae  %r13b
  or     %r13d,%r11d
  test   %r11b,%bl
  je     L121
  cmpq   $0x2,-0x48(%rsp)
  jbe    L121
  xor    %r11d,%r11d
L70:
  movups (%rdx,%r11,2),%xmm2
  movups 0x10(%rdx,%r11,2),%xmm5
  movups (%rax,%r11,2),%xmm1
  movups 0x10(%rax,%r11,2),%xmm7
  movaps %xmm2,%xmm0
  shufps $0xdd,%xmm5,%xmm2
  shufps $0x88,%xmm5,%xmm0
  addps  %xmm2,%xmm0
  movaps %xmm1,%xmm2
  shufps $0xdd,%xmm7,%xmm1
  shufps $0x88,%xmm7,%xmm2
  addps  %xmm2,%xmm0
  addps  %xmm1,%xmm0
  mulps  %xmm3,%xmm0
  movups %xmm0,(%rcx,%r11,1)
  add    $0x10,%r11
  cmp    %r11,%r15
  jne    L70
  mov    -0x40(%rsp),%rbx
  add    %rbx,%r8
  cmp    %rbx,%rdi
  je     L76
  mov    -0x38(%rsp),%rcx
  lea    0x0(,%r8,4),%rbx
  lea    (%rcx,%r9,1),%r11
  add    %r10,%rcx
  movss  0x4(%rsi,%r11,4),%xmm0
  addss  (%rsi,%r11,4),%xmm0
  addss  (%rsi,%rcx,4),%xmm0
  addss  0x4(%rsi,%rcx,4),%xmm0
  mulss  %xmm4,%xmm0
  movss  %xmm0,(%r14,%r8,4)
  cmp    -0x30(%rsp),%rdi
  jbe    L76
  mov    -0x28(%rsp),%rcx
  lea    (%r9,%rcx,1),%r8
  add    %r10,%rcx
  movss  0x4(%rsi,%r8,4),%xmm0
  addss  (%rsi,%r8,4),%xmm0
  addss  (%rsi,%rcx,4),%xmm0
  addss  0x4(%rsi,%rcx,4),%xmm0
  mulss  %xmm4,%xmm0
  movss  %xmm0,0x4(%r14,%rbx,1)
  cmp    -0x20(%rsp),%rdi
  jbe    L76
  mov    -0x18(%rsp),%r8
  lea    (%r8,%r9,1),%rcx
  add    %r8,%r10
  movss  0x4(%rsi,%rcx,4),%xmm0
  addss  (%rsi,%rcx,4),%xmm0
  addss  (%rsi,%r10,4),%xmm0
  addss  0x4(%rsi,%r10,4),%xmm0
  mulss  %xmm4,%xmm0
  movss  %xmm0,0x8(%r14,%rbx,1)
L76:
  mov    %r12,%r8
L68:
  mov    -0x58(%rsp),%rbx
  add    $0x1,%rbp
  add    -0x60(%rsp),%r9
  add    %rbx,%rdx
  add    %rbx,%rax
  cmp    %rbp,-0x68(%rsp)
  jne    L4
L41:
  addq   $0x1,-0x10(%rsp)
  mov    (%rsp),%rdx
  mov    -0x10(%rsp),%rax
  add    %rdx,-0x8(%rsp)
  cmp    %rax,0x8(%rsp)
  jne    L6
  addq   $0x1,0x18(%rsp)
  mov    0x28(%rsp),%rdx
  mov    0x18(%rsp),%rax
  add    %rdx,0x20(%rsp)
  cmp    %rax,0x30(%rsp)
  jne    L16
L148:
  add    $0x40,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L121:
  xor    %r8d,%r8d
  nopl   0x0(%rax,%rax,1)
L86:
  movss  0x4(%rdx,%r8,8),%xmm0
  addss  (%rdx,%r8,8),%xmm0
  addss  (%rax,%r8,8),%xmm0
  addss  0x4(%rax,%r8,8),%xmm0
  mulss  %xmm4,%xmm0
  movss  %xmm0,(%rcx,%r8,4)
  add    $0x1,%r8
  cmp    %r8,%rdi
  jne    L86
  jmp    L76
```

tool_calls: name: unpack_data
arguments: tag: D12
type_infered: byte[16]

tool: {"D12": [0x00,0x00,0x80,0x3e,0x00,0x00,0x80,0x3e,0x00,0x00,0x80,0x3e,0x00,0x00,0x80,0x3e]}

assistant: ```c
void neuralops_avgpool2d_2x2_fwd(size_t batch_sz, size_t in_width, size_t in_height, size_t chan, const float *in_buf, float *out_buf) {
  size_t out_width = (in_width + 1) / 2;
  size_t out_height = (in_height + 1) / 2;
  size_t p = 0;
  for (size_t idx = 0; idx < batch_sz; idx += 1) {
    for (size_t a = 0; a < chan; a += 1) {
      for (size_t y = 0; y < out_height; y += 1) {
        for (size_t x = 0; x < out_width; x += 1) {
          float pool_value = 0.25f * (in_buf[x * 2 + in_width * (y * 2 + in_height * (a + chan * idx))] + in_buf[x * 2 + 1 + in_width * (y * 2 + in_height * (a + chan * idx))] + in_buf[x * 2 + in_width * (y * 2 + 1 + in_height * (a + chan * idx))] + in_buf[x * 2 + 1 + in_width * (y * 2 + 1 + in_height * (a + chan * idx))]);
          out_buf[p] = pool_value;
          p += 1;
        }
      }
    }
  }
}
```