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

```asm
<reorg_cpu>:
  endbr64
  push   %r15
  mov    %rdi,%r10
  mov    %esi,%edi
  mov    %ecx,%eax
  push   %r14
  mov    %r9d,%r14d
  push   %r13
  mov    %r14d,%esi
  push   %r12
  imul   %r14d,%esi
  push   %rbp
  push   %rbx
  mov    %edx,%ebx
  mov    0x40(%rsp),%r9
  mov    %edx,-0x50(%rsp)
  cltd
  idiv   %esi
  mov    %r8d,-0x10(%rsp)
  mov    %ecx,-0x20(%rsp)
  test   %r8d,%r8d
  jle    L241
  mov    %edi,%esi
  imul   %r14d,%esi
  mov    %esi,-0x48(%rsp)
  mov    %ebx,%esi
  imul   %r14d,%esi
  mov    %esi,-0x44(%rsp)
  test   %ecx,%ecx
  jle    L241
  test   %ebx,%ebx
  jle    L241
  mov    %eax,%r13d
  cmp    $0x1,%r14d
  jne    L124
  mov    %ebx,%eax
  mov    -0x20(%rsp),%ebx
  lea    -0x1(%rdi),%r11d
  movl   $0x0,-0x14(%rsp)
  imul   %edi,%eax
  movl   $0x0,-0x40(%rsp)
  movl   $0x0,-0x18(%rsp)
  mov    %r11d,-0x28(%rsp)
  imul   %eax,%ebx
  mov    %eax,-0x1c(%rsp)
  mov    %edi,%eax
  shr    $0x2,%eax
  mov    %r13d,-0x38(%rsp)
  lea    -0x1(%rax),%esi
  mov    %ebx,-0xc(%rsp)
  mov    %edi,%ebx
  add    $0x1,%rsi
  and    $0xfffffffc,%ebx
  shl    $0x4,%rsi
  lea    0x1(%rbx),%r15d
  lea    0x2(%rbx),%r14d
L135:
  mov    -0x14(%rsp),%eax
  movl   $0x0,-0x4c(%rsp)
  mov    %eax,-0x24(%rsp)
L129:
  mov    -0x24(%rsp),%ecx
  xor    %r8d,%r8d
  xchg   %ax,%ax
L306:
  test   %edi,%edi
  jle    L4
  mov    -0x4c(%rsp),%eax
  cltd
  idivl  -0x38(%rsp)
  add    -0x40(%rsp),%edx
  imul   -0x44(%rsp),%edx
  add    %r8d,%eax
  add    %edx,%eax
  mov    0x38(%rsp),%edx
  imul   -0x48(%rsp),%eax
  test   %edx,%edx
  je     L123
  movslq %eax,%rdx
  movslq %ecx,%rbp
  lea    0x4(,%rbp,4),%rbp
  lea    (%r9,%rdx,4),%rdx
  lea    (%r10,%rbp,1),%r13
  mov    %rdx,%r12
  sub    %r13,%r12
  cmp    $0x8,%r12
  lea    -0x4(%r10,%rbp,1),%r12
  jbe    L120
  cmpl   $0x2,-0x28(%rsp)
  jbe    L120
  xor    %ebp,%ebp
  nopl   0x0(%rax,%rax,1)
L117:
  movups (%r12,%rbp,1),%xmm1
  movups %xmm1,(%rdx,%rbp,1)
  add    $0x10,%rbp
  cmp    %rsi,%rbp
  jne    L117
  cmp    %ebx,%edi
  je     L4
  lea    (%rcx,%rbx,1),%edx
  movslq %edx,%rdx
  movss  (%r10,%rdx,4),%xmm0
  lea    (%rax,%rbx,1),%edx
  movslq %edx,%rdx
  movss  %xmm0,(%r9,%rdx,4)
  cmp    %r15d,%edi
  jle    L4
  lea    (%rcx,%r15,1),%edx
  movslq %edx,%rdx
  movss  (%r10,%rdx,4),%xmm0
  lea    (%rax,%r15,1),%edx
  movslq %edx,%rdx
  movss  %xmm0,(%r9,%rdx,4)
  cmp    %r14d,%edi
  jle    L4
  lea    (%rcx,%r14,1),%edx
  add    %r14d,%eax
  movslq %edx,%rdx
  cltq
  movss  (%r10,%rdx,4),%xmm0
  movss  %xmm0,(%r9,%rax,4)
L4:
  add    $0x1,%r8d
  add    %edi,%ecx
  cmp    %r8d,-0x50(%rsp)
  jne    L306
  addl   $0x1,-0x4c(%rsp)
  mov    -0x1c(%rsp),%edx
  mov    -0x4c(%rsp),%eax
  add    %edx,-0x24(%rsp)
  cmp    %eax,-0x20(%rsp)
  jne    L129
  mov    -0x38(%rsp),%edx
  addl   $0x1,-0x18(%rsp)
  add    %edx,-0x40(%rsp)
  mov    -0x18(%rsp),%eax
  mov    -0xc(%rsp),%edx
  add    %edx,-0x14(%rsp)
  cmp    %eax,-0x10(%rsp)
  jne    L135
L241:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L123:
  movslq %eax,%rbp
  movslq %ecx,%rdx
  mov    %rbp,-0x30(%rsp)
  lea    (%r9,%rdx,4),%rdx
  lea    0x4(,%rbp,4),%rbp
  lea    (%r10,%rbp,1),%r13
  mov    %rdx,%r12
  sub    %r13,%r12
  cmp    $0x8,%r12
  jbe    L257
  cmpl   $0x2,-0x28(%rsp)
  jbe    L257
  lea    -0x4(%r10,%rbp,1),%r12
  xor    %ebp,%ebp
  nopl   (%rax)
L64:
  movups (%r12,%rbp,1),%xmm2
  movups %xmm2,(%rdx,%rbp,1)
  add    $0x10,%rbp
  cmp    %rsi,%rbp
  jne    L64
  cmp    %ebx,%edi
  je     L4
  lea    (%rax,%rbx,1),%edx
  movslq %edx,%rdx
  movss  (%r10,%rdx,4),%xmm0
  lea    (%rcx,%rbx,1),%edx
  movslq %edx,%rdx
  movss  %xmm0,(%r9,%rdx,4)
  cmp    %r15d,%edi
  jle    L4
  lea    (%rax,%r15,1),%edx
  movslq %edx,%rdx
  movss  (%r10,%rdx,4),%xmm0
  lea    (%rcx,%r15,1),%edx
  movslq %edx,%rdx
  movss  %xmm0,(%r9,%rdx,4)
  cmp    %r14d,%edi
  jle    L4
  add    %r14d,%eax
  cltq
  movss  (%r10,%rax,4),%xmm0
  lea    (%rcx,%r14,1),%eax
  cltq
  movss  %xmm0,(%r9,%rax,4)
  jmp    L4
L257:
  mov    -0x30(%rsp),%rax
  lea    (%r10,%rax,4),%r12
  xor    %eax,%eax
  nopl   (%rax)
L49:
  movss  (%r12,%rax,4),%xmm0
  mov    %rax,%rbp
  movss  %xmm0,(%rdx,%rax,4)
  add    $0x1,%rax
  cmp    %r11,%rbp
  jne    L49
  jmp    L4
L120:
  xor    %eax,%eax
  xchg   %ax,%ax
L329:
  movss  (%r12,%rax,4),%xmm0
  mov    %rax,%rbp
  movss  %xmm0,(%rdx,%rax,4)
  add    $0x1,%rax
  cmp    %r11,%rbp
  jne    L329
  jmp    L4
L124:
  mov    %ebx,%eax
  mov    -0x20(%rsp),%ebx
  movslq %r14d,%rsi
  xor    %r15d,%r15d
  imul   %edi,%eax
  shl    $0x2,%rsi
  lea    -0x1(%rdi),%r12d
  mov    %r13d,%ebp
  movl   $0x0,-0x1c(%rsp)
  movl   $0x0,-0x30(%rsp)
  imul   %eax,%ebx
  mov    %eax,-0x24(%rsp)
  lea    0x4(%r10),%rax
  mov    %rax,-0x40(%rsp)
  lea    0x4(%r9),%rax
  mov    %rax,-0x38(%rsp)
  mov    %ebx,-0x18(%rsp)
L242:
  mov    -0x1c(%rsp),%eax
  movl   $0x0,-0x4c(%rsp)
  mov    %eax,-0x28(%rsp)
L31:
  mov    -0x28(%rsp),%ebx
  xor    %r11d,%r11d
  xor    %r8d,%r8d
  nopl   (%rax)
L320:
  test   %edi,%edi
  jle    L128
  mov    -0x4c(%rsp),%eax
  mov    0x38(%rsp),%r13d
  cltd
  idiv   %ebp
  mov    %edx,%ecx
  cltd
  idiv   %r14d
  add    %r15d,%ecx
  imul   -0x44(%rsp),%ecx
  add    %r11d,%eax
  add    %eax,%ecx
  imul   -0x48(%rsp),%ecx
  test   %r13d,%r13d
  jne    L34
  movslq %edx,%rax
  movslq %ecx,%rcx
  mov    -0x38(%rsp),%r13
  add    %rcx,%rax
  movslq %ebx,%rcx
  lea    (%r10,%rax,4),%rdx
  lea    (%r9,%rcx,4),%rax
  add    %r12,%rcx
  lea    0x0(%r13,%rcx,4),%rcx
  nopw   0x0(%rax,%rax,1)
L80:
  movss  (%rdx),%xmm0
  add    $0x4,%rax
  add    %rsi,%rdx
  movss  %xmm0,-0x4(%rax)
  cmp    %rcx,%rax
  jne    L80
L128:
  add    $0x1,%r8d
  add    %edi,%ebx
  add    %r14d,%r11d
  cmp    %r8d,-0x50(%rsp)
  jne    L320
  addl   $0x1,-0x4c(%rsp)
  mov    -0x24(%rsp),%ecx
  mov    -0x4c(%rsp),%eax
  add    %ecx,-0x28(%rsp)
  cmp    %eax,-0x20(%rsp)
  jne    L31
  addl   $0x1,-0x30(%rsp)
  mov    -0x18(%rsp),%ecx
  add    %ebp,%r15d
  add    %ecx,-0x1c(%rsp)
  mov    -0x30(%rsp),%eax
  cmp    %eax,-0x10(%rsp)
  jne    L242
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L34:
  movslq %ecx,%rcx
  movslq %edx,%rdx
  movslq %ebx,%r13
  add    %rcx,%rdx
  mov    -0x40(%rsp),%rcx
  lea    (%r10,%r13,4),%rax
  add    %r12,%r13
  lea    (%r9,%rdx,4),%rdx
  lea    (%rcx,%r13,4),%rcx
  nopl   0x0(%rax,%rax,1)
L77:
  movss  (%rax),%xmm0
  add    $0x4,%rax
  movss  %xmm0,(%rdx)
  add    %rsi,%rdx
  cmp    %rcx,%rax
  jne    L77
  jmp    L128
```

assistant: ```c
void reorg_cpu(float *x, int w, int h, int c, int batch, int stride, int forward, float *out) {
  int b, i, j, k;
  int out_c = c / (stride * stride);
  for (b = 0; b < batch; ++b) {
    for (k = 0; k < c; ++k) {
      for (j = 0; j < h; ++j) {
        for (i = 0; i < w; ++i) {
          int in_index = i + w * (j + h * (k + c * b));
          int c2 = k % out_c;
          int offset = k / out_c;
          int w2 = i * stride + offset % stride;
          int h2 = j * stride + offset / stride;
          int out_index = w2 + w * stride * (h2 + h * stride * (c2 + out_c * b));
          if (forward)
            out[out_index] = x[in_index];
          else
            out[in_index] = x[out_index];
        }
      }
    }
  }
}
```