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

```asm
<p3dCrop3D_8>:
  endbr64
  push   %r15
  mov    %ecx,%eax
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edx,%ebx
  mov    %ebx,%r11d
  mov    %ebx,%ecx
  mov    %eax,%ebx
  mov    %edx,-0x4c(%rsp)
  lea    (%r9,%r9,1),%edx
  sub    %edx,%ebx
  sub    %edx,%r8d
  sub    %edx,%r11d
  mov    %ebx,-0x50(%rsp)
  mov    %r8d,-0x20(%rsp)
  test   %r8d,%r8d
  jle    L31
  test   %ebx,%ebx
  jle    L31
  test   %r11d,%r11d
  jle    L31
  imul   %ecx,%eax
  movl   $0x0,-0x2c(%rsp)
  mov    %rsi,%r10
  xor    %r14d,%r14d
  imul   %r11d,%ebx
  mov    %eax,-0xc(%rsp)
  imul   %r9d,%eax
  mov    %ebx,-0x10(%rsp)
  mov    %eax,%ebx
  mov    %ecx,%eax
  imul   %r9d,%eax
  movslq %eax,%rdx
  movslq %r9d,%rax
  add    %rdx,%rax
  mov    %edx,-0x1c(%rsp)
  mov    %rax,-0x18(%rsp)
  lea    -0x1(%r11),%eax
  mov    %eax,-0x54(%rsp)
  mov    %r11d,%eax
  shr    $0x4,%eax
  sub    $0x1,%eax
  add    $0x1,%rax
  shl    $0x4,%rax
  mov    %rax,%r15
  mov    %r11d,%eax
  and    $0xfffffff0,%eax
  mov    %r15,%r13
  mov    %r9d,%r15d
  mov    %eax,-0x38(%rsp)
  movslq %r11d,%rax
  mov    %rax,-0x40(%rsp)
  movslq %ecx,%rax
  mov    %rax,-0x48(%rsp)
  mov    %r11d,%eax
  and    $0xf,%eax
  mov    %eax,-0x34(%rsp)
  sub    $0x1,%eax
  mov    %eax,-0x30(%rsp)
  mov    %r11d,%eax
  mov    %rax,-0x28(%rsp)
  nopl   0x0(%rax)
L166:
  movslq %r14d,%rcx
  movslq %ebx,%rdx
  mov    -0x1c(%rsp),%r9d
  add    -0x18(%rsp),%rdx
  add    %r10,%rcx
  add    %rdi,%rdx
  xor    %r8d,%r8d
  mov    %ebx,%r12d
  movl   $0x0,-0x6c(%rsp)
  nopl   0x0(%rax)
L209:
  mov    %rcx,%rax
  lea    0x1(%rdx),%rsi
  sub    %r10,%rax
  mov    %rax,-0x60(%rsp)
  mov    %rdx,%rax
  sub    %rdi,%rax
  mov    %rax,-0x68(%rsp)
  mov    %rcx,%rax
  sub    %rsi,%rax
  cmp    $0xe,%rax
  jbe    L27
  cmpl   $0x6,-0x54(%rsp)
  jbe    L27
  cmpl   $0xe,-0x54(%rsp)
  jbe    L156
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L199:
  movdqu (%rdx,%rax,1),%xmm0
  movups %xmm0,(%rcx,%rax,1)
  add    $0x10,%rax
  cmp    %r13,%rax
  jne    L199
  mov    -0x38(%rsp),%eax
  cmp    %r11d,%eax
  je     L113
  cmpl   $0x6,-0x30(%rsp)
  mov    -0x34(%rsp),%ebx
  jbe    L157
  mov    %eax,-0x58(%rsp)
  mov    %eax,%esi
L125:
  mov    -0x68(%rsp),%rax
  lea    (%rdi,%rsi,1),%rbp
  add    %r10,%rsi
  mov    0x0(%rbp,%rax,1),%rbp
  mov    -0x60(%rsp),%rax
  mov    %rbp,(%rsi,%rax,1)
  mov    -0x58(%rsp),%eax
  mov    %ebx,%esi
  and    $0xfffffff8,%esi
  add    %esi,%eax
  cmp    %esi,%ebx
  je     L113
L157:
  lea    (%r15,%rax,1),%esi
  add    %r9d,%esi
  add    %r12d,%esi
  movslq %esi,%rsi
  movzbl (%rdi,%rsi,1),%ebx
  lea    (%r8,%rax,1),%esi
  add    %r14d,%esi
  movslq %esi,%rsi
  mov    %bl,(%r10,%rsi,1)
  lea    0x1(%rax),%esi
  cmp    %esi,%r11d
  jle    L113
  lea    (%r15,%rsi,1),%ebx
  add    %r8d,%esi
  add    %r9d,%ebx
  add    %r14d,%esi
  add    %r12d,%ebx
  movslq %esi,%rsi
  movslq %ebx,%rbx
  movzbl (%rdi,%rbx,1),%ebx
  mov    %bl,(%r10,%rsi,1)
  lea    0x2(%rax),%esi
  cmp    %esi,%r11d
  jle    L113
  lea    (%r15,%rsi,1),%ebx
  add    %r8d,%esi
  add    %r9d,%ebx
  add    %r14d,%esi
  add    %r12d,%ebx
  movslq %esi,%rsi
  movslq %ebx,%rbx
  movzbl (%rdi,%rbx,1),%ebx
  mov    %bl,(%r10,%rsi,1)
  lea    0x3(%rax),%esi
  cmp    %esi,%r11d
  jle    L113
  lea    (%r15,%rsi,1),%ebx
  add    %r8d,%esi
  add    %r9d,%ebx
  add    %r14d,%esi
  add    %r12d,%ebx
  movslq %esi,%rsi
  movslq %ebx,%rbx
  movzbl (%rdi,%rbx,1),%ebx
  mov    %bl,(%r10,%rsi,1)
  lea    0x4(%rax),%esi
  cmp    %esi,%r11d
  jle    L113
  lea    (%r15,%rsi,1),%ebx
  add    %r8d,%esi
  add    %r9d,%ebx
  add    %r14d,%esi
  add    %r12d,%ebx
  movslq %esi,%rsi
  movslq %ebx,%rbx
  movzbl (%rdi,%rbx,1),%ebx
  mov    %bl,(%r10,%rsi,1)
  lea    0x5(%rax),%esi
  cmp    %esi,%r11d
  jle    L113
  lea    (%r15,%rsi,1),%ebx
  add    %r8d,%esi
  add    $0x6,%eax
  add    %r9d,%ebx
  add    %r14d,%esi
  add    %r12d,%ebx
  movslq %esi,%rsi
  movslq %ebx,%rbx
  movzbl (%rdi,%rbx,1),%ebx
  mov    %bl,(%r10,%rsi,1)
  cmp    %eax,%r11d
  jle    L113
  lea    (%r15,%rax,1),%esi
  add    %r8d,%eax
  add    %r9d,%esi
  add    %r14d,%eax
  add    %r12d,%esi
  cltq
  movslq %esi,%rsi
  movzbl (%rdi,%rsi,1),%esi
  mov    %sil,(%r10,%rax,1)
L113:
  addl   $0x1,-0x6c(%rsp)
  add    -0x40(%rsp),%rcx
  add    %r11d,%r8d
  mov    -0x6c(%rsp),%eax
  add    -0x48(%rsp),%rdx
  add    -0x4c(%rsp),%r9d
  cmp    %eax,-0x50(%rsp)
  jne    L209
  addl   $0x1,-0x2c(%rsp)
  mov    %r12d,%ebx
  mov    -0x2c(%rsp),%eax
  add    -0x10(%rsp),%r14d
  add    -0xc(%rsp),%ebx
  cmp    %eax,-0x20(%rsp)
  jne    L166
L31:
  pop    %rbx
  mov    $0x2,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nop
L27:
  mov    -0x28(%rsp),%rbx
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L69:
  movzbl (%rdx,%rax,1),%esi
  mov    %sil,(%rcx,%rax,1)
  add    $0x1,%rax
  cmp    %rbx,%rax
  jne    L69
  jmp    L113
L156:
  movl   $0x0,-0x58(%rsp)
  mov    %r11d,%ebx
  xor    %esi,%esi
  jmp    L125
```

assistant: ```c
int p3dCrop3D_8(unsigned char *in_rev, unsigned char *out_rev, const int dimx, const int dimy, const int dimz, const int size, int (*wr_log)(const char *, ...), int (*wr_progress)(const int, ...)) {
  int a_dimx, a_dimy, a_dimz;
  int i, j, k;
  a_dimx = dimx - size * 2;
  a_dimy = dimy - size * 2;
  a_dimz = dimz - size * 2;
  for (k = 0; k < a_dimz; k++)
    for (j = 0; j < a_dimy; j++)
      for (i = 0; i < a_dimx; i++)
        out_rev[((j) * (a_dimx) + (i) + (k) * (a_dimx) * (a_dimy))] = in_rev[((j + size) * (dimx) + (i + size) + (k + size) * (dimx) * (dimy))];
  return 2;
}
```